From cc7c700143bca2420ff0497e648d31a18cc9add2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 22 Feb 2009 20:40:00 +0000 Subject: [PATCH] Ticket resolved, code rewrites and caching: - Resolves ticket #90 - Caching added to prevent some queries - Some code cleanups - TODOs added --- beg.php | 1 + birthday_confirm.php | 2 +- inc/autopurge/purge-general.php | 2 +- inc/autopurge/purge-inact.php | 2 +- inc/autopurge/purge-mails.php | 2 +- inc/autopurge/purge-tsks.php | 2 +- inc/autopurge/purge-unconfirmed.php | 2 +- inc/doubler_send.php | 2 +- inc/extensions/ext-autopurge.php | 2 +- inc/extensions/ext-bonus.php | 2 +- inc/extensions/ext-newsletter.php | 2 +- inc/extensions/ext-profile.php | 2 +- inc/functions.php | 16 +-- inc/libs/beg_functions.php | 2 +- inc/libs/bonus_functions.php | 4 +- inc/libs/wernis_functions.php | 2 +- inc/load_extensions.php | 2 +- inc/modules/admin/what-config_autopurge.php | 2 +- inc/modules/admin/what-config_order.php | 6 +- inc/modules/admin/what-config_other.php | 8 +- inc/modules/admin/what-unlock_emails.php | 2 +- inc/modules/guest/what-register.php | 5 +- inc/modules/member/what-order.php | 6 +- inc/modules/member/what-points.php | 2 +- inc/modules/member/what-refback.php | 2 +- inc/monthly/monthly_beg.php | 4 +- inc/mysql-manager.php | 132 ++++++++++++-------- inc/profile-updte.php | 20 ++- inc/stylesheet.php | 16 +-- mailid_top.php | 2 +- modules.php | 6 +- 31 files changed, 144 insertions(+), 118 deletions(-) diff --git a/beg.php b/beg.php index ccf6edf252..5f68fbc761 100644 --- a/beg.php +++ b/beg.php @@ -191,6 +191,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { // Tracker code enabled? (We don't track users here! if ((getConfig('beg_pay_mode') != "NONE") && ($pay)) { // Prepare content for template + // @TODO Opps, what is missing here??? $content = array( ); diff --git a/birthday_confirm.php b/birthday_confirm.php index ca7d8243be..25e737196b 100644 --- a/birthday_confirm.php +++ b/birthday_confirm.php @@ -76,7 +76,7 @@ WHERE b.userid=%s AND b.chk_value='%s' LIMIT 1", if ($data['status'] == "CONFIRMED") { // Set mode depending on how many mails the member has to confirm $locked = false; - if (($data['ref_payout'] > 0) && (getConfig('allow_direct_pay') == "N")) $locked = true; + if (($data['ref_payout'] > 0) && (getConfig('allow_direct_pay') != "Y")) $locked = true; // Add points to account unset($GLOBALS['ref_level']); diff --git a/inc/autopurge/purge-general.php b/inc/autopurge/purge-general.php index a11fc14b33..782b69d6f0 100644 --- a/inc/autopurge/purge-general.php +++ b/inc/autopurge/purge-general.php @@ -39,7 +39,7 @@ if (!defined('__SECURITY')) { } // Abort if autopurge is not active or disabled by admin -if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') == "N")) { +if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) { // Abort here return false; } diff --git a/inc/autopurge/purge-inact.php b/inc/autopurge/purge-inact.php index bcf5a92470..c015fc56da 100644 --- a/inc/autopurge/purge-inact.php +++ b/inc/autopurge/purge-inact.php @@ -38,7 +38,7 @@ if (!defined('__SECURITY')) { } // END - if // Abort if autopurge is not active or disabled by admin -if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') == "N")) { +if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) { // Abort here return false; } // END - if diff --git a/inc/autopurge/purge-mails.php b/inc/autopurge/purge-mails.php index d1aeb1d3de..7d5de27783 100644 --- a/inc/autopurge/purge-mails.php +++ b/inc/autopurge/purge-mails.php @@ -38,7 +38,7 @@ if (!defined('__SECURITY')) { } // END - if // Abort if autopurge is not active or disabled by admin -if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') == "N")) { +if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) { // Abort here return false; } // END - if diff --git a/inc/autopurge/purge-tsks.php b/inc/autopurge/purge-tsks.php index 07dbc704c5..dde1e7c77e 100644 --- a/inc/autopurge/purge-tsks.php +++ b/inc/autopurge/purge-tsks.php @@ -38,7 +38,7 @@ if (!defined('__SECURITY')) { } // END - if // Abort if autopurge is not active or disabled by admin -if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') == "N")) { +if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) { // Abort here return false; } // END - if diff --git a/inc/autopurge/purge-unconfirmed.php b/inc/autopurge/purge-unconfirmed.php index c8e1c68f38..baa56db400 100644 --- a/inc/autopurge/purge-unconfirmed.php +++ b/inc/autopurge/purge-unconfirmed.php @@ -38,7 +38,7 @@ if (!defined('__SECURITY')) { } // END - if // Abort if autopurge is not active or disabled by admin -if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') == "N")) { +if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) { // Abort here return false; } // END - if diff --git a/inc/doubler_send.php b/inc/doubler_send.php index 1fd505799d..75e73ca3d7 100644 --- a/inc/doubler_send.php +++ b/inc/doubler_send.php @@ -72,7 +72,7 @@ ORDER BY d.timemark LIMIT %d", array($DOUBLER_POINTS, $min, getConfig('doubler_max_sent')), __FILE__, __LINE__); // Do we have entries found? -if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == "Y")) || ((SQL_NUMROWS($result_main) == getConfig('doubler_group_sent')) && (getConfig('doubler_sent_all') == "N"))) { +if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == "Y")) || ((SQL_NUMROWS($result_main) == getConfig('doubler_group_sent')) && (getConfig('doubler_sent_all') != "Y"))) { // Switch to matching SQL resource $result_load = $result_main; if ((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == "Y")) $result_load = $result_total; diff --git a/inc/extensions/ext-autopurge.php b/inc/extensions/ext-autopurge.php index 9c46b91e5a..d876c0188b 100644 --- a/inc/extensions/ext-autopurge.php +++ b/inc/extensions/ext-autopurge.php @@ -254,7 +254,7 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha default: // Do stuff when extension is loaded // Do we have a daily-reset-run? - if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) + if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($CSS != 1)) { // Yes, we have. So let's auto-purge some campaigns, inactive users and unconfirmed accounts $INC_POOL[] = sprintf("%sinc/autopurge.php", constant('PATH')); diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index 0bcddc787e..8fad3e4797 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -546,7 +546,7 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha break; default: // Do stuff when extension is loaded - if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) { + if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($CSS != 1)) { // Daily reset was run so let's check if active rallye is activated if (getConfig('bonus_active') == "Y") { // Run active rallye diff --git a/inc/extensions/ext-newsletter.php b/inc/extensions/ext-newsletter.php index 5810b4e1f0..daaf75603e 100644 --- a/inc/extensions/ext-newsletter.php +++ b/inc/extensions/ext-newsletter.php @@ -168,7 +168,7 @@ default: // Do stuff when extension is loaded '2','3','4','5','6','7','8','9' ); - if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) { + if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($CSS != 1)) { // Daily reset was run so let's check out for expired newsletter orders $INC_POOL[] = sprintf("%sinc/monthly/monthly_newsletter.php", constant('PATH')); } diff --git a/inc/extensions/ext-profile.php b/inc/extensions/ext-profile.php index ae60910112..6d2805798f 100644 --- a/inc/extensions/ext-profile.php +++ b/inc/extensions/ext-profile.php @@ -123,7 +123,7 @@ case "test": // For testing purposes. For details see file inc/modules/admin/wha default: // Do stuff when extension is loaded // Do we have a daily-reset-run? - if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) { + if (isBooleanConstantAndTrue('__DAILY_RESET') && (!isBooleanConstantAndTrue('DEBUG_MODE')) && ($CSS != 1)) { // So let's check for profiles which needs an update $INC_POOL[] = sprintf("%sinc/profile-updte.php", constant('PATH')); } diff --git a/inc/functions.php b/inc/functions.php index 2ee2e1e264..74cef54935 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -145,7 +145,7 @@ function OUTPUT_HTML ($HTML, $newLine = true) { // Was that eval okay? if (empty($newContent)) { // Something went wrong! - die("Evaluation error:
".htmlentities($eval)."
"); + mxchange_die("Evaluation error:
".htmlentities($eval)."
"); } // END - if $OUTPUT = $newContent; } // END - while @@ -853,22 +853,22 @@ function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") { $tmpl_file = addslashes($tmpl_file); // Run code - $tmpl_file = "\$newContent=html_entity_decode(\"".COMPILE_CODE($tmpl_file)."\");"; + $tmpl_file = "\$newContent = html_entity_decode(\"".COMPILE_CODE($tmpl_file)."\");"; @eval($tmpl_file); } elseif (!empty($template)) { // Template file not found! - $newContent = TEMPLATE_404.": ".$template."
-".TEMPLATE_CONTENT." + $newContent = "{!TEMPLATE_404!}: ".$template."
+{!TEMPLATE_CONTENT!}
".print_r($content, true)."
-".TEMPLATE_DATA." +{!TEMPLATE_DATA!}
".print_r($DATA, true)."


"; // Debug mode not active? Then remove the HTML tags - if (!DEBUG_MODE) $newContent = strip_tags($newContent); + if (!isBooleanConstantAndTrue('DEBUG_MODE')) $newContent = strip_tags($newContent); } else { // No template name supplied! - $newContent = NO_TEMPLATE_SUPPLIED; + $newContent = getMessage('NO_TEMPLATE_SUPPLIED'); } // Is there some content? @@ -2638,7 +2638,7 @@ function CACHE_PURGE_ADMIN_MENU ($id=0, $action="", $what="", $str="") { // No cache instance! DEBUG_LOG(__FUNCTION__, __LINE__, " No cache instance found."); return false; - } elseif ((!isConfigEntrySet('cache_admin_menu')) || (getConfig('cache_admin_menu') == "N")) { + } elseif ((!isConfigEntrySet('cache_admin_menu')) || (getConfig('cache_admin_menu') != "Y")) { // Caching disabled (currently experiemental!) return false; } diff --git a/inc/libs/beg_functions.php b/inc/libs/beg_functions.php index fdadd1a116..62e5949ba1 100644 --- a/inc/libs/beg_functions.php +++ b/inc/libs/beg_functions.php @@ -43,7 +43,7 @@ function BEG_ADD_POINTS ($uid, $points) { // Set mode depending on how many mails the member has to confirm $locked = false; - if ((getConfig('ref_payout') > 0) && (getConfig('allow_direct_pay') == "N")) $locked = true; + if ((getConfig('ref_payout') > 0) && (getConfig('allow_direct_pay') != "Y")) $locked = true; // Is begging rallye active? if (getConfig('beg_rallye') == "Y") { diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php index 5ceee13249..b5ea9b2b9f 100644 --- a/inc/libs/bonus_functions.php +++ b/inc/libs/bonus_functions.php @@ -42,7 +42,7 @@ function BONUS_ADD_TURBO_POINTS($mid, $uid, $type) { global $_CONFIG; // Shall we add bonus points? - if (getConfig('bonus_active') == "N") return false; + if (getConfig('bonus_active') != "Y") return false; // Init variables $SQL = ""; $bonys = 0; $mail = 0; $column = ""; @@ -191,7 +191,7 @@ function BONUS_POINTS_HANDLER ($MODE) { global $_CONFIG; // Shall we add bonus points? - if (getConfig('bonus_active') == "N") return; + if (getConfig('bonus_active') != "Y") return; // Switch to jackpot-mode when no UID is supplied but userid-mode is selected if ((getConfig('bonus_mode') == "UID") && (getConfig('bonus_uid') == "0")) { diff --git a/inc/libs/wernis_functions.php b/inc/libs/wernis_functions.php index 7809ce6461..e8e6d9a59b 100644 --- a/inc/libs/wernis_functions.php +++ b/inc/libs/wernis_functions.php @@ -210,7 +210,7 @@ function WERNIS_TEST_API () { // Widthdraw this amount function WERNIS_EXECUTE_WITHDRAW ($wdsId, $userMd5, $amount) { // Is the sponsor extension installed? - if (getConfig('wernis_withdraw_active') == "N") { + if (getConfig('wernis_withdraw_active') != "Y") { if (!EXT_IS_ACTIVE("sponsor")) { // No, abort here return false; diff --git a/inc/load_extensions.php b/inc/load_extensions.php index f77b7c7242..dd92ec8e18 100644 --- a/inc/load_extensions.php +++ b/inc/load_extensions.php @@ -72,7 +72,7 @@ if (EXT_IS_ACTIVE("cache")) { // Init cache file $cacheInstance->init("EXTENSIONS"); $cacheInstance->storeExtensionVersion("sql_patches"); - } elseif (getConfig('cache_exts') == "N") { + } elseif (getConfig('cache_exts') != "Y") { // Cache will not be created for extensions $cacheMode = "skip"; } diff --git a/inc/modules/admin/what-config_autopurge.php b/inc/modules/admin/what-config_autopurge.php index b55200c1a2..cea9d4cb81 100644 --- a/inc/modules/admin/what-config_autopurge.php +++ b/inc/modules/admin/what-config_autopurge.php @@ -65,7 +65,7 @@ if (isset($_POST['ok'])) { // Mail confirmation links define('_CFG_AUTO_PURGE', CREATE_TIME_SELECTIONS(getConfig('auto_purge'), "auto_purge", "MWD")); - if (getConfig('auto_purge_active') == "N") { + if (getConfig('auto_purge_active') != "Y") { define('_CFG_AP_ACTIVE_N', " checked=\"checked\""); define('_CFG_AP_ACTIVE_Y', ""); } else { diff --git a/inc/modules/admin/what-config_order.php b/inc/modules/admin/what-config_order.php index 04febbd6ea..dbf9e3075a 100644 --- a/inc/modules/admin/what-config_order.php +++ b/inc/modules/admin/what-config_order.php @@ -79,7 +79,7 @@ if (isset($_POST['ok'])) { define('_CFG_UNCONFIRMED' , getConfig('unconfirmed')); define('_CFG_MAX_TLENGTH' , getConfig('max_tlength')); - if (getConfig('test_text') == "N") { + if (getConfig('test_text') != "Y") { define('_CFG_TEST_TEXT_N', " checked=\"checked\""); define('_CFG_TEST_TEXT_Y', ""); } else { @@ -107,7 +107,7 @@ if (isset($_POST['ok'])) { break; } - if (getConfig('test_subj') == "N") { + if (getConfig('test_subj') != "Y") { define('_CFG_TEST_SUBJ_N', " checked=\"checked\""); define('_CFG_TEST_SUBJ_Y', ""); } else { @@ -115,7 +115,7 @@ if (isset($_POST['ok'])) { define('_CFG_TEST_SUBJ_Y', " checked=\"checked\""); } - if (getConfig('url_blacklist') == "N") { + if (getConfig('url_blacklist') != "Y") { define('_CFG_URL_BLIST_N', " checked=\"checked\""); define('_CFG_URL_BLIST_Y', ""); } else { diff --git a/inc/modules/admin/what-config_other.php b/inc/modules/admin/what-config_other.php index 58fe215f3a..d73a2f793d 100644 --- a/inc/modules/admin/what-config_other.php +++ b/inc/modules/admin/what-config_other.php @@ -86,7 +86,7 @@ if (isset($_POST['ok'])) { define('_CFG_PROFILE_UPDATE', CREATE_TIME_SELECTIONS(getConfig('profile_update'), "profile_update" , "YM")); define('_CFG_PROF_REUPDATE' , CREATE_TIME_SELECTIONS(getConfig('resend_profile_update') , "resend_profile_update", "MWD")); - if (getConfig('order_multi_page') == "N") { + if (getConfig('order_multi_page') != "Y") { define('_CFG_ORDER_MULTI_N', " checked=\"checked\""); define('_CFG_ORDER_MULTI_Y', ""); } else { @@ -94,7 +94,7 @@ if (isset($_POST['ok'])) { define('_CFG_ORDER_MULTI_Y', " checked=\"checked\""); } - if (getConfig('autosend_active') == "N") { + if (getConfig('autosend_active') != "Y") { define('_CFG_AUTOSEND_ACTIVE_N', " checked=\"checked\""); define('_CFG_AUTOSEND_ACTIVE_Y', ""); } else { @@ -102,7 +102,7 @@ if (isset($_POST['ok'])) { define('_CFG_AUTOSEND_ACTIVE_Y', " checked=\"checked\""); } - if (getConfig('send_prof_update') == "N") { + if (getConfig('send_prof_update') != "Y") { define('_CFG_SEND_UPDATE_N', " checked=\"checked\""); define('_CFG_SEND_UPDATE_Y', ""); } else { @@ -110,7 +110,7 @@ if (isset($_POST['ok'])) { define('_CFG_SEND_UPDATE_Y', " checked=\"checked\""); } - if (getConfig('admin_notify') == "N") { + if (getConfig('admin_notify') != "Y") { define('_CFG_ADMIN_NOTIFY_N', " checked=\"checked\""); define('_CFG_ADMIN_NOTIFY_Y', ""); } else { diff --git a/inc/modules/admin/what-unlock_emails.php b/inc/modules/admin/what-unlock_emails.php index b47c51cf42..e1f53a777f 100644 --- a/inc/modules/admin/what-unlock_emails.php +++ b/inc/modules/admin/what-unlock_emails.php @@ -227,7 +227,7 @@ LIMIT 1", // Load main template LOAD_TEMPLATE("admin_unlock_emails"); - } elseif ((isset($_POST['lock'])) && (getConfig('url_blacklist') == "N")) { + } elseif ((isset($_POST['lock'])) && (getConfig('url_blacklist') != "Y")) { // URL blacklist not activated LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_URL_BLACKLIST_DISABLED')); } else { diff --git a/inc/modules/guest/what-register.php b/inc/modules/guest/what-register.php index 7cf8158ed9..ba46619ea6 100644 --- a/inc/modules/guest/what-register.php +++ b/inc/modules/guest/what-register.php @@ -195,11 +195,12 @@ if ((isset($_POST['ok'])) && ((!$FAILED) || (IS_ADMIN()))) { } // END - if // Check if I shall disable sending mail to newly registered members out about active/begging rallye + // @TODO Rewrite this to a single filter // // First comes first: begging rallye if (GET_EXT_VERSION("beg") >= "0.1.7") { // Okay, shall I disable now? - if (getConfig('beg_new_mem_notify') == "N") { + if (getConfig('beg_new_mem_notify') != "Y") { $ADD1 .= ", beg_ral_notify, beg_ral_en_notify"; $ADD2 .= ", UNIX_TIMESTAMP(), UNIX_TIMESTAMP()"; } // END - if @@ -208,7 +209,7 @@ if ((isset($_POST['ok'])) && ((!$FAILED) || (IS_ADMIN()))) { // Second: active rallye if (GET_EXT_VERSION("bonus") >= "0.7.7") { // Okay, shall I disable now? - if (getConfig('bonus_new_mem_notify') == "N") { + if (getConfig('bonus_new_mem_notify') != "Y") { $ADD1 .= ", bonus_ral_notify, bonus_ral_en_notify"; $ADD2 .= ", UNIX_TIMESTAMP(), UNIX_TIMESTAMP()"; } // END - if diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index ae81c82614..c82794c250 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -147,7 +147,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1", list($blist) = SQL_FETCHROW($result); // Create redirect-URL - $URL = "modules.php?module=login&what=order&msg=".constant('CODE_BLIST_URL')."&blist=".$blist; + $URL = "modules.php?module=login&what=order&msg=".constant('CODE_BLIST_URL')."&blist=".$blist; } // END - if // Free result @@ -616,8 +616,8 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__); // Free result SQL_FREERESULT($result); - // 01 2 21 12 2 23 443 3 3210 - if ((!empty($_POST['data'])) || ((getConfig('order_multi_page') == "N") && ((!IS_ADMIN()) && (!EXT_IS_ACTIVE("html_mail"))))) { + // 01 2 21 12 2 23 443 3 3210 + if ((!empty($_POST['data'])) || ((getConfig('order_multi_page') != "Y") && ((!IS_ADMIN()) && (!EXT_IS_ACTIVE("html_mail"))))) { // Pre-output categories $CAT = ""; foreach ($CATS['id'] as $key => $value) { diff --git a/inc/modules/member/what-points.php b/inc/modules/member/what-points.php index da7b330b7f..ebbf566f0a 100644 --- a/inc/modules/member/what-points.php +++ b/inc/modules/member/what-points.php @@ -168,7 +168,7 @@ if ((GET_EXT_VERSION("bonus") >= "0.2.2") && (EXT_IS_ACTIVE("bonus")) && (getCon // Output rows define('__SPECIAL_ROWS', LOAD_TEMPLATE("member_points_bonus_rows", true)); -} elseif (getConfig('bonus_active') == "N") { +} elseif (getConfig('bonus_active') != "Y") { // Bonus active rallye deactivated define('__SPECIAL_ROWS', LOAD_TEMPLATE("member_points_bonus_disabled", true)); } elseif ((IS_ADMIN()) && (EXT_VERSION_IS_OLDER("bonus", "0.2.2")) && (EXT_IS_ACTIVE("bonus"))) { diff --git a/inc/modules/member/what-refback.php b/inc/modules/member/what-refback.php index e751a5a9d2..687b45b9df 100644 --- a/inc/modules/member/what-refback.php +++ b/inc/modules/member/what-refback.php @@ -44,7 +44,7 @@ if (!defined('__SECURITY')) { } // Is the refback system enabled? -if (getConfig('refback_enabled') == "N") { +if (getConfig('refback_enabled') != "Y") { // Output message LOAD_TEMPLATE("admin_settings_saved", false, getMessage('MEMBER_REFBACK_DISABLED')); // Abort here diff --git a/inc/monthly/monthly_beg.php b/inc/monthly/monthly_beg.php index 17a38d2a8b..292eb5befc 100644 --- a/inc/monthly/monthly_beg.php +++ b/inc/monthly/monthly_beg.php @@ -40,7 +40,7 @@ if (!defined('__SECURITY')) { } // Do not execute when script is in CSS mode or no daily reset -if (($CSS == 1) || (!defined('__DAILY_RESET')) || (getConfig('beg_rallye') == "N")) return; +if (($CSS == 1) || (!defined('__DAILY_RESET')) || (getConfig('beg_rallye') != "Y")) return; //* DEBUG: */ echo basename(__FILE__)."
\n"; // Get current month (2 digits) @@ -53,7 +53,7 @@ if (($curr != getConfig('last_month')) && (getConfig('last_month') > 0) && (getC $whereStatement2 = bigintval(getConfig('beg_ranks')); // Shall we exclude webmaster's own userid? - if ((getConfig('beg_include_own') == "N") && (getConfig('beg_uid') > 0)) { + if ((getConfig('beg_include_own') != "Y") && (getConfig('beg_uid') > 0)) { // Exclude it $whereStatement1 = sprintf(" AND userid != %s", bigintval(getConfig('beg_uid'))); } // END - if diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 9484506fc9..4e10c88740 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -37,10 +37,13 @@ if (!defined('__SECURITY')) { require($INC); } -// -function ADD_MODULE_TITLE($mod) { +// Returns the title for given module +function ADD_MODULE_TITLE ($mod) { global $cacheArray; - $name = ""; $result = false; + + // Init variables + $name = ""; + $result = false; // Is the script installed? if (isBooleanConstantAndTrue('mxchange_installed')) { @@ -65,7 +68,7 @@ function ADD_MODULE_TITLE($mod) { // Still no luck or empty title? if (empty($name)) { // No name found - $name = sprintf("%s (%s)", LANG_UNKNOWN_MODULE, $mod); + $name = sprintf("%s (%s)", getMessage('LANG_UNKNOWN_MODULE'), $mod); if (SQL_NUMROWS($result) == 0) { // Add module to database $dummy = CHECK_MODULE($mod); @@ -133,7 +136,7 @@ function CHECK_MODULE ($mod) { } // Is the module found? - if ($found) { + if ($found === true) { // Check returned values against current access permissions // // Admin access ----- Guest access ----- --- Guest or member? --- @@ -204,6 +207,7 @@ function CHECK_MODULE ($mod) { // Add menu description pending on given file name (without path!) function ADD_DESCR ($ACC_LVL, $file, $return = false, $output = true) { global $NAV_DEPTH; + // Use only filename of the file ;) $file = basename($file); @@ -322,6 +326,7 @@ function ADD_DESCR ($ACC_LVL, $file, $return = false, $output = true) { return $OUT; } } + // function ADD_MENU ($MODE, $act, $wht) { // Init some variables @@ -437,6 +442,7 @@ function ADD_MENU ($MODE, $act, $wht) { OUTPUT_HTML(""); } } + // This patched function will reduce many SELECT queries for the specified or current admin login function IS_ADMIN ($admin="") { global $cacheArray; @@ -458,14 +464,14 @@ function IS_ADMIN ($admin="") { // Use cached string $valPass = $cacheArray['admin_hash']; } elseif ((!empty($passCookie)) && (isset($cacheArray['admins']['password'][$admin])) && (!empty($admin))) { - // Count cache hits - incrementConfigEntry('cache_hits'); - // Login data is valid or not? $valPass = generatePassString($cacheArray['admins']['password'][$admin]); // Cache it away $cacheArray['admin_hash'] = $valPass; + + // Count cache hits + incrementConfigEntry('cache_hits'); } elseif ((!empty($admin)) && ((!EXT_IS_ACTIVE("cache"))) || (!isset($cacheArray['admins']['password'][$admin]))) { // Search for admin $result = SQL_QUERY_ESC("SELECT HIGH_PRIORITY password FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1", @@ -498,21 +504,18 @@ function IS_ADMIN ($admin="") { //* DEBUG: */ if (!$ret) echo __LINE__."OK!
"; return $ret; } -// -function ADD_MAX_RECEIVE_LIST($MODE, $default="", $return=false) -{ + +// Generates a list of "max receiveable emails per day" +function ADD_MAX_RECEIVE_LIST ($MODE, $default = "", $return = false) { global $_POST; $OUT = ""; - switch ($MODE) - { + switch ($MODE) { case "guest": // Guests (in the registration form) are not allowed to select 0 mails per day. $result = SQL_QUERY("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value > 0 ORDER BY value", __FILE__, __LINE__); - if (SQL_NUMROWS($result) > 0) - { + if (SQL_NUMROWS($result) > 0) { $OUT = ""; - while (list($value, $comment) = SQL_FETCHROW($result)) - { + while (list($value, $comment) = SQL_FETCHROW($result)) { $OUT .= "