Fixes for a lot bug tickets. (Sorry for lame comment)
[mailer.git] / mailid_top.php
index 05b86518e6e37c7f8f2f352f6264719e40bb698a..27da0b7caad766ad991ea81c62556912f36ea683 100644 (file)
@@ -107,7 +107,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                if ($ltype == "BONUS") $sender = 0;
 
                                // Is the user's ID unlocked?
-                               $result = SQL_QUERY_ESC("SELECT status, gender, surname, family, ref_payout FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
+                               $result = SQL_QUERY_ESC("SELECT status, gender, surname, family, ref_payout FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s LIMIT 1",
                                        array($url_uid), __FILE__, __LINE__);
                                if (SQL_NUMROWS($result) == 1) {
                                        // Load data
@@ -118,7 +118,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
 
                                        if ($status == "CONFIRMED") {
                                                // Update last activity
-                                               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET last_online=UNIX_TIMESTAMP(), last_module='mailid_top' WHERE userid=%s LIMIT 1",
+                                               SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET last_online=UNIX_TIMESTAMP(), last_module='mailid_top' WHERE userid=%s LIMIT 1",
                                                        array($url_uid), __FILE__, __LINE__);
 
                                                // User has confirmed his account so we can procede...
@@ -161,7 +161,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                                        if (($time > 0) && ($payment > 0)) {
                                                                if (!empty($code)) {
                                                                        // Generate code
-                                                                       $img_code = GEN_RANDOM_CODE($_CONFIG['code_length'], $code, $url_uid, $DATA);
+                                                                       $img_code = GEN_RANDOM_CODE(getConfig('code_length'), $code, $url_uid, $DATA);
                                                                } // END - if
 
                                                                switch ($mode) {
@@ -173,7 +173,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                                                        switch ($ltype)
                                                                        {
                                                                        case "NORMAL":
-                                                                               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_stats SET clicks=clicks + 1 WHERE id=%s LIMIT 1",
+                                                                               SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_stats SET clicks=clicks + 1 WHERE id=%s LIMIT 1",
                                                                                        array($url_mid), __FILE__, __LINE__);
 
                                                                                // Update mediadata as well
@@ -185,7 +185,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                                                                break;
 
                                                                        case "BONUS":
-                                                                               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET clicks=clicks + 1 WHERE id=%s LIMIT 1",
+                                                                               SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET clicks=clicks + 1 WHERE id=%s LIMIT 1",
                                                                                        array($url_bid), __FILE__, __LINE__);
 
                                                                                // Update mediadata as well
@@ -204,13 +204,13 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                                                        // Only when user extension = v0.1.2: Update mails-confirmed counter
                                                                        if (GET_EXT_VERSION("user") >= "0.1.2") {
                                                                                // Update counter
-                                                                               SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET mails_confirmed=mails_confirmed + 1 WHERE userid=%s LIMIT 1",
+                                                                               SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET mails_confirmed=mails_confirmed + 1 WHERE userid=%s LIMIT 1",
                                                                                        array($url_uid), __FILE__, __LINE__);
 
                                                                                // Update random confirmed as well?
                                                                                if (GET_EXT_VERSION("user") >= "0.3.4") {
                                                                                        // Update second counter
-                                                                                       SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET rand_confirmed=rand_confirmed + 1 WHERE userid=%s LIMIT 1",
+                                                                                       SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET rand_confirmed=rand_confirmed + 1 WHERE userid=%s LIMIT 1",
                                                                                                array($url_uid), __FILE__, __LINE__);
                                                                                } // END - if
                                                                        } // END - if
@@ -225,26 +225,26 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                                                                $template = "mailid_points_done";
 
                                                                                // Right code entered add points and remove entry
-                                                                               if (($ref_pay > 0) && ($_CONFIG['allow_direct_pay'] == "N")) {
+                                                                               if (($ref_pay > 0) && (getConfig('allow_direct_pay') == "N")) {
                                                                                        // Don't add points over the referal system
                                                                                        $locked = true;
                                                                                        $template = "mailid_points_locked";
                                                                                } // END - if
 
                                                                                // Count down ref_payout value
-                                                                               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET ref_payout=ref_payout-1 WHERE userid=%s AND ref_payout > 0 LIMIT 1",
+                                                                               SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET ref_payout=ref_payout-1 WHERE userid=%s AND ref_payout > 0 LIMIT 1",
                                                                                        array($url_uid), __FILE__, __LINE__);
 
                                                                                // Add points
-                                                                               unset($DEPTH);
+                                                                               unset($GLOBALS['ref_level']);
                                                                                ADD_POINTS_REFSYSTEM("mailid_okay", $url_uid, $payment, false, "0", $locked);
 
                                                                                // Shall I add bonus points for "turbo clickers" ?
                                                                                if ((GET_EXT_VERSION("bonus") >= "0.2.2") && (function_exists('BONUS_ADD_TURBO_POINTS'))) {
                                                                                        // Is an active-rallye running and this is not a notification mail?
-                                                                                       if (($_CONFIG['bonus_active'] == "Y") && ($notify == "N")) {
+                                                                                       if ((getConfig('bonus_active') == "Y") && ($notify == "N")) {
                                                                                                // Shall I exclude the webmaster's own userid from the active-rallye?
-                                                                                               if (((($_CONFIG['bonus_uid'] == $url_uid) && ($_CONFIG['bonus_include_own'] == "Y")) || ($_CONFIG['bonus_uid'] != $url_uid)) && ($_CONFIG['def_refid'] != $url_uid)) {
+                                                                                               if ((((getConfig('bonus_uid') == $url_uid) && (getConfig('bonus_include_own') == "Y")) || (getConfig('bonus_uid') != $url_uid)) && (getConfig('def_refid') != $url_uid)) {
                                                                                                        // Add points and remember ranking are done in this function....
                                                                                                        BONUS_ADD_TURBO_POINTS($DATA, $url_uid, $type);
 
@@ -268,7 +268,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                                                                LOAD_TEMPLATE($template);
                                                                        } else {
                                                                                // Wrong image code! So add points to sender's account
-                                                                               unset($DEPTH);
+                                                                               unset($GLOBALS['ref_level']);
                                                                                ADD_POINTS_REFSYSTEM("mailid_payback", $sender, $payment, false, 0, false, "direct");
 
                                                                                // Load template
@@ -276,7 +276,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                                                        }
 
                                                                        // Remove link from table
-                                                                       $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE id=%s LIMIT 1",
+                                                                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE id=%s LIMIT 1",
                                                                                array(bigintval($lid)), __FILE__, __LINE__);
                                                                        break;
 
@@ -293,7 +293,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                                                                define('_TYPE_VALUE', $type);
                                                                                define('_DATA_VALUE', $DATA);
                                                                                define('_TEMPLATE_BANNER', LOAD_TEMPLATE("mailid_banner", true));
-                                                                               if ($_CONFIG['code_length'] > 0)
+                                                                               if (getConfig('code_length') > 0)
                                                                                {
                                                                                        // Generate Code
                                                                                        define('_IMAGE_CODE', IMG_CODE($code, $type, $DATA, $url_uid));