Index: core/admin_templates/error_fatal.tpl =================================================================== --- core/admin_templates/error_fatal.tpl +++ core/admin_templates/error_fatal.tpl @@ -0,0 +1,59 @@ + + + + + + + + + + + + +
+ + +
+ +
+
+ + + +

+
+
+
+
+ + +
+
+ + Index: core/install/english.lang =================================================================== --- core/install/english.lang +++ core/install/english.lang @@ -1363,6 +1363,7 @@ UGxlYXNlIG1ha2Ugc3VyZSB0byBCQUNLVVAgeW91ciBkYXRhYmFzZShzKSBiZWZvcmUgcnVubmluZyB0aGlzIHV0aWxpdHkh RWRpdA== RW1haWw= + T3Bwcywgc29tZXRoaW5nIHdlbnQgd3JvbmcgLi4u Rm9sbG93aW5nIGxpbmVzIHdlcmUgTk9UIGltcG9ydGVk RnJvbnQtRW5kIE9ubHk= R2VuZXJhbA== Index: core/install/install_data.sql =================================================================== --- core/install/install_data.sql +++ core/install/install_data.sql @@ -37,14 +37,15 @@ INSERT INTO SystemSettings VALUES(DEFAULT, 'ForceModRewriteUrlEnding', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_ForceModRewriteUrlEnding', 'checkbox', '', NULL, 10.012, 0, 0, 'hint:la_config_ForceModRewriteUrlEnding'); INSERT INTO SystemSettings VALUES(DEFAULT, 'UseContentLanguageNegotiation', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_UseContentLanguageNegotiation', 'checkbox', '', '', 10.013, 0, 0, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'cms_DefaultDesign', '#default_design#', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_DefaultDesignTemplate', 'text', NULL, NULL, 10.02, 0, 0, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'ErrorTemplate', 'error_notfound', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_error_template', 'text', '', '', 10.03, 0, 0, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'NotFoundErrorTemplate', 'error_notfound', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_error_template', 'text', '', '', 10.03, 0, 0, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'NoPermissionTemplate', 'no_permission', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_nopermission_template', 'text', '', '', 10.04, 0, 0, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'UsePageHitCounter', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_UsePageHitCounter', 'checkbox', '', '', 10.05, 0, 0, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'ForceImageMagickResize', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_ForceImageMagickResize', 'checkbox', '', '', 10.06, 0, 0, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'CheckStopWords', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_CheckStopWords', 'checkbox', '', '', 10.07, 0, 0, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'UseVisitorTracking', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_UseVisitorTracking', 'checkbox', '', '', 10.08, 0, 0, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'cms_DefaultTrackingCode', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_DefaultTrackingCode', 'textarea', NULL, 'COLS=40 ROWS=5', 10.09, 0, 0, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'PerformExactSearch', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_PerformExactSearch', 'checkbox', '', '', '10.10', 0, 0, 'hint:la_config_PerformExactSearch'); +INSERT INTO SystemSettings VALUES(DEFAULT, 'FatalErrorTemplate', 'error_fatal', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_FatalErrorTemplate', 'text', '', '', 10.05, 0, 0, null); +INSERT INTO SystemSettings VALUES(DEFAULT, 'UsePageHitCounter', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_UsePageHitCounter', 'checkbox', '', '', 10.06, 0, 0, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'ForceImageMagickResize', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_ForceImageMagickResize', 'checkbox', '', '', 10.07, 0, 0, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'CheckStopWords', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_CheckStopWords', 'checkbox', '', '', 10.08, 0, 0, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'UseVisitorTracking', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_UseVisitorTracking', 'checkbox', '', '', 10.09, 0, 0, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'cms_DefaultTrackingCode', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_DefaultTrackingCode', 'textarea', NULL, 'COLS=40 ROWS=5', '10.10', 0, 0, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'PerformExactSearch', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_PerformExactSearch', 'checkbox', '', '', 10.11, 0, 0, 'hint:la_config_PerformExactSearch'); INSERT INTO SystemSettings VALUES(DEFAULT, 'MaintenanceMessageFront', 'Website is currently undergoing the upgrades. Please come back shortly!', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMaintenance', 'la_config_MaintenanceMessageFront', 'textarea', '', 'style="width: 100%; height: 100px;"', '15.01', 0, 0, 'hint:la_config_MaintenanceMessageFront'); INSERT INTO SystemSettings VALUES(DEFAULT, 'MaintenanceMessageAdmin', 'Website is currently undergoing the upgrades. Please come back shortly!', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMaintenance', 'la_config_MaintenanceMessageAdmin', 'textarea', '', 'style="width: 100%; height: 100px;"', '15.02', 0, 0, 'hint:la_config_MaintenanceMessageAdmin'); INSERT INTO SystemSettings VALUES(DEFAULT, 'SoftMaintenanceTemplate', 'maintenance', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMaintenance', 'la_config_SoftMaintenanceTemplate', 'text', '', 'style="width: 200px;"', '15.03', 0, 0, 'hint:la_config_SoftMaintenanceTemplate'); @@ -1040,4 +1041,4 @@ INSERT INTO PromoBlockGroups VALUES (DEFAULT, 'Default Group', UNIX_TIMESTAMP(), '1', '7.00', '0.60', '1', 'fade', ''); INSERT INTO Modules VALUES ('Core', 'core/', 'Intechnic\\InPortal\\Core', 'adm', DEFAULT, 1, 1, '', 0, NULL); -INSERT INTO Modules VALUES ('In-Portal', 'core/', 'Intechnic\\InPortal\\Core', 'm', DEFAULT, 1, 0, '', 0, NULL); \ No newline at end of file +INSERT INTO Modules VALUES ('In-Portal', 'core/', 'Intechnic\\InPortal\\Core', 'm', DEFAULT, 1, 0, '', 0, NULL); Index: core/install/upgrades.sql =================================================================== --- core/install/upgrades.sql +++ core/install/upgrades.sql @@ -3021,4 +3021,14 @@ ALTER TABLE SiteDomains CHANGE SSLUrl SSLDomainName VARCHAR(255) NOT NULL DEFAULT '', CHANGE SSLUrlUsesRegExp SSLDomainNameUsesRegExp TINYINT(4) NOT NULL DEFAULT '0'; -DELETE FROM UserPersistentSessionData WHERE VariableName = 'site-domain[Default]columns_.'; \ No newline at end of file +DELETE FROM UserPersistentSessionData WHERE VariableName = 'site-domain[Default]columns_.'; + +UPDATE SystemSettings +SET VariableName = 'NotFoundErrorTemplate' +WHERE VariableName = 'ErrorTemplate'; + +UPDATE SystemSettings +SET DisplayOrder = ROUND(DisplayOrder + 0.01, 2) +WHERE Section = 'in-portal:configure_advanced' and Heading = 'la_section_SettingsWebsite' AND DisplayOrder > 10.04; + +INSERT INTO SystemSettings VALUES (DEFAULT, 'FatalErrorTemplate', 'error_fatal', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_FatalErrorTemplate', 'text', '', '', 10.05, 0, 0, null); Index: core/kernel/managers/url_manager.php =================================================================== --- core/kernel/managers/url_manager.php +++ core/kernel/managers/url_manager.php @@ -492,7 +492,7 @@ $theme_id = $this->Application->GetVar('m_theme'); } - $not_found = $this->Application->ConfigValue('ErrorTemplate'); + $not_found = $this->Application->ConfigValue('NotFoundErrorTemplate'); $vars['t'] = $not_found ? $not_found : 'error_notfound'; $themes_helper = $this->Application->recallObject('ThemesHelper'); @@ -524,4 +524,4 @@ $this->Application->Done(); exit; } -} \ No newline at end of file +} Index: core/kernel/utility/logger.php =================================================================== --- core/kernel/utility/logger.php +++ core/kernel/utility/logger.php @@ -212,6 +212,13 @@ protected $_ignoreInTrace = Array ('logger.php', 'db_connection.php', 'db_load_balancer.php'); /** + * True when application is going to shutdown. + * + * @var boolean + */ + public $applicationShutdown = false; + + /** * Create event log * * @param Array $methods_to_call List of invokable kLogger class method with their parameters (if any) @@ -767,6 +774,7 @@ */ public function catchLastError() { + $this->applicationShutdown = true; $this->write(); $last_error = error_get_last(); @@ -1150,10 +1158,29 @@ protected function _displayFatalError($errno) { $errno = $this->_getFatalErrorTitle($errno); + $message = $this->_logger->toString($errno); - $margin = $this->Application->isAdmin ? '8px' : 'auto'; - echo '
' . $this->_logger->toString($errno) . '
'; + if ( PHP_SAPI == 'cli' || $this->_logger->applicationShutdown || $this->Application->isDebugMode(false) ) { + $css_properties = array( + 'background-color: #FEFFBF', + 'margin: ' . $this->Application->isAdmin ? '8px' : 'auto', + 'padding: 10px', + 'border: 2px solid red', + 'text-align: center', + ); + echo '
' . $message . '
'; - exit; + exit; + } + else { + $this->Application->StoreVar('FatalErrorMessage', $message); + + if ( $this->Application->isAdmin ) { + $this->Application->Redirect('error_fatal'); + } + else { + $this->Application->Redirect($this->Application->ConfigValue('FatalErrorTemplate')); + } + } } /** @@ -1364,4 +1391,4 @@ return $res; } -} \ No newline at end of file +} Index: core/units/categories/categories_event_handler.php =================================================================== --- core/units/categories/categories_event_handler.php +++ core/units/categories/categories_event_handler.php @@ -1781,7 +1781,7 @@ } } else { - $not_found = $this->Application->ConfigValue('ErrorTemplate'); + $not_found = $this->Application->ConfigValue('NotFoundErrorTemplate'); $real_t = $not_found ? $not_found : 'error_notfound'; $themes_helper = $this->Application->recallObject('ThemesHelper'); Index: themes/advanced/error_fatal.tpl =================================================================== --- themes/advanced/error_fatal.tpl +++ themes/advanced/error_fatal.tpl @@ -0,0 +1,25 @@ + + + + + + + + + Server Error + + + + + + Opps, something went wrong ... Back + + + + + +