@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | require_once __DIR__ . '/../lib/base.php'; |
| 33 | 33 | |
| 34 | 34 | if (\OCP\Util::needUpgrade() |
| 35 | - || \OC::$server->getSystemConfig()->getValue('maintenance', false)) { |
|
| 36 | - // since the behavior of apps or remotes are unpredictable during |
|
| 37 | - // an upgrade, return a 503 directly |
|
| 38 | - OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
| 39 | - $response = new OC_OCS_Result(null, OC_Response::STATUS_SERVICE_UNAVAILABLE, 'Service unavailable'); |
|
| 40 | - OC_API::respond($response, OC_API::requestedFormat()); |
|
| 41 | - exit; |
|
| 35 | + || \OC::$server->getSystemConfig()->getValue('maintenance', false)) { |
|
| 36 | + // since the behavior of apps or remotes are unpredictable during |
|
| 37 | + // an upgrade, return a 503 directly |
|
| 38 | + OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
| 39 | + $response = new OC_OCS_Result(null, OC_Response::STATUS_SERVICE_UNAVAILABLE, 'Service unavailable'); |
|
| 40 | + OC_API::respond($response, OC_API::requestedFormat()); |
|
| 41 | + exit; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | use Symfony\Component\Routing\Exception\ResourceNotFoundException; |
@@ -49,56 +49,56 @@ discard block |
||
| 49 | 49 | * We first try the old routes since the appframework triggers more login stuff. |
| 50 | 50 | */ |
| 51 | 51 | try { |
| 52 | - OC_App::loadApps(['session']); |
|
| 53 | - OC_App::loadApps(['authentication']); |
|
| 54 | - // load all apps to get all api routes properly setup |
|
| 55 | - OC_App::loadApps(); |
|
| 52 | + OC_App::loadApps(['session']); |
|
| 53 | + OC_App::loadApps(['authentication']); |
|
| 54 | + // load all apps to get all api routes properly setup |
|
| 55 | + OC_App::loadApps(); |
|
| 56 | 56 | |
| 57 | - // force language as given in the http request |
|
| 58 | - \OC::$server->getL10NFactory()->setLanguageFromRequest(); |
|
| 57 | + // force language as given in the http request |
|
| 58 | + \OC::$server->getL10NFactory()->setLanguageFromRequest(); |
|
| 59 | 59 | |
| 60 | - OC::$server->getRouter()->match('/ocs'.\OC::$server->getRequest()->getRawPathInfo()); |
|
| 61 | - return; |
|
| 60 | + OC::$server->getRouter()->match('/ocs'.\OC::$server->getRequest()->getRawPathInfo()); |
|
| 61 | + return; |
|
| 62 | 62 | } catch (ResourceNotFoundException $e) { |
| 63 | - // Fall through the not found |
|
| 63 | + // Fall through the not found |
|
| 64 | 64 | } catch (MethodNotAllowedException $e) { |
| 65 | - OC_API::setContentType(); |
|
| 66 | - OC_Response::setStatus(405); |
|
| 67 | - exit(); |
|
| 65 | + OC_API::setContentType(); |
|
| 66 | + OC_Response::setStatus(405); |
|
| 67 | + exit(); |
|
| 68 | 68 | } catch (Exception $ex) { |
| 69 | - OC_API::respond($ex->getResult(), OC_API::requestedFormat()); |
|
| 70 | - exit(); |
|
| 69 | + OC_API::respond($ex->getResult(), OC_API::requestedFormat()); |
|
| 70 | + exit(); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /* |
| 74 | 74 | * Try the appframework routes |
| 75 | 75 | */ |
| 76 | 76 | try { |
| 77 | - if(!\OC::$server->getUserSession()->isLoggedIn()) { |
|
| 78 | - OC::handleLogin(\OC::$server->getRequest()); |
|
| 79 | - } |
|
| 80 | - OC::$server->getRouter()->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo()); |
|
| 77 | + if(!\OC::$server->getUserSession()->isLoggedIn()) { |
|
| 78 | + OC::handleLogin(\OC::$server->getRequest()); |
|
| 79 | + } |
|
| 80 | + OC::$server->getRouter()->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo()); |
|
| 81 | 81 | } catch (ResourceNotFoundException $e) { |
| 82 | - OC_API::setContentType(); |
|
| 82 | + OC_API::setContentType(); |
|
| 83 | 83 | |
| 84 | - $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
|
| 85 | - $txt='Invalid query, please check the syntax. API specifications are here:' |
|
| 86 | - .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:'."\n"; |
|
| 87 | - OC_API::respond(new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
|
| 84 | + $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
|
| 85 | + $txt='Invalid query, please check the syntax. API specifications are here:' |
|
| 86 | + .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:'."\n"; |
|
| 87 | + OC_API::respond(new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
|
| 88 | 88 | } catch (MethodNotAllowedException $e) { |
| 89 | - OC_API::setContentType(); |
|
| 90 | - OC_Response::setStatus(405); |
|
| 89 | + OC_API::setContentType(); |
|
| 90 | + OC_Response::setStatus(405); |
|
| 91 | 91 | } catch (\OC\OCS\Exception $ex) { |
| 92 | - OC_API::respond($ex->getResult(), OC_API::requestedFormat()); |
|
| 92 | + OC_API::respond($ex->getResult(), OC_API::requestedFormat()); |
|
| 93 | 93 | } catch (\OC\User\LoginException $e) { |
| 94 | - OC_API::respond(new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'Unauthorised')); |
|
| 94 | + OC_API::respond(new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'Unauthorised')); |
|
| 95 | 95 | } catch (\Exception $e) { |
| 96 | - \OC::$server->getLogger()->logException($e); |
|
| 97 | - OC_API::setContentType(); |
|
| 96 | + \OC::$server->getLogger()->logException($e); |
|
| 97 | + OC_API::setContentType(); |
|
| 98 | 98 | |
| 99 | - $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
|
| 100 | - $txt='Invalid query, please check the syntax. API specifications are here:' |
|
| 101 | - .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:'."\n"; |
|
| 102 | - OC_API::respond(new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
|
| 99 | + $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
|
| 100 | + $txt='Invalid query, please check the syntax. API specifications are here:' |
|
| 101 | + .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:'."\n"; |
|
| 102 | + OC_API::respond(new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
|
| 103 | 103 | } |
| 104 | 104 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | -require_once __DIR__ . '/../lib/base.php'; |
|
| 32 | +require_once __DIR__.'/../lib/base.php'; |
|
| 33 | 33 | |
| 34 | 34 | if (\OCP\Util::needUpgrade() |
| 35 | 35 | || \OC::$server->getSystemConfig()->getValue('maintenance', false)) { |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * Try the appframework routes |
| 75 | 75 | */ |
| 76 | 76 | try { |
| 77 | - if(!\OC::$server->getUserSession()->isLoggedIn()) { |
|
| 77 | + if (!\OC::$server->getUserSession()->isLoggedIn()) { |
|
| 78 | 78 | OC::handleLogin(\OC::$server->getRequest()); |
| 79 | 79 | } |
| 80 | 80 | OC::$server->getRouter()->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo()); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | OC_API::setContentType(); |
| 83 | 83 | |
| 84 | 84 | $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
| 85 | - $txt='Invalid query, please check the syntax. API specifications are here:' |
|
| 85 | + $txt = 'Invalid query, please check the syntax. API specifications are here:' |
|
| 86 | 86 | .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:'."\n"; |
| 87 | 87 | OC_API::respond(new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
| 88 | 88 | } catch (MethodNotAllowedException $e) { |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | OC_API::setContentType(); |
| 98 | 98 | |
| 99 | 99 | $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
| 100 | - $txt='Invalid query, please check the syntax. API specifications are here:' |
|
| 100 | + $txt = 'Invalid query, please check the syntax. API specifications are here:' |
|
| 101 | 101 | .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:'."\n"; |
| 102 | 102 | OC_API::respond(new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
| 103 | 103 | } |