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

View File

@ -15,14 +15,14 @@ class LogKeeper
$todayFileName = date("Y-m-d").'.log';
$seconds = $days * 86400;
$logFiles = scandir('./app/logs/');
$logFiles = scandir('../app/logs/');
foreach ($logFiles as $key => $file) {
if (in_array($file,array(".","..", ".gitkeep", $todayFileName)))
{
continue;
}
if (filemtime($file) > $seconds) {
unlink('./app/logs/'.$file);
unlink('../app/logs/'.$file);
}
}
}
@ -35,11 +35,11 @@ class LogManager
function __construct($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!");
}