Surfbar continued and some rewrites/fixes:
[mailer.git] / mailid_top.php
index 33c4acad41ffe3c0626fe2a3b65dec34a21fe4be..cee39dbc3a0dbf89fad0831d1a33db2b218644b7 100644 (file)
@@ -42,7 +42,7 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = "";
 $GLOBALS['module'] = "mailid";  $CSS = 0;
 
 // Load the required file(s)
-require ("inc/config.php");
+require("inc/config.php");
 
 if (isBooleanConstantAndTrue('mxchange_installed'))
 {
@@ -175,7 +175,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",
+                                                                               $result = 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
@@ -187,7 +187,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",
+                                                                               $result = 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
@@ -206,46 +206,47 @@ 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
-                                                                               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET mails_confirmed=mails_confirmed+1 WHERE userid=%s LIMIT 1",
-                                                                                array($url_uid), __FILE__, __LINE__);
-                                                                       }
+                                                                               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",
+                                                                                               array($url_uid), __FILE__, __LINE__);
+                                                                               } // END - if
+                                                                       } // END - if
 
                                                                        // Insert stats record
                                                                        USER_STATS_INSERT_RECORD($url_uid, $type, $stats_data);
 
                                                                        // Right code entered?
                                                                        if (bigintval($_POST['gfx_check']) == $img_code) {
+                                                                               // Add points over referal system is the default
+                                                                               $locked = false;
+                                                                               $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) && ($_CONFIG['allow_direct_pay'] == "N")) {
                                                                                        // Don't add points over the referal system
                                                                                        $locked = true;
                                                                                        $template = "mailid_points_locked";
-                                                                               }
-                                                                                else
-                                                                               {
-                                                                                       // Add points over referal system
-                                                                                       $locked = false;
-                                                                                       $template = "mailid_points_done";
-                                                                               }
+                                                                               } // 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",
-                                                                                array($url_uid), __FILE__, __LINE__);
+                                                                                       array($url_uid), __FILE__, __LINE__);
 
                                                                                // Add points
                                                                                unset($DEPTH);
-                                                                               ADD_POINTS_REFSYSTEM($url_uid, $payment, false, "0", $locked);
+                                                                               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')))
-                                                                               {
+                                                                               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 (($_CONFIG['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 (((($_CONFIG['bonus_uid'] == $url_uid) && ($_CONFIG['bonus_include_own'] == "Y")) || ($_CONFIG['bonus_uid'] != $url_uid)) && ($_CONFIG['def_refid'] != $url_uid)) {
                                                                                                        // Add points and remember ranking are done in this function....
                                                                                                        BONUS_ADD_TURBO_POINTS($DATA, $url_uid, $type);
 
@@ -255,13 +256,9 @@ if (isBooleanConstantAndTrue('mxchange_installed'))
                                                                                                        define('_UID_VALUE' , $url_uid);
                                                                                                        define('_TYPE_VALUE', $type);
                                                                                                        define('_DATA_VALUE', TRANSLATE_COMMA($DATA));
-                                                                                               }
-                                                                                       }
-                                                                               }
-
-                                                                               // Remove link from table
-                                                                               $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE id=%s LIMIT 1",
-                                                                                array(bigintval($lid)), __FILE__, __LINE__);
+                                                                                               } // END - if
+                                                                                       } // END - if
+                                                                               } // END - if
 
                                                                                // Load total points
                                                                                define('__TOTAL_POINTS', TRANSLATE_COMMA(
@@ -274,15 +271,15 @@ if (isBooleanConstantAndTrue('mxchange_installed'))
                                                                        } else {
                                                                                // Wrong image code! So add points to sender's account
                                                                                unset($DEPTH);
-                                                                               ADD_POINTS_REFSYSTEM($sender, $payment, false, 0, false, "direct");
-
-                                                                               // Remove link from table
-                                                                               $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE id=%s LIMIT 1",
-                                                                                array(bigintval($lid)), __FILE__, __LINE__);
+                                                                               ADD_POINTS_REFSYSTEM("mailid_payback", $sender, $payment, false, 0, false, "direct");
 
                                                                                // Load template
                                                                                LOAD_TEMPLATE("mailid_points_failed");
                                                                        }
+
+                                                                       // Remove link from table
+                                                                       $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE id=%s LIMIT 1",
+                                                                               array(bigintval($lid)), __FILE__, __LINE__);
                                                                        break;
 
                                                                case "img":