q('SELECT * FROM settings WHERE id = 1;'); self::$s = $s ? $s->fetch() : []; if (INSTALLED) { // load the player's auth self::$auth->good(); } // load flash messages self::$flashes = $_SESSION['flash'] ?? []; } public static function auth(): bool { return self::$auth->good(); } public function route(string $uri, string $module): App { $this->routes[$uri] = $module; return $this; } public function handle(string $uri): App { // if the route doesn't exist, return 404 if (!isset($this->routes[$uri])) { http_response_code(404); echo "404: $uri"; return $this; } // handle the route $this->routes[$uri]::handle(); return $this; } public static function flash(string $key, mixed $value = null): mixed { // get a flash message if ($value === null) return self::$flashes[$key] ?? null; // set a flash message $_SESSION['flash'][$key] = $value; self::$flashes[$key] = $value; return null; } public function cleanup() { // clean up flash messages $_SESSION['flash'] = []; self::$flashes = []; } }