From: Roland Häder Date: Mon, 18 Aug 2008 22:56:07 +0000 (+0000) Subject: Missing SERVER_NAME in non-web applications fixed X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0d830fa818c20a7bda5e58e4ab93ff16887800d1;p=shipsimu.git Missing SERVER_NAME in non-web applications fixed --- diff --git a/inc/config/class_FrameworkConfiguration.php b/inc/config/class_FrameworkConfiguration.php index 1178361..6bfdfbf 100644 --- a/inc/config/class_FrameworkConfiguration.php +++ b/inc/config/class_FrameworkConfiguration.php @@ -292,8 +292,14 @@ class FrameworkConfiguration implements Registerable { * @return $fullDomain The detected full domain */ public function detectDomain () { - // Detect the full domain - $fullDomain = htmlentities(strip_tags($_SERVER['SERVER_NAME']), ENT_QUOTES); + // Full domain is localnet.invalid by default + $fullDomain = "localnet.invalid"; + + // Is the server name there? + if (isset($_SERVER['SERVER_NAME'])) { + // Detect the full domain + $fullDomain = htmlentities(strip_tags($_SERVER['SERVER_NAME']), ENT_QUOTES); + } // END - if // Return it return $fullDomain;