define('SERVER_URL', "http://www.mxchange.org");
// Current SVN revision
-define('CURR_SVN_REVISION', "656");
+define('CURR_SVN_REVISION', "657");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
return false;
} // END - if
-// Set some global variables
-global $cnt, $msg;
-
-// Init counter and message
-$cnt = 0; $msg = "";
+// Init counter
+$GLOBALS['pool_cnt'] = 0;
// Load more cache includes
$INC_POOL = GET_DIR_AS_ARRAY(PATH."inc/pool/", "pool-");
// Run the filter
RUN_FILTER('load_includes');
-// Remove message (IMPORTANT!)
-unset($msg);
+// Remove counter again
+unset($GLOBALS['pool_cnt']);
//
?>
}
// Only send bonus mail when bonus extension is active and maximum send-mails is not reached
-if ($cnt < getConfig('max_send')) {
+if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
// Do we need to send out bonus mails?
if (EXT_IS_ACTIVE("html_mail")) {
// 0 1 2 3 4 5 6 7 8 9 10 11
);
// Prepare the mail
- $msg = LOAD_EMAIL_TEMPLATE("bonus-mail", $content, $uid);
+ $mailText = LOAD_EMAIL_TEMPLATE("bonus-mail", $content, $uid);
// Send mail away
if (isset($DATA['html_msg'])) {
// Send HTML?
- SEND_EMAIL($email, $DATA['subject'], $msg, $DATA['html_msg']);
+ SEND_EMAIL($email, $DATA['subject'], $mailText, $DATA['html_msg']);
} else {
// No HTML mail!
- SEND_EMAIL($email, $DATA['subject'], $msg);
+ SEND_EMAIL($email, $DATA['subject'], $mailText);
}
// Count one up and remove entry from dummy array
- $cnt++; unset($dummy[$key]);
+ $GLOBALS['pool_cnt']++; unset($dummy[$key]);
if (GET_EXT_VERSION("user") >= "0.1.4") {
// Update mails received for receiver
} // END - if
// Do we have send maximum mails?
- if (($cnt >= getConfig('max_send')) || (SELECTION_COUNT($dummy) == 0)) {
+ if (($GLOBALS['pool_cnt'] >= getConfig('max_send')) || (SELECTION_COUNT($dummy) == 0)) {
// Yes, we have
//* DEBUG: */ echo "*EXIT/L:".__LINE__."<br />";
break;
// Update mediadata if version is 0.0.4 or higher
if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
// Update entry (or add missing
- $P = $cnt;
- if (!empty($cnt2) && empty($cnt)) $P = $cnt2;
+ $P = $GLOBALS['pool_cnt'];
+ if (!empty($cnt2) && empty($GLOBALS['pool_cnt'])) $P = $cnt2;
//* DEBUG: */ echo "+MEDIA/L:".__LINE__."/".$P."+<br />";
MEDIA_UPDATE_ENTRY(array("total_send", "bonus_send"), "add", $P);
} // END - if
if (SELECTION_COUNT($dummy) == 0) {
// Queue reached!
$result_done = 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__);
+ array(bigintval($DATA['id'])), __FILE__, __LINE__);
//* DEBUG: */ echo "*L:".__LINE__."*<br />";
// Update mediadata if version is 0.0.4 or higher
//* DEBUG: */ echo "*MEDIA/L:".__LINE__."*<br />";
MEDIA_UPDATE_ENTRY(array("total_orders", "bonus_orders"), "add", 1);
} // END - if
- } elseif ($cnt >= getConfig('max_send')) {
+ } elseif ($GLOBALS['pool_cnt'] >= getConfig('max_send')) {
// Update bonus pool
$result_done = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET data_type='NEW', target_send=%s, receivers='%s' WHERE id=%s LIMIT 1",
array(SELECTION_COUNT($dummy), implode(";", $dummy), bigintval($DATA['id'])), __FILE__, __LINE__);
// Free memory
SQL_FREERESULT($result_bonus);
-}
-// Remove message (IMPORTANT!)
-unset($msg);
+ // Remove variable
+ unset($mailText);
+}
//
?>
);
// Load message template
- $msg = LOAD_EMAIL_TEMPLATE("normal-mail", $content, bigintval($uid));
+ $mailText = LOAD_EMAIL_TEMPLATE("normal-mail", $content, bigintval($uid));
// Send mail away
- SEND_EMAIL($email, $DATA[2], $msg, $HTML);
+ SEND_EMAIL($email, $DATA[2], $mailText, $HTML);
// Count sent mails...
$result = SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET emails_sent=emails_sent+1 WHERE userid=%s LIMIT 1",
} // END - if
// And count up the mail
- $cnt++;
- //* DEBUG: */ echo"*EXIT/L:".__LINE__."/".$cnt."*<br />";
+ $GLOBALS['pool_cnt']++;
+ //* DEBUG: */ echo"*EXIT/L:".__LINE__."/".$GLOBALS['pool_cnt']."*<br />";
break;
case "already":
// Entry already found, but we still count one up!
- $cnt++;
- //* DEBUG: */ echo"*EXIT/L:".__LINE__."/".$cnt."<br />";
+ $GLOBALS['pool_cnt']++;
+ //* DEBUG: */ echo"*EXIT/L:".__LINE__."/".$GLOBALS['pool_cnt']."<br />";
break;
}
}
- // Do we have reached the maximum to send mails? || (getConfig('max_send') >= $cnt)
- //* DEBUG: */ echo "*L:".__LINE__."/".$cnt.">=".$DATA[8]."/".getConfig('max_send').">=".$cnt."/".$LAST_SENT_ID."!=".$DATA[0]."*<br />";
- if ((($cnt >= $DATA[8])) && ($LAST_SENT_ID != $DATA[0])) {
+ // Do we have reached the maximum to send mails? || (getConfig('max_send') >= $GLOBALS['pool_cnt'])
+ //* DEBUG: */ echo "*L:".__LINE__."/".$GLOBALS['pool_cnt'].">=".$DATA[8]."/".getConfig('max_send').">=".$GLOBALS['pool_cnt']."/".$LAST_SENT_ID."!=".$DATA[0]."*<br />";
+ if ((($GLOBALS['pool_cnt'] >= $DATA[8])) && ($LAST_SENT_ID != $DATA[0])) {
// Prepare content
$content = array(
'sender_uid' => $DATA[1],
list($sname, $fname, $email) = SQL_FETCHROW($result_sender);
// Load email template
- $msg = LOAD_EMAIL_TEMPLATE("done-member", $content, $DATA[1]);
+ $mailText = LOAD_EMAIL_TEMPLATE("done-member", $content, $DATA[1]);
// Send it also waway
- SEND_EMAIL($email, MEMBER_SUBJ_SEND_DONE, $msg);
+ SEND_EMAIL($email, MEMBER_SUBJ_SEND_DONE, $mailText);
} // END - if
// Free result
$result_user = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_stats SET timestamp_send=UNIX_TIMESTAMP() WHERE pool_id=%s LIMIT 1",
array(bigintval($DATA[0])), __FILE__, __LINE__);
- $LAST_SENT_ID = $DATA[0]; $cnt = 0;
- $cnt2 += $cnt;
+ $LAST_SENT_ID = $DATA[0]; $GLOBALS['pool_cnt'] = 0;
+ $cnt2 += $GLOBALS['pool_cnt'];
// Update mediadata if version is 0.0.4 or higher
if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
break;
}
// Do we have send maximum mails?
- elseif (($cnt >= getConfig('max_send')) || ($cnt2 >= getConfig('max_send'))) {
+ elseif (($GLOBALS['pool_cnt'] >= getConfig('max_send')) || ($cnt2 >= 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 ($cnt <= $DATA[8]) $ADD = ", target_send=target_send-".$cnt;
+ if ($GLOBALS['pool_cnt'] <= $DATA[8]) $ADD = ", target_send=target_send-".$GLOBALS['pool_cnt'];
$result_queue = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_pool SET data_type='NEW', receivers='%s'".$ADD." WHERE id=%s LIMIT 1",
array(implode(";", $dummy), bigintval($DATA[0])), __FILE__, __LINE__);
SQL_FREERESULT($result);
// User account does exists, so we can safely pay back!
- $msg = LOAD_EMAIL_TEMPLATE("back-member", $content, bigintval($uid));
+ $mailText = LOAD_EMAIL_TEMPLATE("back-member", $content, bigintval($uid));
// Send mail out to member
- SEND_EMAIL($email, MEMBER_BACK_JACKPOT." (".$uid.")", $msg);
+ SEND_EMAIL($email, MEMBER_BACK_JACKPOT." (".$uid.")", $mailText);
} else {
// Add to jackpot
ADD_JACKPOT($PB);
// Free memory
SQL_FREERESULT($result_main);
+// Remove variable
+unset($mailText);
+
//
?>