summaryrefslogtreecommitdiffstats
path: root/lib/base.php
diff options
context:
space:
mode:
authorBart Visscher <bart@thisnet.nl>2011-09-18 19:37:54 +0200
committerBart Visscher <bart@thisnet.nl>2011-09-18 19:37:54 +0200
commit82c7598861db175617694891bb9f21b426426225 (patch)
treefce8fb4717b4cc2a5dc6da8835bdb51b5fb40054 /lib/base.php
parentd5656716f69caa6a1eb98706994ffcb9a08553a7 (diff)
downloadnextcloud-server-82c7598861db175617694891bb9f21b426426225.tar.gz
nextcloud-server-82c7598861db175617694891bb9f21b426426225.zip
Remove global vars and use the OC static version.
Removed global vars are DOCUMENTROOT, SERVERROOT, SUBURI, WEBROOT and CONFIG_DATADIRECTORY
Diffstat (limited to 'lib/base.php')
-rw-r--r--lib/base.php27
1 files changed, 9 insertions, 18 deletions
diff --git a/lib/base.php b/lib/base.php
index dc3ed4129cd..7344601ba45 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -81,30 +81,21 @@ ini_set('session.cookie_httponly','1;');
session_start();
// calculate the documentroot
-$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']);
-$SERVERROOT=str_replace("\\",'/',substr(__FILE__,0,-13));
-$SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT));
+OC::$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']);
+OC::$SERVERROOT=str_replace("\\",'/',substr(__FILE__,0,-13));
+OC::$SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen(OC::$SERVERROOT));
$scriptName=$_SERVER["SCRIPT_NAME"];
if(substr($scriptName,-1)=='/'){
$scriptName.='index.php';
}
-$WEBROOT=substr($scriptName,0,strlen($scriptName)-strlen($SUBURI));
+OC::$WEBROOT=substr($scriptName,0,strlen($scriptName)-strlen(OC::$SUBURI));
-OC::$SERVERROOT=$SERVERROOT;
-OC::$WEBROOT=$WEBROOT;
-
-if($WEBROOT!='' and $WEBROOT[0]!=='/'){
- $WEBROOT='/'.$WEBROOT;
+if(OC::$WEBROOT!='' and OC::$WEBROOT[0]!=='/'){
+ OC::$WEBROOT='/'.OC::$WEBROOT;
}
-// We are going to use OC::* instead of globels soon
-OC::$WEBROOT = $WEBROOT;
-OC::$SERVERROOT = $SERVERROOT;
-OC::$DOCUMENTROOT = $DOCUMENTROOT;
-OC::$SUBURI = $SUBURI;
-
// set the right include path
-set_include_path($SERVERROOT.'/lib'.PATH_SEPARATOR.$SERVERROOT.'/config'.PATH_SEPARATOR.$SERVERROOT.'/3rdparty'.PATH_SEPARATOR.get_include_path().PATH_SEPARATOR.$SERVERROOT);
+set_include_path(OC::$SERVERROOT.'/lib'.PATH_SEPARATOR.OC::$SERVERROOT.'/config'.PATH_SEPARATOR.OC::$SERVERROOT.'/3rdparty'.PATH_SEPARATOR.get_include_path().PATH_SEPARATOR.OC::$SERVERROOT);
//Some libs we really depend on
require_once('Sabre/autoload.php');
@@ -119,9 +110,9 @@ if( !isset( $RUNTIME_NOAPPS )){
// TODO: we should get rid of this one, too
// WARNING: to make everything even more confusing, DATADIRECTORY is a var that
-// changes and DATATIRECTORY_ROOT stays the same, but is set by
+// changes and DATADIRECTORY_ROOT stays the same, but is set by
// "datadirectory". Any questions?
-$CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", "$SERVERROOT/data" );
+OC::$CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
// redirect to https site if configured
if( OC_Config::getValue( "forcessl", false )){