summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2012-08-04 20:25:20 +0200
committerThomas Tanghus <thomas@tanghus.net>2012-08-04 20:25:20 +0200
commitd19803654f4b728b17ae5f0f682ba7bd1d9f3953 (patch)
tree69887eedad1122a03b3857dd7436702e25648504
parent24af2e8078147578bd435983c1d9a11f13dae8c1 (diff)
downloadnextcloud-server-d19803654f4b728b17ae5f0f682ba7bd1d9f3953.tar.gz
nextcloud-server-d19803654f4b728b17ae5f0f682ba7bd1d9f3953.zip
And add the file goddammit
-rw-r--r--settings/ajax/apps/ocs.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/settings/ajax/apps/ocs.php b/settings/ajax/apps/ocs.php
new file mode 100644
index 00000000000..c7b6b22748a
--- /dev/null
+++ b/settings/ajax/apps/ocs.php
@@ -0,0 +1,65 @@
+<?php
+/**
+ * Copyright (c) 2012 Thomas Tanghus <thomas@tanghus.net>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+// Init owncloud
+require_once('../../../lib/base.php');
+
+OC_JSON::checkAdminUser();
+OC_JSON::callCheck();
+$l = OC_L10N::get('core');
+
+if(OC_Config::getValue('appstoreenabled', true)==false){
+ OCP\JSON::success(array('type' => 'external', 'data' => array()));
+}
+
+$enabledApps=OC_App::getEnabledApps();
+
+if(is_null($enabledApps)) {
+ OCP\JSON::error(array('data' => array('message' => $l->t('Unable to load list from App Store'))));
+}
+
+$apps=array();
+
+// apps from external repo via OCS
+$catagoryNames=OC_OCSClient::getCategories();
+if(is_array($catagoryNames)){
+ $categories=array_keys($catagoryNames);
+ $page=0;
+ $externalApps=OC_OCSClient::getApplications($categories,$page);
+ foreach($externalApps as $app){
+ // show only external apps that aren't enabled yet
+ $local=false;
+ foreach($enabledApps as $a){
+ if($a['name'] == $app['name']) {
+ $local=true;
+ }
+ }
+
+ if(!$local) {
+ if($app['preview']=='') {
+ $pre='trans.png';
+ } else {
+ $pre=$app['preview'];
+ }
+ $apps[]=array(
+ 'name'=>$app['name'],
+ 'id'=>$app['id'],
+ 'active'=>false,
+ 'description'=>$app['description'],
+ 'author'=>$app['personid'],
+ 'license'=>$app['license'],
+ 'preview'=>$pre,
+ 'internal'=>false,
+ 'internallabel'=>'3rd Party App',
+ );
+ }
+ }
+}
+
+OCP\JSON::success(array('type' => 'external', 'data' => $apps));
+