]> source.dussan.org Git - nextcloud-server.git/commitdiff
not all http server add index.php to $_SERVER[SCRIPT_NAME], do it manually
authorRobin Appelman <icewind1991@gmail.com>
Sat, 25 Jun 2011 22:59:09 +0000 (00:59 +0200)
committerRobin Appelman <icewind1991@gmail.com>
Sat, 25 Jun 2011 22:59:31 +0000 (00:59 +0200)
this fixes incorect generated links in some cases

lib/base.php

index 6aac2d9855d149642a34365b506f7e6f227dcb80..c5a0403e3b9485e8f13fbd184eb405b39156b66a 100644 (file)
@@ -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));