Add initial .htaccess and PHP files for project setup
This commit is contained in:
8
.htaccess
Normal file
8
.htaccess
Normal file
@@ -0,0 +1,8 @@
|
||||
RewriteEngine on
|
||||
RewriteCond %{HTTPS} !=on [NC]
|
||||
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
|
||||
|
||||
Options All -Indexes
|
||||
|
||||
ErrorDocument 403 https://%{SERVER_NAME}/?view=403
|
||||
ErrorDocument 404 https://%{SERVER_NAME}/?view=404
|
||||
20
index.php
Normal file
20
index.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
include './init.php';
|
||||
|
||||
$html->setTitle('RDMusicWorld');
|
||||
$html->setIconPage($assets['IMAGE']['FILE_DIR']['music']);
|
||||
$html->loadStyles($styles);
|
||||
$html->loadScripts($scripts);
|
||||
|
||||
ob_start();
|
||||
if(!empty($_POST)){
|
||||
include $page['REQUEST']['POST']['FILE_DIR'][$view];
|
||||
}else{
|
||||
include $views[$view];
|
||||
}
|
||||
$view_page = ob_get_clean();
|
||||
|
||||
$html->loadHTML($view_page, $view);
|
||||
|
||||
$html->output();
|
||||
65
init.php
Normal file
65
init.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
date_default_timezone_set('America/Santo_Domingo');
|
||||
|
||||
include './etc/SearchFilePath.php';
|
||||
include './etc/functions.php';
|
||||
include './controller/html/Html.controller.php';
|
||||
include './controller/connection/Connection.controller.php';
|
||||
include './controller/user/Session.controller.php';
|
||||
include './controller/music/Music.controller.php';
|
||||
include './controller/user/User.controller.php';
|
||||
include './controller/listplayer/ListMusic.controller.php';
|
||||
include './controller/listplayer/ListPlayer.controller.php';
|
||||
|
||||
$paths = SearchFilePath::getFilesFilter('.controller', 'controller');
|
||||
$page = SearchFilePath::getFiles();
|
||||
|
||||
$exception = ['connection', 'session'];// archivos que no deben instanciarse
|
||||
|
||||
foreach ($paths as $path){// Creando variables de instancias
|
||||
$file = explode('/', $path);
|
||||
$file = $file[count($file)-2];
|
||||
$filename = explode('.', $file)[0];
|
||||
if(!in_array(strtolower($filename), $exception)){
|
||||
eval('$' . strtolower($filename) . ' = new ' . $filename . '();');
|
||||
}
|
||||
}
|
||||
|
||||
$views = $page['VIEW']['FILE_DIR'];// vistas
|
||||
$view = isset($_GET['view']) ? $_GET['view'] : 'home';// vista
|
||||
|
||||
if(!Session::Auth()){// validando las páginas que puede ver sin iniciar sesión
|
||||
$view = in_array($view, ['login', 'home', 'register', '404', '403']) ? $view : 'home';
|
||||
}
|
||||
|
||||
// verificando existencia de vista
|
||||
$view = isset($views[$view])? $view : '404';
|
||||
|
||||
// cargando rutas de archivos en variables
|
||||
$styles = $page['STYLE']['FILE_DIR'];// hojas de estilos.
|
||||
$styles['googlefonts'] = 'https://fonts.googleapis.com/css?family=Poppins:200,300,400,600,700,800';
|
||||
$styles['fontawesome'] = 'https://use.fontawesome.com/releases/v5.0.6/css/all.css';
|
||||
|
||||
$scripts = $page['SCRIPT']['FILE_DIR'];// scripts.
|
||||
$assets = $page['ASSETS'];// multimedia
|
||||
|
||||
$gennerMusical = $music->getGennersMusical();
|
||||
$musics = $music->getMusics((isset($_GET['search']) ? $_GET['search'] : null));
|
||||
$listsName = $listplayer->getListName();
|
||||
|
||||
if(isset($_GET['listmusic'])){
|
||||
if(!empty($_GET['listmusic'])){
|
||||
$listMusics = $listplayer->getListMusic($_GET['listmusic']);
|
||||
if(empty($listMusics)){
|
||||
header("location: ./?view=$view");
|
||||
}
|
||||
}else{
|
||||
header("location: ./?view=$view");
|
||||
}
|
||||
}
|
||||
|
||||
$elementDelete = getElementsDelete([
|
||||
$listplayer->getDelete(),
|
||||
$music->getDelete()
|
||||
]);
|
||||
Reference in New Issue
Block a user