From 0b7a8c0252375dc5cd99e7a4d2a932d332a1ba69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Sat, 3 Feb 2024 17:05:31 +0100 Subject: [PATCH] fix --- lib/endpoint.php | 11 +++++++++-- lib/router.php | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/endpoint.php b/lib/endpoint.php index ce0d177..f81419b 100644 --- a/lib/endpoint.php +++ b/lib/endpoint.php @@ -21,9 +21,16 @@ function getEndpoint($endpoint_name): string $endpoint_name = $routerRequest["page_name"]; } - $endpoint_file = $routerConfig["endpoint_dir"] . $routerRequest["subdomain"] . "/" . $endpoint_name . ".php"; + if($routerRequest["isToApex"]){ + $subdomain_part = ""; + } + else{ + $subdomain_part = $routerRequest["subdomain"] . "/"; + } - $endpoint_file_global = $routerConfig["endpoint_dir"] . "home/" . $endpoint_name . ".php"; + $endpoint_file = $routerConfig["endpoint_dir"] . $subdomain_part . $endpoint_name . ".php"; + + $endpoint_file_global = $routerConfig["endpoint_dir"] . "global/" . $endpoint_name . ".php"; if (file_exists($endpoint_file_global)){ $output = runEndpoint($endpoint_file_global); diff --git a/lib/router.php b/lib/router.php index 4223fcd..2ad4038 100644 --- a/lib/router.php +++ b/lib/router.php @@ -15,6 +15,7 @@ function initRouter(): bool $routerRequest["subdomain"] = $routerConfig["default_site"]; $routerRequest["domain"] = basename($routerRequest["requestAddress"][0]); $routerRequest["tld"] = basename($routerRequest["requestAddress"][1]); + $routerRequest["isToApex"] = true; } else {