Referal levels for surfbar added (unfinished)
[mailer.git] / inc / autopurge.php
index aa393cf9b5718c65f6dcb9b85dedb04b0a67bae4..7c98694ed7e1dc7c2c3e8ca624136116ed96ea63 100644 (file)
@@ -38,16 +38,16 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
        require($INC);
 }
 
-if (($CONFIG['auto_purge_active'] == 'Y') && ($CONFIG['auto_purge'] > 0))
+if (($_CONFIG['auto_purge_active'] == "Y") && ($_CONFIG['auto_purge'] > 0))
 {
        // First calculate the timestamp
        if (function_exists('CREATE_TIME_SELECTIONS'))
        {
-               $PURGE = time() - $CONFIG['auto_purge'];
+               $PURGE = time() - $_CONFIG['auto_purge'];
        }
         else
        {
-               $PURGE = time() - $CONFIG['auto_purge'] * 24 * 60 * 60;
+               $PURGE = time() - $_CONFIG['auto_purge'] * 24 * 60 * 60;
        }
 
        // Init variables
@@ -162,10 +162,10 @@ WHERE s.timestamp_ordered <= %s ORDER BY s.userid",
 }
 
 // Shall I look for inactive accounts and autopurge inactive accounts?
-if ($CONFIG['ap_inactive'] == 'Y')
+if ($_CONFIG['ap_inactive'] == "Y")
 {
        // Ok, let's have a look...
-       $since = bigintval(time() - $CONFIG['ap_in_since']);
+       $since = bigintval(time() - $_CONFIG['ap_in_since']);
        $EXCLUDE_LIST = " AND d.userid != c.def_refid";
 
        // Check for more extensions
@@ -190,8 +190,8 @@ ORDER BY d.userid", array($since, $since, $since), __FILE__, __LINE__);
        {
                // Prepare variables and constants...
                $UIDs = "";
-               define('__INACTIVE_SINCE', ($CONFIG['ap_in_since'] / 60 / 60));
-               define('__INACTIVE_TIME' , ($CONFIG['ap_in_time']  / 60 / 60));
+               define('__INACTIVE_SINCE', ($_CONFIG['ap_in_since'] / 60 / 60));
+               define('__INACTIVE_TIME' , ($_CONFIG['ap_in_time']  / 60 / 60));
 
                // Mark found accounts as inactive and send an email
                while(list($uid, $email, $last) = SQL_FETCHROW($result_inactive))
@@ -231,7 +231,7 @@ ORDER BY d.userid", array($since, $since, $since), __FILE__, __LINE__);
 
        // Now let's have a look for inactive accounts we want to delete we newly use the same exclude list
        // here for e.g. excluding holiday users
-       $time = bigintval(time() - $CONFIG['ap_in_time']);
+       $time = bigintval(time() - $_CONFIG['ap_in_time']);
        $result_inactive = SQL_QUERY_ESC("SELECT d.userid, d.email, d.last_online
 FROM "._MYSQL_PREFIX."_user_data AS d, "._MYSQL_PREFIX."_config AS c
 WHERE status='CONFIRMED' AND joined < %s AND last_online< %s AND ap_notified < %s
@@ -260,7 +260,7 @@ ORDER BY userid",
                $UIDs = str_replace(", ", "\n", substr($UIDs, 0, -2));
 
                // Send mail notification to admin
-               if ($CONFIG['ap_un_mail'] == 'Y')
+               if ($_CONFIG['ap_un_mail'] == "Y")
                {
                        if (GET_EXT_VERSION("admins") >= "0.4.1")
                        {
@@ -279,17 +279,17 @@ ORDER BY userid",
 }
 
 // Shall I auto-purge unconfirmed accounts?
-if ($CONFIG['ap_unconfirmed'] == 'Y')
+if ($_CONFIG['ap_unconfirmed'] == "Y")
 {
        // Init variables and find unconfirmed accounts which I shall auto-purge
-       $time = bigintval(time() - $CONFIG['ap_un_time']);
+       $time = bigintval(time() - $_CONFIG['ap_un_time']);
        $result_uncon = SQL_QUERY_ESC("SELECT userid, email, joined FROM "._MYSQL_PREFIX."_user_data WHERE status='UNCONFIRMED' AND joined < %s ORDER BY userid",
         array($time), __FILE__, __LINE__);
        if (SQL_NUMROWS($result_uncon) > 0)
        {
                // Prepare variable...
                $UIDs = "";
-               define('__UNCONFIRMED_TIME' , ($CONFIG['ap_un_time']  / 60 / 60));
+               define('__UNCONFIRMED_TIME' , ($_CONFIG['ap_un_time']  / 60 / 60));
 
                // Delete inactive accounts
                while (list($uid, $email, $joined) = SQL_FETCHROW($result_uncon))
@@ -308,7 +308,7 @@ if ($CONFIG['ap_unconfirmed'] == 'Y')
                $UIDs = str_replace(", ", "\n", substr($UIDs, 0, -2));
 
                // Send mail notification to admin
-               if ($CONFIG['ap_un_mail'] == 'Y')
+               if ($_CONFIG['ap_un_mail'] == "Y")
                {
                        if (GET_EXT_VERSION("admins") >= "0.4.1")
                        {
@@ -327,15 +327,15 @@ if ($CONFIG['ap_unconfirmed'] == 'Y')
 }
 
 // Check version (must be > 0.0)
-if ((GET_EXT_VERSION("task") > "0.0") && ($CONFIG['ap_tasks'] == 'Y'))
+if ((GET_EXT_VERSION("task") > "0.0") && ($_CONFIG['ap_tasks'] == "Y"))
 {
        // Purge deleted tasks (no notification to admin)
-       $since = bigintval(time() - $CONFIG['ap_tasks_time']);
+       $since = bigintval(time() - $_CONFIG['ap_tasks_time']);
        $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE status='DELETED' AND task_created <= %s",
         array($since), __FILE__, __LINE__);
        $DELETED = SQL_AFFECTEDROWS();
 
-       if (($DELETED > 0) && ($CONFIG['ap_tasks_mail'] == 'Y'))
+       if (($DELETED > 0) && ($_CONFIG['ap_tasks_mail'] == "Y"))
        {
                // Send out email to admin
                if (GET_EXT_VERSION("admins") >= "0.4.1")
@@ -351,10 +351,10 @@ 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']);
+       $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",
         array($since), __FILE__, __LINE__);
 
@@ -377,7 +377,7 @@ if ($CONFIG['ap_del_mails'])
                                $DELETED += SQL_AFFECTEDROWS();
 
                                // Reset query (to prevent possible errors) ...
-                               $since = bigintval(time() - $CONFIG['ap_dm_timeout']);
+                               $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",
                                 array($since), __FILE__, __LINE__);
                        }
@@ -388,7 +388,7 @@ if ($CONFIG['ap_del_mails'])
        SQL_FREERESULT($result_mails);
 
        // Now let's check for stats entries as well
-       $since = bigintval(time() - $CONFIG['ap_dm_timeout']);
+       $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",
         array($since), __FILE__, __LINE__);
 
@@ -407,7 +407,7 @@ if ($CONFIG['ap_del_mails'])
                                $DELETED += SQL_AFFECTEDROWS();
 
                                // Reset query (to prevent possible errors) ...
-                               $since = bigintval(time() - $CONFIG['ap_dm_timeout']);
+                               $since = bigintval(time() - $_CONFIG['ap_dm_timeout']);
                                $result_mails = SQL_QUERY_ESC("SELECT sender FROM "._MYSQL_PREFIX."_user_stats WHERE data_type='DELETED' AND timestamp_send <= %s ORDER BY sender",
                                 array($since), __FILE__, __LINE__);
                        }
@@ -418,7 +418,7 @@ 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
                if (GET_EXT_VERSION("admins") >= "0.4.1")