From cdf91b6b3e0f6d9fc435497b9dcc051ff24d6c7e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 10 Aug 2011 12:20:43 +0200 Subject: work in new app management --- lib/app.php | 17 +++++++++++++++-- lib/base.php | 3 ++- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/app.php b/lib/app.php index 411c08cbe5b..9c7b7e75dcd 100644 --- a/lib/app.php +++ b/lib/app.php @@ -136,7 +136,6 @@ class OC_App{ * This function returns all data it got via register(). */ public static function get(){ - // TODO: write function return OC_App::$apps; } @@ -242,7 +241,7 @@ class OC_App{ if(is_file($appid)){ $file=$appid; }else{ - $file='apps/'.$appid.'/appinfo/info.xml'; + $file=OC::$SERVERROOT.'/apps/'.$appid.'/appinfo/info.xml'; if(!is_file($file)){ return array(); } @@ -332,4 +331,18 @@ class OC_App{ public static function registerPersonal($app,$page){ self::$personalForms[]='apps/'.$app.'/'.$page.'.php'; } + + /** + * get a list of all apps in the apps folder + */ + public static function getAllApps(){ + $apps=array(); + $dh=opendir(OC::$SERVERROOT.'/apps'); + while($file=readdir($dh)){ + if(is_file(OC::$SERVERROOT.'/apps/'.$file.'/appinfo/app.php')){ + $apps[]=$file; + } + } + return $apps; + } } diff --git a/lib/base.php b/lib/base.php index f59e375e763..93b8e0b584d 100644 --- a/lib/base.php +++ b/lib/base.php @@ -90,7 +90,8 @@ if(substr($scriptName,-1)=='/'){ } $WEBROOT=substr($scriptName,0,strlen($scriptName)-strlen($SUBURI)); - +OC::$SERVERROOT=$SERVERROOT; +OC::$WEBROOT=$WEBROOT; if($WEBROOT!='' and $WEBROOT[0]!=='/'){ $WEBROOT='/'.$WEBROOT; -- cgit v1.2.3