webapps.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * ownCloud status page. usefull if you want to check from the outside if an owncloud installation exists
  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. $RUNTIME_NOAPPS = TRUE; //no apps, yet
  23. require_once('lib/base.php');
  24. //valid user account
  25. if(isset($_SERVER['PHP_AUTH_USER'])) $authuser=$_SERVER['PHP_AUTH_USER']; else $authuser='';
  26. if(isset($_SERVER['PHP_AUTH_PW'])) $authpw=$_SERVER['PHP_AUTH_PW']; else $authpw='';
  27. if(!OC_User::login($authuser,$authpw)){
  28. header('WWW-Authenticate: Basic realm="your valid user account"');
  29. header('HTTP/1.0 401 Unauthorized');
  30. exit;
  31. }else{
  32. $apps=OC_App::getEnabledApps();
  33. $values=array();
  34. foreach($apps as $app) {
  35. $info=OC_App::getAppInfo($app);
  36. if(isset($info['standalone'])) {
  37. $newvalue=array('name'=>$info['name'],'url'=>OC_Helper::linkToAbsolute($app,''),'icon'=>'');
  38. $values[]=$newvalue;
  39. }
  40. }
  41. echo(json_encode($values));
  42. exit;
  43. }
  44. ?>