]> git.mxchange.org Git - mailer.git/blobdiff - inc/pool/pool-bonus.php
Next wave of more use of EL, see ticket #176
[mailer.git] / inc / pool / pool-bonus.php
index 6276de68290a22b048c95350d8d1a6663c92cd8a..65b4e36774bc95500ad7dfcf101e77b73124f080 100644 (file)
@@ -99,18 +99,8 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
                                                        if (isset($DATA[$key])) $DATA['text'] = str_replace($value, $DATA[$key], $DATA['text']);
                                                } // END - foreach
 
-                                               // Prepare content
-                                               $content = array(
-                                                       'id'       => $DATA['id'],
-                                                       'url'      => $DATA['url'],
-                                                       'time'     => createFancyTime($DATA['time']),
-                                                       'points'   => translateComma($DATA['points']),
-                                                       'category' => getCategory($DATA['cat_id']),
-                                                       'text'     => $DATA['text']
-                                               );
-
                                                // Prepare the mail
-                                               $mailText = loadEmailTemplate('bonus-mail', $content, $userid);
+                                               $mailText = loadEmailTemplate('bonus-mail', $DATA, $userid);
 
                                                // Send mail away
                                                if (isset($DATA['html_msg'])) {
@@ -153,8 +143,16 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
                        //* DEBUG: */ print("-L:".__LINE__.'/'.countSelection($dummy)."-<br />");
                        if (countSelection($dummy) == 0) {
                                // Queue reached!
-                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_bonus` SET `data_type`='SEND', `target_send`=0, `receivers`='' WHERE `id`=%s LIMIT 1",
-                               array(bigintval($DATA['id'])), __FILE__, __LINE__);
+                               SQL_QUERY_ESC("UPDATE
+       `{?_MYSQL_PREFIX?}_bonus`
+SET
+       `data_type`='SEND',
+       `target_send`=0,
+       `receivers`=''
+WHERE
+       `id`=%s
+LIMIT 1",
+                                       array(bigintval($DATA['id'])), __FILE__, __LINE__);
                                //* DEBUG: */ print("*L:".__LINE__."*<br />");
 
                                // Update mediadata if version is 0.0.4 or higher
@@ -165,22 +163,34 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
                                } // END - if
                        } elseif ($GLOBALS['pool_cnt'] >= getConfig('max_send')) {
                                // Update bonus pool
-                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_bonus` SET `data_type`='NEW', `target_send`=%s, `receivers`='%s' WHERE `id`=%s LIMIT 1",
-                               array(countSelection($dummy), implode(';', $dummy), bigintval($DATA['id'])), __FILE__, __LINE__);
+                               SQL_QUERY_ESC("UPDATE
+       `{?_MYSQL_PREFIX?}_bonus`
+SET
+       `data_type`='NEW',
+       `target_send`=%s,
+       `receivers`='%s'
+WHERE
+       `id`=%s
+LIMIT 1",
+                                       array(
+                                               countSelection($dummy),
+                                               implode(';', $dummy),
+                                               bigintval($DATA['id'])
+                                       ), __FILE__, __LINE__);
                                //* DEBUG: */ print("*L:".__LINE__."<pre>");
                                //* DEBUG: */ print(print_r($dummy, true));
                                //* DEBUG: */ print("</pre>\n!!!<br />");
                                break;
                        }
-               }
-       }
+               } // END - while
+       } // END - if
 
        // Free memory
        SQL_FREERESULT($result_bonus);
 
        // Remove variable
        unset($mailText);
-}
+} // END - if
 
-//
+// [EOF]
 ?>