categories.php 786 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * Copyright (c) 2014 Thomas Müller <deepdiver@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. OC_JSON::checkAdminUser();
  9. $l = OC_L10N::get('settings');
  10. $categories = array(
  11. array('id' => 0, 'displayName' => (string)$l->t('Enabled') ),
  12. array('id' => 1, 'displayName' => (string)$l->t('Not enabled') ),
  13. );
  14. if(OC_Config::getValue('appstoreenabled', true)) {
  15. $categories[] = array('id' => 2, 'displayName' => (string)$l->t('Recommended') );
  16. // apps from external repo via OCS
  17. $ocs = OC_OCSClient::getCategories();
  18. foreach($ocs as $k => $v) {
  19. $categories[] = array(
  20. 'id' => $k,
  21. 'displayName' => str_replace('ownCloud ', '', $v)
  22. );
  23. }
  24. }
  25. OCP\JSON::success($categories);