@@ -32,62 +32,62 @@ |
||
| 32 | 32 | |
| 33 | 33 | try { |
| 34 | 34 | |
| 35 | - require_once __DIR__ . '/lib/base.php'; |
|
| 36 | - if (\OCP\Util::needUpgrade()) { |
|
| 37 | - // since the behavior of apps or remotes are unpredictable during |
|
| 38 | - // an upgrade, return a 503 directly |
|
| 39 | - OC_Template::printErrorPage('Service unavailable', '', 503); |
|
| 40 | - exit; |
|
| 41 | - } |
|
| 35 | + require_once __DIR__ . '/lib/base.php'; |
|
| 36 | + if (\OCP\Util::needUpgrade()) { |
|
| 37 | + // since the behavior of apps or remotes are unpredictable during |
|
| 38 | + // an upgrade, return a 503 directly |
|
| 39 | + OC_Template::printErrorPage('Service unavailable', '', 503); |
|
| 40 | + exit; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - OC::checkMaintenanceMode(); |
|
| 44 | - $request = \OC::$server->getRequest(); |
|
| 45 | - $pathInfo = $request->getPathInfo(); |
|
| 43 | + OC::checkMaintenanceMode(); |
|
| 44 | + $request = \OC::$server->getRequest(); |
|
| 45 | + $pathInfo = $request->getPathInfo(); |
|
| 46 | 46 | |
| 47 | - if (!$pathInfo && $request->getParam('service', '') === '') { |
|
| 48 | - http_response_code(404); |
|
| 49 | - exit; |
|
| 50 | - } elseif ($request->getParam('service', '')) { |
|
| 51 | - $service = $request->getParam('service', ''); |
|
| 52 | - } else { |
|
| 53 | - $pathInfo = trim($pathInfo, '/'); |
|
| 54 | - list($service) = explode('/', $pathInfo); |
|
| 55 | - } |
|
| 56 | - $file = \OC::$server->getConfig()->getAppValue('core', 'public_' . strip_tags($service)); |
|
| 57 | - if ($file === '') { |
|
| 58 | - http_response_code(404); |
|
| 59 | - exit; |
|
| 60 | - } |
|
| 47 | + if (!$pathInfo && $request->getParam('service', '') === '') { |
|
| 48 | + http_response_code(404); |
|
| 49 | + exit; |
|
| 50 | + } elseif ($request->getParam('service', '')) { |
|
| 51 | + $service = $request->getParam('service', ''); |
|
| 52 | + } else { |
|
| 53 | + $pathInfo = trim($pathInfo, '/'); |
|
| 54 | + list($service) = explode('/', $pathInfo); |
|
| 55 | + } |
|
| 56 | + $file = \OC::$server->getConfig()->getAppValue('core', 'public_' . strip_tags($service)); |
|
| 57 | + if ($file === '') { |
|
| 58 | + http_response_code(404); |
|
| 59 | + exit; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - $parts = explode('/', $file, 2); |
|
| 63 | - $app = $parts[0]; |
|
| 62 | + $parts = explode('/', $file, 2); |
|
| 63 | + $app = $parts[0]; |
|
| 64 | 64 | |
| 65 | - // Load all required applications |
|
| 66 | - \OC::$REQUESTEDAPP = $app; |
|
| 67 | - OC_App::loadApps(array('authentication')); |
|
| 68 | - OC_App::loadApps(array('filesystem', 'logging')); |
|
| 65 | + // Load all required applications |
|
| 66 | + \OC::$REQUESTEDAPP = $app; |
|
| 67 | + OC_App::loadApps(array('authentication')); |
|
| 68 | + OC_App::loadApps(array('filesystem', 'logging')); |
|
| 69 | 69 | |
| 70 | - if (!\OC::$server->getAppManager()->isInstalled($app)) { |
|
| 71 | - http_response_code(501); |
|
| 72 | - exit; |
|
| 73 | - } |
|
| 74 | - OC_App::loadApp($app); |
|
| 75 | - OC_User::setIncognitoMode(true); |
|
| 70 | + if (!\OC::$server->getAppManager()->isInstalled($app)) { |
|
| 71 | + http_response_code(501); |
|
| 72 | + exit; |
|
| 73 | + } |
|
| 74 | + OC_App::loadApp($app); |
|
| 75 | + OC_User::setIncognitoMode(true); |
|
| 76 | 76 | |
| 77 | - $baseuri = OC::$WEBROOT . '/public.php/' . $service . '/'; |
|
| 77 | + $baseuri = OC::$WEBROOT . '/public.php/' . $service . '/'; |
|
| 78 | 78 | |
| 79 | - require_once OC_App::getAppPath($app) . '/' . $parts[1]; |
|
| 79 | + require_once OC_App::getAppPath($app) . '/' . $parts[1]; |
|
| 80 | 80 | |
| 81 | 81 | } catch (Exception $ex) { |
| 82 | - $status = 500; |
|
| 83 | - if ($ex instanceof \OC\ServiceUnavailableException) { |
|
| 84 | - $status = 503; |
|
| 85 | - } |
|
| 86 | - //show the user a detailed error page |
|
| 87 | - \OC::$server->getLogger()->logException($ex, ['app' => 'public']); |
|
| 88 | - OC_Template::printExceptionErrorPage($ex, $status); |
|
| 82 | + $status = 500; |
|
| 83 | + if ($ex instanceof \OC\ServiceUnavailableException) { |
|
| 84 | + $status = 503; |
|
| 85 | + } |
|
| 86 | + //show the user a detailed error page |
|
| 87 | + \OC::$server->getLogger()->logException($ex, ['app' => 'public']); |
|
| 88 | + OC_Template::printExceptionErrorPage($ex, $status); |
|
| 89 | 89 | } catch (Error $ex) { |
| 90 | - //show the user a detailed error page |
|
| 91 | - \OC::$server->getLogger()->logException($ex, ['app' => 'public']); |
|
| 92 | - OC_Template::printExceptionErrorPage($ex, 500); |
|
| 90 | + //show the user a detailed error page |
|
| 91 | + \OC::$server->getLogger()->logException($ex, ['app' => 'public']); |
|
| 92 | + OC_Template::printExceptionErrorPage($ex, 500); |
|
| 93 | 93 | } |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
| 31 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
| 32 | 32 | |
| 33 | 33 | try { |
| 34 | 34 | |
| 35 | - require_once __DIR__ . '/lib/base.php'; |
|
| 35 | + require_once __DIR__.'/lib/base.php'; |
|
| 36 | 36 | if (\OCP\Util::needUpgrade()) { |
| 37 | 37 | // since the behavior of apps or remotes are unpredictable during |
| 38 | 38 | // an upgrade, return a 503 directly |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $pathInfo = trim($pathInfo, '/'); |
| 54 | 54 | list($service) = explode('/', $pathInfo); |
| 55 | 55 | } |
| 56 | - $file = \OC::$server->getConfig()->getAppValue('core', 'public_' . strip_tags($service)); |
|
| 56 | + $file = \OC::$server->getConfig()->getAppValue('core', 'public_'.strip_tags($service)); |
|
| 57 | 57 | if ($file === '') { |
| 58 | 58 | http_response_code(404); |
| 59 | 59 | exit; |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | OC_App::loadApp($app); |
| 75 | 75 | OC_User::setIncognitoMode(true); |
| 76 | 76 | |
| 77 | - $baseuri = OC::$WEBROOT . '/public.php/' . $service . '/'; |
|
| 77 | + $baseuri = OC::$WEBROOT.'/public.php/'.$service.'/'; |
|
| 78 | 78 | |
| 79 | - require_once OC_App::getAppPath($app) . '/' . $parts[1]; |
|
| 79 | + require_once OC_App::getAppPath($app).'/'.$parts[1]; |
|
| 80 | 80 | |
| 81 | 81 | } catch (Exception $ex) { |
| 82 | 82 | $status = 500; |