Ticket resolved, code rewrites and caching:
authorRoland Häder <roland@mxchange.org>
Sun, 22 Feb 2009 20:40:00 +0000 (20:40 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 22 Feb 2009 20:40:00 +0000 (20:40 +0000)
- Resolves ticket #90
- Caching added to prevent some queries
- Some code cleanups
- TODOs added

31 files changed:
beg.php
birthday_confirm.php
inc/autopurge/purge-general.php
inc/autopurge/purge-inact.php
inc/autopurge/purge-mails.php
inc/autopurge/purge-tsks.php
inc/autopurge/purge-unconfirmed.php
inc/doubler_send.php
inc/extensions/ext-autopurge.php
inc/extensions/ext-bonus.php
inc/extensions/ext-newsletter.php
inc/extensions/ext-profile.php
inc/functions.php
inc/libs/beg_functions.php
inc/libs/bonus_functions.php
inc/libs/wernis_functions.php
inc/load_extensions.php
inc/modules/admin/what-config_autopurge.php
inc/modules/admin/what-config_order.php
inc/modules/admin/what-config_other.php
inc/modules/admin/what-unlock_emails.php
inc/modules/guest/what-register.php
inc/modules/member/what-order.php
inc/modules/member/what-points.php
inc/modules/member/what-refback.php
inc/monthly/monthly_beg.php
inc/mysql-manager.php
inc/profile-updte.php
inc/stylesheet.php
mailid_top.php
modules.php

diff --git a/beg.php b/beg.php
index ccf6edf2525eb1d5af30863ab89729205a657c82..5f68fbc7616f2def3e953545cfcefc5f1bac809e 100644 (file)
--- 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(
                                );
 
index ca7d8243bea41756e6fab757c2bfa7337169fe7f..25e737196b7b3c451850cb8feb9a2afbd02d3825 100644 (file)
@@ -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']);
index a11fc14b333f8b9a65dbe635420900081dd6eaf6..782b69d6f0e8a9b26f6e56611ab50d5df20c641b 100644 (file)
@@ -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;
 }
index bcf5a92470a930da4e9f3e126de39dbd898b230c..c015fc56da5270b421f1c53874267cd7efc18008 100644 (file)
@@ -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
index d1aeb1d3de36f150d9e72413f72c97567e9a9241..7d5de277833197ad8e314faefe9cc544925a7799 100644 (file)
@@ -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
index 07dbc704c57c1745cc040a747bc716cc6b52e7f9..dde1e7c77e30583e22c9dbfd7ac427632ebe44f6 100644 (file)
@@ -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
index c8e1c68f38bea4b8773a25d54be93fedff2cb2b4..baa56db400d3bcd501627431b93a8317386ca4b3 100644 (file)
@@ -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
index 1fd505799d8808144097bc225d72958b3f79e67a..75e73ca3d7e5338808eefd61780830e8cc5232de 100644 (file)
@@ -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;
index 9c46b91e5a1bc0bc4042d96ba76a4f8f642fa0a4..d876c0188b8cf63aa361cddbfa0d7a8186d7fda8 100644 (file)
@@ -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'));
index 0bcddc787e04ff58d7ff334f8e91f535fe2ab86b..8fad3e4797799f764e8e1790be16e7e250870c45 100644 (file)
@@ -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
index 5810b4e1f0f9ffcf738721e041602149a7803d2c..daaf75603e000412609da91979f9b6858d57af72 100644 (file)
@@ -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'));
        }
index ae60910112dc968bfd19d175678c30d4828993e4..6d2805798f267b9aae44a37a4be9c110eb1f92fa 100644 (file)
@@ -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'));
        }
index 2ee2e1e2648972fae280c075f2c5f2596276302e..74cef5493551f8a770cf405d2de2fa5cd914ec03 100644 (file)
@@ -145,7 +145,7 @@ function OUTPUT_HTML ($HTML, $newLine = true) {
                        // Was that eval okay?
                        if (empty($newContent)) {
                                // Something went wrong!
-                               die("Evaluation error:<pre>".htmlentities($eval)."</pre>");
+                               mxchange_die("Evaluation error:<pre>".htmlentities($eval)."</pre>");
                        } // 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."<br />
-".TEMPLATE_CONTENT."
+               $newContent = "{!TEMPLATE_404!}: ".$template."<br />
+{!TEMPLATE_CONTENT!}
 <pre>".print_r($content, true)."</pre>
-".TEMPLATE_DATA."
+{!TEMPLATE_DATA!}
 <pre>".print_r($DATA, true)."</pre>
 <br /><br />";
 
                // 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;
        }
index fdadd1a1164620d25ca16d5324379d3f0ae65627..62e5949ba112fae296c342c37dfeeb927e4829aa 100644 (file)
@@ -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") {
index 5ceee1324997971c3911fa6e26505e4f55a7c0f6..b5ea9b2b9f450f85f68751a137908375e4a331e5 100644 (file)
@@ -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")) {
index 7809ce6461476475e3ea7af55146550be27af15c..e8e6d9a59b95e25bfad0689e35e955e35a237d89 100644 (file)
@@ -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;
index f77b7c7242f2b590674393d20b435db4c8eea32d..dd92ec8e18af86410f5ce6b75632ff1e9d2a214b 100644 (file)
@@ -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";
        }
index b55200c1a2d3daf261b8ff5fe6176679744a4f5a..cea9d4cb8155c152ae31537b64b565c5f03301f5 100644 (file)
@@ -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 {
index 04febbd6ea023df9c5453339d612db8c2de9c9d5..dbf9e3075aa86b23f96297f297b69dc4a721b346 100644 (file)
@@ -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 {
index 58fe215f3a2d2e36e79eab00869efcb5495dae10..d73a2f793d380cc048eadb8dff9d775100251cb7 100644 (file)
@@ -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 {
index b47c51cf42c863998fbcaf26e84d4edb4481fd1b..e1f53a777f3df02db77f6ac93c037f303d8bfc86 100644 (file)
@@ -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 {
index 7cf8158ed9e3f97b5002ebb5e427cbbf22a624ac..ba46619ea6ffce593dabf7fdd7e5ba8d92c6b898 100644 (file)
@@ -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
index ae81c826143ee0476456f42a2ae8b8dd3e791e49..c82794c2506945a52fe8eff9aa4964d7daddb8e1 100644 (file)
@@ -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&amp;what=order&amp;msg=".constant('CODE_BLIST_URL')."&blist=".$blist;
+                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_BLIST_URL')."&amp;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) {
index da7b330b7f40a521be5dd6f6f02ca7b0f47d0bd1..ebbf566f0ad9d20d030e6185e8430de5dad10ac2 100644 (file)
@@ -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"))) {
index e751a5a9d2bcef7c11e75094154b160c9a71d2a4..687b45b9df72cf478e7a4bf0bd7ea01bdc3b99e3 100644 (file)
@@ -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
index 17a38d2a8b69c10cdb168d03ffc86421271c92b9..292eb5befcbc34deb27b0684b55dedff0b90fea5 100644 (file)
@@ -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__)."<br />\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
index 9484506fc9896cfc92060df76c2e21ef76a5f9a3..4e10c8874056bca75b325df90ad6ea0926799ff0 100644 (file)
@@ -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("</table>");
        }
 }
+
 // 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!<br />";
        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 .= "      <option value=\"".$value."\"";
                                if ($_POST['max_mails'] == $value) $OUT .= " selected=\"selected\"";
                                $OUT .= ">".$value." ".PER_DAY;
@@ -524,21 +527,18 @@ function ADD_MAX_RECEIVE_LIST($MODE, $default="", $return=false)
                        // Free memory
                        SQL_FREERESULT($result);
                        $OUT = LOAD_TEMPLATE("guest_receive_table", true);
-               }
-                else
-               {
+               } else {
                        // Maybe the admin has to setup some maximum values?
+                       debug_report_bug("Nothing is being done here?");
                }
                break;
 
        case "member":
                // Members are allowed to set to zero mails per day (we will change this soon!)
                $result = SQL_QUERY("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` 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 .= "      <option value=\"".$value."\"";
                                if ($default == $value) $OUT .= " selected=\"selected\"";
                                $OUT .= ">".$value." ".PER_DAY;
@@ -548,53 +548,75 @@ function ADD_MAX_RECEIVE_LIST($MODE, $default="", $return=false)
                        define('__MAX_RECEIVE_OPTIONS', $OUT);
                        SQL_FREERESULT($result);
                        $OUT = LOAD_TEMPLATE("member_receive_table", true);
-               }
-                else
-               {
+               } else {
                        // Maybe the admin has to setup some maximum values?
                        $OUT = LOAD_TEMPLATE("admin_settings_saved", true, NO_MAX_VALUES);
                }
                break;
        }
-       if ($return)
-       {
+
+       if ($return) {
                // Return generated HTML code
                return $OUT;
-       }
-        else
-       {
+       } else {
                // Output directly (default)
                OUTPUT_HTML($OUT);
        }
 }
-//
-function SEARCH_EMAIL_USERTAB($email)
-{
-       $ret = false;
-       $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE email LIKE '{PER}%s{PER}' LIMIT 1", array($email), __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) == 1) $ret = true;
+
+// Checks wether the given email address is used.
+function SEARCH_EMAIL_USERTAB ($email) {
+       // Query the database
+       $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE email LIKE '{PER}%s{PER}' LIMIT 1",
+               array($email), __FILE__, __LINE__);
+
+       // Is the email there?
+       $ret = (SQL_NUMROWS($result) == 1);
+
+       // Free the result
        SQL_FREERESULT($result);
+
+       // Return result
        return $ret;
 }
-//
-function WHAT_IS_VALID($act, $wht, $type="guest")
-{
-       if (IS_ADMIN())
-       {
+
+// Checks wether 'what' is valid
+// @TODO This cache can be flushed to hard drive
+function WHAT_IS_VALID ($act, $wht, $type="guest") {
+       global $cacheArray;
+
+       // Is admin or cache entry is there?
+       if (IS_ADMIN()) {
                // Everything is valid to the admin :-)
-               return true;
-       }
-        else
-       {
+               $ret = true;
+       } elseif (isset($cacheArray['what_valid'][$type][$act][$what])) {
+               // Use the cache
+               $ret = $cacheArray['what_valid'][$type][$act][$what];
+
+               // Count the cache hit
+               incrementConfigEntry('cache_hits');
+       } else {
+               // By default is nothing valid
                $ret = false;
+
+               // Look in database
                $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE action='%s' AND what='%s' AND `locked`='N' LIMIT 1", array($type, $act, $wht), __FILE__, __LINE__);
+
                // Is "what" valid?
-               if (SQL_NUMROWS($result) == 1) $ret = true;
+               $ret = (SQL_NUMROWS($result) == 1);
+
+               // Free the result
                SQL_FREERESULT($result);
-               return $ret;
        }
+
+       // Cache the entry
+       $cacheArray['what_valid'][$type][$act][$what] = $ret;
+
+       // Return the result
+       return $ret;
 }
-//
+
+// Checks wether the current user is a member
 function IS_MEMBER () {
        global $status, $LAST, $cacheArray;
        if (!is_array($LAST)) $LAST = array();
@@ -657,12 +679,16 @@ function IS_MEMBER () {
        // Return status
        return $ret;
 }
-//
-function VALIDATE_MENU_ACTION ($MODE, $act, $wht, $UPDATE=false)
-{
+
+// Validate the given menu action
+function VALIDATE_MENU_ACTION ($MODE, $act, $wht, $UPDATE=false) {
+       // By default nothing is valid
        $ret = false;
+
+       // Look in all menus or only unlocked
        $ADD = "";
        if ((!IS_ADMIN()) && ($MODE != "admin")) $ADD = " AND `locked`='N'";
+
        //* DEBUG: */ echo __LINE__.":".$MODE."/".$act."/".$wht."*<br />\n";
        if (($MODE != "admin") && ($UPDATE)) {
                // Update guest or member menu
index 05ce24ce5bcc07494b7f11e1d27a681a1f09a250..67ff3d451fa495635f4486840d8b397a8f596117 100644 (file)
@@ -48,19 +48,16 @@ WHERE
 OR
        (last_update=0 AND last_profile_sent=0 AND joined < (UNIX_TIMESTAMP() - %s))
 ORDER BY userid", array(getConfig('profile_update'), getConfig('resend_profile_update'), getConfig('profile_update')), __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) > 0)
-       {
+
+       // Do we have some notifications to sent?
+       if (SQL_NUMROWS($result) > 0) {
                // We need to send-out notifications...
-               while ($DATA = SQL_FETCHROW($result))
-               {
+               while ($DATA = SQL_FETCHROW($result)) {
                        $DATA[6] = MAKE_DATETIME($DATA[6], "0");
-                       if (round($DATA[5]) == "0")
-                       {
+                       if (round($DATA[5]) == "0") {
                                // Has never changed his accont
                                $DATA[5] = PROFILE_NEVER_CHANGED;
-                       }
-                        else
-                       {
+                       } else {
                                // Has changed his account
                                $DATA[5] = MAKE_DATETIME($DATA[5], "0");
                        }
@@ -72,11 +69,12 @@ ORDER BY userid", array(getConfig('profile_update'), getConfig('resend_profile_u
                        // Update profile data
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET last_profile_sent=UNIX_TIMESTAMP(), notified='Y' WHERE userid=%s LIMIT 1",
                                array(bigintval($DATA[0])), __FILE__, __LINE__);
-               }
-       }
+               } // END - while
+       } // END - if
 
        // Free result
        SQL_FREERESULT($result);
 }
+
 //
 ?>
index a84660c803eefb80d5ba1b4c1d2dc39594acab00..8c62a7b7b7a37afaf166945aa196a5436a85ada6 100644 (file)
@@ -60,31 +60,31 @@ if (($CSS == "1") || (getConfig('css_php') == "DIRECT")) {
        foreach ($STYLES as $value) {
                // Only include found CSS files (to reduce 404 requests)
                $BASE = sprintf("%stheme/%s/css/", constant('PATH'), GET_CURR_THEME());
-               $file = $BASE.$value;
+               $FQFN = $BASE.$value;
 
                // Do include only existing files and whose are not empty
-               if ((FILE_READABLE($file)) && (filesize($file) > 0)) {
+               if ((FILE_READABLE($FQFN)) && (filesize($FQFN) > 0)) {
                        switch (getConfig('css_php')) {
                                case "DIRECT":
                                        OUTPUT_HTML("<link rel=\"stylesheet\" type=\"text/css\" href=\"{!URL!}/theme/".GET_CURR_THEME()."/".$value."\" />");
                                        break;
 
                                case "FILE":
-                                       OUTPUT_HTML(READ_FILE($file));
+                                       OUTPUT_HTML(READ_FILE($FQFN));
                                        break;
-                       }
-               }
-       }
+                       } // END - switch
+               } // END - if
+       } // END - foreach
 } else {
        // Now we load all CSS files from css.php!
        OUTPUT_HTML("<link rel=\"stylesheet\" type=\"text/css\" href=\"{!URL!}/css.php", false);
        if (isBooleanConstantAndTrue('mxchange_installing')) {
                // Default theme first
                $NEW_THEME = "default";
-               if (!empty($_GET['theme'])) $NEW_THEME = SQL_ESCAPE($_GET['theme']);
+               if (!empty($_GET['theme']))  $NEW_THEME = SQL_ESCAPE($_GET['theme']);
                if (!empty($_POST['theme'])) $NEW_THEME = SQL_ESCAPE($_POST['theme']);
                OUTPUT_HTML("?theme=".$NEW_THEME."&amp;installing=1", false);
-       }
+       } // END - if
        OUTPUT_HTML("\" />");
 }
 
index cf0ec430c2162794333a642b0241cdcb3bc7e759..b52f9740fda920872fbae5ebea62f413db87765a 100644 (file)
@@ -225,7 +225,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                                                                $template = "mailid_points_done";
 
                                                                                // Right code entered add points and remove entry
-                                                                               if (($ref_pay > 0) && (getConfig('allow_direct_pay') == "N")) {
+                                                                               if (($ref_pay > 0) && (getConfig('allow_direct_pay') != "Y")) {
                                                                                        // Don't add points over the referal system
                                                                                        $locked = true;
                                                                                        $template = "mailid_points_locked";
index bee4beae2c00a70d0f97698017f0e3292245c17d..17271bca4297916cbb590b18c58fdc5f44e176ad 100644 (file)
@@ -49,7 +49,7 @@ if (empty($_GET['module'])) $_GET['module'] = "index";
 
 // Secure action/what if present
 if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);
-if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);
+if (!empty($_GET['what']))   $GLOBALS['what']   = secureString($_GET['what']);
 
 // Secure the module name (very important line!)
 $GLOBALS['module'] = secureString($_GET['module']);
@@ -87,10 +87,10 @@ if (IS_MEMBER()) {
        SQL_FREERESULT($result);
 } elseif (IS_ADMIN()) {
        // Admin is there
-       $username = _ADMIN;
+       $username = getMessage('_ADMIN');
 } else {
        // He's a guest, hello there... ;-)
-       $username = _GUEST;
+       $username = getMessage('_GUEST');
 }
 
 // The header file