@@ -28,68 +28,68 @@ |
||
| 28 | 28 | // Show warning if a PHP version below 5.6.0 is used, this has to happen here |
| 29 | 29 | // because base.php will already use 5.6 syntax. |
| 30 | 30 | if (version_compare(PHP_VERSION, '5.6.0') === -1) { |
| 31 | - echo 'This version of Nextcloud requires at least PHP 5.6.0<br/>'; |
|
| 32 | - echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.'; |
|
| 33 | - return; |
|
| 31 | + echo 'This version of Nextcloud requires at least PHP 5.6.0<br/>'; |
|
| 32 | + echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.'; |
|
| 33 | + return; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | try { |
| 37 | 37 | |
| 38 | - require_once __DIR__ . '/lib/base.php'; |
|
| 38 | + require_once __DIR__ . '/lib/base.php'; |
|
| 39 | 39 | |
| 40 | - OC::handleRequest(); |
|
| 40 | + OC::handleRequest(); |
|
| 41 | 41 | |
| 42 | 42 | } catch(\OC\ServiceUnavailableException $ex) { |
| 43 | - \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 43 | + \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 44 | 44 | |
| 45 | - //show the user a detailed error page |
|
| 46 | - OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
| 47 | - OC_Template::printExceptionErrorPage($ex); |
|
| 45 | + //show the user a detailed error page |
|
| 46 | + OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
| 47 | + OC_Template::printExceptionErrorPage($ex); |
|
| 48 | 48 | } catch (\OC\HintException $ex) { |
| 49 | - OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
| 50 | - try { |
|
| 51 | - OC_Template::printErrorPage($ex->getMessage(), $ex->getHint()); |
|
| 52 | - } catch (Exception $ex2) { |
|
| 53 | - \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 54 | - \OC::$server->getLogger()->logException($ex2, array('app' => 'index')); |
|
| 49 | + OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
| 50 | + try { |
|
| 51 | + OC_Template::printErrorPage($ex->getMessage(), $ex->getHint()); |
|
| 52 | + } catch (Exception $ex2) { |
|
| 53 | + \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 54 | + \OC::$server->getLogger()->logException($ex2, array('app' => 'index')); |
|
| 55 | 55 | |
| 56 | - //show the user a detailed error page |
|
| 57 | - OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 58 | - OC_Template::printExceptionErrorPage($ex); |
|
| 59 | - } |
|
| 56 | + //show the user a detailed error page |
|
| 57 | + OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 58 | + OC_Template::printExceptionErrorPage($ex); |
|
| 59 | + } |
|
| 60 | 60 | } catch (\OC\User\LoginException $ex) { |
| 61 | - OC_Response::setStatus(OC_Response::STATUS_FORBIDDEN); |
|
| 62 | - OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage()); |
|
| 61 | + OC_Response::setStatus(OC_Response::STATUS_FORBIDDEN); |
|
| 62 | + OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage()); |
|
| 63 | 63 | } catch (Exception $ex) { |
| 64 | - \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 64 | + \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 65 | 65 | |
| 66 | - //show the user a detailed error page |
|
| 67 | - OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 68 | - OC_Template::printExceptionErrorPage($ex); |
|
| 66 | + //show the user a detailed error page |
|
| 67 | + OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 68 | + OC_Template::printExceptionErrorPage($ex); |
|
| 69 | 69 | } catch (Error $ex) { |
| 70 | - try { |
|
| 71 | - \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 72 | - } catch (Error $e) { |
|
| 70 | + try { |
|
| 71 | + \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
|
| 72 | + } catch (Error $e) { |
|
| 73 | 73 | |
| 74 | - $claimedProtocol = strtoupper($_SERVER['SERVER_PROTOCOL']); |
|
| 75 | - $validProtocols = [ |
|
| 76 | - 'HTTP/1.0', |
|
| 77 | - 'HTTP/1.1', |
|
| 78 | - 'HTTP/2', |
|
| 79 | - ]; |
|
| 80 | - $protocol = 'HTTP/1.1'; |
|
| 81 | - if(in_array($claimedProtocol, $validProtocols, true)) { |
|
| 82 | - $protocol = $claimedProtocol; |
|
| 83 | - } |
|
| 84 | - header($protocol . ' 500 Internal Server Error'); |
|
| 85 | - header('Content-Type: text/plain; charset=utf-8'); |
|
| 86 | - print("Internal Server Error\n\n"); |
|
| 87 | - print("The server encountered an internal error and was unable to complete your request.\n"); |
|
| 88 | - print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n"); |
|
| 89 | - print("More details can be found in the webserver log.\n"); |
|
| 74 | + $claimedProtocol = strtoupper($_SERVER['SERVER_PROTOCOL']); |
|
| 75 | + $validProtocols = [ |
|
| 76 | + 'HTTP/1.0', |
|
| 77 | + 'HTTP/1.1', |
|
| 78 | + 'HTTP/2', |
|
| 79 | + ]; |
|
| 80 | + $protocol = 'HTTP/1.1'; |
|
| 81 | + if(in_array($claimedProtocol, $validProtocols, true)) { |
|
| 82 | + $protocol = $claimedProtocol; |
|
| 83 | + } |
|
| 84 | + header($protocol . ' 500 Internal Server Error'); |
|
| 85 | + header('Content-Type: text/plain; charset=utf-8'); |
|
| 86 | + print("Internal Server Error\n\n"); |
|
| 87 | + print("The server encountered an internal error and was unable to complete your request.\n"); |
|
| 88 | + print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n"); |
|
| 89 | + print("More details can be found in the webserver log.\n"); |
|
| 90 | 90 | |
| 91 | - throw $e; |
|
| 92 | - } |
|
| 93 | - OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 94 | - OC_Template::printExceptionErrorPage($ex); |
|
| 91 | + throw $e; |
|
| 92 | + } |
|
| 93 | + OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
| 94 | + OC_Template::printExceptionErrorPage($ex); |
|
| 95 | 95 | } |
@@ -29,17 +29,17 @@ discard block |
||
| 29 | 29 | // because base.php will already use 5.6 syntax. |
| 30 | 30 | if (version_compare(PHP_VERSION, '5.6.0') === -1) { |
| 31 | 31 | echo 'This version of Nextcloud requires at least PHP 5.6.0<br/>'; |
| 32 | - echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.'; |
|
| 32 | + echo 'You are currently running '.PHP_VERSION.'. Please update your PHP version.'; |
|
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | try { |
| 37 | 37 | |
| 38 | - require_once __DIR__ . '/lib/base.php'; |
|
| 38 | + require_once __DIR__.'/lib/base.php'; |
|
| 39 | 39 | |
| 40 | 40 | OC::handleRequest(); |
| 41 | 41 | |
| 42 | -} catch(\OC\ServiceUnavailableException $ex) { |
|
| 42 | +} catch (\OC\ServiceUnavailableException $ex) { |
|
| 43 | 43 | \OC::$server->getLogger()->logException($ex, array('app' => 'index')); |
| 44 | 44 | |
| 45 | 45 | //show the user a detailed error page |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | 'HTTP/2', |
| 79 | 79 | ]; |
| 80 | 80 | $protocol = 'HTTP/1.1'; |
| 81 | - if(in_array($claimedProtocol, $validProtocols, true)) { |
|
| 81 | + if (in_array($claimedProtocol, $validProtocols, true)) { |
|
| 82 | 82 | $protocol = $claimedProtocol; |
| 83 | 83 | } |
| 84 | - header($protocol . ' 500 Internal Server Error'); |
|
| 84 | + header($protocol.' 500 Internal Server Error'); |
|
| 85 | 85 | header('Content-Type: text/plain; charset=utf-8'); |
| 86 | 86 | print("Internal Server Error\n\n"); |
| 87 | 87 | print("The server encountered an internal error and was unable to complete your request.\n"); |