From 2fe817e4c19790fc99815a7f9f288826aa89175d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Fri, 2 Feb 2024 00:34:56 +0100 Subject: [PATCH 1/7] debug print --- lib/navigation.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/navigation.php b/lib/navigation.php index d5fdfff..0aca785 100644 --- a/lib/navigation.php +++ b/lib/navigation.php @@ -40,6 +40,7 @@ function generateNavigation(): string } $navpages = ""; + print_r($pages_dir); foreach ($pages_dir as $page_file) { $page_dir_tmp = explode(".", $page_file); $page_dir = $page_dir_tmp[0]; From 01e0d34d429730c7e3d7d0f0a9d49bc3e52cb174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Fri, 2 Feb 2024 00:37:10 +0100 Subject: [PATCH 2/7] debug print --- lib/navigation.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/navigation.php b/lib/navigation.php index 0aca785..5cf9308 100644 --- a/lib/navigation.php +++ b/lib/navigation.php @@ -40,7 +40,7 @@ function generateNavigation(): string } $navpages = ""; - print_r($pages_dir); + foreach ($pages_dir as $page_file) { $page_dir_tmp = explode(".", $page_file); $page_dir = $page_dir_tmp[0]; @@ -54,10 +54,12 @@ function generateNavigation(): string $page_name = str_replace("_", " ", $page_dir); $page_name = explode(".", $page_name)[0]; $page_name = ucfirst($page_name); - $page_file = $routerConfig["page_dir"] . $site_dir . "/" . $page_file ; + $page_file_path = $routerConfig["page_dir"] . $site_dir . "/" . $page_file ; + print_r($page_file_path); + print_r($page_dir_tmp); 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); if(!empty($pageMetadata["parameters"]["minimal_permission_level"])){ @@ -68,7 +70,7 @@ function generateNavigation(): string } } elseif($page_dir_tmp[1] == "php"){ - $page_required_permission = getDynamicPermission($page_file); + $page_required_permission = getDynamicPermission($page_file_path); } else{ $page_required_permission = $routerConfig["default_page_permission_level"]; From e4ca769bb8fbb8fd87243e93c58e01423154766d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Fri, 2 Feb 2024 00:40:17 +0100 Subject: [PATCH 3/7] debug print --- lib/navigation.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/navigation.php b/lib/navigation.php index 5cf9308..ac1b39e 100644 --- a/lib/navigation.php +++ b/lib/navigation.php @@ -42,6 +42,7 @@ function generateNavigation(): string $navpages = ""; foreach ($pages_dir as $page_file) { + print_r($page_file); $page_dir_tmp = explode(".", $page_file); $page_dir = $page_dir_tmp[0]; $page_class = "class=\"navpage_link\""; @@ -55,7 +56,7 @@ function generateNavigation(): string $page_name = explode(".", $page_name)[0]; $page_name = ucfirst($page_name); $page_file_path = $routerConfig["page_dir"] . $site_dir . "/" . $page_file ; - + print_r($site_dir); print_r($page_file_path); print_r($page_dir_tmp); if($page_dir_tmp[1] == "html"){ From 479e9a782dbb49765195d70030e2437abb1d262d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Fri, 2 Feb 2024 00:41:57 +0100 Subject: [PATCH 4/7] why --- lib/navigation.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/navigation.php b/lib/navigation.php index ac1b39e..5b9403a 100644 --- a/lib/navigation.php +++ b/lib/navigation.php @@ -20,7 +20,6 @@ function generateNavigation(): string $site_name = str_replace("_", " ", $site_dir); if ($site_name == "global") { $site_name = "misc"; - $site_dir = $routerConfig["default_site"]; } if ($site_name == "smp") { From dd590ef492cd7a303e24967481d389099ce81fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Fri, 2 Feb 2024 00:42:27 +0100 Subject: [PATCH 5/7] remove debug prints --- lib/navigation.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/navigation.php b/lib/navigation.php index 5b9403a..d8a5d21 100644 --- a/lib/navigation.php +++ b/lib/navigation.php @@ -41,7 +41,6 @@ function generateNavigation(): string $navpages = ""; foreach ($pages_dir as $page_file) { - print_r($page_file); $page_dir_tmp = explode(".", $page_file); $page_dir = $page_dir_tmp[0]; $page_class = "class=\"navpage_link\""; @@ -55,9 +54,6 @@ function generateNavigation(): string $page_name = explode(".", $page_name)[0]; $page_name = ucfirst($page_name); $page_file_path = $routerConfig["page_dir"] . $site_dir . "/" . $page_file ; - print_r($site_dir); - print_r($page_file_path); - print_r($page_dir_tmp); if($page_dir_tmp[1] == "html"){ $page_tmp = file_get_contents($page_file_path); From 2ed53291d6eb607fa67ec0a61e9a7a4abc6087d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Fri, 2 Feb 2024 00:44:07 +0100 Subject: [PATCH 6/7] fix logic --- lib/navigation.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/navigation.php b/lib/navigation.php index d8a5d21..0d03292 100644 --- a/lib/navigation.php +++ b/lib/navigation.php @@ -20,6 +20,10 @@ function generateNavigation(): string $site_name = str_replace("_", " ", $site_dir); if ($site_name == "global") { $site_name = "misc"; + $site_subdomain = $routerConfig["default_site"]; + } + else{ + $site_subdomain = $site_dir; } if ($site_name == "smp") { @@ -28,7 +32,7 @@ function generateNavigation(): string $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) { //this is the current page From 3cbeb4368adb182431d575eca65de4c5ad9517e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Fri, 2 Feb 2024 00:45:07 +0100 Subject: [PATCH 7/7] fix logic --- lib/navigation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/navigation.php b/lib/navigation.php index 0d03292..e4b6b4b 100644 --- a/lib/navigation.php +++ b/lib/navigation.php @@ -52,7 +52,7 @@ function generateNavigation(): string $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 = explode(".", $page_name)[0];