Index: branches/5.3.x/core/kernel/utility/email.php =================================================================== diff -u -N -r15483 -r15578 --- branches/5.3.x/core/kernel/utility/email.php (.../email.php) (revision 15483) +++ branches/5.3.x/core/kernel/utility/email.php (.../email.php) (revision 15578) @@ -1,6 +1,6 @@ Application->ConfigValue('EmailLogRotationInterval') != ''; + return $this->Application->ConfigValue('EnableEmailLog'); } /** Index: branches/5.3.x/core/install/steps_db.xml =================================================================== diff -u -N -r15483 -r15578 --- branches/5.3.x/core/install/steps_db.xml (.../steps_db.xml) (revision 15483) +++ branches/5.3.x/core/install/steps_db.xml (.../steps_db.xml) (revision 15578) @@ -148,6 +148,10 @@ but can set to other encoding also (see wikipedia.org options). It's highly recommended to have Website Encoding match the Database Encoding (specified on DB step).

+

Enable "System Log" - "System Log" has capability to record PHP Exceptions, Errors, Warnings, Notices, Database/SQL + Errors and Warnings, and User defined messages that happened on your website. It has 3 modes - Enabled (logs everything, including user + defined messages), User-only (user defined messages only), and Disabled (don't log anything at all - default setting).

+
]]> Index: branches/5.3.x/core/kernel/kbase.php =================================================================== diff -u -N -r15483 -r15578 --- branches/5.3.x/core/kernel/kbase.php (.../kbase.php) (revision 15483) +++ branches/5.3.x/core/kernel/kbase.php (.../kbase.php) (revision 15578) @@ -1,6 +1,6 @@ prefixSpecial; } + + /** + * Creates string representation of a class (for logging) + * + * @return string + * @access public + */ + public function __toString() + { + return 'ClassName: ' . get_class($this) . '; PrefixSpecial: ' . $this->getPrefixSpecial(); + } } Index: branches/5.3.x/core/kernel/session/session.php =================================================================== diff -u -N -r15483 -r15578 --- branches/5.3.x/core/kernel/session/session.php (.../session.php) (revision 15483) +++ branches/5.3.x/core/kernel/session/session.php (.../session.php) (revision 15578) @@ -1,6 +1,6 @@ Data->AddParams( $this->Storage->LoadData() ); } - function PrintSession($comment = '') + /** + * Returns information about session contents + * + * @param bool $include_optional + * @return array + * @access public + */ + public function getSessionData($include_optional = true) { - if (defined('DEBUG_MODE') && $this->Application->isDebugMode() && kUtil::constOn('DBG_SHOW_SESSIONDATA')) { - // dump session data - $this->Application->Debugger->appendHTML('SessionStorage [' . ($this->RecallVar('admin') == 1 ? 'Admin' : 'Front-End') . '] ('.$comment.'):'); - $session_data = $this->Data->GetParams(); - ksort($session_data); + $session_data = $this->Data->GetParams(); + ksort($session_data); + + foreach ($session_data as $session_key => $session_value) { + if ( kUtil::IsSerialized($session_value) ) { + $session_data[$session_key] = unserialize($session_value); + } + } + + if ( !$include_optional ) { + $optional_keys = array_keys($this->OptionalData); + foreach ($session_data as $session_key => $session_value) { - if (kUtil::IsSerialized($session_value)) { - $session_data[$session_key] = unserialize($session_value); + if ( in_array($session_key, $optional_keys) ) { + unset($session_data[$session_key]); } } + } + + return $session_data; + } + + /** + * Returns real session data, that was saved + * + * @param Array $session_data + * @return Array + * @access protected + */ + protected function _getRealSessionData($session_data) + { + $data_keys = array_keys($session_data); + $optional_keys = array_keys($this->OptionalData); + $real_keys = array_diff($data_keys, $optional_keys); + + if ( !$real_keys ) { + return Array (); + } + + $ret = Array (); + + foreach ($real_keys as $real_key) { + $ret[$real_key] = $session_data[$real_key]; + } + + return $ret; + } + + function PrintSession($comment = '') + { + if ( defined('DEBUG_MODE') && $this->Application->isDebugMode() && kUtil::constOn('DBG_SHOW_SESSIONDATA') ) { + // dump session data + $this->Application->Debugger->appendHTML('SessionStorage [' . ($this->RecallVar('admin') == 1 ? 'Admin' : 'Front-End') . '] (' . $comment . '):'); + + $session_data = $this->getSessionData(); $this->Application->Debugger->dumpVars($session_data); - if (!$this->RecallVar('admin')) { + if ( !$this->RecallVar('admin') ) { // dump real keys (only for front-end) - $data_keys = array_keys($session_data); - $optional_keys = array_keys($this->OptionalData); - $real_keys = array_diff($data_keys, $optional_keys); + $real_session_data = $this->_getRealSessionData($session_data); - if ($real_keys) { - $ret = ''; - foreach ($real_keys as $real_key) { - $ret .= '[' . $real_key . '] = [' . $session_data[$real_key] . ']
'; - } - - $this->Application->Debugger->appendHTML('Real Keys:
' . $ret); + if ( $real_session_data ) { + $this->Application->Debugger->appendHTML('Real Keys:'); + $this->Application->Debugger->dumpVars($real_session_data); } } } - if (defined('DEBUG_MODE') && $this->Application->isDebugMode() && kUtil::constOn('DBG_SHOW_PERSISTENTDATA')) { + if ( defined('DEBUG_MODE') && $this->Application->isDebugMode() && kUtil::constOn('DBG_SHOW_PERSISTENTDATA') ) { // dump persistent session data - if ($this->Storage->PersistentVars) { + if ( $this->Storage->PersistentVars ) { $this->Application->Debugger->appendHTML('Persistant Session:'); $session_data = $this->Storage->PersistentVars; ksort($session_data); foreach ($session_data as $session_key => $session_value) { - if (kUtil::IsSerialized($session_value)) { + if ( kUtil::IsSerialized($session_value) ) { $session_data[$session_key] = unserialize($session_value); } } Index: branches/5.3.x/core/kernel/db/db_load_balancer.php =================================================================== diff -u -N -r15483 -r15578 --- branches/5.3.x/core/kernel/db/db_load_balancer.php (.../db_load_balancer.php) (revision 15483) +++ branches/5.3.x/core/kernel/db/db_load_balancer.php (.../db_load_balancer.php) (revision 15578) @@ -1,6 +1,6 @@ openConnection(isset($i) ? $i : $this->getMasterIndex()); + + return $conn ? $conn->connectionOpened : false; + } + + /** * Really opens a connection. * Returns a database object whether or not the connection was successful. * Index: branches/5.3.x/core/install/install_schema.sql =================================================================== diff -u -N -r15574 -r15578 --- branches/5.3.x/core/install/install_schema.sql (.../install_schema.sql) (revision 15574) +++ branches/5.3.x/core/install/install_schema.sql (.../install_schema.sql) (revision 15578) @@ -422,6 +422,38 @@ KEY `timestamp` (SentOn) ); +CREATE TABLE SystemLog ( + LogId int(11) NOT NULL AUTO_INCREMENT, + LogUniqueId int(11) DEFAULT NULL, + LogLevel tinyint(4) NOT NULL DEFAULT '7', + LogType tinyint(4) NOT NULL DEFAULT '3', + LogCode int(11) DEFAULT NULL, + LogMessage longtext, + LogTimestamp int(11) DEFAULT NULL, + LogDate datetime DEFAULT NULL, + LogEventName varchar(100) NOT NULL DEFAULT '', + LogHostname varchar(255) NOT NULL DEFAULT '', + LogRequestSource tinyint(4) DEFAULT NULL, + LogRequestURI varchar(255) NOT NULL DEFAULT '', + LogRequestData longtext, + LogUserId int(11) DEFAULT NULL, + LogInterface tinyint(4) DEFAULT NULL, + IpAddress varchar(15) NOT NULL DEFAULT '', + LogSessionKey int(11) DEFAULT NULL, + LogSessionData longtext, + LogBacktrace longtext, + LogSourceFilename varchar(255) NOT NULL DEFAULT '', + LogSourceFileLine int(11) DEFAULT NULL, + LogProcessId bigint(20) unsigned DEFAULT NULL, + LogMemoryUsed bigint(20) unsigned NOT NULL, + LogUserData longtext NOT NULL, + LogNotificationStatus tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (LogId), + KEY LogLevel (LogLevel), + KEY LogType (LogType), + KEY LogNotificationStatus (LogNotificationStatus) +); + CREATE TABLE SystemCache ( VarName varchar(255) NOT NULL default '', Data longtext, Index: branches/5.3.x/core/units/helpers/mailing_list_helper.php =================================================================== diff -u -N -r15483 -r15578 --- branches/5.3.x/core/units/helpers/mailing_list_helper.php (.../mailing_list_helper.php) (revision 15483) +++ branches/5.3.x/core/units/helpers/mailing_list_helper.php (.../mailing_list_helper.php) (revision 15578) @@ -1,6 +1,6 @@ SetTo($email, $email); - if ( $this->Application->ConfigValue('EmailLogRotationInterval') != '' ) { + if ( $this->Application->ConfigValue('EnableEmailLog') ) { // 4. write to log $log_fields_hash = Array ( 'From' => $mailing_data['FromName'] . '(' . $mailing_data['FromEmail'] . ')', Index: branches/5.3.x/core/install/english.lang =================================================================== diff -u -N -r15574 -r15578 --- branches/5.3.x/core/install/english.lang (.../english.lang) (revision 15574) +++ branches/5.3.x/core/install/english.lang (.../english.lang) (revision 15578) @@ -164,7 +164,8 @@ RGVmYXVsdCAiUGVyIFBhZ2UiIHNldHRpbmcgaW4gR3JpZHM= RGVmYXVsdCBSZWdpc3RyYXRpb24gQ291bnRyeQ== RGVmYXVsdCBBbmFseXRpY3MgVHJhY2tpbmcgQ29kZQ== - S2VlcCBFbWFpbCBMb2cgZm9y + S2VlcCAiRS1tYWlsIExvZyIgZm9y + RW5hYmxlICJFLW1haWwgTG9nIg== RW5hYmxlIFJldmlzaW9uIENvbnRyb2wgZm9yIFNlY3Rpb24gQ29udGVudA== VGVtcGxhdGUgZm9yICJGaWxlIG5vdCBmb3VuZCAoNDA0KSIgRXJyb3I= RXhjbHVkZSB0ZW1wbGF0ZSBiYXNlZCBTZWN0aW9ucyBmcm9tIFNlYXJjaCBSZXN1bHRzIChpZS4gVXNlciBSZWdpc3RyYXRpb24p @@ -207,6 +208,8 @@ VGVtcGxhdGUgZm9yIFNvZnQgTWFpbnRlbmFuY2U= U1NMIEZ1bGwgVVJMIChodHRwczovL3d3dy5kb21haW4uY29tL3BhdGgp VXNlIFN0aWNreSBHcmlkIFNlbGVjdGlvbg== + U2VuZCBVc2VyLWRlZmluZWQgIlN5c3RlbSBMb2ciIG1lc3NhZ2VzIHRv + S2VlcCAiU3lzdGVtIExvZyIgZm9y VGh1bWJuYWlsIEhlaWdodA== VGh1bWJuYWlsIFdpZHRo VHJpbSBSZXF1aXJlZCBGaWVsZHM= @@ -512,10 +515,30 @@ TG9jYWxl TG9jYWwgTmFtZQ== TG9jYXRpb24= + QmFja3RyYWNl + Q29kZQ== + RXZlbnQgTmFtZQ== + SG9zdG5hbWU= TG9naW4= + SW50ZXJmYWNl + TG9nIExldmVs + TWVtb3J5IFVzZWQ= + TWVzc2FnZQ== + Tm90aWZpY2F0aW9uIFN0YXR1cw== TG9nbyBpbWFnZQ== Qm90dG9tIExvZ28gSW1hZ2U= TG9nbyBMb2dpbg== + UHJvY2VzcyBJRA== + UmVxdWVzdCBEYXRh + UmVxdWVzdCBTb3VyY2U= + UmVxdWVzdCBVUkk= + U2Vzc2lvbiBEYXRh + U2Vzc2lvbiBLZXk= + U291cmNlIEZpbGUgTGluZQ== + U291cmNlIEZpbGVuYW1l + VGltZXN0YW1w + VHlwZQ== + VXNlciBEYXRh TWFyZ2luIEJvdHRvbQ== TWFyZ2luIExlZnQ= TWFyZ2luIFJpZ2h0 @@ -738,6 +761,7 @@ TGludXg= TG9jYWw= TG9jYWwgSW1hZ2U= + RnVuY3Rpb24= TG9nZ2VkIGluIGFz TG9naW4= TG9nb3V0 @@ -780,6 +804,7 @@ T2Zm T24= T25lIFdheQ== + b24gbGluZQ== Y3JlYXRlZA== ZGVsZXRlZA== dXBkYXRlZA== @@ -858,7 +883,6 @@ RS1tYWlsIEJvZHk= RS1tYWlsIEV2ZW50cw== Rm9yZXZlciAobmV2ZXIgZGVsZXRlZCBhdXRvbWF0aWNhbGx5KQ== - TmV2ZXIgKHR1cm5lZCBvZmYp RS1tYWlsIFN1YmplY3Q= RXZlcnlvbmU= RXhhY3Q= @@ -882,6 +906,12 @@ SnVuZQ== TGFzdCBOYW1l TG9nZ2VkIE91dA== + RGlzYWJsZWQ= + UGVuZGluZw== + U2VudA== + RGF0YWJhc2U= + T3RoZXI= + UEhQ TWFudWFs TWFyY2g= TWF5 @@ -927,6 +957,7 @@ RnJvbSBvdGhlcnM= VG8gb3RoZXJz U3lzdGVt + Rm9yZXZlciAobmV2ZXIgZGVsZXRlZCBhdXRvbWF0aWNhbGx5KQ== VGFi VGVtcGxhdGU= MyBtb250aHM= @@ -1160,6 +1191,7 @@ M3JkIFBhcnR5IEFQSSBTZXR0aW5ncw== QWRtaW4gQ29uc29sZSBTZXR0aW5ncw== Q1NWIEV4cG9ydCBTZXR0aW5ncw== + TG9ncyBTZXR0aW5ncw== TWFpbGluZyBTZXR0aW5ncw== TWFpbnRlbmFuY2UgU2V0dGluZ3M= U2Vzc2lvbiBTZXR0aW5ncw== @@ -1260,6 +1292,7 @@ V2Vic2l0ZSAmIENvbnRlbnQ= QWRtaW4gU2tpbnM= U3VtbWFyeQ== + U3lzdGVtIExvZw== Q29uZmlndXJhdGlvbg== VGFnIGxpYnJhcnk= VGhlbWVz @@ -1447,6 +1480,10 @@ TGFuZ3VhZ2UgUGFja3M= TGFuZ3VhZ2VzIE1hbmFnZW1lbnQ= TG9hZGluZyAuL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aW5wMjp1LnJlZ2lzdGVyX0ZpZWxkIG5hbWU9IkZpcnN0TmFtZSIgLz4gPGlucDI6dS5yZWdpc3Rlcl9GaWVsZCBuYW1lPSJMYXN0TmFtZSIgLz4sDQoNClRoYW5rIHlvdSBmb3IgcmVnaXN0ZXJpbmcgb24gPGlucDI6bV9MaW5rIHRlbXBsYXRlPSJpbmRleCIvPi4gWW91ciByZWdpc3RyYXRpb24gaXMgbm93IGFjdGl2ZS4NCjxpbnAyOm1faWYgY2hlY2s9InUucmVnaXN0ZXJfRmllbGQiIG5hbWU9IkVtYWlsIj4NCjxici8+PGJyLz4NClBsZWFzZSBjbGljayBoZXJlIHRvIHZlcmlmeSB5b3VyIEUtbWFpbCBhZGRyZXNzOg0KPGEgaHJlZj0iPGlucDI6dS5yZWdpc3Rlcl9Db25maXJtUGFzc3dvcmRMaW5rIHQ9InBsYXRmb3JtL215X2FjY291bnQvdmVyaWZ5X2VtYWlsIiBub19hbXA9IjEiLz4iPjxpbnAyOnUucmVnaXN0ZXJfQ29uZmlybVBhc3N3b3JkTGluayB0PSJwbGF0Zm9ybS9teV9hY2NvdW50L3ZlcmlmeV9lbWFpbCIgbm9fYW1wPSIxIi8+PC9hPjxici8+PGJyLz4NCjwvaW5wMjptX2lmPg== Index: branches/5.3.x/core/kernel/utility/debugger.php =================================================================== diff -u -N -r15483 -r15578 --- branches/5.3.x/core/kernel/utility/debugger.php (.../debugger.php) (revision 15483) +++ branches/5.3.x/core/kernel/utility/debugger.php (.../debugger.php) (revision 15578) @@ -1,6 +1,6 @@ profileStart('script_runtime', 'Script runtime', $start); $this->LastMoment = $start; - error_reporting(E_ALL); + error_reporting(E_ALL & ~E_STRICT); // show errors on screen in case if not in Zend Studio debugging ini_set('display_errors', DebuggerUtil::constOn('DBG_ZEND_PRESENT') ? 0 : 1); @@ -403,7 +403,6 @@ 'DBG_WINDOW_WIDTH' => 700, // set width of debugger window (in pixels) for better viewing large amount of debug data 'DBG_USE_SHUTDOWN_FUNC' => DBG_ZEND_PRESENT ? 0 : 1, // use shutdown function to include debugger code into output 'DBG_HANDLE_ERRORS' => DBG_ZEND_PRESENT ? 0 : 1, // handle all allowed by php (see php manual) errors instead of default handler - 'DBG_IGNORE_STRICT_ERRORS' => 0, // ignore PHP5 errors about private/public view modified missing in class declarations 'DBG_DOMVIEWER' => '/temp/domviewer.html', // path to DOMViewer on website 'DOC_ROOT' => str_replace('\\', '/', realpath($_SERVER['DOCUMENT_ROOT']) ), // windows hack 'DBG_LOCAL_BASE_PATH' => 'w:', // replace DOC_ROOT in filenames (in errors) using this path @@ -481,21 +480,6 @@ } /** - * Allows to overcome short error message problem in tigger_error function - * - * @param string $msg - * @return int - * @access public - */ - public function mapLongError($msg) - { - $key = $this->generateID(); - $this->longErrors[$key] = $msg; - - return $key; - } - - /** * Appends all passed variable values (without variable names) to debug output * * @return void @@ -1337,24 +1321,15 @@ private function getErrorNameByCode($error_code) { $error_map = Array ( - 'Fatal Error' => Array (E_USER_ERROR), - 'Warning' => Array (E_WARNING, E_USER_WARNING), - 'Notice' => Array (E_NOTICE, E_USER_NOTICE), + 'Fatal Error' => Array (E_RECOVERABLE_ERROR, E_USER_ERROR, E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE), + 'Warning' => Array (E_WARNING, E_USER_WARNING, E_CORE_WARNING, E_COMPILE_WARNING), + 'Notice' => Array (E_NOTICE, E_USER_NOTICE, E_STRICT), ); - if ( defined('E_STRICT') ) { - // since PHP 5 - $error_map['PHP5 Strict'] = Array (E_STRICT); - } - - if ( defined('E_RECOVERABLE_ERROR') ) { - // since PHP 5.2 - $error_map['Fatal Error (recoverable)'] = Array (E_RECOVERABLE_ERROR); - } - if ( defined('E_DEPRECATED') ) { // since PHP 5.3 - $error_map['PHP5 Depricated'] = Array (E_DEPRECATED, E_USER_DEPRECATED); + $error_map['Notice'][] = E_DEPRECATED; + $error_map['Notice'][] = E_USER_DEPRECATED; } foreach ($error_map as $error_name => $error_codes) { @@ -1429,6 +1404,13 @@ return ''; } + $last_error = error_get_last(); + + if ( !is_null($last_error) && !$this->_lastErrorProcessed ) { + $this->_lastErrorProcessed = true; + $this->saveError($last_error['type'], $last_error['message'], $last_error['file'], $last_error['line']); + } + $this->profileFinish('script_runtime'); $this->breakOutofBuffering(!$returnResult); @@ -1713,10 +1695,6 @@ $this->appendTrace(4); } - if ( DebuggerUtil::constOn('DBG_IGNORE_STRICT_ERRORS') && defined('E_STRICT') && ($errno == E_STRICT) ) { - return false; - } - $this->expandError($errstr, $errfile, $errline); $this->Data[] = Array ( @@ -1795,11 +1773,11 @@ */ private function expandError(&$errstr, &$errfile, &$errline) { - if ( preg_match('/(.*)#([\d]+)$/', $errstr, $rets) ) { - // replace short message with long one (due triger_error limitations on message size) - $long_id = $rets[2]; - $errstr = $this->longErrors[$long_id]; - unset($this->longErrors[$long_id]); + $errstr = kLogger::expandMessage($errstr); + list ($errno, $errstr, $sql) = kLogger::parseDatabaseError($errstr); + + if ( $errno != 0 ) { + $errstr = '' . $errstr . ' (' . $errno . ')
SQL: ' . $this->formatSQL($sql); } if ( strpos($errfile, 'eval()\'d code') !== false ) { @@ -1886,20 +1864,14 @@ } if ( class_exists('kApplication') ) { - // replace application error/exception handler with own - restore_error_handler(); - restore_exception_handler(); - $this->Application =& kApplication::Instance(); - $this->Application->Debugger =& $this; - - $this->Application->errorHandlers[] = Array (&$this, 'saveError'); - $this->Application->exceptionHandlers[] = Array (&$this, 'saveException'); + $this->Application->Debugger = $this; } - else { - set_error_handler( Array (&$this, 'saveError') ); - set_exception_handler( Array (&$this, 'saveException') ); - } + + // kLogger will auto-detect these automatically + // error/exception handlers registered before debugger will be removed! + set_error_handler( Array ($this, 'saveError') ); + set_exception_handler( Array ($this, 'saveException') ); } /** Index: branches/5.3.x/core/install/install_data.sql =================================================================== diff -u -N -r15576 -r15578 --- branches/5.3.x/core/install/install_data.sql (.../install_data.sql) (revision 15576) +++ branches/5.3.x/core/install/install_data.sql (.../install_data.sql) (revision 15578) @@ -89,7 +89,6 @@ INSERT INTO SystemSettings VALUES(DEFAULT, 'MailingListQueuePerStep', '10', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_config_MailingListQueuePerStep', 'text', NULL, NULL, 50.08, 0, 0, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'MailingListSendPerStep', '10', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_config_MailingListSendPerStep', 'text', NULL, NULL, 50.09, 0, 0, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'DefaultEmailRecipients', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_config_DefaultEmailRecipients', 'text', NULL, NULL, 50.10, 0, 0, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'EmailLogRotationInterval', '2419200', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_config_EmailLogRotationInterval', 'select', NULL, '=la_opt_EmailLogKeepNever||86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2419200=la_opt_OneMonth||7257600=la_opt_ThreeMonths||29030400=la_opt_OneYear||-1=la_opt_EmailLogKeepForever', 50.11, 0, 0, 'hint:la_config_EmailLogRotationInterval'); INSERT INTO SystemSettings VALUES(DEFAULT, 'UseOutputCompression', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_UseOutputCompression', 'checkbox', '', '', 60.01, 0, 1, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'OutputCompressionLevel', '7', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_OutputCompressionLevel', 'text', '', '', 60.02, 0, 1, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'UseTemplateCompression', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_UseTemplateCompression', 'checkbox', '', '', 60.03, 0, 1, NULL); @@ -99,6 +98,10 @@ INSERT INTO SystemSettings VALUES(DEFAULT, 'Backup_Path', '/home/alex/web/in-portal.rc/system/backupdata', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_backup_path', 'text', '', '', 60.07, 0, 1, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'SystemTagCache', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_prompt_syscache_enable', 'checkbox', NULL, NULL, 60.08, 0, 0, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'SocketBlockingMode', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_prompt_socket_blocking_mode', 'checkbox', NULL, NULL, 60.09, 0, 0, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'EnableEmailLog', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_EnableEmailLog', 'radio', NULL, '1=la_Yes||0=la_No', 65.01, 0, 1, 'hint:la_config_EnableEmailLog'); +INSERT INTO SystemSettings VALUES(DEFAULT, 'EmailLogRotationInterval', '2419200', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_EmailLogRotationInterval', 'select', NULL, '86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2419200=la_opt_OneMonth||7257600=la_opt_ThreeMonths||29030400=la_opt_OneYear||-1=la_opt_EmailLogKeepForever', 65.02, 0, 0, 'hint:la_config_EmailLogRotationInterval'); +INSERT INTO SystemSettings VALUES(DEFAULT, 'SystemLogRotationInterval', '2419200', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_SystemLogRotationInterval', 'select', NULL, '86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2419200=la_opt_OneMonth||7257600=la_opt_ThreeMonths||29030400=la_opt_OneYear||-1=la_opt_SystemLogKeepForever', 65.03, 0, 1, 'hint:la_config_SystemLogRotationInterval'); +INSERT INTO SystemSettings VALUES(DEFAULT, 'SystemLogNotificationEmail', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_SystemLogNotificationEmail', 'text', 'a:5:{s:4:"type";s:6:"string";s:9:"formatter";s:10:"kFormatter";s:6:"regexp";s:85:"/^([-a-zA-Z0-9!\\#$%&*+\\/=?^_`{|}~.]+@[a-zA-Z0-9]{1}[-.a-zA-Z0-9_]*\\.[a-zA-Z]{2,6})$/i";s:10:"error_msgs";a:1:{s:14:"invalid_format";s:18:"!la_invalid_email!";}s:7:"default";s:0:"";}', NULL, 65.04, 0, 1, 'hint:la_config_SystemLogNotificationEmail'); INSERT INTO SystemSettings VALUES(DEFAULT, 'CSVExportDelimiter', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsCSVExport', 'la_config_CSVExportDelimiter', 'select', NULL, '0=la_opt_Tab||1=la_opt_Comma||2=la_opt_Semicolon||3=la_opt_Space||4=la_opt_Colon', 70.01, 0, 1, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'CSVExportEnclosure', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsCSVExport', 'la_config_CSVExportEnclosure', 'radio', NULL, '0=la_Doublequotes||1=la_Quotes', 70.02, 0, 1, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'CSVExportSeparator', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsCSVExport', 'la_config_CSVExportSeparator', 'radio', NULL, '0=la_Linux||1=la_Windows', 70.03, 0, 1, NULL); @@ -183,6 +186,7 @@ INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'ROOT.RESET.PASSWORD', NULL, 1, 0, 'Core', 'Root Reset Password', 1, 1, 0); INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.EMAIL.CHANGE.VERIFY', NULL, 1, 0, 'Core', 'Changed E-mail Verification', 0, 1, 1); INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.EMAIL.CHANGE.UNDO', NULL, 1, 0, 'Core', 'Changed E-mail Rollback', 0, 1, 1); +INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'SYSTEM.LOG.NOTIFY', NULL, 1, 0, 'Core', 'Notification about message added to System Log', 1, 1, 1); INSERT INTO IdGenerator VALUES ('100'); Index: branches/5.3.x/tools/debug_sample.php =================================================================== diff -u -N -r15483 -r15578 --- branches/5.3.x/tools/debug_sample.php (.../debug_sample.php) (revision 15483) +++ branches/5.3.x/tools/debug_sample.php (.../debug_sample.php) (revision 15578) @@ -1,6 +1,6 @@ Debugger->appendMemoryUsage('Application before Init:'); } - if ( !$this->isDebugMode() && !kUtil::constOn('DBG_ZEND_PRESENT') ) { - error_reporting(0); - ini_set('display_errors', 0); - } - - if ( !kUtil::constOn('DBG_ZEND_PRESENT') ) { - $error_handler = set_error_handler(Array (&$this, 'handleError')); - if ( $error_handler ) { - // wrap around previous error handler, if any was set - $this->errorHandlers[] = $error_handler; - } - - $exception_handler = set_exception_handler(Array (&$this, 'handleException')); - if ( $exception_handler ) { - // wrap around previous exception handler, if any was set - $this->exceptionHandlers[] = $exception_handler; - } - } - + $this->_logger = new kLogger($this->_logger); $this->Factory = new $factory_class(); $this->registerDefaultClasses(); $vars = kUtil::parseConfig(true); $db_class = isset($vars['Databases']) ? 'kDBLoadBalancer' : ($this->isDebugMode() ? 'kDBConnectionDebug' : 'kDBConnection'); - $this->Conn = $this->Factory->makeClass($db_class, Array (SQL_TYPE, Array (&$this, 'handleSQLError'))); + $this->Conn = $this->Factory->makeClass($db_class, Array (SQL_TYPE, Array ($this->_logger, 'handleSQLError'))); $this->Conn->setup($vars); $this->cacheManager = $this->makeClass('kCacheManager'); @@ -752,6 +726,7 @@ $this->registerClass('kTempTablesHandler', KERNEL_PATH . '/utility/temp_handler.php'); $this->registerClass('kValidator', KERNEL_PATH . '/utility/validator.php'); $this->registerClass('kOpenerStack', KERNEL_PATH . '/utility/opener_stack.php'); + $this->registerClass('kLogger', KERNEL_PATH . '/utility/logger.php'); $this->registerClass('kUnitConfigReader', KERNEL_PATH . '/utility/unit_config_reader.php'); @@ -2385,224 +2360,15 @@ * @param string $sql * @return bool * @access public + * @throws Exception + * @deprecated */ public function handleSQLError($code, $msg, $sql) { - if ( isset($this->Debugger) ) { - $long_error_msg = '' . $msg . ' (' . $code . ')
SQL: ' . $this->Debugger->formatSQL($sql); - $long_id = $this->Debugger->mapLongError($long_error_msg); - $error_msg = mb_substr($msg . ' (' . $code . ') [' . $sql . ']', 0, 1000) . ' #' . $long_id; - - if ( kUtil::constOn('DBG_SQL_FAILURE') && !defined('IS_INSTALL') ) { - throw new Exception($error_msg); - } - else { - $this->Debugger->appendTrace(); - } - } - else { - // when not debug mode, then fatal database query won't break anything - $error_msg = 'SQL Error in sql: ' . $sql . ', code ' . $code . ' (' . $msg . ')'; - } - - trigger_error($error_msg, E_USER_WARNING); - - return true; + return $this->_logger->handleSQLError($code, $msg, $sql); } /** - * Default error handler - * - * @param int $errno - * @param string $errstr - * @param string $errfile - * @param int $errline - * @param Array $errcontext - * @return bool - * @access public - */ - public function handleError($errno, $errstr, $errfile = null, $errline = null, $errcontext = Array ()) - { - $this->errorLogSilent($errno, $errstr, $errfile, $errline); - - $debug_mode = defined('DEBUG_MODE') && DEBUG_MODE; - $skip_reporting = defined('DBG_SKIP_REPORTING') && DBG_SKIP_REPORTING; - - if ( !$this->errorHandlers || ($debug_mode && $skip_reporting) ) { - // when debugger absent OR it's present, but we actually can't see it's error report (e.g. during ajax request) - if ( $errno == E_USER_ERROR ) { - $this->errorDisplayFatal('Fatal Error: ' . "{$errstr} in {$errfile} on line {$errline}"); - } - - if ( !$this->errorHandlers ) { - return true; - } - } - - $res = false; - /* @var $handler Closure */ - - foreach ($this->errorHandlers as $handler) { - if ( is_array($handler) ) { - $object =& $handler[0]; - $method = $handler[1]; - $res = $object->$method($errno, $errstr, $errfile, $errline, $errcontext); - } - else { - $res = $handler($errno, $errstr, $errfile, $errline, $errcontext); - } - } - - return $res; - } - - /** - * Handles exception - * - * @param Exception $exception - * @return bool - * @access public - */ - public function handleException($exception) - { - // transform exception to regular error (no need to rewrite existing error handlers) - $errno = $exception->getCode(); - $errstr = $exception->getMessage(); - $errfile = $exception->getFile(); - $errline = $exception->getLine(); - - $this->errorLogSilent($errno, $errstr, $errfile, $errline); - - $debug_mode = defined('DEBUG_MODE') && DEBUG_MODE; - $skip_reporting = defined('DBG_SKIP_REPORTING') && DBG_SKIP_REPORTING; - - if ( $exception instanceof kRedirectException ) { - /* @var $exception kRedirectException */ - - $exception->run(); - } - - if ( !$this->exceptionHandlers || ($debug_mode && $skip_reporting) ) { - // when debugger absent OR it's present, but we actually can't see it's error report (e.g. during ajax request) - $this->errorDisplayFatal('' . get_class($exception) . ': ' . "{$errstr} in {$errfile} on line {$errline}"); - - if ( !$this->exceptionHandlers ) { - return true; - } - } - - $res = false; - /* @var $handler Closure */ - - foreach ($this->exceptionHandlers as $handler) { - if ( is_array($handler) ) { - $object =& $handler[0]; - $method = $handler[1]; - $res = $object->$method($exception); - } - else { - $res = $handler($exception); - } - } - - return $res; - } - - /** - * Silently saves each given error message to "silent_log.txt" file, when silent log mode is enabled - * @param int $errno - * @param string $errstr - * @param string $errfile - * @param int $errline - * @return void - * @access protected - */ - protected function errorLogSilent($errno, $errstr = '', $errfile = '', $errline = null) - { - if ( !defined('SILENT_LOG') || !SILENT_LOG ) { - return; - } - - if ( !(defined('DBG_IGNORE_STRICT_ERRORS') && DBG_IGNORE_STRICT_ERRORS && defined('E_STRICT') && ($errno == E_STRICT)) ) { - $time = adodb_date('d/m/Y H:i:s'); - - $fp = fopen((defined('RESTRICTED') ? RESTRICTED : FULL_PATH) . '/silent_log.txt', 'a'); - fwrite($fp, '[' . $time . '] #' . $errno . ': ' . strip_tags($errstr) . ' in [' . $errfile . '] on line ' . $errline . "\n"); - fclose($fp); - } - } - - /** - * Displays div with given error message - * - * @param string $msg - * @return void - * @access protected - */ - protected function errorDisplayFatal($msg) - { - $margin = $this->isAdmin ? '8px' : 'auto'; - echo '
' . $msg . '
'; - exit; - } - - /** - * Prints trace, when debug mode is not available - * - * @param bool $return_result - * @param int $skip_levels - * @return string - * @access public - */ - public function printTrace($return_result = false, $skip_levels = 1) - { - $ret = Array (); - $trace = debug_backtrace(false); - - for ($i = 0; $i < $skip_levels; $i++) { - array_shift($trace); - } - - foreach ($trace as $level => $trace_info) { - if ( isset($trace_info['class']) ) { - $object = $trace_info['class']; - } - elseif ( isset($trace_info['object']) ) { - $object = get_class($trace_info['object']); - } - else { - $object = ''; - } - - $args = ''; - $type = isset($trace_info['type']) ? $trace_info['type'] : ''; - - if ( isset($trace_info['args']) ) { - foreach ($trace_info['args'] as $argument) { - if ( is_object($argument) ) { - $args .= get_class($argument) . ' instance, '; - } - else { - $args .= is_array($argument) ? 'Array' : substr($argument, 0, 10) . ' ..., '; - } - } - - $args = substr($args, 0, -2); - } - - $ret[] = '#' . $level . ' ' . $object . $type . $trace_info['function'] . '(' . $args . ') called at [' . $trace_info['file'] . ':' . $trace_info['line'] . ']'; - } - - if ( $return_result ) { - return implode("\n", $ret); - } - - echo implode("\n", $ret); - - return ''; - } - - /** * Returns & blocks next ResourceId available in system * * @return int @@ -3219,4 +2985,38 @@ $already_set = true; header($header); } + + /** + * Posts message to event log + * + * @param string $message + * @param int $code + * @param bool $write_now Allows further customization of log record by returning kLog object + * @return bool|int|kLogger + * @access public + */ + public function log($message, $code = null, $write_now = false) + { + $log = $this->_logger->prepare($message, $code)->addSource($this->_logger->createTrace(null, 1)); + + if ( $write_now ) { + return $log->write(); + } + + return $log; + } + + /** + * Deletes log with given id from database or disk, when database isn't available + * + * @param int $unique_id + * @param int $storage_medium + * @return void + * @access public + * @throws InvalidArgumentException + */ + public function deleteLog($unique_id, $storage_medium = kLogger::LS_AUTOMATIC) + { + $this->_logger->delete($unique_id, $storage_medium); + } } \ No newline at end of file Index: branches/5.3.x/core/units/logs/email_logs/email_log_eh.php =================================================================== diff -u -N -r15483 -r15578 --- branches/5.3.x/core/units/logs/email_logs/email_log_eh.php (.../email_log_eh.php) (revision 15483) +++ branches/5.3.x/core/units/logs/email_logs/email_log_eh.php (.../email_log_eh.php) (revision 15578) @@ -1,6 +1,6 @@ Application->ConfigValue('EmailLogRotationInterval'); + $rotation_interval = (int)$this->Application->ConfigValue('EmailLogRotationInterval'); - if ( $rotation_interval == '' || $rotation_interval == -1 ) { - // never OR forever + if ( $rotation_interval === -1 ) { + // forever return; } Index: branches/5.3.x/core/install/remove_schema.sql =================================================================== diff -u -N -r15483 -r15578 --- branches/5.3.x/core/install/remove_schema.sql (.../remove_schema.sql) (revision 15483) +++ branches/5.3.x/core/install/remove_schema.sql (.../remove_schema.sql) (revision 15578) @@ -20,6 +20,7 @@ DROP TABLE UserGroupRelations; DROP TABLE UserSessions; DROP TABLE EmailLog; +DROP TABLE SystemLog; DROP TABLE SystemCache; DROP TABLE CountryStates; DROP TABLE Categories; Index: branches/5.3.x/core/kernel/db/db_connection.php =================================================================== diff -u -N -r15483 -r15578 --- branches/5.3.x/core/kernel/db/db_connection.php (.../db_connection.php) (revision 15483) +++ branches/5.3.x/core/kernel/db/db_connection.php (.../db_connection.php) (revision 15578) @@ -1,6 +1,6 @@ connectionOpened; + } + + /** * Setups the connection according given configuration * * @param Array $config Index: branches/5.3.x/core/install/upgrades.sql =================================================================== diff -u -N -r15577 -r15578 --- branches/5.3.x/core/install/upgrades.sql (.../upgrades.sql) (revision 15577) +++ branches/5.3.x/core/install/upgrades.sql (.../upgrades.sql) (revision 15578) @@ -2807,6 +2807,56 @@ INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.NEW.PASSWORD', NULL, 1, 0, 'Core', 'Sends new password to an existing user', 0, 1, 0); INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.ADD.BYADMIN', NULL, 1, 0, 'Core', 'Sends password to a new user', 0, 1, 0); +CREATE TABLE SystemLog ( + LogId int(11) NOT NULL AUTO_INCREMENT, + LogUniqueId int(11) DEFAULT NULL, + LogLevel tinyint(4) NOT NULL DEFAULT '7', + LogType tinyint(4) NOT NULL DEFAULT '3', + LogCode int(11) DEFAULT NULL, + LogMessage longtext, + LogTimestamp int(11) DEFAULT NULL, + LogDate datetime DEFAULT NULL, + LogEventName varchar(100) NOT NULL DEFAULT '', + LogHostname varchar(255) NOT NULL DEFAULT '', + LogRequestSource tinyint(4) DEFAULT NULL, + LogRequestURI varchar(255) NOT NULL DEFAULT '', + LogRequestData longtext, + LogUserId int(11) DEFAULT NULL, + LogInterface tinyint(4) DEFAULT NULL, + IpAddress varchar(15) NOT NULL DEFAULT '', + LogSessionKey int(11) DEFAULT NULL, + LogSessionData longtext, + LogBacktrace longtext, + LogSourceFilename varchar(255) NOT NULL DEFAULT '', + LogSourceFileLine int(11) DEFAULT NULL, + LogProcessId bigint(20) unsigned DEFAULT NULL, + LogMemoryUsed bigint(20) unsigned NOT NULL, + LogUserData longtext NOT NULL, + LogNotificationStatus tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (LogId), + KEY LogLevel (LogLevel), + KEY LogType (LogType), + KEY LogNotificationStatus (LogNotificationStatus) +); + +INSERT INTO SystemSettings VALUES(DEFAULT, 'EnableEmailLog', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_EnableEmailLog', 'radio', NULL, '1=la_Yes||0=la_No', 65.01, 0, 1, 'hint:la_config_EnableEmailLog'); + +UPDATE SystemSettings +SET DisplayOrder = 65.02, Heading = 'la_section_SettingsLogs', ValueList = '86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2419200=la_opt_OneMonth||7257600=la_opt_ThreeMonths||29030400=la_opt_OneYear||-1=la_opt_EmailLogKeepForever' +WHERE VariableName = 'EmailLogRotationInterval'; + +UPDATE LanguageLabels +SET + l<%PRIMARY_LANGUAGE%>_Translation = 'Keep "E-mail Log" for', + l<%PRIMARY_LANGUAGE%>_HintTranslation = 'This setting allows you to control for how long "E-mail Log" messages will be stored in the log and then automatically deleted. Use option "Forever" with caution since it will completely disable automatic log cleanup and can lead to large size of database table that stores e-mail messages.' +WHERE PhraseKey = 'LA_CONFIG_EMAILLOGROTATIONINTERVAL' AND l<%PRIMARY_LANGUAGE%>_Translation = 'Keep Email Log for'; + +DELETE FROM LanguageLabels WHERE PhraseKey = 'LA_OPT_EMAILLOGKEEPNEVER'; + +INSERT INTO SystemSettings VALUES(DEFAULT, 'SystemLogRotationInterval', '2419200', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_SystemLogRotationInterval', 'select', NULL, '86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2419200=la_opt_OneMonth||7257600=la_opt_ThreeMonths||29030400=la_opt_OneYear||-1=la_opt_SystemLogKeepForever', 65.03, 0, 1, 'hint:la_config_SystemLogRotationInterval'); +INSERT INTO SystemSettings VALUES(DEFAULT, 'SystemLogNotificationEmail', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_SystemLogNotificationEmail', 'text', 'a:5:{s:4:"type";s:6:"string";s:9:"formatter";s:10:"kFormatter";s:6:"regexp";s:85:"/^([-a-zA-Z0-9!\\#$%&*+\\/=?^_`{|}~.]+@[a-zA-Z0-9]{1}[-.a-zA-Z0-9_]*\\.[a-zA-Z]{2,6})$/i";s:10:"error_msgs";a:1:{s:14:"invalid_format";s:18:"!la_invalid_email!";}s:7:"default";s:0:"";}', NULL, 65.04, 0, 1, 'hint:la_config_SystemLogNotificationEmail'); +INSERT INTO EmailEvents (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'SYSTEM.LOG.NOTIFY', NULL, 1, 0, 'Core', 'Notification about message added to System Log', 1, 1, 1); + # ===== v 5.3.0-B1 ===== ALTER TABLE ScheduledTasks ADD Settings TEXT NULL; ALTER TABLE Themes ADD ImageResizeRules TEXT NULL; Index: branches/5.3.x/core/install/step_templates/sys_config.tpl =================================================================== diff -u -N -r15483 -r15578 --- branches/5.3.x/core/install/step_templates/sys_config.tpl (.../sys_config.tpl) (revision 15483) +++ branches/5.3.x/core/install/step_templates/sys_config.tpl (.../sys_config.tpl) (revision 15578) @@ -11,10 +11,17 @@ 'MemcacheServers' => Array ('type' => 'text', 'title' => 'Location of Memcache Servers', 'section' => 'Misc', 'default' => 'localhost:11211'), 'CompressionEngine' => Array ('type' => 'select', 'title' => 'CSS/JS Compression Engine', 'section' => 'Misc', 'default' => ''), 'WebsiteCharset' => Array ('type' => 'text', 'title' => 'Website Charset', 'section' => 'Misc', 'required' => 1, 'default' => 'utf-8'), + 'EnableSystemLog' => Array ('type' => 'radio', 'title' => 'Enable "System Log"', 'section' => 'Misc', 'required' => 1, 'default' => '0'), + 'SystemLogMaxLevel' => Array ('type' => 'select', 'title' => 'Highest "Log Level", that will be saved in "System Log"', 'section' => 'Misc', 'required' => 1, 'default' => '5'), ); $settings['CacheHandler']['options'] = $this->toolkit->getWorkingCacheHandlers(); $settings['CompressionEngine']['options'] = $this->toolkit->getWorkingCompressionEngines(); + $settings['EnableSystemLog']['options'] = Array (1 => 'Enabled', 2 => 'User-only', 0 => 'Disabled'); + $settings['SystemLogMaxLevel']['options'] = Array ( + 0 => 'emergency', 1 => 'alert', 2 => 'critical', 3 => 'error', + 4 => 'warning', 5 => 'notice', 6 => 'info', 7 => 'debug' + ); $row_class = 'table-color2'; @@ -29,26 +36,36 @@ toolkit->getSystemConfig($output_params['section'], $config_var, $output_params['default']); - if ( $output_params['type'] == 'text' ) { - echo ''; - } - else { - echo ''; + break; - if ( $output_params['options'][$config_value] == 'None' ) { - $tmp_values = array_keys($output_params['options']); + case 'select': + echo ''; + echo ''; + break; + + case 'radio': + foreach($output_params['options'] as $option_key => $option_value) { + $selected = $option_key == $config_value ? ' checked' : ''; + echo '' . $option_value; + } + break; } ?> Index: branches/5.3.x/core/kernel/utility/logger.php =================================================================== diff -u -N -r15553 -r15578 --- branches/5.3.x/core/kernel/utility/logger.php (.../5.2.x/core/kernel/utility/logger.php) (revision 15553) +++ branches/5.3.x/core/kernel/utility/logger.php (.../5.3.x/core/kernel/utility/logger.php) (revision 15578) @@ -1,6 +1,6 @@