Implement a bunch of stuff

This commit is contained in:
2024-02-03 16:08:26 +01:00
parent e3722e3ef7
commit 15964cf109
15 changed files with 690 additions and 242 deletions

View File

@@ -1,10 +1,11 @@
<?php
require_once "lib/router.php";
require_once "lib/account.php";
function get_parameters():array
{
return ["minimal_permission_level" => 1, "secret" => "no", "page_title" => "Domov"];
return ["minimal_permission_level" => 1, "secret" => "no", "page_title" => "Account"];
}
function render(): string
@@ -13,12 +14,10 @@ function render(): string
ob_start();
if ($_SESSION["ID"] > 0) {
$account_template = file_get_contents($routerConfig["template_dir"] . "home.html");
echo $account_template;
if (isLoggedIn()) {
echo file_get_contents($routerConfig["template_dir"] . "dashboard.html");
} else {
$login_template = file_get_contents($routerConfig["template_dir"] . "login.html");
echo $login_template;
echo file_get_contents($routerConfig["template_dir"] . "login.html");
}
return ob_get_clean();

24
pages/home/settings.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
require_once "lib/router.php";
require_once "lib/account.php";
function get_parameters():array
{
return ["minimal_permission_level" => 2, "secret" => "no", "page_title" => "Settings"];
}
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();
}