- // Mark this user as "spammed" ;-) And place a line for him...
- //* DEBUG: */ echo "?L:".__LINE__."/".$dummy."/".$key."/".$uid."(".$DATA[1].")/".$DATA[0]."/".$stats_id."?<br />";
- switch (REMOVE_RECEIVER($dummy, $key, bigintval($uid), bigintval($DATA[0]), bigintval($stats_id)))
- {
- case "done":
- // Prepare the mail
- $DATA[11] = bigintval($stats_id);
- $DATA[12] = $sname;
- $DATA[13] = $fname;
- $DATA[14] = TRANSLATE_GENDER($gender);
-
- // Replace text variables
- foreach ($GLOBALS['replacer'] as $key => $value) {
- if (isset($DATA[$key])) $DATA[3] = str_replace($value, $DATA[$key], $DATA[3]);
- } // END - if
-
- // Prepare content
- $content = array(
- 'id' => $DATA[11],
- 'url' => $DATA[7],
- 'sender_uid' => $DATA[1],
- 'category' => GET_CATEGORY($DATA[9]),
- 'time' => CREATE_FANCY_TIME(GET_PAY_POINTS($DATA[5], "time")),
- 'points' => TRANSLATE_COMMA(GET_PAY_POINTS($DATA[5], "payment")),
- 'text' => $DATA[3]
- );
-
- // Load message template
- $mailText = LOAD_EMAIL_TEMPLATE("normal-mail", $content, bigintval($uid));
-
- // Send mail away
- SEND_EMAIL($email, $DATA[2], $mailText, $HTML);
-
- // Count sent mails...
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET emails_sent=emails_sent+1 WHERE userid=%s LIMIT 1",
- array(bigintval($DATA[1])), __FILE__, __LINE__);
-
- 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
-
- // Update mediadata if version is 0.0.4 or higher
- if (GET_EXT_VERSION('mediadata') >= '0.0.4') {
- // Update entry (or add missing)
- //* DEBUG: */ echo "*MEDIA/L:".__LINE__."*<br />";
- MEDIA_UPDATE_ENTRY(array("total_send", "normal_send"), 'add', 1);
- } // END - if
-
- // And count up the mail
- $GLOBALS['pool_cnt']++;
- //* DEBUG: */ echo"*EXIT/L:".__LINE__."/".$GLOBALS['pool_cnt']."*<br />";
- break;
-
- case "already":
- // Entry already found, but we still count one up!
- $GLOBALS['pool_cnt']++;
- //* DEBUG: */ echo"*EXIT/L:".__LINE__."/".$GLOBALS['pool_cnt']."<br />";
- break;
- }
- }
+ // Remove receiver from list
+ $status = removeReceiver($temporaryReceivers, $key, bigintval($userid), bigintval($mailData['id']), bigintval($stats_id));
+
+ //* DEBUG: */ debugOutput('?L:'.__LINE__.'/'.$temporaryReceivers.'/'.$key.'/'.$userid.'('.['sender_userid'].')/'.$mailData['id'].'/'.$stats_id.'?');
+ switch ($status) {
+ case 'done':
+ // Prepare the mail
+ $mailData['stats_id'] = bigintval($stats_id);
+
+ // Prepare content
+ $mailData['time'] = getPaymentPoints($mailData['payment_id'], 'time');
+ $mailData['points'] = getPaymentPoints($mailData['payment_id'], 'payment');
+
+ // Load message template
+ $mailText = loadEmailTemplate('member_user_pool_normal', $mailData, bigintval($userid));
+
+ // Send mail away
+ sendEmail(getUserData('userid'), $mailData['subject'], $mailText, $isHtml);
+
+ // Count sent mails...
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `emails_sent`=`emails_sent`+1 WHERE `userid`=%s LIMIT 1",
+ array(bigintval($mailData['sender_userid'])), __FILE__, __LINE__);
+
+ 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
+
+ // Update mediadata if version is 0.0.4 or higher
+ if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) {
+ // Update entry (or add missing)
+ //* DEBUG: */ debugOutput('*MEDIA/L:'.__LINE__.'*');
+ updateMediadataEntry(array('total_send', 'normal_send'), 'add', 1);
+ } // END - if
+
+ // And count up the mail
+ $GLOBALS['pool_cnt']++;
+ //* DEBUG: */ debugOutput('*EXIT/L:'.__LINE__.'/'.$GLOBALS['pool_cnt'].'*');
+ break;
+
+ case 'already':
+ // Entry already found, but we still count one up!
+ $GLOBALS['pool_cnt']++;
+ //* DEBUG: */ debugOutput('*EXIT/L:'.__LINE__.'/'.$GLOBALS['pool_cnt']);
+ break;
+
+ default: // Unknown return type
+ logDebugMessage(__FILE__, __LINE__, 'Unknown status ' . $status . ' detected. pool_id=' . $mailData['id'] . ',sender=' . $mailData['sender_userid'] . ',stats_id=' . $stats_id);
+ break;
+ } // END - switch
+ } // END - if