Entire rewrite of mail part in app! Not kidding here...
[mailer.git] / inc / pool-update.php
index f5d6a9b36fcf1d288a83aa7ceaed3b7afd110d5f..3c6015d66cb524dff7927666fc7c5836b1d13a12 100644 (file)
@@ -56,7 +56,7 @@ if ($HTML_EXT) {
 }
 
 // Reset variables
-$cnt = 0; $cnt2 = 0; $LAST_SENT_ID = 0; $cnt_back = array("0"); $pointsBack = array("0");
+$cnt = 0; $cnt2 = 0; $LAST_SENT_ID = 0; $cnt_back = array("0"); $points_BACK = array("0");
 if (SQL_NUMROWS($result_main) > 0)
 {
        while ($DATA = SQL_FETCHROW($result_main))
@@ -117,7 +117,7 @@ if (SQL_NUMROWS($result_main) > 0)
                                        if (SQL_NUMROWS($result_stats) == 0)
                                        {
                                                // No entry was found, so we add him!
-                                               $result_stats = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_stats (pool_id , userid, cat_id, payment_id, subject, url , max_rec , timestamp_ordered, timestamp_sstart) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' , UNIX_TIMESTAMP())",
+                                               $result_stats = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_stats (pool_id , userid, cat_id, payment_id, subject, url , max_rec , timestamp_ordered, timestamp_sstart) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s' , UNIX_TIMESTAMP())",
                                                 array(bigintval($DATA[0]), bigintval($DATA[1]), bigintval($DATA[9]), bigintval($DATA[5]), $DATA[2], $DATA[7], $DATA[8], bigintval($DATA[6])), __FILE__, __LINE__);
 
                                                // Receive it's ID for the links table
@@ -273,7 +273,7 @@ if (SQL_NUMROWS($result_main) > 0)
                                        {
                                                if ($uid > 0)
                                                {
-                                                       // User does exist so pay the points back
+                                                       // User does not exists, pay points back
                                                        $points = GET_PAY_POINTS($DATA[5]);
                                                        $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET points=points+%s WHERE userid=%s AND ref_depth=0 LIMIT 1",
                                                         array($points, bigintval($DATA[1])), __FILE__, __LINE__);
@@ -287,7 +287,7 @@ if (SQL_NUMROWS($result_main) > 0)
                                                        }
 
                                                        // Add points together and remove user
-                                                       $pointsBack[$DATA[1]] += $points;
+                                                       $points_BACK[$DATA[1]] += $points;
                                                }
                                                $cnt_back[$DATA[1]]++;
                                        }
@@ -301,8 +301,8 @@ if (SQL_NUMROWS($result_main) > 0)
                        }
                }
        }
-       if ((sizeof($pointsBack) > 0) && (!empty($pointsBack[0]))) {
-               foreach ($pointsBack as $uid => $PB) {
+       if ((sizeof($points_BACK) > 0) && (!empty($points_BACK[0]))) {
+               foreach ($points_BACK as $uid => $PB) {
                        // Add points only when we have points left to add and a valid user ID
                        if (($PB > 0) && ($uid > 0)) {
                                // Prepare content