X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fpurge%2Fpurge-general.php;h=07205e280fe3bddd5f4838163135208cb45a0dca;hb=094f3a6af3b901020395eafee16b3b5e151f1137;hp=f3ab83bd2d7124f637d2be0121e2d5c8ee95397c;hpb=2df9f7a53f8b1dd5164f87824a324ccb3b6634cb;p=mailer.git diff --git a/inc/purge/purge-general.php b/inc/purge/purge-general.php index f3ab83bd2d..07205e280f 100644 --- a/inc/purge/purge-general.php +++ b/inc/purge/purge-general.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { die(); } elseif ((!isExtensionActive('autopurge')) || (!isAutoPurgingActive())) { // Abort here - return false; + return FALSE; } if (getAutoPurge() > 0) { @@ -53,17 +53,20 @@ if (getAutoPurge() > 0) { // Then check for outdated mail order. We don't delete them just the confirmation links will be deleted. $result = SQL_QUERY('SELECT - s.id, s.userid, s.pool_id, t.price + `s`.`id`, + `s`.`userid`, + `s`.`pool_id`, + `t`.`price` FROM - `{?_MYSQL_PREFIX?}_user_stats` AS s + `{?_MYSQL_PREFIX?}_user_stats` AS `s` LEFT JOIN - `{?_MYSQL_PREFIX?}_payments` AS t + `{?_MYSQL_PREFIX?}_payments` AS `t` ON - s.`payment_id`=t.`id` + `s`.`payment_id`=`t`.`id` WHERE - (UNIX_TIMESTAMP() - s.`timestamp_ordered`) >= {?auto_purge?} + (UNIX_TIMESTAMP() - `s`.`timestamp_ordered`) >= {?auto_purge?} ORDER BY - s.userid ASC', __FILE__, __LINE__); + `s`.`userid` ASC', __FILE__, __LINE__); if (!SQL_HASZERONUMS($result)) { // Start deleting procedure $userid = NULL; @@ -77,7 +80,7 @@ ORDER BY SQL_FREERESULT($result_links); // At least one link was found, enougth to pay back the points - if (($userid != $content['userid']) && (isValidUserId($userid)) && ($points > 0)) { + if (($userid != $content['userid']) && (isValidId($userid)) && ($points > 0)) { // Directly add points back to senders account addPointsAutoPurge($userid, $points); $points = '0'; @@ -88,11 +91,11 @@ ORDER BY // Remove confirmation links from queue addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `stats_id`=%s", - array(bigintval($content['id'])), __FILE__, __LINE__, false)); + array(bigintval($content['id'])), __FILE__, __LINE__, FALSE)); // Update status of order addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='DELETED' WHERE `id`=%s LIMIT 1", - array(bigintval($content['pool_id'])), __FILE__, __LINE__, false)); + array(bigintval($content['pool_id'])), __FILE__, __LINE__, FALSE)); } // END - if } // END - while @@ -104,7 +107,7 @@ ORDER BY SQL_FREERESULT($result); // Is the 'bonus' extension installed and activated? - if (isExtensionActive('bonus', true)) { + if (isExtensionActive('bonus', TRUE)) { // Check for bonus campaigns $result = SQL_QUERY("SELECT `id`, `points` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `data_type`='SEND' AND `timestamp` <= {?auto_purge?} ORDER BY `id` ASC", __FILE__, __LINE__); if (!SQL_HASZERONUMS($result)) { @@ -123,11 +126,11 @@ ORDER BY // Remove confirmation links from queue addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s", - array(bigintval($content['id'])), __FILE__, __LINE__, false)); + array(bigintval($content['id'])), __FILE__, __LINE__, FALSE)); // Update status of order addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_bonus` SET `data_type`='DELETED' WHERE `id`=%s LIMIT 1", - array(bigintval($content['id'])), __FILE__, __LINE__, false)); + array(bigintval($content['id'])), __FILE__, __LINE__, FALSE)); } // END - if } // END - while