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