Merge branch 'main' of brn.systems:Adleraci/adlerka.top

This commit is contained in:
Richard Mikloš 2024-02-02 10:42:41 +01:00
commit d07c2bd0ca

@ -20,7 +20,10 @@ function generateNavigation(): string
$site_name = str_replace("_", " ", $site_dir); $site_name = str_replace("_", " ", $site_dir);
if ($site_name == "global") { if ($site_name == "global") {
$site_name = "misc"; $site_name = "misc";
$site_dir = $routerConfig["default_site"]; $site_subdomain = $routerConfig["default_site"];
}
else{
$site_subdomain = $site_dir;
} }
if ($site_name == "smp") { if ($site_name == "smp") {
@ -29,7 +32,7 @@ function generateNavigation(): string
$site_name = ucfirst($site_name); $site_name = ucfirst($site_name);
} }
$site_location = $routerConfig["protocol"] . $site_dir . "." . $routerRequest["domain"] . "." . $routerRequest["tld"] . "/" . $routerConfig["default_page"]; $site_location = $routerConfig["protocol"] . $site_subdomain . "." . $routerRequest["domain"] . "." . $routerRequest["tld"] . "/" . $routerConfig["default_page"];
if ($routerRequest["subdomain"] == $site_dir) { if ($routerRequest["subdomain"] == $site_dir) {
//this is the current page //this is the current page
@ -40,6 +43,7 @@ function generateNavigation(): string
} }
$navpages = ""; $navpages = "";
foreach ($pages_dir as $page_file) { foreach ($pages_dir as $page_file) {
$page_dir_tmp = explode(".", $page_file); $page_dir_tmp = explode(".", $page_file);
$page_dir = $page_dir_tmp[0]; $page_dir = $page_dir_tmp[0];
@ -48,15 +52,14 @@ function generateNavigation(): string
$page_class = "class=\"navpage_link active\""; $page_class = "class=\"navpage_link active\"";
} }
$page_location = $routerConfig["protocol"] . $site_dir . "." . $routerRequest["domain"] . "." . $routerRequest["tld"] . "/" . $page_dir; $page_location = $routerConfig["protocol"] . $site_subdomain . "." . $routerRequest["domain"] . "." . $routerRequest["tld"] . "/" . $page_dir;
$page_name = str_replace("_", " ", $page_dir); $page_name = str_replace("_", " ", $page_dir);
$page_name = explode(".", $page_name)[0]; $page_name = explode(".", $page_name)[0];
$page_name = ucfirst($page_name); $page_name = ucfirst($page_name);
$page_file = $routerConfig["page_dir"] . $site_dir . "/" . $page_file ; $page_file_path = $routerConfig["page_dir"] . $site_dir . "/" . $page_file ;
if($page_dir_tmp[1] == "html"){ if($page_dir_tmp[1] == "html"){
$page_tmp = file_get_contents($page_file); $page_tmp = file_get_contents($page_file_path);
$pageMetadata = parsePageTag($page_tmp); $pageMetadata = parsePageTag($page_tmp);
if(!empty($pageMetadata["parameters"]["minimal_permission_level"])){ if(!empty($pageMetadata["parameters"]["minimal_permission_level"])){
@ -67,7 +70,7 @@ function generateNavigation(): string
} }
} }
elseif($page_dir_tmp[1] == "php"){ elseif($page_dir_tmp[1] == "php"){
$page_required_permission = getDynamicPermission($page_file); $page_required_permission = getDynamicPermission($page_file_path);
} }
else{ else{
$page_required_permission = $routerConfig["default_page_permission_level"]; $page_required_permission = $routerConfig["default_page_permission_level"];