- //* DEBUG: */ print("OK!/L:".__LINE__."<br />");
-
- // Mark this user as "spammed" ;-) And place a line for him...
- if (removeReceiver($dummy, $key, $userid, $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' => createFancyTime($DATA['time']),
- 'points' => translateComma($DATA['points']),
- 'category' => getCategory($DATA['cat_id']),
- 'text' => $DATA['text']
- );
-
- // Prepare the mail
- $mailText = loadEmailTemplate('bonus-mail', $content, $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 (getExtensionVersion('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'] >= getConfig('max_send')) || (countSelection($dummy) == 0)) {
- // Yes, we have
- //* DEBUG: */ print("*EXIT/L:".__LINE__."<br />");
+ //* DEBUG: */ debugOutput('OK!/L:'.__LINE__);
+
+ // Remove receiver from list
+ $status = removeReceiver($temporaryReceivers, $key, $userid, $mailData['id'], $mailData['id'], TRUE);
+
+ // Did it work?
+ switch ($status) {
+ case 'done': // Done!
+ // Prepare the mail
+ $mailText = loadEmailTemplate('member_bonus_pool_normal', $mailData, $userid);
+
+ // Send mail away
+ if (isset($mailData['html_msg'])) {
+ // Send HTML?
+ sendEmail(getUserData('userid'), $mailData['subject'], $mailText, $mailData['html_msg']);
+ } else {
+ // No HTML mail!
+ sendEmail(getUserData('userid'), $mailData['subject'], $mailText);
+ }
+
+ // Count one up and remove entry from dummy array
+ $GLOBALS['pool_cnt']++; unset($temporaryReceivers[$key]);
+
+ // Is ext-user installed?
+ if (isExtensionInstalledAndNewer('user', '0.1.4')) {
+ // Debug message
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',mailData[id]=' . $mailData['id']);
+ // Update mails received for receiver
+ addSql(sprintf("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `emails_received`=`emails_received`+1 WHERE `userid`=%s LIMIT 1", bigintval($userid)));
+ } // END - if
+
+ // Is the size of pool reached or nothing to sent left?
+ if (($GLOBALS['pool_cnt'] >= getMaxSend()) || (countSelection($temporaryReceivers) == 0)) {
+ // Yes, it is. So abort here
+ break;
+ } // END - if