diff options
-rw-r--r-- | doku.php | 3 | ||||
-rw-r--r-- | inc/common.php | 17 |
2 files changed, 8 insertions, 12 deletions
@@ -5,8 +5,7 @@ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Andreas Gohr <andi@splitbrain.org> */ - - ini_set('short_open_tag',"1"); + require_once("conf/dokuwiki.php"); require_once("inc/common.php"); require_once("inc/html.php"); 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; } |