From 3d3190309f85a3b66890763f9605a6919f52d5f4 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 1 Mar 2012 22:04:13 +0100 Subject: [PATCH] Simplify stripping the last part off WEBROOT and SERVERROOT for 3rdparty and app dir --- lib/base.php | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/base.php b/lib/base.php index 0df6631df4..ee79f08eb2 100644 --- a/lib/base.php +++ b/lib/base.php @@ -181,14 +181,8 @@ class OC{ OC::$THIRDPARTYROOT=OC::$SERVERROOT; OC::$THIRDPARTYWEBROOT=OC::$WEBROOT; }elseif(file_exists(OC::$SERVERROOT.'/../3rdparty')){ - $url_tmp=explode('/',OC::$WEBROOT); - $length=count($url_tmp); - unset($url_tmp[$length-1]); - OC::$THIRDPARTYWEBROOT=implode('/',$url_tmp); - $root_tmp=explode('/',OC::$SERVERROOT); - $length=count($root_tmp); - unset($root_tmp[$length-1]); - OC::$THIRDPARTYROOT=implode('/',$root_tmp); + OC::$THIRDPARTYWEBROOT=rtrim(dirname(OC::$WEBROOT), '/'); + OC::$THIRDPARTYROOT=rtrim(dirname(OC::$SERVERROOT), '/'); }else{ echo("3rdparty directory not found! Please put the ownCloud 3rdparty folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file."); exit; @@ -199,14 +193,8 @@ class OC{ OC::$APPSROOT=OC::$SERVERROOT; OC::$APPSWEBROOT=OC::$WEBROOT; }elseif(file_exists(OC::$SERVERROOT.'/../apps')){ - $url_tmp=explode('/',OC::$WEBROOT); - $length=count($url_tmp); - unset($url_tmp[$length-1]); - OC::$APPSWEBROOT=implode('/',$url_tmp); - $root_tmp=explode('/',OC::$SERVERROOT); - $length=count($root_tmp); - unset($root_tmp[$length-1]); - OC::$APPSROOT=implode('/',$root_tmp); + OC::$APPSWEBROOT=rtrim(dirname(OC::$WEBROOT), '/'); + OC::$APPSROOT=rtrim(dirname(OC::$SERVERROOT), '/'); }else{ echo("apps directory not found! Please put the ownCloud apps folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file."); exit;