]> git.mxchange.org Git - mailer.git/blobdiff - inc/autopurge.php
Reset rewritten, SQL fixed, zeros are now numeric
[mailer.git] / inc / autopurge.php
index 0871b6ce80aa14ae21a16ebaa91ba513e28d7248..a0896be2c32a52c8911a8af81318a8ada6c813bd 100644 (file)
@@ -51,7 +51,7 @@ if (($_CONFIG['auto_purge_active'] == "Y") && ($_CONFIG['auto_purge'] > 0))
        }
 
        // Init variables
-       $admin_points = "0";
+       $admin_points = 0;
 
        // Then check for outdated mail order. We don't delete them just the confirmation links will be deleted.
        $result = SQL_QUERY_ESC("SELECT s.id, s.userid, s.pool_id, t.price
@@ -63,7 +63,7 @@ WHERE s.timestamp_ordered <= %s ORDER BY s.userid",
        if (SQL_NUMROWS($result) > 0)
        {
                // Start deleting procedure
-               $uid = "0"; $points = "0";
+               $uid = 0; $points = 0;
                while(list($mid, $sender, $pool, $price) = SQL_FETCHROW($result))
                {
                        // Check if confirmation links are purged or not
@@ -79,7 +79,7 @@ WHERE s.timestamp_ordered <= %s ORDER BY s.userid",
                                {
                                        // Directly add points back to senders account
                                        AUTOPURGE_ADD_POINTS($uid, $points);
-                                       $points = "0";
+                                       $points = 0;
                                }
                                // Add points
                                $uid = $sender; $points += $price; $admin_points += $price;
@@ -110,7 +110,7 @@ WHERE s.timestamp_ordered <= %s ORDER BY s.userid",
                if (SQL_NUMROWS($result) > 0)
                {
                        // Start deleting procedure
-                       $points = "0";
+                       $points = 0;
                        while (list($bid, $price) = SQL_FETCHROW($result))
                        {
                                // Check if confirmation links are purged or not
@@ -311,8 +311,7 @@ if ((GET_EXT_VERSION("task") > "0.0") && ($_CONFIG['ap_tasks'] == "Y"))
 }
 
 // Search for mails from deleted members?
-if ($_CONFIG['ap_del_mails'])
-{
+if ($_CONFIG['ap_del_mails']) {
        // Okay, let's check for them...
        $since = bigintval(time() - $_CONFIG['ap_dm_timeout']);
        $result_mails = SQL_QUERY_ESC("SELECT sender FROM "._MYSQL_PREFIX."_pool WHERE data_type='DELETED' AND timestamp <= %s ORDER BY sender",
@@ -322,15 +321,12 @@ if ($_CONFIG['ap_del_mails'])
        $DELETED = 0;
 
        // Do we have "purged" mails?
-       if (SQL_NUMROWS($result_mails) > 0)
-       {
+       if (SQL_NUMROWS($result_mails) > 0) {
                // Okay, check for their sender's
-               while(list($sender) = SQL_FETCHROW($result_mails))
-               {
+               while(list($sender) = SQL_FETCHROW($result_mails)) {
                        // Check now...
                        $fount = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", array(bigintval($sender)), __FILE__, __LINE__));
-                       if ($found == 0)
-                       {
+                       if ($found == 0) {
                                // Okay we found some mails!
                                $result_remove = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_pool WHERE sender=%s",
                                 array(bigintval($sender)), __FILE__, __LINE__);
@@ -353,15 +349,12 @@ if ($_CONFIG['ap_del_mails'])
         array($since), __FILE__, __LINE__);
 
        // Do we have "purged" mails?
-       if (SQL_NUMROWS($result_mails) > 0)
-       {
+       if (SQL_NUMROWS($result_mails) > 0) {
                // Okay, check for their sender's
-               while(list($sender) = SQL_FETCHROW($result_mails))
-               {
+               while(list($sender) = SQL_FETCHROW($result_mails)) {
                        // Check now...
                        $found = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", array(bigintval($sender)), __FILE__, __LINE__));
-                       if ($found == 0)
-                       {
+                       if ($found == 0) {
                                // Okay we found some mails!
                                $result_remove = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_stats WHERE sender=%s", array(bigintval($sender)), __FILE__, __LINE__);
                                $DELETED += SQL_AFFECTEDROWS();
@@ -378,25 +371,23 @@ if ($_CONFIG['ap_del_mails'])
        SQL_FREERESULT($result_mails);
 
        // Do we have deleted mails and the admin want's to receive a notification
-       if (($DELETED > 0) && ($_CONFIG['ap_dm_notify'] == "Y"))
-       {
+       if (($DELETED > 0) && ($_CONFIG['ap_dm_notify'] == "Y")) {
                // Send out email to admin
                SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT, "admin_autopurge_del_mails", $DELETED, "");
        }
 }
 
-if (EXT_IS_ACTIVE("rallye"))
-{
+if (EXT_IS_ACTIVE("rallye")) {
        // Check expired rallyes (hard-coded 3 days limit for displaying expired rallyes!)
        require_once(PATH."inc/libs/rallye_functions.php");
        RALLYE_DELETE_EXPIRED_RALLYES();
 }
-//
-if (EXT_IS_ACTIVE("bonus"))
-{
+
+if (EXT_IS_ACTIVE("bonus")) {
        // Check for expired turbo bonus lines
        require_once(PATH."inc/libs/bonus_functions.php");
        BONUS_PURGE_EXPIRED_TURBO_BONUS();
 }
+
 //
 ?>