This commit is contained in:
JonatanRek 2020-04-21 15:19:05 +02:00
parent e76d2bc5e5
commit 216db28e60
2 changed files with 21 additions and 15 deletions

View File

@ -20,9 +20,9 @@ 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; return;
} }
} }
} }
@ -32,8 +32,13 @@ Class Autoloader {
} }
} }
Autoloader::setRoot('/var/www/dev.steelants.cz/vasek/home-update/');
spl_autoload_register("Autoloader::ClassLoader"); spl_autoload_register("Autoloader::ClassLoader");
Autoloader::setRoot('/var/www/dev.steelants.cz/vasek/home-update/');
//Debug
error_reporting(E_ALL);
ini_set( 'display_errors','1');
//setup //setup
ini_set ('session.cookie_httponly', '1'); ini_set ('session.cookie_httponly', '1');
@ -44,18 +49,19 @@ session_start ();
mb_internal_encoding ("UTF-8"); mb_internal_encoding ("UTF-8");
//Language //Language
$langTag = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); //$langTag = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
$langMng = new LanguageManager($langTag); //$langMng = new LanguageManager($langTag);
$langMng->load(); //$langMng->load();
//DB Conector //DB Conector
Db::connect (DBHOST, DBUSER, DBPASS, DBNAME); //Db::connect (DBHOST, DBUSER, DBPASS, DBNAME);
//TODO: Přesunout do Login Pohledu
$userManager = new UserManager();
//Logs //Logs
$logManager = new LogManager(); $logManager = new LogManager();
//TODO: Přesunout do Login Pohledu
$userManager = new UserManager();
// import routes // import routes
require_once './Routes.php'; require_once './Routes.php';

View File

@ -15,14 +15,14 @@ class LogKeeper
$todayFileName = date("Y-m-d").'.log'; $todayFileName = date("Y-m-d").'.log';
$seconds = $days * 86400; $seconds = $days * 86400;
$logFiles = scandir('./app/logs/'); $logFiles = scandir('../app/logs/');
foreach ($logFiles as $key => $file) { foreach ($logFiles as $key => $file) {
if (in_array($file,array(".","..", ".gitkeep", $todayFileName))) if (in_array($file,array(".","..", ".gitkeep", $todayFileName)))
{ {
continue; continue;
} }
if (filemtime($file) > $seconds) { if (filemtime($file) > $seconds) {
unlink('./app/logs/'.$file); unlink('../app/logs/'.$file);
} }
} }
} }
@ -35,11 +35,11 @@ class LogManager
function __construct($fileName = "") function __construct($fileName = "")
{ {
if ($fileName == ""){ if ($fileName == ""){
$fileName = './app/logs/'. date("Y-m-d").'.log'; $fileName = '../app/logs/'. date("Y-m-d").'.log';
} }
if(!is_dir("./app/logs/")) if(!is_dir("../app/logs/"))
{ {
mkdir("./app/logs/"); mkdir("../app/logs/");
} }
$this->logFile = fopen($fileName, "a") or die("Unable to open file!"); $this->logFile = fopen($fileName, "a") or die("Unable to open file!");
} }