diff --git a/500.php b/500.php new file mode 100644 index 0000000..703de56 --- /dev/null +++ b/500.php @@ -0,0 +1,11 @@ + + + + + 502 + Извините, возникла техническая проблема, свяжитесь с нами по телефона 8 800 111 22 33 + + + + + \ No newline at end of file diff --git a/bitrix/php_interface/init.php b/bitrix/php_interface/init.php index 795bce8..03c9a5e 100644 --- a/bitrix/php_interface/init.php +++ b/bitrix/php_interface/init.php @@ -100,6 +100,29 @@ function get_ext_from_mime($mime) return isset($mime_map[ $mime ]) ? $mime_map[ $mime ] : false; } +use Bitrix\Main\Diag\ExceptionHandlerFormatter; + +class HttpExceptionHandlerOutput extends \Bitrix\Main\Diag\HttpExceptionHandlerOutput +{ + public function renderExceptionMessage($exception, $debug = false) + { + if ($debug) + { + echo ExceptionHandlerFormatter::format($exception, true); + } + else + { + global $APPLICATION; + $APPLICATION->RestartBuffer(); + $APPLICATION->__view = []; + + include($_SERVER["DOCUMENT_ROOT"] . "/local/templates/500/header.php"); + include $_SERVER['DOCUMENT_ROOT'] . '/500.php'; + include($_SERVER["DOCUMENT_ROOT"] . "/local/templates/500/footer.php"); + } + } +} + AddEventHandler("main", "OnEpilog", "OnEpilogHandler", 1); function OnEpilogHandler() { @@ -113,4 +136,6 @@ function OnEpilogHandler() } } +\Bitrix\Main\Application::getInstance()->getExceptionHandler()->setHandlerOutput(new HttpExceptionHandlerOutput()); + ?> \ No newline at end of file diff --git a/local/templates/500/description.php b/local/templates/500/description.php new file mode 100644 index 0000000..5bcee1c --- /dev/null +++ b/local/templates/500/description.php @@ -0,0 +1,8 @@ + +$arTemplate = array ( + 'NAME' => 'Evolution 500', + 'DESCRIPTION' => '', + 'SORT' => '', + 'TYPE' => '', +); +?> \ No newline at end of file diff --git a/local/templates/500/footer.php b/local/templates/500/footer.php new file mode 100644 index 0000000..fed8dd0 --- /dev/null +++ b/local/templates/500/footer.php @@ -0,0 +1,4 @@ + + +
Извините, возникла техническая проблема, свяжитесь с нами по телефона 8 800 111 22 33