Extension ext-coupon continued, a lot improvements applied:
[mailer.git] / inc / libs / task_functions.php
index 7636970fd7924d012a5f2c0f8689934a3dbc8ffe..d8e62f093197855ab067388ec525015417f88fc6 100644 (file)
@@ -253,9 +253,9 @@ FROM
        `{?_MYSQL_PREFIX?}_user_data` AS d
 WHERE
        d.`status`='CONFIRMED' AND
-       d.joined < (UNIX_TIMESTAMP() - {?ap_inactive_since?}) AND
-       d.last_online < (UNIX_TIMESTAMP() - {?ap_inactive_since?}) AND
-       d.ap_notified < (UNIX_TIMESTAMP() - {?ap_inactive_since?})
+       (UNIX_TIMESTAMP() - d.`joined`) >= {?ap_inactive_since?} AND
+       (UNIX_TIMESTAMP() - d.`last_online`) >= {?ap_inactive_since?} AND
+       (UNIX_TIMESTAMP() - d.`ap_notified`) >= {?ap_inactive_since?}
 ".$EXCLUDE_LIST."
 ORDER BY
        d.userid ASC");
@@ -332,11 +332,13 @@ ORDER BY
                        $USE = 'turbo_bonus';
                }
 
-               // Autopurge installed?
+               // Init variable
                $lastOnline = '';
-               if ((isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getApInactiveSince() > 0)) {
+
+               // Autopurge installed?
+               if ((isExtensionActive('autopurge')) && (isAutopurgeInactiveEnabled()) && (getApInactiveSince() > 0)) {
                        // Use last online timestamp to keep inactive members away from here
-                       $lastOnline   = ' AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})';
+                       $lastOnline   = ' AND (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?}';
                } // END - if
 
                addSql("SELECT
@@ -356,13 +358,15 @@ ORDER BY
        }
 
        if (isExtensionInstalledAndNewer('beg', '0.1.2')) {
-               // Begging rallye
+               // ----- Begging rallye -----
 
-               // Autopurge installed?
+               // Init variable
                $lastOnline = '';
-               if ((isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getApInactiveSince() > 0)) {
+
+               // Autopurge installed?
+               if ((isExtensionActive('autopurge')) && (isAutopurgeInactiveEnabled()) && (getApInactiveSince() > 0)) {
                        // Use last online timestamp to keep inactive members away from here
-                       $lastOnline   = ' AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})';
+                       $lastOnline   = ' AND (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?}';
                } // END - if
 
                addSql("SELECT