]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/task_functions.php
More queries now depends on UNIX_TIMESTAMP() SQL function, wrong index in autopurge...
[mailer.git] / inc / libs / task_functions.php
index 94fb9b9c7da581f0b8f6ea31ca61f7b25bc7839c..1aced16f60ee5ed4cb060d3ad899bdd6d5992617 100644 (file)
  ************************************************************************/
 
 // Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
+
 //
 // The advanced overview shows detailed informations to your exchange script:
 //  - Unconfirmed / locked accounts
@@ -271,22 +272,18 @@ function OUTPUT_ADVANCED_OVERVIEW (&$result_main)
 
        if (EXT_IS_ACTIVE("autopurge")) {
                // Start finding them...
-               $since = (time() - $_CONFIG['ap_in_since']);
-               $EXCLUDE_LIST = " AND d.userid != c.def_refid";
+               $since = (time() - $_CONFIG['ap_inactive_since']);
+               $EXCLUDE_LIST = " AND d.userid != ".$_CONFIG['def_refid']."";
 
                // Check for more extensions
-               if (EXT_IS_ACTIVE("beg"))     $EXCLUDE_LIST .= " AND d.userid != c.beg_uid";
-               if (EXT_IS_ACTIVE("bonus"))   $EXCLUDE_LIST .= " AND d.userid != c.bonus_uid";
-               if (EXT_IS_ACTIVE("doubler")) $EXCLUDE_LIST .= " AND d.userid != c.doubler_uid";
-
-               // Check for new holiday system
-               if (GET_EXT_VERSION("holiday") >= "0.1.3") {
-                       $EXCLUDE_LIST .= " AND d.holiday_active = 'N'";
-               }
+               if (EXT_IS_ACTIVE("beg"))                  $EXCLUDE_LIST .= " AND d.userid != c.beg_uid";
+               if (EXT_IS_ACTIVE("bonus"))                $EXCLUDE_LIST .= " AND d.userid != c.bonus_uid";
+               if (EXT_IS_ACTIVE("doubler"))              $EXCLUDE_LIST .= " AND d.userid != c.doubler_uid";
+               if (GET_EXT_VERSION("holiday") >= "0.1.3") $EXCLUDE_LIST .= " AND d.holiday_active = 'N'";
 
                // Check for all accounts
                $SQLs[] = "SELECT DISTINCT d.userid, d.email, d.last_online
-FROM "._MYSQL_PREFIX."_user_data AS d, "._MYSQL_PREFIX."_config AS c
+FROM "._MYSQL_PREFIX."_user_data AS d
 WHERE d.status='CONFIRMED' AND d.joined < ".$since." AND d.last_online < ".$since." AND d.ap_notified < ".$since."
 ".$EXCLUDE_LIST."
 ORDER BY d.userid";
@@ -357,10 +354,10 @@ ORDER BY d.userid";
 
                // Autopurge installed?
                $LAST = ""; $ONLINE = "";
-               if ((EXT_IS_ACTIVE("autopurge")) && ($_CONFIG['ap_inactive'] == "Y") && ($_CONFIG['ap_in_since'] > 0)) {
+               if ((EXT_IS_ACTIVE("autopurge")) && ($_CONFIG['ap_inactive'] == "Y") && ($_CONFIG['ap_inactive_since'] > 0)) {
                        // Use last online timestamp to keep inactive members away from here
                        $LAST   = " AND last_online >= ";
-                       $ONLINE = bigintval(time() - $_CONFIG['ap_in_since']);
+                       $ONLINE = bigintval(time() - $_CONFIG['ap_inactive_since']);
                }
 
                $SQLs[]   = "SELECT ".$USE." AS active_bonus FROM "._MYSQL_PREFIX."_user_data
@@ -376,10 +373,10 @@ ORDER BY active_bonus DESC, userid";
 
                // Autopurge installed?
                $LAST = ""; $ONLINE = "";
-               if ((EXT_IS_ACTIVE("autopurge")) && ($_CONFIG['ap_inactive'] == "Y") && ($_CONFIG['ap_in_since'] > 0)) {
+               if ((EXT_IS_ACTIVE("autopurge")) && ($_CONFIG['ap_inactive'] == "Y") && ($_CONFIG['ap_inactive_since'] > 0)) {
                        // Use last online timestamp to keep inactive members away from here
                        $LAST   = " AND last_online >= ";
-                       $ONLINE = bigintval(time() - $_CONFIG['ap_in_since']);
+                       $ONLINE = bigintval(time() - $_CONFIG['ap_inactive_since']);
                }
 
                $SQLs[]   = "SELECT userid FROM "._MYSQL_PREFIX."_user_data
@@ -558,7 +555,11 @@ function TASK_CREATE_EXTRA_ROWS($SQLs, $WHATs, $DESCRs, $TITLEs){
        foreach ($SQLs as $key => $sql) {
                // Run SQL command, get line numbers and free memory
                $result = SQL_QUERY($sql, __FILE__, __LINE__);
+
+               // Get rows
                $value = SQL_NUMROWS($result);
+
+               // Free result
                SQL_FREERESULT($result);
 
                $content = array(
@@ -580,7 +581,7 @@ function TASK_CREATE_EXTRA_ROWS($SQLs, $WHATs, $DESCRs, $TITLEs){
 
                // And insert the final string into extras template
                $OUT .= LOAD_TEMPLATE("admin_overview_task_rows", true, $content);
-       }
+       } // END - if
 
        // Return output
        return LOAD_TEMPLATE("admin_overview_task_extras", true, $OUT);