<?php
/************************************************************************
- * MXChange v0.2.1 Start: 12/12/2008 *
- * =============== Last change: 12/12/2008 *
+ * Mailer v0.2.1-FINAL Start: 12/12/2008 *
+ * =================== Last change: 12/12/2008 *
* *
* -------------------------------------------------------------------- *
* File : pool-bonus.php *
// "Explode" all receivers into an array
if (ereg(';', $DATA['receivers'])) {
// There's more than one receiver in the list...
- $RECEIVERS = explode(';', $DATA['receivers']);
+ $receiverS = explode(';', $DATA['receivers']);
} elseif (!empty($DATA['points'])) {
// Only one user left
- $RECEIVERS = array($DATA['receivers']);
+ $receiverS = array($DATA['receivers']);
} else {
// No users left
- $RECEIVERS = array(0);
+ $receiverS = array(0);
}
- $dummy = $RECEIVERS;
+ $dummy = $receiverS;
- // Now, if we are good little boys and girls Santa left us some user-ids.
+ // Now, if we are good little boys and girls Santa Claus left us some user-ids.
// We can now send mails to them...
- foreach ($RECEIVERS as $key => $userid) {
+ foreach ($receiverS as $key => $userid) {
// Load personal data
if (fetchUserData($userid)) {
// The final receiver does exists so we can continue...
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__."<br />");
break;
$P = $GLOBALS['pool_cnt'];
if (!empty($cnt2) && empty($GLOBALS['pool_cnt'])) $P = $cnt2;
//* DEBUG: */ print("+MEDIA/L:".__LINE__.'/'.$P."+<br />");
- 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)."-<br />");
- 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__);
if (getExtensionVersion('mediadata') >= '0.0.4') {
// Update entry (or add missing)
//* DEBUG: */ print("*MEDIA/L:".__LINE__."*<br />");
- 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