Guest User

Untitled

a guest
Apr 5th, 2021
27
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  8. * @author Lukas Reschke <lukas@statuscode.ch>
  9. * @author Morris Jobke <hey@morrisjobke.de>
  10. * @author Robin Appelman <robin@icewind.nl>
  11. * @author Roeland Jago Douma <roeland@famdouma.nl>
  12. * @author Sergio Bertolín <sbertolin@solidgear.es>
  13. * @author Thomas Müller <thomas.mueller@tmit.eu>
  14. * @author Vincent Petry <vincent@nextcloud.com>
  15. *
  16. * @license AGPL-3.0
  17. *
  18. * This code is free software: you can redistribute it and/or modify
  19. * it under the terms of the GNU Affero General Public License, version 3,
  20. * as published by the Free Software Foundation.
  21. *
  22. * This program is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. * GNU Affero General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU Affero General Public License, version 3,
  28. * along with this program. If not, see <http://www.gnu.org/licenses/>
  29. *
  30. */
  31.  
  32. require_once __DIR__ . '/lib/versioncheck.php';
  33.  
  34. try {
  35. require_once __DIR__ . '/lib/base.php';
  36.  
  37. OC::handleRequest();
  38. } catch (\OC\ServiceUnavailableException $ex) {
  39. \OC::$server->getLogger()->logException($ex, ['app' => 'index']);
  40.  
  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, ['app' => 'index']);
  49. \OC::$server->getLogger()->logException($ex2, ['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.  
  54. //show the user a detailed error page
  55. OC_Template::printExceptionErrorPage($ex, 500);
  56. }
  57. } catch (\OC\User\LoginException $ex) {
  58. OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage(), 403);
  59. } catch (Exception $ex) {
  60. \OC::$server->getLogger()->logException($ex, ['app' => 'index']);
  61.  
  62. //show the user a detailed error page
  63. OC_Template::printExceptionErrorPage($ex, 500);
  64. } catch (Error $ex) {
  65. try {
  66. \OC::$server->getLogger()->logException($ex, ['app' => 'index']);
  67. } catch (Error $e) {
  68. http_response_code(500);
  69. header('Content-Type: text/plain; charset=utf-8');
  70. print("Internal Server Error\n\n");
  71. print("The server encountered an internal error and was unable to complete your request.\n");
  72. print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n");
  73. print("More details can be found in the webserver log.\n");
  74.  
  75. throw $ex;
  76. }
  77. OC_Template::printExceptionErrorPage($ex, 500);
  78. }
RAW Paste Data