diff options
author | andi <andi@splitbrain.org> | 2005-02-17 19:06:02 +0100 |
---|---|---|
committer | andi <andi@splitbrain.org> | 2005-02-17 19:06:02 +0100 |
commit | 8196db7bfdc38ec80fe16c5a30601198ff16e671 (patch) | |
tree | b9e61cfedd3ee4755e976da2dd646462ddc796f3 | |
parent | c2ba91565fbb2ba14dfa6274a850b9a270ee5d7d (diff) | |
download | rpg-8196db7bfdc38ec80fe16c5a30601198ff16e671.tar.gz rpg-8196db7bfdc38ec80fe16c5a30601198ff16e671.tar.bz2 |
some getBaseURL changes (maybe fixes #123)
darcs-hash:20050217180602-9977f-06df5b55635df223490d5baf9aafe1cb08471e86.gz
-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; } |