checkLogin($controllerName); if (array_key_exists($controllerName, $controllers)) { if (\method_exists($controllers[$controllerName], $functionName)) { return $controllers[$controllerName]; } else { return null; } } else { return null; } } public function getDefaultRoute() { return 'jobs/home'; } public function checkLogin($name) { $loginRoutes = []; //TODO: Add login routes $loginRoutes['portal'] = true; $requiresLogin = $loginRoutes[$name] ?? false; if ($requiresLogin && !isset($_SESSION['loggedin'])) { header('location: /user/login'); exit(); } } public function notFound() { $cats = new \CSY2028\DatabaseTable('category', 'id', '\jobs\Entity\Category'); return ['template' => 'response.html.php', 'title' => 'Jo\'s Jobs- 404 Not Found', 'vars' => ['cats' => $cats->findAll(), 'response' => '404 Page Not Found'] ]; } public function nav() { $cats = new \CSY2028\DatabaseTable('category', 'id', '\jobs\Entity\Category'); return ['template' => 'nav.html.php', 'vars' => ['cats' => $cats->findAll()] ]; } } ?>