Add new views and styles for music application

- Created new CSS files for styling the application, including home.css and style.css.
- Implemented 403 and 404 error views with appropriate messages and navigation.
- Developed a dump view to display deleted elements with restoration options.
- Enhanced home view to include music search functionality and display results.
- Added listplay view for managing music playlists, including creation and deletion options.
- Implemented loadmusic view for uploading new music with necessary fields.
- Created login and register views for user authentication.
- Developed sound view to display individual music tracks with playback controls and options for liking and deleting.
- Updated menu view to include navigation links based on user authentication status.
This commit is contained in:
2026-01-05 17:20:17 -04:00
parent 24f62ca4c2
commit a8624fc847
33 changed files with 1370 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
<?php
if (Session::Auth()) {
if (isset($_POST['delete']) && isset($_POST['origin'])) {
switch ($_POST['origin']) {
case 'listplayer':
$listplayer->deleteList($_POST['delete']);
break;
case 'music':
$music->deleteMusic($_POST['delete']);
break;
}
}
}
header("location: ./?view=$view");

View File

@@ -0,0 +1,17 @@
<?php
if(Session::Auth()){
if(isset($_POST['idMusic'])){
$music->like(
[
'idUser' => Session::getUserID(),
'idMusic' => $_POST['idMusic']
]
);
}elseif(isset($_POST['delete'])){
$music->deleteMusic($_POST['delete']);
header("location: ./?view=$view");
}
}
?>

View File

@@ -0,0 +1,14 @@
<?php
if(Session::Auth()){
if(isset($_POST['txtListName'])){
$listplayer->newList($_POST['txtListName']);
}elseif(isset($_POST['deleteList'])){
$listplayer->deleteList($_POST['deleteList']);
}elseif(isset($_POST['idMusic']) && isset($_POST['idList'])){
$listplayer->addMusicToList($_POST['idList'], $_POST['idMusic']);
$view = "$view&listmusic=" . md5($_POST['idList']);
}
}
header("location: ./?view=$view");
?>

View File

@@ -0,0 +1,28 @@
<?php
$sound = [];
$ext = explode('.', $_FILES['fileMusic']['name']);
$ext = $ext[count($ext)-1];
$sound['nameMusic'] = $_POST['txtTitle'];
$sound['formatMusic'] = $_FILES['fileMusic']['type'];
$sound['fileNameMusic']= md5($_POST['txtTitle'] . time());
$sound['fileSizeMusic'] = $_FILES['fileMusic']['size'];
$sound['descriptionMusic'] = $_POST['txtDescription'];
$sound['authorMusic'] = $_POST['txtAuthor'];
$sound['idGenner'] = $_POST['genner'];
$sound['idUser'] = Session::getUserID();
$message = 'Archivo cargado con exito.';
$color = 'success';
if(in_array(strtoupper($ext), ['WAV', 'AIFF','AU','FLAC','MPEG-4','SHORTEN','TTA','ATRAC','APPLE', 'LOSSLESS','MP3','VORBIS','MUSEPACK','AAC','WMA','OPUS','OGG','DSD','MQA'])){
$music->newMusic($sound);
$fileName = "{$assets['SOUND']['PATH_DIR']}/{$sound['fileNameMusic']}.$ext";
move_uploaded_file($_FILES['fileMusic']['tmp_name'], $fileName);
}else{
$message = 'Formato no válido!';
$color = 'danger';
}
header("location: ./?view=$view&message=$message&action=$color");

View File

@@ -0,0 +1,11 @@
<?php
$redirect = "./?view=$view";
if (isset($_POST['username']) && isset($_POST['password'])) {
if ($user->isAccess($_POST)) {
$redirect = './';
}
}
header("location: $redirect");
?>

View File

@@ -0,0 +1,24 @@
<?php
$newUser = false;
if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['rpassword'])) {
if (!$user->exists($_POST['username'])) {
if (strpos('_' . $_POST['username'], ' ') <= 0) {
if ($_POST['password'] == $_POST['rpassword']) {
$user->newUser($_POST);
$message = 'Usuario creado con exito!';
$newUser = true;
} else {
$message = "Las claves no coinciden.";
}
} else {
$message = "El nombre de usuario <b>\"{$_POST['username']}\"</b> no debe tener espacios.";
}
} else {
$message = "El usuario <b>{$_POST['username']}</b> existe.";
}
}
header("location: ./?view=$view&newuser=$newUser&message=$message");
?>