Routes From Index

This commit is contained in:
JonatanRek 2020-04-21 14:11:34 +02:00
parent 28490f5d67
commit 36690e6899
2 changed files with 37 additions and 0 deletions

View File

@ -20,6 +20,8 @@ Class Autoloader {
foreach ($files as $key => $file) { foreach ($files as $key => $file) {
if (strtolower($file->getFilename()) === strtolower($filename) && $file->isReadable()) { if (strtolower($file->getFilename()) === strtolower($filename) && $file->isReadable()) {
echo $file->getPathname();
include_once $file->getPathname(); include_once $file->getPathname();
break; break;
} }
@ -37,3 +39,26 @@ spl_autoload_register("Autoloader::ClassLoader");
// import routes // import routes
require_once './Routes.php'; require_once './Routes.php';
//setup
ini_set ('session.cookie_httponly', '1');
ini_set('session.cookie_domain', $_SERVER['HTTP_HOST']);
ini_set('session.cookie_path', str_replace("login", "", str_replace('https://' . $_SERVER['HTTP_HOST'], "", $_SERVER['REQUEST_URI'])));
ini_set('session.cookie_secure', '1');
session_start ();
mb_internal_encoding ("UTF-8");
/** Language **/
$langTag = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
$langMng = new LanguageManager($langTag);
$langMng->load();
//DB Conector
Db::connect (DBHOST, DBUSER, DBPASS, DBNAME);
//TODO: Přesunout do Login Pohledu
$userManager = new UserManager();
//Logs
$logManager = new LogManager();

View File

@ -6,4 +6,16 @@ $router->setDefault(function(){
echo '404'; echo '404';
}); });
//Pages
$router->any('/', 'Home');
$router->any('/login', 'Login');
$router->any('/logout', 'Logout');
$router->any('/automation', 'Automation');
$router->any('/dashboard', 'Dashboard');
$router->any('/setting', 'Setting');
$router->any('/scene', 'Scene');
$router->any('/ajax', 'Ajax');
$router->any('/log', 'Log');
$router->any('/rooms', 'Rooms');
$router->run($_SERVER['REQUEST_METHOD'], '/'.$_GET['url']); $router->run($_SERVER['REQUEST_METHOD'], '/'.$_GET['url']);