A lot has been rewritten, ext-teams added, ext-forced continued:
[mailer.git] / inc / pool / pool-bonus.php
index 92c76082795553f990de4275e59a281cc2d4ccf8..9f04c935bd52d60f9dab5726891a3bd8ee3de855 100644 (file)
@@ -55,10 +55,10 @@ if ($GLOBALS['pool_cnt'] < getMaxSend()) {
        // Do we need to send out bonus mails?
        if (isExtensionActive('html_mail')) {
                //                                 0        1        2          3          4        5          6            7         8        9            10           11
        // Do we need to send out bonus mails?
        if (isExtensionActive('html_mail')) {
                //                                 0        1        2          3          4        5          6            7         8        9            10           11
-               $result_bonus = SQL_QUERY("SELECT `id`, `subject`, `text`, `receivers`, `points`, `time`, `data_type`, `timestamp`, `url`, `cat_id`, `target_send`, `html_msg` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `data_type`='NEW' ORDER BY `timestamp` DESC", __FILE__, __LINE__);
+               $result_bonus = SQL_QUERY("SELECT `id`,`subject`,`text`,`receivers`,`points`,`time`,`data_type`,`timestamp`,`url`,`cat_id`,`target_send`,`html_msg` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `data_type`='NEW' ORDER BY `timestamp` DESC", __FILE__, __LINE__);
        } else {
                //                                 0        1        2          3          4        5          6            7         8        9            10
        } else {
                //                                 0        1        2          3          4        5          6            7         8        9            10
-               $result_bonus = SQL_QUERY("SELECT `id`, `subject`, `text`, `receivers`, `points`, `time`, `data_type`, `timestamp`, `url`, `cat_id`, `target_send` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `data_type`='NEW' ORDER BY `timestamp` DESC", __FILE__, __LINE__);
+               $result_bonus = SQL_QUERY("SELECT `id`,`subject`,`text`,`receivers`,`points`,`time`,`data_type`,`timestamp`,`url`,`cat_id`,`target_send` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `data_type`='NEW' ORDER BY `timestamp` DESC", __FILE__, __LINE__);
        }
 
        if (!SQL_HASZERONUMS($result_bonus)) {
        }
 
        if (!SQL_HASZERONUMS($result_bonus)) {
@@ -80,7 +80,7 @@ if ($GLOBALS['pool_cnt'] < getMaxSend()) {
                                // No users left
                                $receivers = array(0);
                        }
                                // No users left
                                $receivers = array(0);
                        }
-                       $dummy = $receivers;
+                       $temporaryReceivers = $receivers;
 
                        // Now, if we are good little boys and girls Santa Claus left us some user-ids.
                        // We can now send mails to them...
 
                        // Now, if we are good little boys and girls Santa Claus left us some user-ids.
                        // We can now send mails to them...
@@ -91,7 +91,7 @@ if ($GLOBALS['pool_cnt'] < getMaxSend()) {
                                        //* DEBUG: */ debugOutput('OK!/L:'.__LINE__);
 
                                        // Remove receiver from list
                                        //* DEBUG: */ debugOutput('OK!/L:'.__LINE__);
 
                                        // Remove receiver from list
-                                       $status = removeReceiver($dummy, $key, $userid, $mailData['id'], $mailData['id'], true);
+                                       $status = removeReceiver($temporaryReceivers, $key, $userid, $mailData['id'], $mailData['id'], true);
 
                                        // Did it work?
                                        switch ($status) {
 
                                        // Did it work?
                                        switch ($status) {
@@ -109,7 +109,7 @@ if ($GLOBALS['pool_cnt'] < getMaxSend()) {
                                                        }
 
                                                        // Count one up and remove entry from dummy array
                                                        }
 
                                                        // Count one up and remove entry from dummy array
-                                                       $GLOBALS['pool_cnt']++; unset($dummy[$key]);
+                                                       $GLOBALS['pool_cnt']++; unset($temporaryReceivers[$key]);
 
                                                        if (isExtensionInstalledAndNewer('user', '0.1.4')) {
                                                                // Update mails received for receiver
 
                                                        if (isExtensionInstalledAndNewer('user', '0.1.4')) {
                                                                // Update mails received for receiver
@@ -118,7 +118,7 @@ if ($GLOBALS['pool_cnt'] < getMaxSend()) {
                                                        } // END - if
 
                                                        // Do we have send maximum mails?
                                                        } // END - if
 
                                                        // Do we have send maximum mails?
-                                                       if (($GLOBALS['pool_cnt'] >= getMaxSend()) || (countSelection($dummy) == 0)) {
+                                                       if (($GLOBALS['pool_cnt'] >= getMaxSend()) || (countSelection($temporaryReceivers) == 0)) {
                                                                // Yes, we have
                                                                //* DEBUG: */ debugOutput('*EXIT/L:'.__LINE__);
                                                                break;
                                                                // Yes, we have
                                                                //* DEBUG: */ debugOutput('*EXIT/L:'.__LINE__);
                                                                break;
@@ -142,8 +142,8 @@ if ($GLOBALS['pool_cnt'] < getMaxSend()) {
                        } // END - if
 
                        // Close sending system
                        } // END - if
 
                        // Close sending system
-                       //* DEBUG: */ debugOutput('-L:'.__LINE__.'/'.countSelection($dummy).'-');
-                       if (countSelection($dummy) == 0) {
+                       //* DEBUG: */ debugOutput('-L:'.__LINE__.'/'.countSelection($temporaryReceivers).'-');
+                       if (countSelection($temporaryReceivers) == 0) {
                                // Queue reached!
                                SQL_QUERY_ESC("UPDATE
        `{?_MYSQL_PREFIX?}_bonus`
                                // Queue reached!
                                SQL_QUERY_ESC("UPDATE
        `{?_MYSQL_PREFIX?}_bonus`
@@ -175,11 +175,11 @@ WHERE
        `id`=%s
 LIMIT 1",
                                        array(
        `id`=%s
 LIMIT 1",
                                        array(
-                                               countSelection($dummy),
-                                               implode(';', $dummy),
+                                               countSelection($temporaryReceivers),
+                                               implode(';', $temporaryReceivers),
                                                bigintval($mailData['id'])
                                        ), __FILE__, __LINE__);
                                                bigintval($mailData['id'])
                                        ), __FILE__, __LINE__);
-                               //* DEBUG: */ debugOutput('*L:'.__LINE__.'<pre>'.print_r($dummy, true).'</pre>!!!');
+                               //* DEBUG: */ debugOutput('*L:'.__LINE__.'<pre>'.print_r($temporaryReceivers, true).'</pre>!!!');
                                break;
                        }
                } // END - while
                                break;
                        }
                } // END - while