index.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  6. * @author Lukas Reschke <lukas@statuscode.ch>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Robin Appelman <robin@icewind.nl>
  9. * @author Thomas Müller <thomas.mueller@tmit.eu>
  10. * @author Vincent Petry <pvince81@owncloud.com>
  11. *
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. require_once __DIR__ . '/lib/versioncheck.php';
  28. // Show warning if PHP 7.2 is used as Nextcloud is not compatible with PHP 7.2 for now
  29. // @see https://github.com/nextcloud/server/pull/5791
  30. if (version_compare(PHP_VERSION, '7.2.0') !== -1) {
  31. echo 'This version of Nextcloud is not compatible with PHP 7.2.<br/>';
  32. echo 'You are currently running ' . PHP_VERSION . '.';
  33. return;
  34. }
  35. try {
  36. require_once __DIR__ . '/lib/base.php';
  37. OC::handleRequest();
  38. } catch(\OC\ServiceUnavailableException $ex) {
  39. \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
  40. //show the user a detailed error page
  41. OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
  42. OC_Template::printExceptionErrorPage($ex);
  43. } catch (\OC\HintException $ex) {
  44. OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
  45. OC_Template::printErrorPage($ex->getMessage(), $ex->getHint());
  46. } catch (\OC\User\LoginException $ex) {
  47. OC_Response::setStatus(OC_Response::STATUS_FORBIDDEN);
  48. OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage());
  49. } catch (Exception $ex) {
  50. \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
  51. //show the user a detailed error page
  52. OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
  53. OC_Template::printExceptionErrorPage($ex);
  54. } catch (Error $ex) {
  55. \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
  56. OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
  57. OC_Template::printExceptionErrorPage($ex);
  58. }