From: Roland Häder Date: Tue, 28 Jul 2009 17:06:17 +0000 (+0000) Subject: Possible fix for #125, applied fixes from profi-concept's branch X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=7297440d795390abd70ddc339b1a81d34f76c953 Possible fix for #125, applied fixes from profi-concept's branch --- diff --git a/inc/handler.php b/inc/handler.php index 7dd84499a4..344b88a6f0 100644 --- a/inc/handler.php +++ b/inc/handler.php @@ -45,25 +45,35 @@ if (!defined('__SECURITY')) { // Error handler function function __errorHandler ($errno, $errstr, $errfile, $errline) { // Construct message - $msg = sprintf("errno=%s,errstr=%s,errfile=%s,errline=%s", - $errno, - $errstr, - basename($errfile), - $errline + $message = sprintf("errno=%s,errstr=%s,errfile=%s,errline=%s", + $errno, + $errstr, + basename($errfile), + $errline ); // Write debug log message - DEBUG_LOG(__FUNCTION__, __LINE__, "".$msg, true); + DEBUG_LOG($errfile, $errline, $message, true); // Output message to user and die if (EXT_IS_ACTIVE('debug')) { // Debug extension found! So Output a small message - app_die(__FUNCTION__, __LINE__, "Error message written to debug.log. Please try to call the main page to continue."); - } else { + app_die($errfile, $errline, "Error message written to debug.log. Please try to call the main page to continue."); + } elseif ($GLOBALS['error_handler']['exit_on_error'] === true) { // No debug extension found, so regular output - debug_report_bug($msg); + debug_report_bug($message); } } +// Init error handler +function initErrorHandler () { + enableExitOnError(false); +} + +// Enable exit on error +function enableExitOnError ($enable=true) { + $GLOBALS['error_handler']['exit_on_error'] = $enable; +} + // [EOF] ?> diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 5663a354b1..bc63f76e2c 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -272,7 +272,7 @@ function adminsEditAdminAccount ($POST) { $content['mode'] = generateOptionList('/ARRAY/', array("allow", "deny"), array(constant('ADMINS_ALLOW_MODE'), constant('ADMINS_DENY_MODE')), $content['mode']); } else { // Don't allow it - $content['mode'] = " "; + $content['mode'] = ' '; } $content['la_mode'] = generateOptionList('/ARRAY/', array("global", "OLD", "NEW"), array(ADMINS_GLOBAL_LA_SETTING, ADMINS_OLD_LA_SETTING, ADMINS_NEW_LA_SETTING), $content['la_mode']); diff --git a/inc/modules/admin/what-adminedit.php b/inc/modules/admin/what-adminedit.php index 6db7d69647..6949d19c98 100644 --- a/inc/modules/admin/what-adminedit.php +++ b/inc/modules/admin/what-adminedit.php @@ -260,16 +260,16 @@ WHERE ".$AND." AND id=%s LIMIT 1", } // Fix empty elements for constant (fixes display bugs in Firefox) - if (empty($content['action'])) $content['action'] = " "; - if (empty($content['what'])) $content['what'] = " "; - if (empty($content['title'])) $content['title'] = " "; + if (empty($content['action'])) $content['action'] = ' '; + if (empty($content['what'])) $content['what'] = ' '; + if (empty($content['title'])) $content['title'] = ' '; // Add more data to $content $content['sw'] = $SW; $content['mode'] = 'admin'; // Load row template and switch colors - $OUT .= LOAD_TEMPLATE("admin_menu_overview_row", true, $content); + $OUT .= LOAD_TEMPLATE('admin_menu_overview_row', true, $content); $SW = 3 - $SW; } // END - switch @@ -280,7 +280,7 @@ WHERE ".$AND." AND id=%s LIMIT 1", define('__MENU_ROWS', $OUT); // Load template - LOAD_TEMPLATE("admin_amenu_edit"); + LOAD_TEMPLATE('admin_amenu_edit'); } else { // Menu entries are missing... (???) LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NO_MENUS_FOUND')); diff --git a/inc/modules/admin/what-guestedit.php b/inc/modules/admin/what-guestedit.php index 96ec6ce285..8552a2354f 100644 --- a/inc/modules/admin/what-guestedit.php +++ b/inc/modules/admin/what-guestedit.php @@ -209,12 +209,12 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) 'menu' => $menu, 'sel' => $sel, 'sw' => $SW, - 'visible' => ADD_SELECTION('yn', $vis , "visible", $sel), - 'locked' => ADD_SELECTION('yn', $locked, "locked" , $sel), + 'visible' => ADD_SELECTION('yn', $vis , 'visible', $sel), + 'locked' => ADD_SELECTION('yn', $locked, 'locked' , $sel), ); // Load template - $OUT .= LOAD_TEMPLATE("admin_menu_status_row", true, $content); + $OUT .= LOAD_TEMPLATE('admin_menu_status_row', true, $content); } else { @@ -223,7 +223,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) 'sw' => $SW, 'sel' => $sel ); - $OUT .= LOAD_TEMPLATE("admin_menu_404_row", true, $content); + $OUT .= LOAD_TEMPLATE('admin_menu_404_row', true, $content); } $SW = 3 - $SW; } @@ -232,7 +232,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) define('__MENU_ROWS', $OUT); // Load template - LOAD_TEMPLATE("admin_gmenu_status"); + LOAD_TEMPLATE('admin_gmenu_status'); } else { if ((REQUEST_ISSET_GET(('act'))) && (REQUEST_ISSET_GET(('tid'))) && (REQUEST_ISSET_GET(('fid')))) { // Get IDs @@ -303,9 +303,9 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) $NAVI = "{--HIGHER--}/{--LOWER--}"; } - if (empty($content['action'])) $content['action'] = " "; - if (empty($content['what'])) $content['what'] = " "; - if (empty($content['title'])) $content['title'] = " "; + if (empty($content['action'])) $content['action'] = ' '; + if (empty($content['what'])) $content['what'] = ' '; + if (empty($content['title'])) $content['title'] = ' '; $content = array( 'sw' => $SW, @@ -316,7 +316,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) 'navi' => $NAVI, 'mode' => 'guest' ); - $OUT .= LOAD_TEMPLATE("admin_menu_overview_row", true, $content); + $OUT .= LOAD_TEMPLATE('admin_menu_overview_row', true, $content); $SW = 3 - $SW; } @@ -325,7 +325,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) define('__MENU_ROWS', $OUT); // Load template - LOAD_TEMPLATE("admin_gmenu_edit"); + LOAD_TEMPLATE('admin_gmenu_edit'); } else { // Menu entries are missing... (???) LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NO_MENUS_FOUND')); diff --git a/inc/modules/admin/what-list_transfer.php b/inc/modules/admin/what-list_transfer.php index dd2a3cdf92..16720437e9 100644 --- a/inc/modules/admin/what-list_transfer.php +++ b/inc/modules/admin/what-list_transfer.php @@ -48,8 +48,7 @@ ADD_DESCR('admin', __FILE__); // We only need outgoing transfers $result = SQL_QUERY("SELECT userid, to_uid, trans_id, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_out` ORDER BY trans_id", __FILE__, __LINE__); $total = 0; -if (SQL_NUMROWS($result) > 0) -{ +if (SQL_NUMROWS($result) > 0) { // Output rows $OUT = ''; $SW = 2; while ($content = SQL_FETCHARRAY($result)) { @@ -65,15 +64,13 @@ if (SQL_NUMROWS($result) > 0) ); // Load row template add points and switch color - $OUT .= LOAD_TEMPLATE("admin_list_transfer_row", true, $content); + $OUT .= LOAD_TEMPLATE('admin_list_transfer_row', true, $content); $total += $content['points']; $SW = 3 - $SW; } // Free memory SQL_FREERESULT($result); -} -else -{ +} else { // Nothing for in and out $OUT = " @@ -96,10 +93,10 @@ define('__TRANSFER_TITLE', getMessage('TRANSFER_LIST_ALL')); define('__TRANSFER_SUM', getMessage('TRANSFER_TOTAL_BALANCE')); // Don't show a delete button -define('__TRANSFER_DELETE', " "); +define('__TRANSFER_DELETE', ' '); // Load final template -LOAD_TEMPLATE("admin_list_transfer"); +LOAD_TEMPLATE('admin_list_transfer'); // ?> diff --git a/inc/modules/admin/what-memedit.php b/inc/modules/admin/what-memedit.php index 40173a3b41..e629c93659 100644 --- a/inc/modules/admin/what-memedit.php +++ b/inc/modules/admin/what-memedit.php @@ -152,12 +152,12 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) { 'menu' => $menu, 'sel' => $sel, 'sw' => $SW, - 'visible' => ADD_SELECTION('yn', $vis , "visible", $sel), - 'locked' => ADD_SELECTION('yn', $locked, "locked" , $sel), + 'visible' => ADD_SELECTION('yn', $vis , 'visible', $sel), + 'locked' => ADD_SELECTION('yn', $locked, 'locked' , $sel), ); // Load template - $OUT .= LOAD_TEMPLATE("admin_menu_status_row", true, $content); + $OUT .= LOAD_TEMPLATE('admin_menu_status_row', true, $content); } else { @@ -166,7 +166,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) { 'sw' => $SW, 'sel' => $sel ); - $OUT .= LOAD_TEMPLATE("admin_menu_404_row", true, $content); + $OUT .= LOAD_TEMPLATE('admin_menu_404_row', true, $content); } $SW = 3 - $SW; } @@ -174,7 +174,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) { define('__MENU_ROWS', $OUT); define('__CNT_VALUE', $cnt); // - LOAD_TEMPLATE("admin_mmenu_status"); + LOAD_TEMPLATE('admin_mmenu_status'); } elseif ((isFormSent()) && (!IS_DEMO())) { // An act is done... foreach (REQUEST_POST('sel') as $sel => $menu) { @@ -269,16 +269,16 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) { } // Fix empty values for Firefox - if (empty($content['action'])) $content['action'] = " "; - if (empty($content['what'])) $content['what'] = " "; - if (empty($content['title'])) $content['title'] = " "; + if (empty($content['action'])) $content['action'] = ' '; + if (empty($content['what'])) $content['what'] = ' '; + if (empty($content['title'])) $content['title'] = ' '; // Add more entries $content['sw'] = $SW; - $content['mode'] = "mem"; + $content['mode'] = 'mem'; // Load row template and switch color - $OUT .= LOAD_TEMPLATE("admin_menu_overview_row", true, $content); + $OUT .= LOAD_TEMPLATE('admin_menu_overview_row', true, $content); $SW = 3 - $SW; } @@ -289,7 +289,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) { define('__MENU_ROWS', $OUT); // Load main template - LOAD_TEMPLATE("admin_mmenu_overview"); + LOAD_TEMPLATE('admin_mmenu_overview'); } else { // Menu entries are missing... (???) LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NO_MENUS_FOUND')); diff --git a/inc/modules/admin/what-refbanner.php b/inc/modules/admin/what-refbanner.php index cbeb3d53d4..cab32b9311 100644 --- a/inc/modules/admin/what-refbanner.php +++ b/inc/modules/admin/what-refbanner.php @@ -116,11 +116,11 @@ VALUES ('%s','%s','%s')", 'id' => $id, 'url' => $url, 'alt' => $alt, - 'vis' => ADD_SELECTION('yn', $vis , "visible"), + 'vis' => ADD_SELECTION('yn', $vis , 'visible'), ); // Load row template and switch color - $OUT .= LOAD_TEMPLATE("admin_refbanner_edit_row", true, $content); + $OUT .= LOAD_TEMPLATE('admin_refbanner_edit_row', true, $content); $SW = 3 - $SW; } @@ -128,19 +128,20 @@ VALUES ('%s','%s','%s')", define('__BANNER_ROWS', $OUT); // Load main template - LOAD_TEMPLATE("admin_refbanner_edit"); + LOAD_TEMPLATE('admin_refbanner_edit'); } else { if (($SEL > 0) && (REQUEST_ISSET_POST('del'))) { // Delete banner foreach (REQUEST_POST('sel') as $id => $sel) { SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE `id`=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__); - } - } + } // END - foreach + } // END - if // Referal levels - $result = SQL_QUERY("SELECT id, url, alternate, visible, counter, clicks FROM `{!_MYSQL_PREFIX!}_refbanner` ORDER BY url", - __FILE__, __LINE__); + $result = SQL_QUERY("SELECT id, url, alternate, visible, counter, clicks FROM `{!_MYSQL_PREFIX!}_refbanner` ORDER BY url", __FILE__, __LINE__); + + // Entries found? if (SQL_NUMROWS($result) > 0) { // Make referal banner editable and deletable $OUT = ''; $SW = 2; @@ -169,11 +170,11 @@ VALUES ('%s','%s','%s')", define('__BANNER_ROWS', $OUT); // Load main template - LOAD_TEMPLATE("admin_refbanner"); + LOAD_TEMPLATE('admin_refbanner'); } // Form for adding new referal levels - LOAD_TEMPLATE("admin_add_banner"); + LOAD_TEMPLATE('admin_add_banner'); } // diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index 446518563a..5ad12fcb5d 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -57,6 +57,9 @@ foreach (array('request-functions', 'session-functions', 'config-functions', 'co // Set error handler set_error_handler('__errorHandler'); +// Init error handler +initErrorHandler(); + // Init request initRequest(); @@ -87,6 +90,9 @@ if ((!isInstalling()) && (isInstalled())) { // Is the link valid? if (SQL_IS_LINK_UP()) { + // Enable exit on error + enableExitOnError(); + // Is it a valid resource? if (SQL_SELECT_DB($GLOBALS['mysql']['dbase'], __FILE__, __LINE__) === true) { // This is required for extension 'optimize' to work diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 6d8037fa6c..84c5fd08fc 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -128,7 +128,7 @@ function checkModulePermissions ($mod) { } // END - if // Major error in module registry is the default - $ret = "major"; + $ret = 'major'; // Check if script is installed if not return a 'done' to prevent some errors if ((!isInstalled()) || (isInstalling()) || (!isAdminRegistered())) { @@ -147,8 +147,8 @@ function checkModulePermissions ($mod) { if (GET_EXT_VERSION('cache') >= '0.1.2') { // Is the cache there? if (!isset($GLOBALS['cache_array']['modules'])) { - // This should normally not happen... - debug_report_bug("Cache 'modules' is gone."); + // This happens when a new extension is registered while ext-cache is installed + $ret = 'cache_miss'; } // END - if // Is the module cached? @@ -164,7 +164,7 @@ function checkModulePermissions ($mod) { $found = true; } else { // No, then we have to update it! - $ret = "cache_miss"; + $ret = 'cache_miss'; } } elseif (!EXT_IS_ACTIVE('cache')) { // Check for module in database @@ -188,13 +188,13 @@ function checkModulePermissions ($mod) { $ret = 'done'; } elseif ($locked == 'Y') { // Module is locked - $ret = "locked"; + $ret = 'locked'; } elseif (($mem == 'Y') && (!IS_MEMBER())) { // You have to login first! - $ret = "mem_only"; + $ret = 'mem_only'; } elseif (($admin == 'Y') && (!IS_ADMIN())) { // Only the Admin is allowed to enter this module! - $ret = "admin_only"; + $ret = 'admin_only'; } else { // @TODO Nothing helped??? DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("ret=%s,locked=%s,admin=%s,mem=%s", @@ -207,7 +207,7 @@ function checkModulePermissions ($mod) { } // END - if // Still no luck or not found? - if (($ret == "cache_miss") || (!$found)) { + if (($ret == 'cache_miss') || (!$found)) { // ----- Legacy module ----- ---- Module in base folder ---- --- Module with extension's name --- if ((isFileReadable(sprintf("%sinc/modules/%s.php", constant('PATH'), $mod))) || (isFileReadable(sprintf("%s%s.php", constant('PATH'), $mod))) || (isFileReadable(sprintf("%s%s/%s.php", constant('PATH'), $extension, $mod)))) { // Data is missing so we add it @@ -227,11 +227,11 @@ function checkModulePermissions ($mod) { // Everthing is fine? if (SQL_AFFECTEDROWS() < 1) { // Something bad happend! - return "major"; + return 'major'; } // END - if // Destroy cache here - rebuildCacheFiles("modreg", "modreg"); + rebuildCacheFiles('modreg', 'modreg'); // And reload data $ret = checkModulePermissions($mod_chk); @@ -266,7 +266,7 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) { $AND = ''; // First we have to do some analysis... - if (substr($file, 0, 7) == "action-") { + if (substr($file, 0, 7) == 'action-') { // This is an action file! $type = 'action'; $search = substr($file, 7); @@ -282,7 +282,7 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) { break; } $AND = " AND (`what`='' OR `what` IS NULL)"; - } elseif (substr($file, 0, 5) == "what-") { + } elseif (substr($file, 0, 5) == 'what-') { // This is an admin what file! $type = 'what'; $search = substr($file, 5); diff --git a/templates/de/html/admin/admin_next_link.tpl b/templates/de/html/admin/admin_next_link.tpl index 2f6fb8b7d5..267f380ccf 100644 --- a/templates/de/html/admin/admin_next_link.tpl +++ b/templates/de/html/admin/admin_next_link.tpl @@ -2,7 +2,7 @@
diff --git a/templates/de/html/show_timings.tpl b/templates/de/html/show_timings.tpl index 71ee3df14b..a3cbea352e 100644 --- a/templates/de/html/show_timings.tpl +++ b/templates/de/html/show_timings.tpl @@ -3,10 +3,10 @@
  • {--SHOW_TIMINGS_RUNTIME--} $content[runtime] {--SHOW_TIMINGS_SECS--}
  • -
  • +
  • {--SHOW_TIMINGS_SQL_QUERIES--} $content[numSQLs]
  • -
  • +
  • {--SHOW_TIMINGS_NUM_TEMPLATES--} $content[numTemplates]