]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/task_functions.php
Rewrites to use filters instead of mass if() blocks
[mailer.git] / inc / libs / task_functions.php
index 95e0082d82f2b6ed3770d6ba8becb9c571e66bba..254c53af5e80fdefcccbcc573c114fe4a4f073c9 100644 (file)
  * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
@@ -65,11 +63,11 @@ function outputAdvancedOverview (&$result_main) {
        // Init SQLs
        initSqls();
 
-       // Init contentn
+       // Init content
        foreach (
                array(
                        // Member accounts
-                       'confirmed_members','unconfirmed_members','locked_members',
+                       'confirmed_members','unconfirmed_members','locked_members','random_refid','testers',
                        // Tasks
                        'update_tasks','new_tasks','closed_tasks','your_tasks','deleted_tasks','solved_tasks',
                        // Mail orders
@@ -84,7 +82,7 @@ function outputAdvancedOverview (&$result_main) {
        } // END - foreach
 
        // Extension updates found
-       $value = countSumTotalData(getCurrentAdminId(), 'task_system', 'id', 'assigned_admin', true, " AND `status`='NEW' AND `task_type`='EXTENSION_UPDATE'");
+       $value = countSumTotalData(getCurrentAdminId(), 'task_system', 'id', 'assigned_admin', TRUE, " AND `status`='NEW' AND `task_type`='EXTENSION_UPDATE'");
 
        if ($value > 0) {
                $content['update_tasks'] = '<a href="{%url=modules.php?module=admin&amp;what=list_task&amp;type=updates%}">' . $value . '</a>';
@@ -95,29 +93,42 @@ function outputAdvancedOverview (&$result_main) {
        //
        // Confirmed accounts
        $value = getTotalConfirmedUser();
-
        if ($value > 0) {
                $content['confirmed_members'] = '<a href="{%url=modules.php?module=admin&amp;what=list_user&amp;status=confirmed%}">' . $value . '</a>';
        } // END - if
 
        // Unconfirmed accounts
-       $value = countSumTotalData('UNCONFIRMED', 'user_data', 'userid', 'status', true);
-
+       $value = getTotalUnconfirmedUser();
        if ($value > 0) {
-               $content['unconfirmed_members'] = '<a href="{%url=modules.php?module=admin&amp;what=chk_regs%}">' . $value . '</a>';
+               $content['unconfirmed_members'] = '<a href="{%url=modules.php?module=admin&amp;what=list_user&amp;status=unconfirmed%}">' . $value . '</a>';
        } // END - if
 
-
-       // And locked accounts
-       $value = countSumTotalData('LOCKED', 'user_data', 'userid', 'status', true);
+       // Locked accounts
+       $value = getTotalLockedUser();
        if ($value > 0) {
                $content['locked_members'] = '<a href="{%url=modules.php?module=admin&amp;what=list_user&amp;status=locked%}">' . $value . '</a>';
        } // END - if
 
+       if (isExtensionInstalledAndNewer('user', '0.3.4')) {
+               // And random refid
+               $value = getTotalRandomRefidUser();
+               if ($value > 0) {
+                       $content['random_refid'] = '<a href="{%url=modules.php?module=admin&amp;what=list_user&amp;do=random_refid%}">' . $value . '</a>';
+               } // END - if
+
+               if (isExtensionInstalledAndNewer('user', '0.5.0')) {
+                       // And tester accounts
+                       $value = getTotalTesterUsers();
+                       if ($value > 0) {
+                               $content['testers'] = '<a href="{%url=modules.php?module=admin&amp;what=list_user&amp;do=testers%}">' . $value . '</a>';
+                       } // END - if
+               } // END - if
+       } // END - if
+
        //
        // Unassigned tasks
        //
-       $value = countSumTotalData(0, 'task_system', 'id', 'assigned_admin', true, " AND `status` != 'DELETED'");
+       $value = countSumTotalData(NULL, 'task_system', 'id', 'assigned_admin', TRUE, " AND `status` != 'DELETED'");
 
        if ($value > 0) {
                $content['new_tasks'] = '<a href="{%url=modules.php?module=admin&amp;what=list_task&amp;type=unassigned%}">' . $value . '</a>';
@@ -126,7 +137,7 @@ function outputAdvancedOverview (&$result_main) {
        //
        // Closed tasks
        //
-       $value = countSumTotalData('CLOSED', 'task_system', 'id', 'status', true);
+       $value = countSumTotalData('CLOSED', 'task_system', 'id', 'status', TRUE);
 
        if ($value > 0) {
                $content['closed_tasks'] = '<a href="{%url=modules.php?module=admin&amp;what=list_task&amp;type=closed%}">' . $value . '</a>';
@@ -135,7 +146,7 @@ function outputAdvancedOverview (&$result_main) {
        //
        // Deleted tasks
        //
-       $value = countSumTotalData('DELETED', 'task_system', 'id', 'status', true);
+       $value = countSumTotalData('DELETED', 'task_system', 'id', 'status', TRUE);
 
        if ($value > 0) {
                $content['deleted_tasks'] = '<a href="{%url=modules.php?module=admin&amp;what=list_task&amp;type=deleted%}">' . $value . '</a>';
@@ -144,7 +155,7 @@ function outputAdvancedOverview (&$result_main) {
        //
        // Solved tasks
        //
-       $value = countSumTotalData('SOLVED', 'task_system', 'id', 'status', true, sprintf(" AND `assigned_admin`=%s", getCurrentAdminId()));
+       $value = countSumTotalData('SOLVED', 'task_system', 'id', 'status', TRUE, sprintf(" AND `assigned_admin`=%s", getCurrentAdminId()));
 
        if ($value > 0) {
                $content['solved_tasks'] = '<a href="{%url=modules.php?module=admin&amp;what=list_task&amp;type=solved%}">' . $value . '</a>';
@@ -153,7 +164,7 @@ function outputAdvancedOverview (&$result_main) {
        //
        // Your tasks
        //
-       $value = countSumTotalData(getCurrentAdminId(), 'task_system', 'id', 'assigned_admin', true, " AND `status`='NEW' AND task_type != 'EXTENSION_UPDATE'");
+       $value = countSumTotalData(getCurrentAdminId(), 'task_system', 'id', 'assigned_admin', TRUE, " AND `status`='NEW' AND task_type != 'EXTENSION_UPDATE'");
 
        if ($value > 0) {
                $content['your_tasks'] = '<a href="{%url=modules.php?module=admin&amp;what=list_task%}">' . $value . '</a>';
@@ -162,7 +173,7 @@ function outputAdvancedOverview (&$result_main) {
        //
        // Mails waiting to be approved
        //
-       $value = countSumTotalData('ADMIN', 'pool', 'id', 'data_type', true);
+       $value = countSumTotalData('ADMIN', 'pool', 'id', 'data_type', TRUE);
 
        if ($value > 0) {
                $content['pending_mails'] = '<a href="{%url=modules.php?module=admin&amp;what=unlock_emails%}">' . $value . '</a>';
@@ -171,7 +182,7 @@ function outputAdvancedOverview (&$result_main) {
        //
        // Unfinished mail orders
        //
-       $value = countSumTotalData('TEMP', 'pool', 'id', 'data_type', true);
+       $value = countSumTotalData('TEMP', 'pool', 'id', 'data_type', TRUE);
 
        if ($value > 0) {
                $content['canceled_mails'] = '<a href="{%url=modules.php?module=admin&amp;what=email_details%}">' . $value . '</a>';
@@ -180,7 +191,7 @@ function outputAdvancedOverview (&$result_main) {
        //
        // Sent mail orders
        //
-       $value = countSumTotalData('SEND', 'pool', 'id', 'data_type', true);
+       $value = countSumTotalData('SEND', 'pool', 'id', 'data_type', TRUE);
 
        if ($value > 0) {
                $content['send_emails'] = '<a href="{%url=modules.php?module=admin&amp;what=email_archiv%}">' . $value . '</a>';
@@ -191,7 +202,7 @@ function outputAdvancedOverview (&$result_main) {
        //
        if (isExtensionActive('autopurge')) {
                // Get auto-purged mails
-               $value = countSumTotalData('DELETED', 'pool', 'id', 'data_type', true);
+               $value = countSumTotalData('DELETED', 'pool', 'id', 'data_type', TRUE);
 
                if ($value > 0) {
                        $content['purged_mails'] = '<a href="{%url=modules.php?module=admin&amp;what=email_details%}">' . $value . '</a>';
@@ -202,19 +213,19 @@ function outputAdvancedOverview (&$result_main) {
                //
                if (isExtensionInstalledAndNewer('bonus', '0.1.8')) {
                        // Get auto-purged bonus mails
-                       $value = countSumTotalData('DELETED', 'bonus', 'id', 'data_type', true);
+                       $value = countSumTotalData('DELETED', 'bonus', 'id', 'data_type', TRUE);
 
                        if ($value > 0) {
                                $content['purged_bonus_mails'] = '<a href="{%url=modules.php?module=admin&amp;what=email_details%}">' . $value . '</a>';
                        } // END - if
                } elseif (isExtensionActive('bonus')) {
-                       $content['purged_bonus_mails'] = getMaskedMessage('ADMIN_EXTENSION_BONUS_OUTDATED', '0.1.8');
+                       $content['purged_bonus_mails'] = '{%message,ADMIN_EXTENSION_BONUS_OUTDATED=0.1.8%}';
                } else {
-                       $content['purged_bonus_mails'] = '<span class="admin_note">{--ADMIN_EXTENSION_BONUS_404--}</span>';
+                       $content['purged_bonus_mails'] = '<span class="bad">{--ADMIN_EXTENSION_BONUS_404--}</span>';
                }
        } else {
-               $content['purged_bonus_mails'] = '<span class="admin_note">{--ADMIN_EXTENSION_AUTOPURGE_404--}</span>';
-               $content['purged_mails'] = '<span class="admin_note">{--ADMIN_EXTENSION_AUTOPURGE_404--}</span>';
+               $content['purged_bonus_mails'] = '<span class="bad">{--ADMIN_EXTENSION_AUTOPURGE_404--}</span>';
+               $content['purged_mails'] = '<span class="bad">{--ADMIN_EXTENSION_AUTOPURGE_404--}</span>';
        }
 
        //
@@ -222,57 +233,61 @@ function outputAdvancedOverview (&$result_main) {
        //
        if (isExtensionInstalledAndNewer('bonus', '0.1.8')) {
                // Get sent bonus mails (but not notifications)
-               $value = countSumTotalData('SEND', 'bonus', 'id', 'data_type', true, " AND `is_notify`='N'");
+               $value = countSumTotalData('SEND', 'bonus', 'id', 'data_type', TRUE, " AND `is_notify`='N'");
 
                if ($value > 0) {
                        $content['send_bonus_mails'] = '<a href="{%url=modules.php?module=admin&amp;what=email_details%}">' . $value . '</a>';
                } // END - if
        } elseif (isExtensionActive('bonus')) {
-               $content['send_bonus_mails'] = getMaskedMessage('ADMIN_EXTENSION_BONUS_OUTDATED', '0.1.8');
+               $content['send_bonus_mails'] = '{%message,ADMIN_EXTENSION_BONUS_OUTDATED=0.1.8%}';
        } else {
                $content['send_bonus_mails'] = '{--ADMIN_EXTENSION_BONUS_404--}';
        }
 
-       if (isExtensionActive('autopurge')) {
+       // Both extensions must be there
+       if ((isExtensionActive('autopurge')) && (isExtensionActive('user'))) {
                // Start finding them...
-               $EXCLUDE_LIST = '';
+               $userExclusionSql = ' ';
+               $excludedUserids = runFilterChain('config_userid_exclusion_sql', array());
+               if (count($excludedUserids) > 0) {
+                       // Exclude all
+                       $userExcludeSql = ' AND `d`.`userid` NOT IN (' . implode(', ', $excludedUserids) . ')';
+               } // END - if
 
                // Check for more extensions
-               // @TODO These can be rewritten to filter
-               if (getConfig('def_refid') > 0)                $EXCLUDE_LIST .= ' AND d.userid != {?def_refid?}';
-               if (isExtensionActive('beg'))                  $EXCLUDE_LIST .= ' AND d.userid != {?beg_userid?}';
-               if (isExtensionActive('bonus'))                $EXCLUDE_LIST .= ' AND d.userid != {?bonus_userid?}';
-               if (isExtensionActive('doubler'))              $EXCLUDE_LIST .= ' AND d.userid != {?doubler_userid?}';
+               // @TODO This can be rewritten to filter
                if (isExtensionInstalledAndNewer('holiday', '0.1.3')) {
                        // Recent ext-holiday found
-                       $EXCLUDE_LIST .= " AND d.`holiday_active`='N'";
+                       $userExclusionSql .= " AND `d`.`holiday_active`='N'";
                } // END - if
 
                // Check for all accounts
                addSql("SELECT
-       d.userid, d.email, d.last_online
+       `d`.`userid`,
+       `d`.`email`,
+       `d`.`last_online`
 FROM
-       `{?_MYSQL_PREFIX?}_user_data` AS d
+       `{?_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?})
-".$EXCLUDE_LIST."
+       `d`.`status`='CONFIRMED' AND
+       (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?}
+       " . runFilterChain('user_exclusion_sql', $userExcludeSql) . "
 ORDER BY
-       d.userid ASC");
+       `d`.`userid` ASC");
                $WHATs[]  = 'list_autopurge';
                $DESCRs[] = '{--ADMIN_TASK_INACTIVE_AUTOPURGE--}';
                $TITLEs[] = '{--ADMIN_TASK_INACTIVE_AUTOPURGE_TITLE--}';
-       }
+       } // END - if
 
-       if (isExtensionInstalledAndNewer('sql_patches', '0.3.4')) {
-               // Check for accounts without referal
-               addSql("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `refid`=0 ORDER BY `userid` ASC");
-               $DESCRs[] = '{--ADMIN_TASK_LIST_ACCOUNT_NOREF--}';
-               $TITLEs[] = '{--ADMIN_TASK_LIST_ACCOUNT_NOREF_TITLE--}';
-               $WHATs[]  = 'list_user&amp;mode=norefs';
-       }
+       if ((isExtensionInstalledAndNewer('sql_patches', '0.3.4')) && (isExtensionActive('user'))) {
+               // Check for accounts without referral
+               addSql('SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `refid`=0 OR `refid` IS NULL ' . runFilterChain('user_exclusion_sql', ' ') . ' ORDER BY `userid` ASC');
+               $DESCRs[] = '{--ADMIN_TASK_LIST_ACCOUNT_NO_REFERRAL--}';
+               $TITLEs[] = '{--ADMIN_TASK_LIST_ACCOUNT_NO_REFERRAL_TITLE--}';
+               $WHATs[]  = 'list_user&amp;do=norefs';
+       } // END - if
 
        if (isExtensionActive('payout')) {
                // List new payout requests
@@ -280,35 +295,27 @@ ORDER BY
                $WHATs[]  = 'list_payouts';
                $DESCRs[] = '{--ADMIN_TASK_LIST_PAYOUTS_WAITING--}';
                $TITLEs[] = '{--ADMIN_TASK_LIST_PAYOUTS_WAITING_TITLE--}';
-               addSql("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_payouts` ORDER BY `userid` ASC");
+               addSql('SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_payouts` ORDER BY `userid` ASC');
                $WHATs[]  = 'list_payouts';
                $DESCRs[] = '{--ADMIN_TASK_LIST_PAYOUTS_ALL--}';
                $TITLEs[] = '{--ADMIN_TASK_LIST_PAYOUTS_ALL_TITLE--}';
-       }
+       } // END - if
 
        if (isExtensionActive('wernis')) {
                // List new wernis requests
-               addSql("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_wernis` ORDER BY `userid` ASC");
+               addSql('SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_wernis` ORDER BY `userid` ASC');
                $WHATs[]  = 'list_wernis';
                $DESCRs[] = '{--ADMIN_TASK_LIST_WERNIS_ALL--}';
                $TITLEs[] = '{--ADMIN_TASK_LIST_WERNIS_ALL_TITLE--}';
-       }
-
-       if (isExtensionActive('primera')) {
-               // List new primera requests
-               addSql("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_primera` ORDER BY `userid` ASC");
-               $WHATs[]  = 'list_primera';
-               $DESCRs[] = '{--ADMIN_TASK_LIST_PRIMERA_ALL--}';
-               $TITLEs[] = '{--ADMIN_TASK_LIST_PRIMERA_ALL_TITLE--}';
-       }
+       } // END - if
 
        if (isExtensionActive('holiday')) {
                // List holiday requests
-               addSql("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_holidays` ORDER BY `userid` ASC");
+               addSql('SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_holidays` ORDER BY `userid` ASC');
                $WHATs[]  = 'list_holiday';
                $DESCRs[] = '{--ADMIN_TASK_LIST_HOLIDAYS--}';
                $TITLEs[] = '{--ADMIN_TASK_LIST_HOLIDAYS_TITLE--}';
-       }
+       } // END - if
 
        if (isExtensionInstalledAndNewer('bonus', '0.8.7')) {
                // List all notifications
@@ -318,35 +325,34 @@ ORDER BY
                $TITLEs[] = '{--ADMIN_TASK_LIST_NOTIFICATIONS_TITLE--}';
        } // END - if
 
-       if (isExtensionInstalledAndNewer('bonus', '0.2.3')) {
-               // Active rallye
-               if (isExtensionInstalledAndNewer('bonus', '0.6.9')) {
-                       // Add more bonus points here
-                       $USE = '(0';
-                       if (getConfig('bonus_click_yn') == 'Y') $USE .= ' + `turbo_bonus`';
-                       if (getConfig('bonus_login_yn') == 'Y') $USE .= ' + `login_bonus`';
-                       if (getConfig('bonus_order_yn') == 'Y') $USE .= ' + `bonus_order`';
-                       if (getConfig('bonus_stats_yn') == 'Y') $USE .= ' + `bonus_stats`';
-                       if (getConfig('bonus_ref_yn')   == 'Y') $USE .= ' + `bonus_ref`';
-                       $USE .= ')';
-               } else {
-                       // Old version ???
-                       $USE = 'turbo_bonus';
-               }
+       // Both extensions must be there
+       if ((isExtensionInstalledAndNewer('bonus', '0.2.3')) && (isExtensionActive('user'))) {
+               // Get more columns
+               $add = runFilterChain('add_bonus_points_user_columns', '');
 
-               // Autopurge installed?
+               // Active rallye, so add more point columns, if not empty
+               $pointsColumns = '';
+               if (!empty($add)) {
+                       $pointsColumns = '(0' . $add . ')';
+               } // END - if
+
+               // Init variable
                $lastOnline = '';
-               if ((isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getConfig('ap_inactive_since') > 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
-       ".$USE." AS points
+       " . $pointsColumns . " AS `points`
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
-       `status`='CONFIRMED' AND ".$USE." > 0".$lastOnline."
+       `status`='CONFIRMED' AND
+       " . $pointsColumns . " > 0
+       " . $lastOnline . "
 ORDER BY
        `points` DESC,
        `userid` ASC");
@@ -355,14 +361,17 @@ ORDER BY
                $TITLEs[] = '{--ADMIN_TASK_LIST_BONUS_TITLE--}';
        }
 
-       if (isExtensionInstalledAndNewer('beg', '0.1.2')) {
-               // Begging rallye
+       // Again both extensions must be there
+       if ((isExtensionInstalledAndNewer('beg', '0.1.2')) && (isExtensionActive('user'))) {
+               // ----- Begging rallye -----
 
-               // Autopurge installed?
+               // Init variable
                $lastOnline = '';
-               if ((isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getConfig('ap_inactive_since') > 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
@@ -379,30 +388,30 @@ ORDER BY
                $WHATs[]  = 'list_beg';
                $DESCRs[] = '{--ADMIN_TASK_LIST_BEG--}';
                $TITLEs[] = '{--ADMIN_TASK_LIST_BEG_TITLE--}';
-       }
+       } // END - if
 
        if (isExtensionActive('doubler')) {
                // List waiting payouts
                addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_doubler` WHERE `completed`='N' ORDER BY `id` ASC");
-               $WHATs[]  = 'list_doubler&amp;mode=waiting&amp;select=all';
+               $WHATs[]  = 'list_doubler&amp;do=waiting&amp;select=all';
                $DESCRs[] = '{--ADMIN_TASK_LIST_DOUBLER_WAITING--}';
                $TITLEs[] = '{--ADMIN_TASK_LIST_DOUBLER_WAITING_TITLE--}';
-               addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_doubler` ORDER BY `id` ASC");
+               addSql('SELECT `id` FROM `{?_MYSQL_PREFIX?}_doubler` ORDER BY `id` ASC');
                $WHATs[]  = 'list_doubler';
                $DESCRs[] = '{--ADMIN_TASK_LIST_DOUBLER_ALL--}';
                $TITLEs[] = '{--ADMIN_TASK_LIST_DOUBLER_ALL_TITLE--}';
-       }
+       } // END - if
 
        //
-       // All referal banner
+       // All referral banner
        //
-       addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_refbanner` ORDER BY `id` ASC");
+       addSql('SELECT `id` FROM `{?_MYSQL_PREFIX?}_refbanner` ORDER BY `id` ASC');
        $WHATs[] = 'refbanner';
        $DESCRs[] = '{--ADMIN_TASK_LIST_REFBANNER_ALL--}';
        $TITLEs[] = '{--ADMIN_TASK_LIST_REFBANNER_ALL_TITLE--}';
 
        //
-       // All activated referal banner
+       // All activated referral banner
        //
        addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_refbanner` WHERE `visible`='Y' ORDER BY `id` ASC");
        $WHATs[] = 'refbanner';
@@ -412,7 +421,7 @@ ORDER BY
        //
        // All extensions
        //
-       addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_extensions` ORDER BY `id` ASC");
+       addSql('SELECT `id` FROM `{?_MYSQL_PREFIX?}_extensions` ORDER BY `id` ASC');
        $WHATs[] = 'extensions';
        $DESCRs[] = '{--ADMIN_TASK_LIST_EXTENSIONS_ALL--}';
        $TITLEs[] = '{--ADMIN_TASK_LIST_EXTENSIONS_ALL_TITLE--}';
@@ -425,35 +434,9 @@ ORDER BY
        $DESCRs[] = '{--ADMIN_TASK_LIST_EXTENSIONS_ACTIVE--}';
        $TITLEs[] = '{--ADMIN_TASK_LIST_EXTENSIONS_ACTIVE_TITLE--}';
 
-       if (isExtensionActive('engine')) {
-               // List all export accounts
-               addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_engine_accounts` ORDER BY `id` ASC");
-               $WHATs[]  = 'list_engine';
-               $DESCRs[] = '{--ADMIN_TASK_LIST_ENGINE--}';
-               $TITLEs[] = '{--ADMIN_TASK_LIST_ENGINE_TITLE--}';
-
-               // List all pending accounts
-               addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_engine_accounts` WHERE `status`='UNCONFIRMED' ORDER BY `id` ASC");
-               $WHATs[]  = 'unlock_engine';
-               $DESCRs[] = '{--ADMIN_TASK_UNLOCK_ENGINE--}';
-               $TITLEs[] = '{--ADMIN_TASK_UNLOCK_ENGINE_TITLE--}';
-
-               // List all safes
-               addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_engine_safe` ORDER BY `id` ASC");
-               $WHATs[]  = 'list_engine&amp;mode=safe';
-               $DESCRs[] = '{--ADMIN_TASK_LIST_ENGINE_SAFES--}';
-               $TITLEs[] = '{--ADMIN_TASK_LIST_ENGINE_SAFES_TITLE--}';
-
-               // List all export URLs
-               addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_engine_urls` ORDER BY `id` ASC");
-               $WHATs[]  = 'engine_urls';
-               $DESCRs[] = '{--ADMIN_TASK_LIST_ENGINE_URLS--}';
-               $TITLEs[] = '{--ADMIN_TASK_LIST_ENGINE_URLS_TITLE--}';
-       } // END - if
-
        if (isExtensionActive('sponsor')) {
                // List all sponsors
-               addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` ORDER BY `id` ASC");
+               addSql('SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` ORDER BY `id` ASC');
                $WHATs[]  = 'list_sponsor';
                $DESCRs[] = '{--ADMIN_TASK_LIST_SPONSOR--}';
                $TITLEs[] = '{--ADMIN_TASK_LIST_SPONSOR_TITLE--}';
@@ -491,7 +474,7 @@ ORDER BY
 
        if (isExtensionActive('country')) {
                // List country codes
-               addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_countries` ORDER BY `id` ASC");
+               addSql('SELECT `id` FROM `{?_MYSQL_PREFIX?}_countries` ORDER BY `id` ASC');
                $WHATs[]  = 'list_country';
                $DESCRs[] = '{--ADMIN_TASK_LIST_COUNTRY--}';
                $TITLEs[] = '{--ADMIN_TASK_LIST_COUNTRY_TITLE--}';
@@ -499,7 +482,7 @@ ORDER BY
 
        if (isExtensionActive('theme')) {
                // List all themes
-               addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_themes` ORDER BY `id` ASC");
+               addSql('SELECT `id` FROM `{?_MYSQL_PREFIX?}_themes` ORDER BY `id` ASC');
                $WHATs[]  = 'theme_edit';
                $DESCRs[] = '{--ADMIN_TASK_LIST_THEME_ALL--}';
                $TITLEs[] = '{--ADMIN_TASK_LIST_THEME_ALL_TITLE--}';
@@ -513,7 +496,7 @@ ORDER BY
 
        if (isExtensionActive('admins')) {
                // List all administrator logins
-               addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `id` ASC");
+               addSql('SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `id` ASC');
                $WHATs[]  = 'admins_edit';
                $DESCRs[] = '{--ADMIN_TASK_LIST_ADMINS_ALL--}';
                $TITLEs[] = '{--ADMIN_TASK_LIST_ADMINS_ALL_TITLE--}';
@@ -521,7 +504,7 @@ ORDER BY
 
        if (isExtensionActive('surfbar')) {
                // List all URLs in surfbar
-               addSql("SELECT `url_id` FROM `{?_MYSQL_PREFIX?}_surfbar_urls` ORDER BY `url_id` ASC");
+               addSql('SELECT `url_id` FROM `{?_MYSQL_PREFIX?}_surfbar_urls` ORDER BY `url_id` ASC');
                $WHATs[]  = 'list_surfbar_urls';
                $DESCRs[] = '{--ADMIN_TASK_LIST_SURFBAR_URLS_ALL--}';
                $TITLEs[] = '{--ADMIN_TASK_LIST_SURFBAR_URLS_ALL_TITLE--}';
@@ -533,23 +516,41 @@ ORDER BY
                $TITLEs[] = '{--ADMIN_TASK_LIST_SURFBAR_URLS_PENDING_TITLE--}';
        } // END - if
 
+       if (isExtensionInstalledAndNewer('sql_patches', '0.9.2')) {
+               // Check for wrong "SERVER_NAME" entries
+               addSql('SELECT `server_name_id` FROM `{?_MYSQL_PREFIX?}_server_name_log`');
+               $DESCRs[] = '{--ADMIN_TASK_LIST_SERVER_NAME_LOG--}';
+               $TITLEs[] = '{--ADMIN_TASK_LIST_SERVER_NAME_LOG_TITLE--}';
+               $WHATs[]  = 'list_server_name';
+       } // END - if
+
+       if (isExtensionInstalled('network')) {
+               // Check for HTTP logging entries
+               addSql('SELECT `network_header_id` FROM `{?_MYSQL_PREFIX?}_network_header_logging`');
+               $DESCRs[] = '{--ADMIN_TASK_LIST_NETWORK_HEADER_LOG--}';
+               $TITLEs[] = '{--ADMIN_TASK_LIST_NETWORK_HEADER_LOG_TITLE--}';
+               $WHATs[]  = 'list_network_http_header';
+       } // END - if
+
        // Generate extra overview rows
        $EXTRAS .= createExtraTaskRows($WHATs, $DESCRs, $TITLEs);
 
        // If empty just keep a forced-space left for CSS issues
-       if (empty($EXTRAS)) $EXTRAS = '&nbsp;';
+       if (empty($EXTRAS)) {
+               $EXTRAS = '&nbsp;';
+       } // END - if
 
        // Add compiled string to constant for final template
        $content['extra_table'] = $EXTRAS;
 
        // Simply load the template... :-)
-       loadTemplate('admin_overview_task', false, $content);
+       loadTemplate('admin_overview_task', FALSE, $content);
 }
 
 //
 function createExtraTaskRows ($WHATs, $DESCRs, $TITLEs) {
        // Init variables
-       $OUT = ''; $SW = 2;
+       $OUT = '';
 
        // Sadly this cannot be rewritten to a filter... :(
        foreach (getSqls() as $sqls) {
@@ -558,40 +559,37 @@ function createExtraTaskRows ($WHATs, $DESCRs, $TITLEs) {
                        // Run SQL command, get line numbers and free memory
                        $result = SQL_QUERY($sql, __FUNCTION__, __LINE__);
 
-                       // Get rows
-                       $value = SQL_NUMROWS($result);
-
-                       // Free result
-                       SQL_FREERESULT($result);
-
                        // Prepare array for output
                        $content = array(
                                'row_descr' => $DESCRs[$key],
-                               'row_sw'    => $SW,
                                'bottom'    => '',
                        );
 
                        // Rewrite CSS class if not last entry is reached
-                       if ($key < (count($sqls) - 1)) $content['bottom'] = 'bottom';
+                       if ($key < (count($sqls) - 1)) {
+                               $content['bottom'] = 'bottom';
+                       } // END - if
 
-                       if (($value > 0) && (!empty($WHATs[$key]))) {
-                               if (empty($TITLEs[$key])) $TITLEs[$key] = '{--ADMIN_TASK_UNKNOWN_LIST_TITLE--}';
-                               $content['row_link'] = '<a href="{%url=modules.php?module=admin&amp;what=' . $WHATs[$key] . '%}" title="' . $TITLEs[$key] . '">' . $value . '</a>';
+                       if ((!SQL_HASZERONUMS($result)) && (!empty($WHATs[$key]))) {
+                               if (empty($TITLEs[$key])) {
+                                       $TITLEs[$key] = '{--ADMIN_TASK_UNKNOWN_LIST_TITLE--}';
+                               } // END - if
+                               $content['row_link'] = '<a href="{%url=modules.php?module=admin&amp;what=' . $WHATs[$key] . '%}" title="' . $TITLEs[$key] . '">' . SQL_NUMROWS($result) . '</a>';
                        } else {
                                $content['row_link'] = '0';
                        }
 
-                       // And insert the final string into extras template
-                       $OUT .= loadTemplate('admin_overview_task_rows', true, $content);
+                       // Free result
+                       SQL_FREERESULT($result);
 
-                       // Switch color
-                       $SW = 3 - $SW;
+                       // And insert the final string into extras template
+                       $OUT .= loadTemplate('admin_overview_task_rows', TRUE, $content);
                } // END- foreach
        } // END - foreach
 
        // Return output in the template
-       return loadTemplate('admin_overview_task_extras', true, $OUT);
+       return loadTemplate('admin_overview_task_extras', TRUE, $OUT);
 }
 
-//
+// [EOF]
 ?>