vela vecí nove more

This commit is contained in:
Richard Mikloš 2024-01-20 19:04:39 +01:00
parent a1f5af75bd
commit dcefd7944a
5 changed files with 19 additions and 9 deletions

@ -16,18 +16,28 @@ if (!isset($_SESSION['user_id'])) {
$page = basename($_SERVER['QUERY_STRING']);
$nav = file_get_contents("$template_dir/navigation.html");
if(empty($page)){
if ($user['isAdmin'] == 1) {
$page = 'index_admin'; // Custom HTML for Admin
} else {
$page = 'index_user'; // Custom HTML for regular user
}
$paths_to_check = array();
$paths_to_check[] = "pages/global";
if ($user['isAdmin'] == 1) {
$paths_to_check[] = "pages/admin";
}
$page_file = "$page_dir/$page.html";
$paths_to_check[] = "pages/user";
if (!file_exists($page_file)) {
$page_file = "$template_dir/404.html";
if(empty($page)){
$page = 'index';
}
$page_file = "$template_dir/404.html";
foreach($paths_to_check as $page_dir){
$page_file_tmp = "$page_dir/$page.html";
if(file_exists($page_file_tmp)){
$page_file = $page_file_tmp;
break;
}
}
ob_start();
include $page_file;