summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-06-26 00:59:09 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-06-26 00:59:31 +0200
commitf40a1cad8b55bafa08d7e96415d4d2f9c7059a38 (patch)
treebb729bd1b159666620316ee03fed7b6f1072a174 /lib
parent4ac25942dee332b3227501e50525101a5f85fc6b (diff)
downloadnextcloud-server-f40a1cad8b55bafa08d7e96415d4d2f9c7059a38.tar.gz
nextcloud-server-f40a1cad8b55bafa08d7e96415d4d2f9c7059a38.zip
not all http server add index.php to $_SERVER[SCRIPT_NAME], do it manually
this fixes incorect generated links in some cases
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/base.php b/lib/base.php
index 6aac2d9855d..c5a0403e3b9 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -35,7 +35,11 @@ $SERVERROOT=substr(__FILE__,0,-13);
$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']);
$SERVERROOT=str_replace("\\",'/',$SERVERROOT);
$SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT));
-$WEBROOT=substr($_SERVER["SCRIPT_NAME"],0,strlen($_SERVER["SCRIPT_NAME"])-strlen($SUBURI));
+$scriptName=$_SERVER["SCRIPT_NAME"];
+if(substr($scriptName,-1)=='/'){//if the script isn't a file assume index.php
+ $scriptName.='index.php';
+}
+$WEBROOT=substr($scriptName,0,strlen($scriptName)-strlen($SUBURI));