summaryrefslogtreecommitdiffstats
path: root/settings/ajax/apps/index.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-10-28 11:13:20 +0100
committerLukas Reschke <lukas@owncloud.com>2014-10-28 11:13:20 +0100
commit437a660680ee563d75ce2a3fc916244ff5512e2a (patch)
tree08bc1737df3e26cb10c9016655d8ca6831a54134 /settings/ajax/apps/index.php
parent4461e69873aac223fea410d8e78c3e7674541c17 (diff)
parente4227658d9d80725620ab33b68de5c26c8ed67ad (diff)
downloadnextcloud-server-437a660680ee563d75ce2a3fc916244ff5512e2a.tar.gz
nextcloud-server-437a660680ee563d75ce2a3fc916244ff5512e2a.zip
Merge pull request #11600 from owncloud/refactor-appsettings-to-app-framework
Migrate new app settings to AppFramework
Diffstat (limited to 'settings/ajax/apps/index.php')
-rw-r--r--settings/ajax/apps/index.php65
1 files changed, 0 insertions, 65 deletions
diff --git a/settings/ajax/apps/index.php b/settings/ajax/apps/index.php
deleted file mode 100644
index 24fba8be312..00000000000
--- a/settings/ajax/apps/index.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-/**
- * Copyright (c) 2014 Thomas Müller <deepdiver@owncloud.com>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-OC_JSON::checkAdminUser();
-
-$l = OC_L10N::get('settings');
-
-$category = intval($_GET['category']);
-$apps = array();
-
-switch($category) {
- // installed apps
- case 0:
- $apps = \OC_App::listAllApps(true);
- $apps = array_filter($apps, function($app) {
- return $app['active'];
- });
- break;
- // not-installed apps
- case 1:
- $apps = \OC_App::listAllApps(true);
- $apps = array_filter($apps, function($app) {
- return !$app['active'];
- });
- break;
- default:
- if ($category === 2) {
- $apps = \OC_App::getAppstoreApps('approved');
- $apps = array_filter($apps, function($app) {
- return isset($app['internalclass']) && $app['internalclass'] === 'recommendedapp';
- });
- } else {
- $apps = \OC_App::getAppstoreApps('approved', $category);
- }
- if (!$apps) {
- $apps = array();
- }
- usort($apps, function ($a, $b) {
- $a = (int)$a['score'];
- $b = (int)$b['score'];
- if ($a === $b) {
- return 0;
- }
- return ($a > $b) ? -1 : 1;
- });
- break;
-}
-
-// fix groups to be an array
-$apps = array_map(function($app){
- $groups = array();
- if (is_string($app['groups'])) {
- $groups = json_decode($app['groups']);
- }
- $app['groups'] = $groups;
- $app['canUnInstall'] = !$app['active'] && $app['removable'];
- return $app;
-}, $apps);
-
-OCP\JSON::success(array("apps" => $apps));