diff --git a/index.php b/index.php index a34ff640..eadfb279 100644 --- a/index.php +++ b/index.php @@ -35,4 +35,4 @@ use ZK\Controllers\Dispatcher; $dispatcher = new Dispatcher(); -$dispatcher->processRequest($_REQUEST["target"]); +$dispatcher->processRequest($_REQUEST["target"] ?? ''); diff --git a/ui/UIController.php b/ui/UIController.php index 0fab36ba..2e14278d 100644 --- a/ui/UIController.php +++ b/ui/UIController.php @@ -47,7 +47,7 @@ public function setContext($menu = null, $menuItem = null, $html = null) { $this->app->content->template = $menuItem ? $menuItem->getTemplate() : null; $this->app->content->title = $menuItem ? $menuItem->getTitle() : null; $this->app->menu = $menu ?? []; - $this->app->submenu = $menuItem ? $menuItem->composeSubmenu($_REQUEST['action'], $_REQUEST['subaction']) : []; + $this->app->submenu = $menuItem ? $menuItem->composeSubmenu($_REQUEST['action'] ?? '', $_REQUEST['subaction'] ?? '') : []; $this->app->tertiary = $menuItem ? $menuItem->getTertiary() : null; $this->app->extra = $menuItem ? $menuItem->getExtra() : null; } @@ -171,7 +171,7 @@ public function processRequest() { ob_end_clean(); $templateFact = new TemplateFactoryUI(); - $templateFact->setContext($this->composeMenu($_REQUEST['action']), $this->menuItem, $data); + $templateFact->setContext($this->composeMenu($_REQUEST['action'] ?? ''), $this->menuItem, $data); $template = $templateFact->load('index.html'); echo $template->render($this->menuItem ? $this->menuItem->getTemplateVars() : []); } @@ -185,10 +185,10 @@ protected function preProcessRequest() { $_REQUEST["action"] != "loginValidate" && $_REQUEST["action"] != "logout") { $_REQUEST["action"] = "invalidAction"; - } + } // Setup/teardown a session - switch($_REQUEST["action"]) { + switch($_REQUEST["action"] ?? '') { case "loginValidate": if(!$this->session->isAuth("u")) $this->doLogin($_REQUEST["user"], $_REQUEST["password"]); @@ -206,12 +206,12 @@ protected function preProcessRequest() { break; case "find": // redirect full-text search URLs from v2.x - $qs = "?action=search&s=all&n=".urlencode($_REQUEST["search"]??''); + $qs = "?action=search&s=all&n=".urlencode($_REQUEST["search"] ?? ''); header("Location: ".Engine::getBaseUrl().$qs, true, 301); // 301 Moved Permanently exit; case "viewDJReviews"; // redirect DJ review URLs from v2.x - $qs = "?action=viewRecent&subaction=viewDJ&seq=selUser&viewuser=".urlencode($_REQUEST["n"]??''); + $qs = "?action=viewRecent&subaction=viewDJ&seq=selUser&viewuser=".urlencode($_REQUEST["n"] ?? ''); header("Location: ".Engine::getBaseUrl().$qs, true, 301); // 301 Moved Permanently exit; case "viewList": @@ -376,7 +376,7 @@ protected function emitLogout() { } protected function checkCookiesEnabled() { - if($_REQUEST["checkCookie"]) { + if($_REQUEST["checkCookie"] ?? 0) { if(isset($_COOKIE["testcookie"])) { // the cookie test was successful!