summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-07-25 20:12:35 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-07-25 20:25:53 +0200
commitedec37b402e3f7afbf767c398fc6aca2670fe3d1 (patch)
tree093ac8d3797b7627d38ba3047a81efbe7ca440c9 /lib
parenta471d40cc8a2c72305fdc1728aa05b42c7319a58 (diff)
downloadnextcloud-server-edec37b402e3f7afbf767c398fc6aca2670fe3d1.tar.gz
nextcloud-server-edec37b402e3f7afbf767c398fc6aca2670fe3d1.zip
add OC_APP::getCurrentApp() to get the id of the active app
Diffstat (limited to 'lib')
-rw-r--r--lib/app.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/app.php b/lib/app.php
index 64704f09bbd..475015f6779 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -383,5 +383,21 @@ class OC_APP{
}
return $data;
}
+
+ /**
+ * get the id of loaded app
+ * @return string
+ */
+ public static function getCurrentApp(){
+ global $WEBROOT;
+ $script=substr($_SERVER["SCRIPT_NAME"],strlen($WEBROOT)+1);
+ $topFolder=substr($script,0,strpos($script,'/'));
+ if($topFolder=='apps'){
+ $length=strlen($topFolder);
+ return substr($script,$length+1,strpos($script,'/',$length+1)-$length-1);
+ }else{
+ return $topFolder;
+ }
+ }
}
?> \ No newline at end of file