]> git.mxchange.org Git - mailer.git/blobdiff - inc/pool/pool-user.php
Again better check
[mailer.git] / inc / pool / pool-user.php
index 53e589c81858ca027699c1ab1db465b8a5d70790..83032754aaa984f6f3b02368d5040088563817b5 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -55,13 +55,21 @@ $HTML = '';
 // Check for freed mail orders to send out
 if (isExtensionActive('html_mail')) {
        // With HTML mails
-       $HTML = ', `html_msg`';
+       $HTML = ',`html_msg`';
 } // END - if
 
 // Main query
 $result_main = SQL_QUERY("SELECT
-       `id`,`sender` AS `sender_userid`,`subject`,`text`,`receivers`,
-       `payment_id`,`timestamp`,`url`,`target_send`,`cat_id`
+       `id`,
+       `sender` AS `sender_userid`,
+       `subject`,
+       `text`,
+       `receivers`,
+       `payment_id`,
+       `timestamp`,
+       `url`,
+       `target_send`,
+       `cat_id`
        ".$HTML."
 FROM
        `{?_MYSQL_PREFIX?}_pool`
@@ -78,7 +86,7 @@ $pointsBack = array(0);
 
 if (!SQL_HASZERONUMS($result_main)) {
        // Parse all mails
-       while ($mailData = SQL_FETCHARRAY($result_main, 0, false)) {
+       while ($mailData = SQL_FETCHARRAY($result_main)) {
                // Set mail order as 'active'. That means it will be sent out
                SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='ACTIVE' WHERE `id`=%s AND `data_type`='NEW' LIMIT 1",
                        array($mailData['id']), __FILE__, __LINE__);
@@ -116,8 +124,39 @@ if (!SQL_HASZERONUMS($result_main)) {
                                        //* DEBUG: */ debugOutput('!L:'.__LINE__.'/'.SQL_NUMROWS($result_stats).'!');
                                        if (SQL_HASZERONUMS($result_stats)) {
                                                // No entry was found, so we add him!
-                                               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($mailData['id']), bigintval($mailData['sender_userid']), bigintval($mailData['cat_id']), bigintval($mailData['payment_id']), $mailData['subject'], $mailData['url'], $mailData['target_send'], bigintval($mailData['timestamp'])), __FILE__, __LINE__);
+                                               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($mailData['id']),
+                                                               bigintval($mailData['sender_userid']),
+                                                               bigintval($mailData['cat_id']),
+                                                               bigintval($mailData['payment_id']),
+                                                               $mailData['subject'],
+                                                               $mailData['url'],
+                                                               bigintval($mailData['target_send']),
+                                                               bigintval($mailData['timestamp'])
+                                                       ), __FILE__, __LINE__);
 
                                                // Receive it's id for the links table
                                                $result_stats = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s AND `userid`=%s AND timestamp_ordered='%s' LIMIT 1",
@@ -207,7 +246,7 @@ if (!SQL_HASZERONUMS($result_main)) {
                                                } // END - if
 
                                                // Set status to SEND because we completely send it away
-                                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='SEND', `target_send`=0, `receivers`='' WHERE `id`=%s LIMIT 1",
+                                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='SEND',`target_send`=0,`receivers`='' WHERE `id`=%s LIMIT 1",
                                                        array(bigintval($mailData['id'])), __FILE__, __LINE__);
 
                                                // Update send-completed-time
@@ -255,8 +294,8 @@ if (!SQL_HASZERONUMS($result_main)) {
                                                if (isValidUserId($userid)) {
                                                        // User does not exists, pay points back
                                                        $points = getPaymentPoints($mailData['payment_id']);
-                                                       initReferalSystem();
-                                                       addPointsThroughReferalSystem('pool_payback', $mailData['sender_userid'], $points);
+                                                       initReferralSystem();
+                                                       addPointsThroughReferralSystem('pool_payback', $mailData['sender_userid'], $points);
 
                                                        // Add points together and remove user
                                                        $pointsBack[$mailData['sender_userid']] += $points;