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

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