diff options
Diffstat (limited to 'inc/common.php')
-rw-r--r-- | inc/common.php | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/inc/common.php b/inc/common.php index a126cea9c..afff702d2 100644 --- a/inc/common.php +++ b/inc/common.php @@ -72,13 +72,13 @@ function getBaseURL($abs=false){ //if canonical url enabled always return absolute if($conf['canonical']) $abs = true; - //relative URLs are easy - if(!$abs){ - $dir = dirname($_SERVER['PHP_SELF']).'/'; - $dir = preg_replace('#//#','/',$dir); - $dir = preg_replace('#\\\/#','/',$dir); #bugfix for weird WIN behaviour - return $dir; - } + $dir = dirname($_SERVER['PHP_SELF']).'/'; + + $dir = str_replace('\\','/',$dir); #bugfix for weird WIN behaviour + $dir = preg_replace('#//+#','/',$dir); + + //finish here for relative URLs + if(!$abs) return $dir; $port = ':'.$_SERVER['SERVER_PORT']; //remove port from hostheader as sent by IE @@ -97,9 +97,6 @@ function getBaseURL($abs=false){ $port=''; } } - $dir = (dirname($_SERVER['PHP_SELF'])).'/'; - $dir = preg_replace('#//#','/',$dir); - $dir = preg_replace('#\/$#','/',$dir); #bugfix for weird WIN behaviour return $proto.$host.$port.$dir; } |