diff --git a/app/controllers/automationController.php b/app/controllers/automationController.php index 94790c7..f7ae6fd 100644 --- a/app/controllers/automationController.php +++ b/app/controllers/automationController.php @@ -32,7 +32,7 @@ if (isset($_POST) && !empty($_POST)){ AutomationManager::create($_POST['name'], $onDays, $doCode, $ifCode); - header('Location: ' . BASEDIR . strtolower(basename(__FILE__, '.php'))); + header('Location: ' . BASEURL . strtolower(basename(__FILE__, '.php'))); die(); } else if (isset($_POST['modalFinal']) && $_POST['action'] == "edit") { $doCode = json_encode($_POST['device'], JSON_PRETTY_PRINT); @@ -70,7 +70,7 @@ if (isset($_POST) && !empty($_POST)){ AutomationManager::create($_POST['name'], $onDays, $doCode, $ifCode, (isset ($_POST['automation_id']) ? $_POST['automation_id'] : "")); - header('Location: ' . BASEDIR . strtolower(basename(__FILE__, '.php'))); + header('Location: ' . BASEURL . strtolower(basename(__FILE__, '.php'))); die(); } } diff --git a/app/controllers/dashboardController.php b/app/controllers/dashboardController.php index 384f909..f2538c1 100644 --- a/app/controllers/dashboardController.php +++ b/app/controllers/dashboardController.php @@ -7,7 +7,7 @@ if (isset($_POST) && !empty($_POST)){ DashboardManager::Add($subDeviceId); } } - header('Location: ' . BASEDIR . strtolower(basename(__FILE__, '.php'))); + header('Location: ' . BASEURL . strtolower(basename(__FILE__, '.php'))); die(); } ?> diff --git a/app/controllers/homeController.php b/app/controllers/homeController.php index e569b24..6660f4d 100644 --- a/app/controllers/homeController.php +++ b/app/controllers/homeController.php @@ -78,10 +78,10 @@ if (isset($_POST) && !empty($_POST)){ echo '
';
 		var_dump($POST);
 		echo '
'; - echo 'CONTINUE'; + echo 'CONTINUE'; die(); } - header('Location: ' . BASEDIR ); + header('Location: ' . BASEURL ); die(); } ?> diff --git a/app/controllers/loginController.php b/app/controllers/loginController.php index a8b685e..ae7a445 100644 --- a/app/controllers/loginController.php +++ b/app/controllers/loginController.php @@ -15,7 +15,7 @@ if ( $ota = $userManager->haveOtaEnabled($userName); if ($ota == "") { $landingPage = $userManager->login($userName, $userPassword, $rememberMe); - header('Location: ' . BASEDIR . $landingPage); + header('Location: ' . BASEURL . $landingPage); die(); } @@ -40,7 +40,7 @@ if ( $checkResult = $ga->verifyCode($otaSecret, $otaCode, 2); // 2 = 2*30sec clock tolerance if ($checkResult) { $landingPage = $userManager->login($userName, $userPassword, $rememberMe); - header('Location: ' . BASEDIR . $landingPage); + header('Location: ' . BASEURL . $landingPage); echo 'OK'; } else { echo 'FAILED'; diff --git a/app/controllers/sceneController.php b/app/controllers/sceneController.php index 06faff0..b7f1f99 100644 --- a/app/controllers/sceneController.php +++ b/app/controllers/sceneController.php @@ -3,7 +3,7 @@ if (isset($_POST) && !empty($_POST)){ if (isset($_POST['submitFinal']) && $_POST['submitFinal'] != "") { SceneManager::create($_POST['sceneIcon'], $_POST['sceneName'], json_encode($_POST['devices'])); - header('Location: ' . BASEDIR . strtolower(basename(__FILE__, '.php'))); + header('Location: ' . BASEURL . strtolower(basename(__FILE__, '.php'))); die(); } @@ -12,7 +12,7 @@ if (isset($_POST) && !empty($_POST)){ echo '
';
 		var_dump($_POST);
 		echo '
'; - echo 'CONTINUE'; + echo 'CONTINUE'; die(); } } diff --git a/app/controllers/settingController.php b/app/controllers/settingController.php index 3bde544..f31a8de 100644 --- a/app/controllers/settingController.php +++ b/app/controllers/settingController.php @@ -5,13 +5,13 @@ if (isset($_POST) && !empty($_POST)){ $newPassword = $_POST['newPassword1']; $newPassword2 = $_POST['newPassword2']; UserManager::changePassword($oldPassword, $newPassword, $newPassword2); - header('Location: ' . BASEDIR . 'logout'); + header('Location: ' . BASEURL . 'logout'); die(); } else if (isset($_POST['submitCreateUser']) && $_POST['submitCreateUser'] != "") { $userName = $_POST['userName']; $password = $_POST['userPassword']; UserManager::createUser($userName, $password); - header('Location: ' . BASEDIR . 'setting'); + header('Location: ' . BASEURL . 'setting'); die(); } else if (isset($_POST['submitEnableOta']) && $_POST['submitEnableOta'] != "") { echo $otaCode = $_POST['otaCode']; @@ -23,7 +23,7 @@ if (isset($_POST) && !empty($_POST)){ if ($checkResult) { UserManager::setOta($otaCode, $otaSecret); } - header('Location: ' . BASEDIR . 'setting'); + header('Location: ' . BASEURL . 'setting'); die(); } } diff --git a/app/models/LogManager.php b/app/models/LogManager.php index bf6e3f8..6329072 100644 --- a/app/models/LogManager.php +++ b/app/models/LogManager.php @@ -15,14 +15,14 @@ class LogKeeper $todayFileName = date("Y-m-d").'.log'; $seconds = $days * 86400; - $logFiles = scandir('../app/logs/'); + $logFiles = scandir('../logs/'); foreach ($logFiles as $key => $file) { if (in_array($file,array(".","..", ".gitkeep", $todayFileName))) { continue; } if (filemtime($file) > $seconds) { - unlink('../app/logs/'.$file); + unlink('../logs/'.$file); } } } @@ -35,11 +35,11 @@ class LogManager function __construct($fileName = "") { if ($fileName == ""){ - $fileName = '../app/logs/'. date("Y-m-d").'.log'; + $fileName = '../logs/'. date("Y-m-d").'.log'; } - if(!is_dir("../app/logs/")) + if(!is_dir("../logs/")) { - mkdir("../app/logs/"); + mkdir("../logs/"); } $this->logFile = fopen($fileName, "a") or die("Unable to open file!"); } diff --git a/app/views/Ajax.php b/app/views/Ajax.php index b29153d..96554a3 100644 --- a/app/views/Ajax.php +++ b/app/views/Ajax.php @@ -8,12 +8,12 @@ class Ajax extends Template global $lang; if (!$userManager->isLogin()){ - header('Location: ' . BASEDIR); + header('Location: ' . BASEURL); } $is_ajax = 'XMLHttpRequest' == ( $_SERVER['HTTP_X_REQUESTED_WITH'] ?? '' ); if (!$is_ajax){ - header('Location: ' . BASEDIR); + header('Location: ' . BASEURL); } if ( diff --git a/app/views/Automation.php b/app/views/Automation.php index abbbad7..8bd7263 100644 --- a/app/views/Automation.php +++ b/app/views/Automation.php @@ -1,10 +1,4 @@ isLogin()){ - header('Location: ' . BASEDIR . 'login'); + header('Location: ' . BASEURL . 'login'); } $automations = []; diff --git a/app/views/Dashboard.php b/app/views/Dashboard.php index 399ffd3..37ce3aa 100644 --- a/app/views/Dashboard.php +++ b/app/views/Dashboard.php @@ -7,7 +7,7 @@ class Dashboard extends Template global $langMng; if (!$userManager->isLogin()){ - header('Location: ' . BASEDIR . 'login'); + header('Location: ' . BASEURL . 'login'); } $template = new Template('dashboard'); diff --git a/app/views/Home.php b/app/views/Home.php index 24e4f89..0f053f7 100644 --- a/app/views/Home.php +++ b/app/views/Home.php @@ -9,7 +9,7 @@ class Home extends Template global $langMng; if (!$userManager->isLogin()){ - header('Location: ' . BASEDIR . 'login'); + header('Location: ' . BASEURL . 'login'); } $template = new Template('home'); diff --git a/app/views/Log.php b/app/views/Log.php index fae038a..3fd6338 100644 --- a/app/views/Log.php +++ b/app/views/Log.php @@ -9,14 +9,14 @@ class Log extends Template global $langMng; if (!$userManager->isLogin()){ - header('Location: ' . BASEDIR . 'login'); + header('Location: ' . BASEURL . 'login'); } $template = new Template('log'); $template->prepare('title', 'Log'); $result = array(); - $cdir = scandir('./app/logs/'); + $cdir = scandir('../logs/'); foreach ($cdir as $key => $value) { if (!in_array($value,array(".","..", ".gitkeep"))) diff --git a/app/views/Login.php b/app/views/Login.php index 074a14d..d905d03 100644 --- a/app/views/Login.php +++ b/app/views/Login.php @@ -7,7 +7,7 @@ class Login extends Template global $lang; if ($userManager->isLogin()){ - header('Location: ' . BASEDIR); + header('Location: ' . BASEURL); } $template = new Template('login'); diff --git a/app/views/Logout.php b/app/views/Logout.php index 0747434..e0cf627 100644 --- a/app/views/Logout.php +++ b/app/views/Logout.php @@ -5,7 +5,7 @@ class Logout extends Template { global $userManager; $userManager->logout(); - header('Location: ' . BASEDIR . 'login'); + header('Location: ' . BASEURL . 'login'); die(); } } diff --git a/app/views/Rooms.php b/app/views/Rooms.php index 629bc94..f765e5e 100644 --- a/app/views/Rooms.php +++ b/app/views/Rooms.php @@ -9,7 +9,7 @@ class Rooms extends Template global $langMng; if (!$userManager->isLogin()){ - header('Location: ' . BASEDIR . 'login'); + header('Location: ' . BASEURL . 'login'); } $template = new Template('rooms'); diff --git a/app/views/Scene.php b/app/views/Scene.php index 8a0a5d7..5fee909 100644 --- a/app/views/Scene.php +++ b/app/views/Scene.php @@ -7,7 +7,7 @@ class Scene extends Template global $langMng; if (!$userManager->isLogin()){ - header('Location: ' . BASEDIR . 'login'); + header('Location: ' . BASEURL . 'login'); } $template = new Template('scene'); diff --git a/app/views/Setting.php b/app/views/Setting.php index 79c71fb..d89c28d 100644 --- a/app/views/Setting.php +++ b/app/views/Setting.php @@ -8,7 +8,7 @@ class Setting extends Template global $langMng; if (!$userManager->isLogin()){ - header('Location: ' . BASEDIR . 'login'); + header('Location: ' . BASEURL . 'login'); } $automations = []; diff --git a/library/vendor/GoogleAuthenticator.php b/library/vendor/PHPGangsta_GoogleAuthenticator.php similarity index 100% rename from library/vendor/GoogleAuthenticator.php rename to library/vendor/PHPGangsta_GoogleAuthenticator.php