apps.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Frank Karlitschek
  6. * @copyright 2010 Frank Karlitschek karlitschek@kde.org
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  10. * License as published by the Free Software Foundation; either
  11. * version 3 of the License, or any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public
  19. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. require_once('../lib/base.php');
  23. OC_Util::checkAdminUser();
  24. // Load the files we need
  25. OC_Util::addStyle( "settings", "settings" );
  26. OC_Util::addScript( "settings", "apps" );
  27. OC_App::setActiveNavigationEntry( "core_apps" );
  28. $registeredApps=OC_App::getAllApps();
  29. $apps=array();
  30. $blacklist=array('files_imageviewer','files_textviewer');//we dont want to show configuration for these
  31. foreach($registeredApps as $app){
  32. if(array_search($app,$blacklist)===false){
  33. $info=OC_App::getAppInfo($app);
  34. $active=(OC_Appconfig::getValue($app,'enabled','no')=='yes')?true:false;
  35. $info['active']=$active;
  36. $apps[]=$info;
  37. }
  38. }
  39. function app_sort($a, $b){
  40. if ($a['active'] != $b['active']){
  41. return $b['active'] - $a['active'];
  42. }
  43. return strcmp($a['name'], $b['name']);
  44. }
  45. usort($apps, 'app_sort');
  46. // apps from external repo via OCS
  47. $catagoryNames=OC_OCSClient::getCategories();
  48. if(is_array($catagoryNames)){
  49. $categories=array_keys($catagoryNames);
  50. $externalApps=OC_OCSClient::getApplications($categories);
  51. foreach($externalApps as $app){
  52. // show only external apps that are not exist yet
  53. $local=false;
  54. foreach($apps as $a){
  55. if($a['name']==$app['name']) $local=true;
  56. }
  57. if(!$local) {
  58. $apps[]=array(
  59. 'name'=>$app['name'],
  60. 'id'=>$app['id'],
  61. 'active'=>false,
  62. 'description'=>$app['description'],
  63. 'author'=>$app['personid'],
  64. 'license'=>$app['license'],
  65. );
  66. }
  67. }
  68. }
  69. $tmpl = new OC_Template( "settings", "apps", "user" );
  70. $tmpl->assign('apps',$apps);
  71. $tmpl->printPage();
  72. ?>