Index: core/admin_templates/error_fatal.tpl
===================================================================
--- /dev/null
+++ core/admin_templates/error_fatal.tpl
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: core/install/english.lang
===================================================================
--- core/install/english.lang
+++ core/install/english.lang
@@ -1363,6 +1363,7 @@
UGxlYXNlIG1ha2Ugc3VyZSB0byBCQUNLVVAgeW91ciBkYXRhYmFzZShzKSBiZWZvcmUgcnVubmluZyB0aGlzIHV0aWxpdHkh
RWRpdA==
RW1haWw=
+ T3Bwcywgc29tZXRoaW5nIHdlbnQgd3JvbmcgLi4u
Rm9sbG93aW5nIGxpbmVzIHdlcmUgTk9UIGltcG9ydGVk
RnJvbnQtRW5kIE9ubHk=
R2VuZXJhbA==
@@ -1394,6 +1395,7 @@
TW9kdWxlIFJvb3QgU2VjdGlvbg==
U2F2ZQ==
U2VsZWN0
+ T3Bwcywgc29tZXRoaW5nIHdlbnQgd3JvbmcgLi4u
U2Vzc2lvbiBFeHBpcmVk
U2ltcGxl
U29ydA==
@@ -1558,6 +1560,7 @@
U2VuZCBFLW1haWw=
U2VuZGluZyBQcmVwYXJlZCBFLW1haWxz
TWFpbCBoYXMgYmVlbiBzZW50IFN1Y2Nlc3NmdWxseQ==
+ U2VydmVyIEVycm9y
U2l0ZSBEb21haW5z
U1BBTSBSZXBvcnRz
U3BlbGxpbmcgRGljdGlvbmFyeQ==
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');
Index: core/install/upgrades.sql
===================================================================
--- core/install/upgrades.sql
+++ core/install/upgrades.sql
@@ -3026,3 +3026,13 @@
UPDATE Modules
SET ClassNamespace = 'InPortal\\Core'
WHERE `Name` IN ('Core', 'In-Portal');
+
+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
@@ -206,6 +206,20 @@
protected $_ignoreInTrace = Array ('logger.php', 'db_connection.php', 'db_load_balancer.php');
/**
+ * True when application is going to shutdown.
+ *
+ * @var boolean
+ */
+ public $applicationShutdown = false;
+
+ /**
+ * Id of last log record.
+ *
+ * @var integer
+ */
+ public $lastLogId = null;
+
+ /**
* Create event log
*
* @param Array $methods_to_call List of invokable kLogger class method with their parameters (if any)
@@ -737,6 +751,7 @@
if ( $storage_medium == self::LS_DATABASE ) {
$result = $this->Conn->doInsert($this->_logRecord, TABLE_PREFIX . 'SystemLog');
+ $this->lastLogId = $this->Conn->getInsertID();
}
elseif ( $storage_medium == self::LS_DISK ) {
$result = $this->_saveToFile(RESTRICTED . '/system.log');
@@ -764,6 +779,7 @@
*/
public function catchLastError()
{
+ $this->applicationShutdown = true;
$this->write();
$last_error = error_get_last();
@@ -1147,10 +1163,34 @@
protected function _displayFatalError($errno)
{
$errno = $this->_getFatalErrorTitle($errno);
+ $message = $this->_logger->toString($errno);
- $margin = $this->Application->isAdmin ? '8px' : 'auto';
- echo '' . $this->_logger->toString($errno) . '
';
- exit;
+ 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;
+ }
+ else {
+ $this->Application->StoreVar('FatalErrorMessage', $message);
+ $redirect_params = array();
+
+ if ( $this->Application->isDebugMode() && $this->_logger->lastLogId ) {
+ $redirect_params['system-log_id'] = $this->_logger->lastLogId;
+ }
+
+ if ( $this->Application->isAdmin ) {
+ $this->Application->Redirect('error_fatal', $redirect_params);
+ }
+ else {
+ $this->Application->Redirect($this->Application->ConfigValue('FatalErrorTemplate'), $redirect_params);
+ }
+ }
}
/**
Index: core/units/admin/admin_config.php
===================================================================
--- core/units/admin/admin_config.php
+++ core/units/admin/admin_config.php
@@ -45,6 +45,7 @@
'sql_query' => Array ('format' => '!la_tab_QueryDB!'),
'no_permissions' => Array ('format' => '!la_title_NoPermissions!'),
+ 'error_fatal' => array('format' => '!la_title_ServerError!'),
'column_picker' => Array ('format' => '!la_title_ColumnPicker!'),
'csv_export' => Array ('format' => '!la_title_CSVExport!'),
@@ -98,4 +99,4 @@
'Content' => Array ('type' => 'string', 'default' => ''),
),
-);
\ 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/_install/english.lang
===================================================================
--- themes/advanced/_install/english.lang
+++ themes/advanced/_install/english.lang
@@ -307,6 +307,7 @@
Q2xpY2sgaGVyZSBpZiB5b3VyIGJyb3dzZXIgZG9lcyBub3QgYXV0b21hdGljYWxseSByZWRpcmVjdCB5b3Uu
VGhhbmsgeW91IGZvciByZWdpc3RlcmluZyBvbiBvdXIgd2Vic2l0ZS4gWW91IGNhbiBhY3RpdmF0ZSB5b3VyIHJlZ2lzdHJhdGlvbiB1c2luZyBsaW5rIHNlbnQgdG8geW91IGJ5IGVtYWlsLg==
VGhhbmsgeW91IGZvciByZWdpc3RlcmluZyBvbiBvdXIgd2Vic2l0ZS4gWW91ciByZWdpc3RyYXRpb24gaXMgcGVuZGluZyBhZG1pbmlzdHJhdGl2ZSBhcHByb3ZhbC4gWW91IHdpbGwgZ2V0IGEgc2VwYXJhdGUgZW1haWwgb25jZSBpdCdzIGFjdGl2YXRlZC4=
+ T3Bwcywgc29tZXRoaW5nIHdlbnQgd3JvbmcgLi4u
VGhhbmsgeW91IGZvciBzdWdnZXN0aW5nIHlvdXIgY2F0ZWdvcnku
U3VnZ2VzdGVkIGNhdGVnb3J5IGlzIHBlbmRpbmcgZm9yIEFkbWluaXN0cmF0aXZlIGFwcHJvdmFsIA==
VGhhbmsgeW91IGZvciBzdWJtaXR0aW5nIHlvdXIgcmVxdWVzdC4=
@@ -354,6 +355,7 @@
Q29tbWVudHM=
U2VhcmNoIEJveA==
U2VhcmNoIFJlc3VsdHM=
+ U2VydmVyIEVycm9y
U2l0ZSBtYXA=
U3Vic2NyaXB0aW9uIENvbmZpcm1hdGlvbg==
U3Vic2NyaXB0aW9uIENvbmZpcm1lZA==
@@ -390,4 +392,4 @@
WklQIENvZGU=
-
\ No newline at end of file
+
Index: themes/advanced/error_fatal.tpl
===================================================================
--- /dev/null
+++ themes/advanced/error_fatal.tpl
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: themes/default/_install/english.lang
===================================================================
--- themes/default/_install/english.lang
+++ themes/default/_install/english.lang
@@ -15,10 +15,12 @@
SG9tZQ==
TGFuZ3VhZ2Ugc2VsZWN0aW9uOg==
JnF1b3Q7SW4tUG9ydGFsIC0gU2V0dGluZyBFeGNlbGxlbmNlPGJyLz4NCmluIENvbnRlbnQgTWFuYWdlbWVudCZxdW90Ow==
+ T3Bwcywgc29tZXRoaW5nIHdlbnQgd3JvbmcgLi4u
VGhhbmsgeW91IGZvciBjb250YWN0aW5nIHdpdGggdXMh
QWRkcmVzcw==
TWFpbnRlbmFuY2UgTW9kZQ==
SW5mb3JtYXRpb24gUmVxdWVzdCBGb3Jt
+ U2VydmVyIEVycm9y
-
\ No newline at end of file
+
Index: themes/default/error_fatal.tpl
===================================================================
--- /dev/null
+++ themes/default/error_fatal.tpl
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: themes/simple/_install/english.lang
===================================================================
--- themes/simple/_install/english.lang
+++ themes/simple/_install/english.lang
@@ -304,8 +304,9 @@
NDA0LiBQYWdlIG5vdCBmb3VuZCBvbiB0aGUgc2VydmVyLg==
UGxlYXNlIGNvbmZpcm0gdGhhdCB5b3Ugd2FudCB0byByZXNldCB5b3VyIHBhc3N3b3JkLg==
VGhhbmsgeW91IGZvciByZWdpc3RlcmluZyBvbiBvdXIgd2Vic2l0ZS4gWW91IGNhbiBhY3RpdmF0ZSB5b3VyIHJlZ2lzdHJhdGlvbiB1c2luZyBsaW5rIHNlbnQgdG8geW91IGJ5IGVtYWlsLg==
- VGhhbmsgeW91IGZvciByZWdpc3RlcmluZyBvbiBvdXIgd2Vic2l0ZS4gWW91ciByZWdpc3RyYXRpb24gaXMgcGVuZGluZyBhZG1pbmlzdHJhdGl2ZSBhcHByb3ZhbC4gWW91IHdpbGwgZ2V0IGEgc2VwYXJhdGUgZW1haWwgb25jZSBpdCdzIGFjdGl2YXRlZC4=
- VGhhbmsgeW91IGZvciBzdWdnZXN0aW5nIHlvdXIgY2F0ZWdvcnku
+ VGhhbmsgeW91IGZvciByZWdpc3RlcmluZyBvbiBvdXIgd2Vic2l0ZS4gWW91ciByZWdpc3RyYXRpb24gaXMgcGVuZGluZyBhZG1pbmlzdHJhdGl2ZSBhcHByb3ZhbC4gWW91IHdpbGwgZ2V0IGEgc2VwYXJhdGUgZW1haWwgb25jZSBpdCdzIGFjdGl2YXRlZC4=
+ T3Bwcywgc29tZXRoaW5nIHdlbnQgd3JvbmcgLi4u
+ VGhhbmsgeW91IGZvciBzdWdnZXN0aW5nIHlvdXIgY2F0ZWdvcnku
U3VnZ2VzdGVkIGNhdGVnb3J5IGlzIHBlbmRpbmcgZm9yIEFkbWluaXN0cmF0aXZlIGFwcHJvdmFsIA==
VGhhbmsgeW91IGZvciBzdWJtaXR0aW5nIHlvdXIgcmVxdWVzdC4=
VGhhbmsgeW91IGZvciBzdWJzY3JpYmluZyB0byBvdXIgbWFpbGluZyBsaXN0
@@ -348,6 +349,7 @@
UmVsYXRlZCBTZWFyY2hlcw==
U2VhcmNoIEJveA==
U2VhcmNoIFJlc3VsdHM=
+ U2VydmVyIEVycm9y
U2l0ZSBtYXA=
U3Vic2NyaXB0aW9uIENvbmZpcm1hdGlvbg==
U3Vic2NyaXB0aW9uIENvbmZpcm1lZA==
@@ -387,4 +389,4 @@
WklQIENvZGU=
-
\ No newline at end of file
+
Index: themes/simple/error_fatal.tpl
===================================================================
--- /dev/null
+++ themes/simple/error_fatal.tpl
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+