Unconfirmed mails rewritten, mail confirmation saved in stats table
[mailer.git] / mailid_top.php
index eaa0d57c3400d1ad252112b1e0e69212bf445642..d4896483d1d563c0e34c2c2415aad0c99c98f0a5 100644 (file)
@@ -168,6 +168,9 @@ if (isBooleanConstantAndTrue('mxchange_installed'))
                                                                switch ($mode)
                                                                {
                                                                case "add":
+                                                                       // Init stats data
+                                                                       $stats_data = 0;
+
                                                                        // Count clicks
                                                                        switch ($ltype)
                                                                        {
@@ -176,11 +179,11 @@ if (isBooleanConstantAndTrue('mxchange_installed'))
                                                                                 array($url_mid), __FILE__, __LINE__);
 
                                                                                // Update mediadata as well
-                                                                               if (GET_EXT_VERSION("mediadata") >= "0.0.4")
-                                                                               {
+                                                                               if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
                                                                                        // Update database
                                                                                        MEDIA_UPDATE_ENTRY(array("total_clicks", "normal_clicks"), "add", 1);
                                                                                }
+                                                                               $stats_data = $url_mid;
                                                                                break;
 
                                                                        case "BONUS":
@@ -188,11 +191,11 @@ if (isBooleanConstantAndTrue('mxchange_installed'))
                                                                                 array($url_bid), __FILE__, __LINE__);
 
                                                                                // Update mediadata as well
-                                                                               if (GET_EXT_VERSION("mediadata") >= "0.0.4")
-                                                                               {
+                                                                               if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
                                                                                        // Update database
                                                                                        MEDIA_UPDATE_ENTRY(array("total_clicks", "bonus_clicks"), "add", 1);
                                                                                }
+                                                                               $stats_data = $url_bid;
                                                                                break;
                                                                        }
 
@@ -201,16 +204,17 @@ if (isBooleanConstantAndTrue('mxchange_installed'))
                                                                        define('_TEMPLATE_BANNER', LOAD_TEMPLATE("mailid_banner", true));
 
                                                                        // Only when user extension = v0.1.2: Update mails-confirmed counter
-                                                                       if (GET_EXT_VERSION("user") >= "0.1.2")
-                                                                       {
+                                                                       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__);
                                                                        }
 
+                                                                       // Insert stats record
+                                                                       USER_STATS_INSERT_RECORD($url_uid, $type, $stats_data);
+
                                                                        // Right code entered?
-                                                                       if (bigintval($_POST['gfx_check']) == $img_code)
-                                                                       {
+                                                                       if (bigintval($_POST['gfx_check']) == $img_code) {
                                                                                // Right code entered add points and remove entry
                                                                                if (($ref_pay > 0) && ($_CONFIG['allow_direct_pay'] == "N"))
                                                                                {
@@ -267,9 +271,7 @@ if (isBooleanConstantAndTrue('mxchange_installed'))
 
                                                                                // Load template
                                                                                LOAD_TEMPLATE($template);
-                                                                       }
-                                                                        else
-                                                                       {
+                                                                       } else {
                                                                                // Wrong image code! So add points to sender's account
                                                                                $DEPTH = 0;
                                                                                ADD_POINTS_REFSYSTEM($sender, $payment, false, 0, false, "direct");