X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fpool%2Fpool-user.php;h=744fb6b3ee47a8ed0c60597cec671d6bbf299202;hb=8f14df8c3232a31917df0ac57363dbd6e975c147;hp=1abf8a079befa926fe1ef1d5814885b319fe5a38;hpb=4e5020660b07f30b7bf3ccc0a2ca664a19a21c0d;p=mailer.git
diff --git a/inc/pool/pool-user.php b/inc/pool/pool-user.php
index 1abf8a079b..744fb6b3ee 100644
--- a/inc/pool/pool-user.php
+++ b/inc/pool/pool-user.php
@@ -101,7 +101,7 @@ if (SQL_NUMROWS($result_main) > 0) {
// If there's no stats entry add it!
//* DEBUG: */ outputHtml("!L:".__LINE__.'/'.SQL_NUMROWS($result_stats)."!
");
- if (SQL_NUMROWS($result_stats) == '0') {
+ if (SQL_NUMROWS($result_stats) == 0) {
// No entry was found, so we add him!
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats` (`pool_id` , `userid`, `cat_id`, `payment_id`, `subject`, `url` , `max_rec` , `timestamp_ordered`, `timestamp_sstart`) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s' , UNIX_TIMESTAMP())",
array(bigintval($DATA['id']), bigintval($DATA['sender']), bigintval($DATA['cat_id']), bigintval($DATA['payment_id']), $DATA['subject'], $DATA['url'], $DATA['target_send'], bigintval($DATA['timestamp'])), __FILE__, __LINE__);
@@ -122,9 +122,6 @@ if (SQL_NUMROWS($result_main) > 0) {
case 'done':
// Prepare the mail
$DATA['stats_id'] = bigintval($stats_id);
- $DATA['surname'] = getUserData('surname');
- $DATA['family'] = getUserData('family');
- $DATA['gender'] = translateGender(getUserData('gender'));
// Replace text variables
foreach ($GLOBALS['replacer'] as $key => $value) {
@@ -132,18 +129,11 @@ if (SQL_NUMROWS($result_main) > 0) {
} // END - if
// Prepare content
- $content = array(
- 'id' => $DATA['stats_id'],
- 'url' => $DATA['url'],
- 'sender_userid' => $DATA['sender'],
- 'category' => getCategory($DATA['cat_id']),
- 'time' => createFancyTime(getPaymentPoints($DATA['payment_id'], 'time')),
- 'points' => translateComma(getPaymentPoints($DATA['payment_id'], 'payment')),
- 'text' => $DATA['text']
- );
+ $DATA['time'] = getPaymentPoints($DATA['payment_id'], 'time');
+ $DATA['points'] = getPaymentPoints($DATA['payment_id'], 'payment');
// Load message template
- $mailText = loadEmailTemplate('normal-mail', $content, bigintval($userid));
+ $mailText = loadEmailTemplate('normal-mail', $DATA, bigintval($userid));
// Send mail away
sendEmail(getUserData('email'), $DATA['subject'], $mailText, $HTML);
@@ -152,14 +142,14 @@ if (SQL_NUMROWS($result_main) > 0) {
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET emails_sent=emails_sent+1 WHERE `userid`=%s LIMIT 1",
array(bigintval($DATA['sender'])), __FILE__, __LINE__);
- if (getExtensionVersion('user') >= '0.1.4') {
+ 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 (getExtensionVersion('mediadata') >= '0.0.4') {
+ if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) {
// Update entry (or add missing)
//* DEBUG: */ outputHtml("*MEDIA/L:".__LINE__."*
");
updateMediadataEntry(array('total_send', 'normal_send'), 'add', 1);
@@ -214,7 +204,7 @@ if (SQL_NUMROWS($result_main) > 0) {
$cnt2 += $GLOBALS['pool_cnt'];
// Update mediadata if version is 0.0.4 or higher
- if (getExtensionVersion('mediadata') >= '0.0.4') {
+ if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) {
// Update entry (or add missing)
//* DEBUG: */ outputHtml("*MEDIA/L:".__LINE__."*
");
updateMediadataEntry(array('total_orders', 'normal_orders'), 'add', 1);
@@ -228,8 +218,11 @@ if (SQL_NUMROWS($result_main) > 0) {
// 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'] <= $DATA['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(';', $dummy), bigintval($DATA['id'])), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='NEW', receivers='%s'" . $add . " WHERE `id`=%s LIMIT 1",
+ array(
+ implode(';', $dummy),
+ bigintval($DATA['id'])
+ ), __FILE__, __LINE__);
//* DEBUG: */ outputHtml("*EXIT/L:".__LINE__."*
");
break;
@@ -265,9 +258,9 @@ if (SQL_NUMROWS($result_main) > 0) {
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `receivers`='%s' WHERE `id`=%s LIMIT 1",
array(implode(';', $dummy), bigintval($DATA['id'])), __FILE__, __LINE__);
}
- }
- }
- }
+ } // END - foreach
+ } // END - if
+ } // END - while
// Do we have points to "pay back"?
if ((count($pointsBack) > 0) && (!empty($pointsBack[0]))) {
@@ -277,7 +270,7 @@ if (SQL_NUMROWS($result_main) > 0) {
if (($PB > 0) && ($userid > 0)) {
// Prepare content
$content = array(
- 'points' => translateComma($PB)
+ 'points' => $PB
);
// We have to pay back some points to the sender (we add them directly :-P)
@@ -297,7 +290,7 @@ if (SQL_NUMROWS($result_main) > 0) {
} // END - if
} // END - foreach
} // END - if
-}
+} // END - if
// Free memory
SQL_FREERESULT($result_main);
@@ -305,5 +298,5 @@ SQL_FREERESULT($result_main);
// Remove variable
unset($mailText);
-//
+// [EOF]
?>