From d7460c138fa186b69f85ce2e7cf3ad0e3a685baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Fri, 12 Jan 2024 15:37:02 +0100 Subject: [PATCH] fix --- index.php | 9 ++++++++- templates/navpages.php | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 79508fc..8d7925a 100644 --- a/index.php +++ b/index.php @@ -5,6 +5,8 @@ session_start(); $default_page = "domov"; +$default_site = "home"; + $template_dir = "templates/"; $static_page_dir = "pages/"; @@ -21,8 +23,13 @@ $srvname = $_SERVER["SERVER_NAME"]; $protocol = $_SERVER['PROTOCOL'] = isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && !empty($_SERVER['HTTP_X_FORWARDED_PROTO']) ? "https://" : "http://"; +if (empty($tld)){ + header("Location: $protocol$default_site.$subdomain.$domain/$default_page"); + return; +} + if (empty($page_name)){ - header("Location: $protocol$domain.$tld/$default_page"); + header("Location: $protocol$subdomain.$domain.$tld/$default_page"); return; } diff --git a/templates/navpages.php b/templates/navpages.php index c052f6b..739f547 100644 --- a/templates/navpages.php +++ b/templates/navpages.php @@ -12,9 +12,13 @@ foreach($site_dirs as $site_dir){ $pages_dir = array_diff(scandir("$static_page_dir$site_dir"), array('.', '..')); $navsite = $navsite_template; - $site_location = "$protocol$site_dir.$domain.$tld/$default_page"; $site_class = "class=\"navsite_link\""; $site_name = str_replace("_", " ", $site_dir); + if($site_name == "global"){ + $site_name = "misc"; + $site_dir = $default_site; + } + $site_location = "$protocol$site_dir.$domain.$tld/$default_page"; $navsite = str_replace("__CLASS__", $site_class, $navsite); $navsite = str_replace("__LOCATION__", $site_location, $navsite); $navsite = str_replace("__NAME__", $site_name, $navsite);