You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

public.php 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. $RUNTIME_NOAPPS = true;
  3. try {
  4. require_once 'lib/base.php';
  5. OC::checkMaintenanceMode();
  6. OC::checkSingleUserMode();
  7. $pathInfo = OC_Request::getPathInfo();
  8. if (!$pathInfo && !isset($_GET['service'])) {
  9. header('HTTP/1.0 404 Not Found');
  10. exit;
  11. } elseif ($_GET['service']) {
  12. $service = $_GET['service'];
  13. } else {
  14. $pathInfo = trim($pathInfo, '/');
  15. list($service) = explode('/', $pathInfo);
  16. }
  17. $file = OCP\CONFIG::getAppValue('core', 'public_' . strip_tags($service));
  18. if (is_null($file)) {
  19. header('HTTP/1.0 404 Not Found');
  20. exit;
  21. }
  22. $parts = explode('/', $file, 2);
  23. $app = $parts[0];
  24. OC_Util::checkAppEnabled($app);
  25. OC_App::loadApp($app);
  26. OC_User::setIncognitoMode(true);
  27. $baseuri = OC::$WEBROOT . '/public.php/' . $service . '/';
  28. require_once OC_App::getAppPath($app) . '/' . $parts[1];
  29. } catch (Exception $ex) {
  30. //show the user a detailed error page
  31. OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
  32. \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL);
  33. OC_Template::printExceptionErrorPage($ex);
  34. }