Blame view
sources/public.php
1.71 KB
|
03e52840d
|
1 |
<?php |
|
03e52840d
|
2 |
|
|
31b7f2792
|
3 4 5 |
try {
require_once 'lib/base.php';
|
|
6d9380f96
|
6 7 8 9 10 11 12 |
if (\OCP\Util::needUpgrade()) {
// since the behavior of apps or remotes are unpredictable during
// an upgrade, return a 503 directly
OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
OC_Template::printErrorPage('Service unavailable');
exit;
}
|
|
31b7f2792
|
13 14 |
OC::checkMaintenanceMode(); OC::checkSingleUserMode(); |
|
6d9380f96
|
15 16 |
$pathInfo = OC_Request::getPathInfo();
if (!$pathInfo && !isset($_GET['service'])) {
|
|
31b7f2792
|
17 18 |
header('HTTP/1.0 404 Not Found');
exit;
|
|
6d9380f96
|
19 20 21 22 23 |
} elseif (isset($_GET['service'])) {
$service = $_GET['service'];
} else {
$pathInfo = trim($pathInfo, '/');
list($service) = explode('/', $pathInfo);
|
|
31b7f2792
|
24 |
} |
|
6d9380f96
|
25 26 |
$file = OCP\CONFIG::getAppValue('core', 'public_' . strip_tags($service));
if (is_null($file)) {
|
|
31b7f2792
|
27 28 29 |
header('HTTP/1.0 404 Not Found');
exit;
}
|
|
03e52840d
|
30 |
|
|
6d9380f96
|
31 32 33 34 35 36 37 |
$parts = explode('/', $file, 2);
$app = $parts[0];
// Load all required applications
\OC::$REQUESTEDAPP = $app;
OC_App::loadApps(array('authentication'));
OC_App::loadApps(array('filesystem', 'logging'));
|
|
03e52840d
|
38 |
|
|
31b7f2792
|
39 40 41 |
OC_Util::checkAppEnabled($app); OC_App::loadApp($app); OC_User::setIncognitoMode(true); |
|
6d9380f96
|
42 43 44 |
$baseuri = OC::$WEBROOT . '/public.php/' . $service . '/'; require_once OC_App::getAppPath($app) . '/' . $parts[1]; |
|
31b7f2792
|
45 |
|
|
f7d878ff1
|
46 47 48 49 50 |
} catch (\OC\ServiceUnavailableException $ex) {
//show the user a detailed error page
OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
\OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL);
OC_Template::printExceptionErrorPage($ex);
|
|
31b7f2792
|
51 52 53 54 55 56 |
} catch (Exception $ex) {
//show the user a detailed error page
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
\OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL);
OC_Template::printExceptionErrorPage($ex);
}
|