1
0

index.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. *
  4. * Your webserver seems to be not configured to use PHP or PHP is not installed.
  5. * Please contact your administrator or follow our documentation:
  6. * https://docs.nextcloud.com/server/13/admin_manual/installation/source_installation.html
  7. *
  8. * @copyright Copyright (c) 2016, ownCloud, Inc.
  9. *
  10. * @author Georg Ehrke <oc.list@georgehrke.com>
  11. * @author Joas Schilling <coding@schilljs.com>
  12. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  13. * @author Lukas Reschke <lukas@statuscode.ch>
  14. * @author Morris Jobke <hey@morrisjobke.de>
  15. * @author Robin Appelman <robin@icewind.nl>
  16. * @author Sergio Bertolín <sbertolin@solidgear.es>
  17. * @author Thomas Müller <thomas.mueller@tmit.eu>
  18. * @author Vincent Petry <pvince81@owncloud.com>
  19. *
  20. * @license AGPL-3.0
  21. *
  22. * This code is free software: you can redistribute it and/or modify
  23. * it under the terms of the GNU Affero General Public License, version 3,
  24. * as published by the Free Software Foundation.
  25. *
  26. * This program is distributed in the hope that it will be useful,
  27. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  28. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  29. * GNU Affero General Public License for more details.
  30. *
  31. * You should have received a copy of the GNU Affero General Public License, version 3,
  32. * along with this program. If not, see <http://www.gnu.org/licenses/>
  33. *
  34. */
  35. require_once __DIR__ . '/lib/versioncheck.php';
  36. try {
  37. require_once __DIR__ . '/lib/base.php';
  38. OC::handleRequest();
  39. } catch(\OC\ServiceUnavailableException $ex) {
  40. \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
  41. //show the user a detailed error page
  42. OC_Template::printExceptionErrorPage($ex, 503);
  43. } catch (\OC\HintException $ex) {
  44. try {
  45. OC_Template::printErrorPage($ex->getMessage(), $ex->getHint(), 503);
  46. } catch (Exception $ex2) {
  47. try {
  48. \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
  49. \OC::$server->getLogger()->logException($ex2, array('app' => 'index'));
  50. } catch (Throwable $e) {
  51. // no way to log it properly - but to avoid a white page of death we try harder and ignore this one here
  52. }
  53. //show the user a detailed error page
  54. OC_Template::printExceptionErrorPage($ex, 500);
  55. }
  56. } catch (\OC\User\LoginException $ex) {
  57. OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage(), 403);
  58. } catch (Exception $ex) {
  59. \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
  60. //show the user a detailed error page
  61. OC_Template::printExceptionErrorPage($ex, 500);
  62. } catch (Error $ex) {
  63. try {
  64. \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
  65. } catch (Error $e) {
  66. http_response_code(500);
  67. header('Content-Type: text/plain; charset=utf-8');
  68. print("Internal Server Error\n\n");
  69. print("The server encountered an internal error and was unable to complete your request.\n");
  70. print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n");
  71. print("More details can be found in the webserver log.\n");
  72. throw $ex;
  73. }
  74. OC_Template::printExceptionErrorPage($ex, 500);
  75. }