`url`,
`target_send`,
`cat_id`
- ".$HTML."
+ " . $HTML . "
FROM
`{?_MYSQL_PREFIX?}_pool`
WHERE
// Parse all mails
while ($mailData = SQL_FETCHARRAY($result_main)) {
// Set mail order as 'active'. That means it will be sent out
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='ACTIVE' WHERE `id`=%s AND `data_type`='NEW' LIMIT 1",
- array($mailData['id']), __FILE__, __LINE__);
+ updatePoolDataById($mailData['id'], 'data_type', 'ACTIVE', NULL, " AND `data_type`='NEW'");
// Check fetched data for HTML
$isHtml = 'N';
- if (isset($mailData['html_msg'])) $isHtml = $mailData['html_msg'];
+ if (isset($mailData['html_msg'])) {
+ $isHtml = $mailData['html_msg'];
+ } // END - if
// Entry updated?
if (!SQL_HASZEROAFFECTED()) {
// Prepare the mail
$mailData['stats_id'] = bigintval($stats_id);
- // Prepare content
- $mailData['time'] = getPaymentData($mailData['payment_id'], 'time');
- $mailData['points'] = getPaymentData($mailData['payment_id'], 'payment');
-
// Load message template
$mailText = loadEmailTemplate('member_user_pool_normal', $mailData, bigintval($userid));
'cat_id' => $mailData['cat_id'],
'text' => $mailData['text'],
'url' => $mailData['url'],
- 'expiration' => '{%pipe,createFancyTime=' . getPaymentData($mailData['payment_id'], 'time') . '%}'
+ 'expiration' => '{%pipe,getPaymentTime,createFancyTime=' . $mailData['payment_id'] . '%}'
);
// Yes we do, so we notify admin and sender about fully sent mail!
} // END - if
// Set status to SEND because we completely send it away
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='SEND',`target_send`=0,`receivers`='' WHERE `id`=%s LIMIT 1",
- array(bigintval($mailData['id'])), __FILE__, __LINE__);
+ updatePoolDataById($mailData['id'], NULL, array('data_type' => 'SEND', 'target_send' => '0', 'receivers' => '');
// Update send-completed-time
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_stats` SET `timestamp_send`=UNIX_TIMESTAMP() WHERE `pool_id`=%s LIMIT 1",
elseif (($GLOBALS['pool_cnt'] >= getConfig('max_send')) || ($count2 >= getConfig('max_send'))) {
// There are some mails left to send for next round, so we reset the status back to NEW (=still not fully delivered)
$add = '';
- if ($GLOBALS['pool_cnt'] <= $mailData['target_send']) $add = ", target_send=target_send-".$GLOBALS['pool_cnt'];
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='NEW', receivers='%s'" . $add . " WHERE `id`=%s LIMIT 1",
- array(
- implode(';', $temporaryReceivers),
- bigintval($mailData['id'])
- ), __FILE__, __LINE__);
+ if ($GLOBALS['pool_cnt'] <= $mailData['target_send']) $add = ',`target_send`=`target_send`-' . $GLOBALS['pool_cnt'];
+ updatePoolDataById($mailData['id'], NULL, array('data_type' => 'NEW', 'receivers' => implode(';', $temporaryReceivers)), NULL, '', $add);
//* DEBUG: */ debugOutput('*EXIT/L:'.__LINE__.'*');
break;
// User does not exists so we have add the sender's points back to sender's account
if (($receivers['id'] == '0') || (empty($receivers['id']))) {
// List was empty
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='SEND' WHERE `id`=%s LIMIT 1",
- array(bigintval($mailData['id'])), __FILE__, __LINE__);
+ updatePoolDataById($mailData['id'], 'data_type', 'SEND');
} else {
// Is the userid set?
if (isValidId($userid)) {
// User does not exists, pay points back
- $points = getPaymentPrice($mailData['payment_id']);
initReferralSystem();
- addPointsThroughReferralSystem('pool_payback', $mailData['sender_userid'], $points);
+ addPointsThroughReferralSystem('pool_payback', $mailData['sender_userid'], getPaymentPrice($mailData['payment_id']));
// Add points together and remove user
- $pointsBack[$mailData['sender_userid']] += $points;
+ $pointsBack[$mailData['sender_userid']] += getPaymentPrice($mailData['payment_id']);
} // END - if
// Count up
unset($temporaryReceivers[$key]);
// Update receivers
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `receivers`='%s' WHERE `id`=%s LIMIT 1",
- array(implode(';', $temporaryReceivers), bigintval($mailData['id'])), __FILE__, __LINE__);
+ updatePoolData($mailData['id'], 'receivers', implode(';', $temporaryReceivers));
}
} // END - foreach
} // END - if