- list($sname, $fname, $email) = SQL_FETCHROW($result_user);
- //* DEBUG: */ echo "OK!/L:".__LINE__."<br />";
-
- // Mark this user as "spammed" ;-) And place a line for him...
- if (REMOVE_RECEIVER($dummy, $key, $uid, $DATA['id'], $DATA['id'], true) == "done") {
- // Replace text variables
- foreach ($GLOBALS['replacer'] as $key => $value) {
- 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' => CREATE_FANCY_TIME($DATA['time']),
- 'points' => TRANSLATE_COMMA($DATA['points']),
- 'category' => GET_CATEGORY($DATA['cat_id']),
- 'text' => $DATA['text']
- );
-
- // Prepare the mail
- $mailText = LOAD_EMAIL_TEMPLATE("bonus-mail", $content, $uid);
-
- // Send mail away
- if (isset($DATA['html_msg'])) {
- // Send HTML?
- SEND_EMAIL($email, $DATA['subject'], $mailText, $DATA['html_msg']);
- } else {
- // No HTML mail!
- SEND_EMAIL($email, $DATA['subject'], $mailText);
- }
-
- // Count one up and remove entry from dummy array
- $GLOBALS['pool_cnt']++; unset($dummy[$key]);
-
- if (GET_EXT_VERSION("user") >= "0.1.4") {
- // Update mails received for receiver
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET emails_received=emails_received+1 WHERE userid=%s LIMIT 1",
- array(bigintval($uid)), __FILE__, __LINE__);
- } // END - if
-
- // Do we have send maximum mails?
- if (($GLOBALS['pool_cnt'] >= getConfig('max_send')) || (SELECTION_COUNT($dummy) == 0)) {
- // Yes, we have
- //* DEBUG: */ echo "*EXIT/L:".__LINE__."<br />";
+ //* DEBUG: */ debugOutput('OK!/L:'.__LINE__);
+
+ // Remove receiver from list
+ $status = removeReceiver($dummy, $key, $userid, $DATA['id'], $DATA['id'], true);
+
+ // Did it work?
+ switch ($status) {
+ case 'done': // Done!
+ // Prepare the mail
+ $mailText = loadEmailTemplate('member_bonus_pool_normal', $DATA, $userid);
+
+ // Send mail away
+ if (isset($DATA['html_msg'])) {
+ // Send HTML?
+ sendEmail(getUserData('email'), $DATA['subject'], $mailText, $DATA['html_msg']);
+ } else {
+ // No HTML mail!
+ sendEmail(getUserData('email'), $DATA['subject'], $mailText);
+ }
+
+ // Count one up and remove entry from dummy array
+ $GLOBALS['pool_cnt']++; unset($dummy[$key]);
+
+ if (isExtensionInstalledAndNewer('user', '0.1.4')) {
+ // Update mails received for receiver
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `emails_received`=`emails_received`+1 WHERE `userid`=%s LIMIT 1",
+ array(bigintval($userid)), __FILE__, __LINE__);
+ } // END - if
+
+ // Do we have send maximum mails?
+ if (($GLOBALS['pool_cnt'] >= getMaxSend()) || (countSelection($dummy) == 0)) {
+ // Yes, we have
+ //* DEBUG: */ debugOutput('*EXIT/L:'.__LINE__);
+ break;
+ } // END - if