diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/SemanticScuttle/constants.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/SemanticScuttle/constants.php b/src/SemanticScuttle/constants.php index 4940af8..e37f41c 100644 --- a/src/SemanticScuttle/constants.php +++ b/src/SemanticScuttle/constants.php @@ -11,11 +11,14 @@ if(isset($GLOBALS['debugMode'])) { } // Determine the base URL as ROOT -if (!isset($GLOBALS['root'])) { +if (!isset($_SERVER['HTTP_HOST'])) { + //not set in unit tests + define('ROOT', 'http://localhost/'); +} else if (!isset($GLOBALS['root'])) { $pieces = explode('/', $_SERVER['SCRIPT_NAME']); $rootTmp = '/'; - foreach($pieces as $piece) { + foreach ($pieces as $piece) { //we eliminate possible sscuttle subfolders (like gsearch for example) if ($piece != '' && !strstr($piece, '.php') && $piece != 'gsearch') { $rootTmp .= $piece .'/'; |