]> git.mxchange.org Git - mailer.git/blobdiff - inc/monthly/monthly_beg.php
Rewrites to use filters instead of mass if() blocks
[mailer.git] / inc / monthly / monthly_beg.php
index 62d017396f93445259f05d156e38cae40ab6ed27..893b2e0609d4ff0b725e0bf25d101608adb3ae74 100644 (file)
@@ -55,31 +55,38 @@ if ((getBegRanks() > 0) && (!isCssOutputMode())) {
        $whereStatement = '';
 
        // Shall we exclude webmaster's own userid?
+       // @TODO Rewrite these if() blocks to a filter
        if ((!isBegIncludeOwnEnabled()) && (isValidId(getBegUserid()))) {
                // Exclude it
-               $whereStatement .= ' AND `userid` != {?beg_userid?}';
+               $whereStatement .= ' AND `d`.`userid` != {?beg_userid?}';
        } // END - if
 
        // Let's check if there are some points left we can pay...
        if ((isExtensionActive('autopurge')) && (isBegActiveEnabled()) && ((getApInactiveSince() > 0))) {
                // Okay, include last online timestamp
-               $whereStatement .= ' AND (UNIX_TIMESTAMP() - `last_online`) < {?ap_inactive_since?}';
+               $whereStatement .= ' AND (UNIX_TIMESTAMP() - `d`.`last_online`) < {?ap_inactive_since?}';
+       } // END - if
+
+       // Is ext-holiday installed?
+       if (isExtensionActive('holiday')) {
+               // Exclude those as well
+               $whereStatement .= " AND `d`.`holiday_active`='N'";
        } // END - if
 
        // SQL string to check for accounts
        $result_main = SQL_QUERY("SELECT
-       `userid`,
-       `beg_points`
+       `d`.`userid`,
+       `d`.`beg_points`
 FROM
-       `{?_MYSQL_PREFIX?}_user_data`
+       `{?_MYSQL_PREFIX?}_user_data` AS `d`
 WHERE
-       `status`='CONFIRMED'
+       `d`.`status`='CONFIRMED'
        " . $whereStatement . "
        " . runFilterChain('user_exclusion_sql', ' ') . " AND
-       `beg_points` > 0
+       `d`.`beg_points` > 0
 ORDER BY
-       `beg_points` DESC,
-       `userid` ASC
+       `d`.`beg_points` DESC,
+       `d`.`userid` ASC
 LIMIT {?beg_ranks?}", __FILE__, __LINE__);
 
        if (!SQL_HASZERONUMS($result_main)) {