2019-08-23 11:39:42 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
//Config
|
|
|
|
include_once './config.php';
|
|
|
|
|
|
|
|
//setup
|
2019-09-26 18:48:53 +00:00
|
|
|
ini_set ('session.cookie_httponly', '1');
|
|
|
|
ini_set('session.cookie_domain', $_SERVER['HTTP_HOST']);
|
2019-09-26 18:58:11 +00:00
|
|
|
ini_set('session.cookie_path', str_replace("login", "", str_replace('https://' . $_SERVER['HTTP_HOST'], "", $_SERVER['REQUEST_URI'])));
|
2019-09-26 18:48:53 +00:00
|
|
|
ini_set('session.cookie_secure', '1');
|
2019-08-23 11:39:42 +00:00
|
|
|
session_start ();
|
|
|
|
mb_internal_encoding ("UTF-8");
|
|
|
|
|
|
|
|
|
|
|
|
//Autoloader
|
2019-10-22 14:52:45 +00:00
|
|
|
foreach (["vendor","class", "views"] as $dir) {
|
2019-09-19 12:48:31 +00:00
|
|
|
$files = scandir('./app/'.$dir.'/');
|
|
|
|
$files = array_diff($files, array('.', '..', 'app'));
|
|
|
|
|
2019-08-23 11:39:42 +00:00
|
|
|
foreach($files as $file) {
|
2019-10-09 17:22:28 +00:00
|
|
|
//echo './app/'.$dir.'/'. $file;
|
2019-09-19 12:48:31 +00:00
|
|
|
include './app/'.$dir.'/'. $file;
|
2019-08-23 11:39:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Language **/
|
|
|
|
$langTag = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
|
2019-10-11 12:12:05 +00:00
|
|
|
$langMng = new LanguageManager($langTag, DEBUGMOD);
|
2019-10-11 10:17:47 +00:00
|
|
|
$langMng->load();
|
|
|
|
|
2019-08-23 11:39:42 +00:00
|
|
|
if (DEBUGMOD == 1) {
|
2019-10-11 12:12:05 +00:00
|
|
|
// echo '<div class="col-md-9 main-body">';
|
|
|
|
// echo '<pre>';
|
|
|
|
// echo 'Language SLUG: ' . $langTag;
|
|
|
|
// echo '</pre>';
|
|
|
|
// echo '<pre>';
|
|
|
|
// print_r(get_defined_constants());
|
|
|
|
// echo '</pre>';
|
|
|
|
// echo '<pre>';
|
|
|
|
// print_r(get_defined_vars());
|
|
|
|
// echo '</pre>';
|
|
|
|
// echo '</dev>';
|
2019-08-23 11:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//DB Conector
|
|
|
|
Db::connect (DBHOST, DBUSER, DBPASS, DBNAME);
|
|
|
|
|
|
|
|
//TODO: Přesunout do Login Pohledu
|
|
|
|
$userManager = new UserManager();
|
2019-10-22 14:52:45 +00:00
|
|
|
|
|
|
|
// if (isset($_POST['username']) && isset($_POST['password']) ) {
|
|
|
|
// $userManager->login($_POST['username'], $_POST['password'], (isset ($_POST['remember']) ? $_POST['remember'] : 'false'));
|
|
|
|
// }
|
2019-09-01 13:55:33 +00:00
|
|
|
|
2019-10-11 10:17:47 +00:00
|
|
|
//Logs
|
2019-09-01 13:55:33 +00:00
|
|
|
$logManager = new LogManager();
|
2019-08-23 11:39:42 +00:00
|
|
|
|
|
|
|
$route = new Route();
|
|
|
|
$route->add('/', 'Home');
|
|
|
|
$route->add('/login', 'Login');
|
|
|
|
$route->add('/logout', 'Logout');
|
|
|
|
$route->add('/automation', 'Automation');
|
|
|
|
$route->add('/dashboard', 'Dashboard');
|
|
|
|
$route->add('/setting', 'Setting');
|
|
|
|
$route->add('/scene', 'Scene');
|
|
|
|
$route->add('/ajax', 'Ajax');
|
2019-09-01 13:55:33 +00:00
|
|
|
$route->add('/log', 'Log');
|
2019-08-23 11:39:42 +00:00
|
|
|
$route->add('/rooms', 'Rooms');
|
|
|
|
|
|
|
|
$route->submit();
|