From 8196db7bfdc38ec80fe16c5a30601198ff16e671 Mon Sep 17 00:00:00 2001 From: andi Date: Thu, 17 Feb 2005 19:06:02 +0100 Subject: some getBaseURL changes (maybe fixes #123) darcs-hash:20050217180602-9977f-06df5b55635df223490d5baf9aafe1cb08471e86.gz --- inc/common.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'inc') 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; } -- cgit v1.2.3