X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fpool%2Fpool-bonus.php;h=6baa5b7705d1b567bb09f23b13274ebc5eb00802;hp=630562a0894dd27ae72cc7fea80fbfdaf0b6e893;hb=3fc95231ba85cc8c292b81bf502d4d7fab85ca8b;hpb=4f2414a0134da82027fce8a6c98696a207c8c8cc diff --git a/inc/pool/pool-bonus.php b/inc/pool/pool-bonus.php index 630562a089..6baa5b7705 100644 --- a/inc/pool/pool-bonus.php +++ b/inc/pool/pool-bonus.php @@ -1,7 +1,7 @@ $userid) { + foreach ($receiverS as $key => $userid) { // Load personal data - //* DEBUG: */ print("*L:".__LINE__.'/'.$userid."*
"); - $result_user = SQL_QUERY_ESC("SELECT `surname`, `family`, `email` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1", - array(bigintval($userid)), __FILE__, __LINE__); - - // Is his data available? - if (SQL_NUMROWS($result_user) == 1) { + if (fetchUserData($userid)) { // The final receiver does exists so we can continue... - list($surname, $family, $email) = SQL_FETCHROW($result_user); //* DEBUG: */ print("OK!/L:".__LINE__."
"); // Mark this user as "spammed" ;-) And place a line for him... @@ -120,10 +114,10 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) { // Send mail away if (isset($DATA['html_msg'])) { // Send HTML? - sendEmail($email, $DATA['subject'], $mailText, $DATA['html_msg']); + sendEmail(getUserData('email'), $DATA['subject'], $mailText, $DATA['html_msg']); } else { // No HTML mail! - sendEmail($email, $DATA['subject'], $mailText); + sendEmail(getUserData('email'), $DATA['subject'], $mailText); } // Count one up and remove entry from dummy array @@ -131,22 +125,19 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) { 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", + 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)) { + if (($GLOBALS['pool_cnt'] >= getConfig('max_send')) || (countSelection($dummy) == '0')) { // Yes, we have //* DEBUG: */ print("*EXIT/L:".__LINE__."
"); break; } // END - if } // END - if } // END - if - - // Free some memory - SQL_FREERESULT($result_user); - } + } // END - foreach // Update mediadata if version is 0.0.4 or higher if (getExtensionVersion('mediadata') >= '0.0.4') { @@ -154,12 +145,12 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) { $P = $GLOBALS['pool_cnt']; if (!empty($cnt2) && empty($GLOBALS['pool_cnt'])) $P = $cnt2; //* DEBUG: */ print("+MEDIA/L:".__LINE__.'/'.$P."+
"); - updateMediadataEntry(array("total_send", "bonus_send"), 'add', $P); + updateMediadataEntry(array('total_send', 'bonus_send'), 'add', $P); } // END - if // Close sending system //* DEBUG: */ print("-L:".__LINE__.'/'.countSelection($dummy)."-
"); - if (countSelection($dummy) == 0) { + if (countSelection($dummy) == '0') { // Queue reached! SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_bonus` SET `data_type`='SEND', `target_send`=0, `receivers`='' WHERE `id`=%s LIMIT 1", array(bigintval($DATA['id'])), __FILE__, __LINE__); @@ -169,7 +160,7 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) { if (getExtensionVersion('mediadata') >= '0.0.4') { // Update entry (or add missing) //* DEBUG: */ print("*MEDIA/L:".__LINE__."*
"); - updateMediadataEntry(array("total_orders", "bonus_orders"), 'add', 1); + updateMediadataEntry(array('total_orders', 'bonus_orders'), 'add', 1); } // END - if } elseif ($GLOBALS['pool_cnt'] >= getConfig('max_send')) { // Update bonus pool