PageRenderTime 52ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/public.php

https://github.com/sezuan/core
PHP | 31 lines | 24 code | 6 blank | 1 comment | 2 complexity | 42494f819a43ce0b532492e00b3b69da MD5 | raw file
Possible License(s): AGPL-3.0, AGPL-1.0, MPL-2.0-no-copyleft-exception
  1. <?php
  2. $RUNTIME_NOAPPS = true;
  3. try {
  4. require_once 'lib/base.php';
  5. OC::checkMaintenanceMode();
  6. if (!isset($_GET['service'])) {
  7. header('HTTP/1.0 404 Not Found');
  8. exit;
  9. }
  10. $file = OCP\CONFIG::getAppValue('core', 'public_' . strip_tags($_GET['service']));
  11. if(is_null($file)) {
  12. header('HTTP/1.0 404 Not Found');
  13. exit;
  14. }
  15. $parts=explode('/', $file, 2);
  16. $app=$parts[0];
  17. OC_Util::checkAppEnabled($app);
  18. OC_App::loadApp($app);
  19. require_once OC_App::getAppPath($app) .'/'. $parts[1];
  20. } catch (Exception $ex) {
  21. //show the user a detailed error page
  22. OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
  23. \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL);
  24. OC_Template::printExceptionErrorPage($ex);
  25. }