* $Author:: $ *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team *
- * For more information visit: http://www.mxchange.org *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team *
+ * For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
// Check for freed mail orders to send out
if (isExtensionActive('html_mail')) {
// With HTML mails
- $HTML = ', `html_msg`';
+ $HTML = ',`html_msg`';
} // END - if
// Main query
$result_main = SQL_QUERY("SELECT
- `id`,`sender` AS `sender_userid`,`subject`,`text`,`receivers`,
- `payment_id`,`timestamp`,`url`,`target_send`,`cat_id`
+ `id`,
+ `sender` AS `sender_userid`,
+ `subject`,
+ `text`,
+ `receivers`,
+ `payment_id`,
+ `timestamp`,
+ `url`,
+ `target_send`,
+ `cat_id`
".$HTML."
FROM
`{?_MYSQL_PREFIX?}_pool`
if (!SQL_HASZERONUMS($result_main)) {
// Parse all mails
- while ($mailData = SQL_FETCHARRAY($result_main, 0, false)) {
+ 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__);
//* DEBUG: */ debugOutput('!L:'.__LINE__.'/'.SQL_NUMROWS($result_stats).'!');
if (SQL_HASZERONUMS($result_stats)) {
// 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($mailData['id']), bigintval($mailData['sender_userid']), bigintval($mailData['cat_id']), bigintval($mailData['payment_id']), $mailData['subject'], $mailData['url'], $mailData['target_send'], bigintval($mailData['timestamp'])), __FILE__, __LINE__);
+ 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($mailData['id']),
+ bigintval($mailData['sender_userid']),
+ bigintval($mailData['cat_id']),
+ bigintval($mailData['payment_id']),
+ $mailData['subject'],
+ $mailData['url'],
+ bigintval($mailData['target_send']),
+ bigintval($mailData['timestamp'])
+ ), __FILE__, __LINE__);
// Receive it's id for the links table
$result_stats = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s AND `userid`=%s AND timestamp_ordered='%s' LIMIT 1",
} // 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",
+ 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__);
// Update send-completed-time
if (isValidUserId($userid)) {
// User does not exists, pay points back
$points = getPaymentPoints($mailData['payment_id']);
- initReferalSystem();
- addPointsThroughReferalSystem('pool_payback', $mailData['sender_userid'], $points);
+ initReferralSystem();
+ addPointsThroughReferralSystem('pool_payback', $mailData['sender_userid'], $points);
// Add points together and remove user
$pointsBack[$mailData['sender_userid']] += $points;