Opps, domain detection is wrong
[shipsimu.git] / inc / config / class_FrameworkConfiguration.php
index 5e9b87ef93ff72aa00d7a03d858522c1f07183b4..794925dd1e590fdde9868c4485dbb7c5e117c490 100644 (file)
@@ -278,11 +278,24 @@ class FrameworkConfiguration implements Registerable {
                } // END - if
 
                // Construct the full URL now and secure it against CSRF attacks
-               $baseUrl = $baseUrl . "://" . htmlentities(strip_tags($_SERVER['SERVER_NAME']), ENT_QUOTES) . dirname($_SERVER['SCRIPT_NAME']);
+               $baseUrl = $baseUrl . "://" . $this->detectDomain() . dirname($_SERVER['SCRIPT_NAME']);
 
                // Return the URL
                return $baseUrl;
        }
+
+       /**
+        * Detect safely and return the full domain where this script is installed
+        *
+        * @return      $fullDomain             The detected full domain
+        */
+       public function detectDomain () {
+               // Detect the full domain
+               $fullDomain = htmlentities(strip_tags($_SERVER['SERVER_NAME']), ENT_QUOTES);
+
+               // Return it
+               return $fullDomain;
+       }
 } // END - class
 
 // [EOF]