summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/init.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/inc/init.php b/inc/init.php
index 4b01a1240..108ed615c 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -157,14 +157,16 @@ function getBaseURL($abs=false){
if($conf['basedir']){
$dir = $conf['basedir'].'/';
- }elseif($_SERVER['SCRIPT_NAME']){
+ }elseif(substr($_SERVER['SCRIPT_NAME'],-4) == '.php'){
$dir = dirname($_SERVER['SCRIPT_NAME']).'/';
+ }elseif(substr($_SERVER['PHP_SELF'],-4) == '.php'){
+ $dir = dirname($_SERVER['PHP_SELF']).'/';
}elseif($_SERVER['DOCUMENT_ROOT'] && $_SERVER['SCRIPT_FILENAME']){
$dir = preg_replace ('/^'.preg_quote($_SERVER['DOCUMENT_ROOT'],'/').'/','',
$_SERVER['SCRIPT_FILENAME']);
$dir = dirname('/'.$dir).'/';
}else{
- $dir = dirname($_SERVER['PHP_SELF']).'/';
+ $dir = './'; //probably wrong
}
$dir = str_replace('\\','/',$dir); #bugfix for weird WIN behaviour