CMXX - Mutlisite update

This commit is contained in:
“VeLiTi”
2025-03-13 12:41:11 +01:00
parent 75d9aa722a
commit 5557f6d270
4 changed files with 355 additions and 10 deletions

View File

@@ -3,28 +3,25 @@
//=========================================
//REDIRECTOR TO CONFIG FILE BASED ON DOMAIN
//=========================================
function getDomain($hostname) {
// Extract the domain parts
$parts = explode('.', $hostname);
$parts = explode('.', $_SERVER['SERVER_NAME']);
$count = count($parts);
// For hostnames with enough parts to have a subdomain (at least 3 parts)
if ($count >= 3) {
// Return the second-to-last and third-to-last parts
return $parts[$count - 2];
$domain = $parts[$count - 2];
}
// For hostnames with just domain and TLD (2 parts)
else if ($count == 2) {
// Return just the domain part (without the TLD)
return $parts[0];
$domain = $parts[0];
}
// If it's a single part hostname
else {
return $hostname;
$domain = $hostname;
}
}
$domain = getDomain($_SERVER['SERVER_NAME']);
$settings_location = ((file_exists(dirname(__FILE__).'/'.$domain.'/'.$domain.'_settings.php')) ? dirname(__FILE__).'/'.$domain.'/'.$domain.'_settings.php' : dirname(__FILE__).'/settings.php');
include $settings_location;