From 6fdd76de3d13a0f17d8d63a6fe132d7597a995c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Sat, 3 Feb 2024 16:33:00 +0100 Subject: [PATCH] test --- pages/home/account.php | 35 +++++++++++++++++------------------ pages/home/settings.php | 34 +++++++++++++++++----------------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/pages/home/account.php b/pages/home/account.php index 128d0f7..5728b15 100644 --- a/pages/home/account.php +++ b/pages/home/account.php @@ -3,22 +3,21 @@ require_once "lib/router.php"; require_once "lib/account.php"; -$page_parameters = ["minimal_permission_level" => 1, "secret" => "no", "page_title" => "Account"]; +return [ + "output" => + function () { + global $routerConfig; - -function render(): string -{ - global $routerConfig; - - ob_start(); - - if (isLoggedIn()) { - echo file_get_contents($routerConfig["template_dir"] . "dashboard.html"); - } else { - echo file_get_contents($routerConfig["template_dir"] . "login.html"); - } - - return ob_get_clean(); -} - -return ["output" => render(), "parameters" => $page_parameters]; \ No newline at end of file + if (isLoggedIn()) { + return file_get_contents($routerConfig["template_dir"] . "dashboard.html"); + } else { + return file_get_contents($routerConfig["template_dir"] . "login.html"); + } + }, + "parameters" => + [ + "minimal_permission_level" => 1, + "secret" => "no", + "page_title" => "Account" + ] +]; \ No newline at end of file diff --git a/pages/home/settings.php b/pages/home/settings.php index a346df1..84fce73 100644 --- a/pages/home/settings.php +++ b/pages/home/settings.php @@ -3,21 +3,21 @@ require_once "lib/router.php"; require_once "lib/account.php"; -$page_parameters = ["minimal_permission_level" => 2, "secret" => "no", "page_title" => "Settings"]; +return [ + "output" => + function () { + global $routerConfig; -function render(): string -{ - global $routerConfig; - - ob_start(); - - if (isUserAdmin()) { - echo file_get_contents($routerConfig["template_dir"] . "adminActions.html"); - } else { - echo file_get_contents($routerConfig["template_dir"] . "userActions.html"); - } - - return ob_get_clean(); -} - -return ["output" => render(), "parameters" => $page_parameters]; \ No newline at end of file + if (isUserAdmin()) { + return file_get_contents($routerConfig["template_dir"] . "adminActions.html"); + } else { + return file_get_contents($routerConfig["template_dir"] . "userActions.html"); + } + }, + "parameters" => + [ + "minimal_permission_level" => 2, + "secret" => "no", + "page_title" => "Account" + ] +];