summaryrefslogtreecommitdiffstats
path: root/lib/app.php
diff options
context:
space:
mode:
authorFrank Karlitschek <frank@owncloud.org>2013-01-30 14:36:17 +0100
committerFrank Karlitschek <frank@owncloud.org>2013-01-30 14:36:17 +0100
commit66cab77b6d83980d260cd35556d2759089d2971b (patch)
treeccf3767afba89f90ea82bd0805f23eb189956b53 /lib/app.php
parent389c4e84153893a04310876ef70943cad53ee3e7 (diff)
parent5761bd771f4142394a00083712b63e77f8976946 (diff)
downloadnextcloud-server-66cab77b6d83980d260cd35556d2759089d2971b.tar.gz
nextcloud-server-66cab77b6d83980d260cd35556d2759089d2971b.zip
merge master
Merge branch 'master' into improved_appsmanagement Conflicts: settings/apps.php settings/templates/apps.php
Diffstat (limited to 'lib/app.php')
-rw-r--r--lib/app.php110
1 files changed, 90 insertions, 20 deletions
diff --git a/lib/app.php b/lib/app.php
index fcf5a65458d..f851d802dc3 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -63,17 +63,17 @@ class OC_App{
if (!defined('DEBUG') || !DEBUG) {
if (is_null($types)
- && empty(OC_Util::$core_scripts)
- && empty(OC_Util::$core_styles)) {
+ && empty(OC_Util::$core_scripts)
+ && empty(OC_Util::$core_styles)) {
OC_Util::$core_scripts = OC_Util::$scripts;
- OC_Util::$scripts = array();
- OC_Util::$core_styles = OC_Util::$styles;
- OC_Util::$styles = array();
- }
+ OC_Util::$scripts = array();
+ OC_Util::$core_styles = OC_Util::$styles;
+ OC_Util::$styles = array();
}
- // return
- return true;
}
+ // return
+ return true;
+}
/**
* load a single app
@@ -137,7 +137,7 @@ class OC_App{
OC_Appconfig::setValue($app, 'types', $appTypes);
}
-
+
/**
* check if app is shipped
* @param string $appid the id of the app to check
@@ -309,7 +309,7 @@ class OC_App{
if(OC_Config::getValue('knowledgebaseenabled', true)==true) {
$settings = array(
array( "id" => "help", "order" => 1000, "href" => OC_Helper::linkToRoute( "settings_help" ), "name" => $l->t("Help"), "icon" => OC_Helper::imagePath( "settings", "help.svg" ))
- );
+ );
}
// if the user is logged-in
@@ -323,14 +323,14 @@ class OC_App{
$settings[]=array( "id" => "settings", "order" => 1000, "href" => OC_Helper::linkToRoute( "settings_settings" ), "name" => $l->t("Settings"), "icon" => OC_Helper::imagePath( "settings", "settings.svg" ));
//SubAdmins are also allowed to access user management
- if(OC_SubAdmin::isSubAdmin($_SESSION["user_id"]) || OC_Group::inGroup( $_SESSION["user_id"], "admin" )) {
+ if(OC_SubAdmin::isSubAdmin(OC_User::getUser())) {
// admin users menu
$settings[] = array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkToRoute( "settings_users" ), "name" => $l->t("Users"), "icon" => OC_Helper::imagePath( "settings", "users.svg" ));
}
// if the user is an admin
- if(OC_Group::inGroup( $_SESSION["user_id"], "admin" )) {
+ if(OC_User::isAdminUser(OC_User::getUser())) {
// admin apps menu
$settings[] = array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkToRoute( "settings_apps" ).'?installed', "name" => $l->t("Apps"), "icon" => OC_Helper::imagePath( "settings", "apps.svg" ));
@@ -529,16 +529,16 @@ class OC_App{
$forms=array();
switch($type) {
case 'settings':
- $source=self::$settingsForms;
- break;
+ $source=self::$settingsForms;
+ break;
case 'admin':
- $source=self::$adminForms;
- break;
+ $source=self::$adminForms;
+ break;
case 'personal':
- $source=self::$personalForms;
- break;
+ $source=self::$personalForms;
+ break;
default:
- return array();
+ return array();
}
foreach($source as $form) {
$forms[]=include $form;
@@ -599,6 +599,76 @@ class OC_App{
}
/**
+ * @brief: Lists all apps, this is used in apps.php
+ * @return array
+ */
+ public static function listAllApps() {
+ $installedApps = OC_App::getAllApps();
+
+ //TODO which apps do we want to blacklist and how do we integrate blacklisting with the multi apps folder feature?
+
+ $blacklist = array('files');//we dont want to show configuration for these
+ $appList = array();
+
+ foreach ( $installedApps as $app ) {
+ if ( array_search( $app, $blacklist ) === false ) {
+
+ $info=OC_App::getAppInfo($app);
+
+ if (!isset($info['name'])) {
+ OC_Log::write('core', 'App id "'.$app.'" has no name in appinfo', OC_Log::ERROR);
+ continue;
+ }
+
+ if ( OC_Appconfig::getValue( $app, 'enabled', 'no') == 'yes' ) {
+ $active = true;
+ } else {
+ $active = false;
+ }
+
+ $info['active'] = $active;
+
+ if(isset($info['shipped']) and ($info['shipped']=='true')) {
+ $info['internal']=true;
+ $info['internallabel']='Internal App';
+ $info['internalclass']='';
+ $info['update']=false;
+ } else {
+ $info['internal']=false;
+ $info['internallabel']='3rd Party App';
+ $info['internalclass']='externalapp';
+ $info['update']=OC_Installer::isUpdateAvailable($app);
+ }
+
+ $info['preview'] = OC_Helper::imagePath('settings', 'trans.png');
+ $info['version'] = OC_App::getAppVersion($app);
+ $appList[] = $info;
+ }
+ }
+ $remoteApps = OC_App::getAppstoreApps();
+ if ( $remoteApps ) {
+ // Remove duplicates
+ foreach ( $appList as $app ) {
+ foreach ( $remoteApps AS $key => $remote ) {
+ if (
+ $app['name'] == $remote['name']
+ // To set duplicate detection to use OCS ID instead of string name,
+ // enable this code, remove the line of code above,
+ // and add <ocs_id>[ID]</ocs_id> to info.xml of each 3rd party app:
+ // OR $app['ocs_id'] == $remote['ocs_id']
+ ) {
+ unset( $remoteApps[$key]);
+ }
+ }
+ }
+ $combinedApps = array_merge( $appList, $remoteApps );
+ } else {
+ $combinedApps = $appList;
+ }
+ return $combinedApps;
+}
+
+ /**
* @brief: get a list of all apps on apps.owncloud.com
* @return array, multi-dimensional array of apps. Keys: id, name, type, typename, personid, license, detailpage, preview, changed, description
*/
@@ -767,7 +837,7 @@ class OC_App{
}
return new OC_FilesystemView('/'.OC_User::getUser().'/'.$appid);
}else{
- OC_Log::write('core', 'Can\'t get app storage, app, user not logged in', OC_Log::ERROR);
+ OC_Log::write('core', 'Can\'t get app storage, app '.$appid.', user not logged in', OC_Log::ERROR);
return false;
}
}else{