diff --git a/app/inc.php b/app/inc.php index 6c28c74..84eda46 100644 --- a/app/inc.php +++ b/app/inc.php @@ -45,12 +45,6 @@ $app = new App(__DIR__, $config, $database, $session, $user); // we will use $app instead unset($config, $database, $session, $user); -/** - * This is important! - * Without it, everyone will have access to any page without having to be logged in. - * - * Decides if the user is allowed to view current page. - */ new AccessControl($app); return $app; \ No newline at end of file diff --git a/app/lib/App/Core/App.php b/app/lib/App/Core/App.php index 2cb8820..87cc510 100644 --- a/app/lib/App/Core/App.php +++ b/app/lib/App/Core/App.php @@ -70,9 +70,9 @@ class App } /** - * Turn data array into json response + * Convert data into json response */ - public function api($data, int $status_code = 200): void + public function api(mixed $data, int $status_code = 200): void { // set headers http_response_code($status_code); diff --git a/app/lib/App/Core/Config.php b/app/lib/App/Core/Config.php index 0fda980..584673a 100644 --- a/app/lib/App/Core/Config.php +++ b/app/lib/App/Core/Config.php @@ -2,10 +2,10 @@ namespace App\Core; -use \Exception; +use \InvalidArgumentException; /** - * TODO: ... this should validate the config and stuffs + * TODO: this should validate the config and stuffs */ class Config { @@ -18,7 +18,7 @@ class Config { if (!file_exists($path)) { - throw new Exception("Could not find configuration file: $path"); + throw new InvalidArgumentException("Could not find configuration file: $path"); } $this->config = require $path; } diff --git a/app/lib/App/Core/Database.php b/app/lib/App/Core/Database.php index 224ac35..d63de1a 100644 --- a/app/lib/App/Core/Database.php +++ b/app/lib/App/Core/Database.php @@ -2,13 +2,12 @@ namespace App\Core; -use \Exception; +use \InvalidArgumentException; use \PDO; use \PDOException; /** * Encapsulates a single connection to a database. - * TODO: ... */ class Database { @@ -18,7 +17,7 @@ class Database { if ($config['name'] !== 'mysql') { - throw new Exception("Database error: ".$config['name']." is not implemented"); + throw new InvalidArgumentException("Database error: driver ".$config['name']." is not implemented"); } try { diff --git a/app/view/pages/confirm-logout.php b/app/view/pages/confirm-logout.php deleted file mode 100644 index 1a695cd..0000000 --- a/app/view/pages/confirm-logout.php +++ /dev/null @@ -1,6 +0,0 @@ -
Er du sikker på at du vil logge av?
- - \ No newline at end of file diff --git a/app/view/pages/logout.php b/app/view/pages/logout.php new file mode 100644 index 0000000..5b0f790 --- /dev/null +++ b/app/view/pages/logout.php @@ -0,0 +1,4 @@ +Er du sikker på at du vil logge av?
+ +[ Logg ut ] \ No newline at end of file diff --git a/app/view/pages/race/live-results.php b/app/view/pages/race/live.php similarity index 100% rename from app/view/pages/race/live-results.php rename to app/view/pages/race/live.php diff --git a/app/view/template/header.php b/app/view/template/header.php index 83f24b8..21b6c79 100644 --- a/app/view/template/header.php +++ b/app/view/template/header.php @@ -21,7 +21,7 @@ user->loggedIn): ?> =htmlspecialchars($this->user->username)?> - Logg ut + Logg ut Ikke pålogget Logg inn @@ -38,7 +38,7 @@