X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Flibs%2Ftask_functions.php;h=f067f2e4ebcaca546ed04590ede935f82e60080d;hb=62d8f6d89c35bebe15b8f716a5629f14d95f3078;hp=f33501540b4f66e4d0d5aeef0ce3c2b833f2212a;hpb=21a24662ddc70624c27c607e3904aab23e893898;p=mailer.git
diff --git a/inc/libs/task_functions.php b/inc/libs/task_functions.php
index f33501540b..f067f2e4eb 100644
--- a/inc/libs/task_functions.php
+++ b/inc/libs/task_functions.php
@@ -1,7 +1,7 @@
0) {
- define('__TASK_UPDATE_VALUE', "".$value."");
- } else {
- define('__TASK_UPDATE_VALUE', "0");
- }
- } else {
- define('__TASK_UPDATE_VALUE', "0");
- }
+ if ($value > 0) {
+ $content['update_tasks'] = '' . $value . '';
+ } // END - if
//
// First check for all account status seperately
//
// Confirmed accounts
- $value = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true);
+ $value = getTotalConfirmedUser();
if ($value > 0) {
- define('__CONFIRMED_VALUE', "".$value."");
- } else {
- define('__CONFIRMED_VALUE', "0");
- }
+ $content['confirmed_members'] = '' . $value . '';
+ } // END - if
// Unconfirmed accounts
- $value = GET_TOTAL_DATA("UNCONFIRMED", "user_data", "userid", "status", true);
+ $value = getTotalUnconfirmedUser();
if ($value > 0) {
- define('__UNCONFIRMED_VALUE', "".$value."");
- } else {
- define('__UNCONFIRMED_VALUE', "0");
- }
+ $content['unconfirmed_members'] = '' . $value . '';
+ } // END - if
- // And locked accounts
- $value = GET_TOTAL_DATA("LOCKED", "user_data", "userid", "status", true);
+ // And locked accounts
+ $value = getTotalLockedUser();
if ($value > 0) {
- define('__LOCKED_VALUE', "".$value."");
- } else {
- define('__LOCKED_VALUE', "0");
- }
+ $content['locked_members'] = '' . $value . '';
+ } // END - if
//
// Unassigned tasks
//
- $value = GET_TOTAL_DATA("0", "task_system", "id", "assigned_admin", true, " AND `status` != 'DELETED'");
+ $value = countSumTotalData(0, 'task_system', 'id', 'assigned_admin', true, " AND `status` != 'DELETED'");
if ($value > 0) {
- define('__TASK_NEW_VALUE', "".$value."");
- } else {
- define('__TASK_NEW_VALUE', "0");
- }
+ $content['new_tasks'] = '' . $value . '';
+ } // END - if
//
// Closed tasks
//
- $value = GET_TOTAL_DATA("CLOSED", "task_system", "id", "status", true);
+ $value = countSumTotalData('CLOSED', 'task_system', 'id', 'status', true);
if ($value > 0) {
- define('__TASK_CLOSED_VALUE', "".$value."");
- } else {
- define('__TASK_CLOSED_VALUE', "0");
- }
+ $content['closed_tasks'] = '' . $value . '';
+ } // END - if
//
// Deleted tasks
//
- $value = GET_TOTAL_DATA("DELETED", "task_system", "id", "status", true);
+ $value = countSumTotalData('DELETED', 'task_system', 'id', 'status', true);
if ($value > 0) {
- define('__TASK_DELETED_VALUE', "".$value."");
- } else {
- define('__TASK_DELETED_VALUE', "0");
- }
+ $content['deleted_tasks'] = '' . $value . '';
+ } // END - if
//
// Solved tasks
//
- $value = GET_TOTAL_DATA("SOLVED", "task_system", "id", "status", true, sprintf(" AND assigned_admin=%s", GET_CURRENT_ADMIN_ID()));
+ $value = countSumTotalData('SOLVED', 'task_system', 'id', 'status', true, sprintf(" AND `assigned_admin`=%s", getCurrentAdminId()));
if ($value > 0) {
- define('__TASK_SOLVED_VALUE', "".$value."");
- } else {
- define('__TASK_SOLVED_VALUE', "0");
- }
+ $content['solved_tasks'] = '' . $value . '';
+ } // END - if
//
// Your tasks
//
- $value = GET_TOTAL_DATA(GET_CURRENT_ADMIN_ID(), "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) {
- define('__TASK_YOUR_VALUE', "".$value."");
- } else {
- define('__TASK_YOUR_VALUE', "0");
- }
+ $content['your_tasks'] = '' . $value . '';
+ } // END - if
//
// Mails waiting to be approved
//
- $value = GET_TOTAL_DATA("ADMIN", "pool", "id", "data_type", true);
+ $value = countSumTotalData('ADMIN', 'pool', 'id', 'data_type', true);
if ($value > 0) {
- define('__MAIL_ADMIN_VALUE', "".$value."");
- } else {
- define('__MAIL_ADMIN_VALUE', "0");
- }
+ $content['pending_mails'] = '' . $value . '';
+ } // END - if
//
// Unfinished mail orders
//
- $value = GET_TOTAL_DATA("TEMP", "pool", "id", "data_type", true);
+ $value = countSumTotalData('TEMP', 'pool', 'id', 'data_type', true);
if ($value > 0) {
- define('__MAIL_TEMP_VALUE', "".$value."");
- } else {
- define('__MAIL_TEMP_VALUE', "0");
- }
+ $content['canceled_mails'] = '' . $value . '';
+ } // END - if
//
// Sent mail orders
//
- $value = GET_TOTAL_DATA("SEND", "pool", "id", "data_type", true);
+ $value = countSumTotalData('SEND', 'pool', 'id', 'data_type', true);
if ($value > 0) {
- define('__MAIL_SEND_VALUE', "".$value."");
- } else {
- define('__MAIL_SEND_VALUE', "0");
- }
+ $content['send_emails'] = '' . $value . '';
+ } // END - if
//
// Autopurged mails
//
- if (EXT_IS_ACTIVE("autopurge")) {
+ if (isExtensionActive('autopurge')) {
// Get auto-purged mails
- $value = GET_TOTAL_DATA("DELETED", "pool", "id", "data_type", true);
+ $value = countSumTotalData('DELETED', 'pool', 'id', 'data_type', true);
if ($value > 0) {
- define('__MAIL_DELETED_VALUE', "".$value."");
- } else {
- define('__MAIL_DELETED_VALUE', "0");
- }
+ $content['purged_mails'] = '' . $value . '';
+ } // END - if
//
// Autopurged bonus mails
//
- if (GET_EXT_VERSION("bonus") >= "0.1.8") {
+ if (isExtensionInstalledAndNewer('bonus', '0.1.8')) {
// Get auto-purged bonus mails
- $value = GET_TOTAL_DATA("DELETED", "bonus", "id", "data_type", true);
+ $value = countSumTotalData('DELETED', 'bonus', 'id', 'data_type', true);
if ($value > 0) {
- define('__MAIL_BONUS_AP_VALUE', "".$value."");
- } else {
- define('__MAIL_BONUS_AP_VALUE', "0");
- }
- } elseif (EXT_IS_ACTIVE("bonus")) {
- define('__MAIL_BONUS_AP_VALUE', sprintf(getMessage('ADMIN_EXT_BONUS_OUTDATED', "0.1.8")));
+ $content['purged_bonus_mails'] = '' . $value . '';
+ } // END - if
+ } elseif (isExtensionActive('bonus')) {
+ $content['purged_bonus_mails'] = getMaskedMessage('ADMIN_EXTENSION_BONUS_OUTDATED', '0.1.8');
} else {
- define('__MAIL_BONUS_AP_VALUE', "{--ADMIN_EXT_BONUS_404--}");
+ $content['purged_bonus_mails'] = '{--ADMIN_EXTENSION_BONUS_404--}';
}
} else {
- define('__MAIL_BONUS_AP_VALUE', "{--ADMIN_EXT_AUTOPURGE_404--}");
- define('__MAIL_DELETED_VALUE', "{--ADMIN_EXT_AUTOPURGE_404--}");
+ $content['purged_bonus_mails'] = '{--ADMIN_EXTENSION_AUTOPURGE_404--}';
+ $content['purged_mails'] = '{--ADMIN_EXTENSION_AUTOPURGE_404--}';
}
//
// Sent bonus mails
//
- if (GET_EXT_VERSION("bonus") >= "0.1.8") {
+ if (isExtensionInstalledAndNewer('bonus', '0.1.8')) {
// Get sent bonus mails (but not notifications)
- $value = GET_TOTAL_DATA("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) {
- define('__MAIL_BONUS_SEND_VALUE', "".$value."");
- } else {
- define('__MAIL_BONUS_SEND_VALUE', "0");
- }
- } elseif (EXT_IS_ACTIVE("bonus")) {
- define('__MAIL_BONUS_SEND_VALUE', sprintf(getMessage('ADMIN_EXT_BONUS_OUTDATED', "0.1.8")));
+ $content['send_bonus_mails'] = '' . $value . '';
+ } // END - if
+ } elseif (isExtensionActive('bonus')) {
+ $content['send_bonus_mails'] = getMaskedMessage('ADMIN_EXTENSION_BONUS_OUTDATED', '0.1.8');
} else {
- define('__MAIL_BONUS_SEND_VALUE', getMessage('ADMIN_EXT_BONUS_404'));
+ $content['send_bonus_mails'] = '{--ADMIN_EXTENSION_BONUS_404--}';
}
- if (EXT_IS_ACTIVE("autopurge")) {
+ if (isExtensionActive('autopurge')) {
// Start finding them...
- $since = getConfig('ap_inactive_since');
- $EXCLUDE_LIST = "";
- if (getConfig('def_refid') > 0) {
- $EXCLUDE_LIST = " AND d.userid != ".getConfig('def_refid')."";
- } // END - if
+ $EXCLUDE_LIST = '';
// Check for more extensions
// @TODO These can be rewritten to filter
- if (EXT_IS_ACTIVE("beg")) $EXCLUDE_LIST .= " AND d.userid != ".getConfig('beg_uid')."";
- if (EXT_IS_ACTIVE("bonus")) $EXCLUDE_LIST .= " AND d.userid != ".getConfig('bonus_uid')."";
- if (EXT_IS_ACTIVE("doubler")) $EXCLUDE_LIST .= " AND d.userid != ".getConfig('doubler_uid')."";
- if (GET_EXT_VERSION("holiday") >= "0.1.3") $EXCLUDE_LIST .= " AND d.holiday_active='N'";
+ if (isValidUserId(getDefRefid())) $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?}';
+ if (isExtensionInstalledAndNewer('holiday', '0.1.3')) {
+ // Recent ext-holiday found
+ $EXCLUDE_LIST .= " AND d.`holiday_active`='N'";
+ } // END - if
// Check for all accounts
- ADD_SQL("SELECT DISTINCT d.userid, d.email, d.last_online
-FROM `{!_MYSQL_PREFIX!}_user_data` AS d
-WHERE d.`status`='CONFIRMED' AND d.joined < (UNIX_TIMESTAMP() - ".$since.") AND d.last_online < (UNIX_TIMESTAMP() - ".$since.") AND d.ap_notified < (UNIX_TIMESTAMP() - ".$since.")
+ addSql("SELECT
+ d.userid, d.email, d.last_online
+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?})
".$EXCLUDE_LIST."
-ORDER BY d.userid");
- $WHATs[] = "list_autopurge";
- $DESCRs[] = getMessage('ADMIN_TASK_INACTIVE_AUTOPURGE');
- $TITLEs[] = getMessage('ADMIN_TASK_INACTIVE_AUTOPURGE_TITLE');
+ORDER BY
+ d.userid ASC");
+ $WHATs[] = 'list_autopurge';
+ $DESCRs[] = '{--ADMIN_TASK_INACTIVE_AUTOPURGE--}';
+ $TITLEs[] = '{--ADMIN_TASK_INACTIVE_AUTOPURGE_TITLE--}';
}
- if (GET_EXT_VERSION("sql_patches") >= "0.3.4") {
+ if (isExtensionInstalledAndNewer('sql_patches', '0.3.4')) {
// Check for accounts without referal
- ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE refid='0' ORDER BY userid");
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_ACCOUNT_NOREF');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_ACCOUNT_NOREF_TITLE');
- $WHATs[] = "list_user&mode=norefs";
+ 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_NOREFERAL_TITLE--}';
+ $WHATs[] = 'list_user&mode=norefs';
}
- if (EXT_IS_ACTIVE("payout")) {
+ if (isExtensionActive('payout')) {
// List new payout requests
- ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE `status`='NEW' ORDER BY userid");
- $WHATs[] = "list_payouts";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_PAYOUTS_WAITING');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_PAYOUTS_WAITING_TITLE');
- ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_payouts` ORDER BY userid");
- $WHATs[] = "list_payouts";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_PAYOUTS_ALL');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_PAYOUTS_ALL_TITLE');
+ addSql("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_payouts` WHERE `status`='NEW' ORDER BY `userid` ASC");
+ $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");
+ $WHATs[] = 'list_payouts';
+ $DESCRs[] = '{--ADMIN_TASK_LIST_PAYOUTS_ALL--}';
+ $TITLEs[] = '{--ADMIN_TASK_LIST_PAYOUTS_ALL_TITLE--}';
}
- if (EXT_IS_ACTIVE("wernis")) {
+ if (isExtensionActive('wernis')) {
// List new wernis requests
- ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_wernis` ORDER BY userid");
- $WHATs[] = "list_wernis";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_WERNIS_ALL');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_WERNIS_ALL_TITLE');
+ 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 (EXT_IS_ACTIVE("primera")) {
+ if (isExtensionActive('primera')) {
// List new primera requests
- ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_primera` ORDER BY userid");
- $WHATs[] = "list_primera";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_PRIMERA_ALL');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_PRIMERA_ALL_TITLE');
+ 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--}';
}
- if (EXT_IS_ACTIVE("holiday")) {
+ if (isExtensionActive('holiday')) {
// List holiday requests
- ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_holidays` ORDER BY userid");
- $WHATs[] = "list_holiday";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_HOLIDAYS');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_HOLIDAYS_TITLE');
+ 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--}';
}
- if (GET_EXT_VERSION("bonus") >= "0.8.7") {
+ if (isExtensionInstalledAndNewer('bonus', '0.8.7')) {
// List all notifications
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_bonus` WHERE is_notify='Y' ORDER BY timestamp DESC");
- $WHATs[] = "list_notifications";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_NOTIFICATIONS');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_NOTIFICATIONS_TITLE');
+ addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `is_notify`='Y' ORDER BY `timestamp` DESC");
+ $WHATs[] = 'list_notifications';
+ $DESCRs[] = '{--ADMIN_TASK_LIST_NOTIFICATIONS--}';
+ $TITLEs[] = '{--ADMIN_TASK_LIST_NOTIFICATIONS_TITLE--}';
} // END - if
- if (GET_EXT_VERSION("bonus") >= "0.2.3") {
+ if (isExtensionInstalledAndNewer('bonus', '0.2.3')) {
// Active rallye
- if (GET_EXT_VERSION("bonus") >= "0.6.9") {
+ 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 .= ")";
+ $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";
+ $USE = 'turbo_bonus';
}
// Autopurge installed?
- $lastOnline = "";
- if ((EXT_IS_ACTIVE("autopurge")) && (getConfig('autopurge_inactive') == "Y") && (getConfig('ap_inactive_since') > 0)) {
+ $lastOnline = '';
+ if ((isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getApInactiveSince() > 0)) {
// Use last online timestamp to keep inactive members away from here
- $lastOnline = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
- }
+ $lastOnline = ' AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})';
+ } // END - if
- ADD_SQL("SELECT ".$USE." AS points
-FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND ".$USE.">0".$lastOnline."
-ORDER BY points DESC, userid");
- $WHATs[] = "list_bonus";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_BONUS');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_BONUS_TITLE');
+ addSql("SELECT
+ " . $USE . " AS points
+FROM
+ `{?_MYSQL_PREFIX?}_user_data`
+WHERE
+ `status`='CONFIRMED' AND
+ " . $USE . " > 0
+ " . $lastOnline . "
+ORDER BY
+ `points` DESC,
+ `userid` ASC");
+ $WHATs[] = 'list_bonus';
+ $DESCRs[] = '{--ADMIN_TASK_LIST_BONUS--}';
+ $TITLEs[] = '{--ADMIN_TASK_LIST_BONUS_TITLE--}';
}
- if (GET_EXT_VERSION("beg") >= "0.1.2") {
+ if (isExtensionInstalledAndNewer('beg', '0.1.2')) {
// Begging rallye
// Autopurge installed?
- $lastOnline = "";
- if ((EXT_IS_ACTIVE("autopurge")) && (getConfig('autopurge_inactive') == "Y") && (getConfig('ap_inactive_since') > 0)) {
+ $lastOnline = '';
+ if ((isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getApInactiveSince() > 0)) {
// Use last online timestamp to keep inactive members away from here
- $lastOnline = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
- }
+ $lastOnline = ' AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})';
+ } // END - if
- ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND beg_points>0".$lastOnline."
-ORDER BY beg_points DESC, userid");
- $WHATs[] = "list_beg";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_BEG');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_BEG_TITLE');
- }
+ addSql("SELECT
+ `userid`
+FROM
+ `{?_MYSQL_PREFIX?}_user_data`
+WHERE
+ `status`='CONFIRMED' AND
+ `beg_points` > 0
+ ".$lastOnline."
+ORDER BY
+ `beg_points` DESC,
+ `userid` ASC");
+ $WHATs[] = 'list_beg';
+ $DESCRs[] = '{--ADMIN_TASK_LIST_BEG--}';
+ $TITLEs[] = '{--ADMIN_TASK_LIST_BEG_TITLE--}';
+ } // END - if
- if (EXT_IS_ACTIVE("doubler")) {
+ if (isExtensionActive('doubler')) {
// List waiting payouts
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='N' ORDER BY `id`");
- $WHATs[] = "list_doubler&mode=waiting&select=all";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_WAITING');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_WAITING_TITLE');
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_doubler` ORDER BY `id`");
- $WHATs[] = "list_doubler";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_ALL');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_ALL_TITLE');
- }
+ addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_doubler` WHERE `completed`='N' ORDER BY `id` ASC");
+ $WHATs[] = 'list_doubler&mode=waiting&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");
+ $WHATs[] = 'list_doubler';
+ $DESCRs[] = '{--ADMIN_TASK_LIST_DOUBLER_ALL--}';
+ $TITLEs[] = '{--ADMIN_TASK_LIST_DOUBLER_ALL_TITLE--}';
+ } // END - if
//
// All referal banner
//
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_refbanner` ORDER BY `id`");
- $WHATs[] = "refbanner";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_REFBANNER_ALL');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_REFBANNER_ALL_TITLE');
+ 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
//
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE `visible`='Y' ORDER BY `id`");
- $WHATs[] = "refbanner";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_REFBANNER_ACTIVE');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_REFBANNER_ACTIVE_TITLE');
+ addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_refbanner` WHERE `visible`='Y' ORDER BY `id` ASC");
+ $WHATs[] = 'refbanner';
+ $DESCRs[] = '{--ADMIN_TASK_LIST_REFBANNER_ACTIVE--}';
+ $TITLEs[] = '{--ADMIN_TASK_LIST_REFBANNER_ACTIVE_TITLE--}';
//
// All extensions
//
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_extensions` ORDER BY `id`");
- $WHATs[] = "extensions";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_EXTENSIONS_ALL');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_EXTENSIONS_ALL_TITLE');
+ 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--}';
//
// All activated extensions
//
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_active='Y' ORDER BY `id`");
- $WHATs[] = "extensions&active=Y";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_EXTENSIONS_ACTIVE');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_EXTENSIONS_ACTIVE_TITLE');
+ addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_active`='Y' ORDER BY `id` ASC");
+ $WHATs[] = 'extensions&active=Y';
+ $DESCRs[] = '{--ADMIN_TASK_LIST_EXTENSIONS_ACTIVE--}';
+ $TITLEs[] = '{--ADMIN_TASK_LIST_EXTENSIONS_ACTIVE_TITLE--}';
- if (EXT_IS_ACTIVE("engine")) {
+ if (isExtensionActive('engine')) {
// List all export accounts
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_engine_accounts` ORDER BY `id`");
- $WHATs[] = "list_engine";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_ENGINE');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_ENGINE_TITLE');
+ 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
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_engine_accounts` WHERE `status`='UNCONFIRMED' ORDER BY `id`");
- $WHATs[] = "unlock_engine";
- $DESCRs[] = getMessage('ADMIN_TASK_UNLOCK_ENGINE');
- $TITLEs[] = getMessage('ADMIN_TASK_UNLOCK_ENGINE_TITLE');
+ 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
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_engine_safe` ORDER BY `id`");
- $WHATs[] = "list_engine&mode=safe";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_ENGINE_SAFES');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_ENGINE_SAFES_TITLE');
+ addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_engine_safe` ORDER BY `id` ASC");
+ $WHATs[] = 'list_engine&mode=safe';
+ $DESCRs[] = '{--ADMIN_TASK_LIST_ENGINE_SAFES--}';
+ $TITLEs[] = '{--ADMIN_TASK_LIST_ENGINE_SAFES_TITLE--}';
// List all export URLs
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_engine_urls` ORDER BY `id`");
- $WHATs[] = "engine_urls";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_ENGINE_URLS');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_ENGINE_URLS_TITLE');
- }
+ 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 (EXT_IS_ACTIVE("sponsor")) {
+ if (isExtensionActive('sponsor')) {
// List all sponsors
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` ORDER BY `id`");
- $WHATs[] = "list_sponsor";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_TITLE');
+ 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--}';
// List confirmed sponsor accounts
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='CONFIRMED' ORDER BY `id`");
- $WHATs[] = "list_sponsor";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_CONFIRMED');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_CONFIRMED_TITLE');
+ addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `status`='CONFIRMED' ORDER BY `id` ASC");
+ $WHATs[] = 'list_sponsor';
+ $DESCRs[] = '{--ADMIN_TASK_LIST_SPONSOR_CONFIRMED--}';
+ $TITLEs[] = '{--ADMIN_TASK_LIST_SPONSOR_CONFIRMED_TITLE--}';
// List unconfirmed sponsor accounts
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='UNCONFIRMED' ORDER BY `id`");
- $WHATs[] = "list_sponsor";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_UNCONFIRMED');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_UNCONFIRMED_TITLE');
+ addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `status`='UNCONFIRMED' ORDER BY `id` ASC");
+ $WHATs[] = 'list_sponsor';
+ $DESCRs[] = '{--ADMIN_TASK_LIST_SPONSOR_UNCONFIRMED--}';
+ $TITLEs[] = '{--ADMIN_TASK_LIST_SPONSOR_UNCONFIRMED_TITLE--}';
// List locked sponsor accounts
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='LOCKED' ORDER BY `id`");
- $WHATs[] = "list_sponsor";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_LOCKED');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_LOCKED_TITLE');
+ addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `status`='LOCKED' ORDER BY `id` ASC");
+ $WHATs[] = 'list_sponsor';
+ $DESCRs[] = '{--ADMIN_TASK_LIST_SPONSOR_LOCKED--}';
+ $TITLEs[] = '{--ADMIN_TASK_LIST_SPONSOR_LOCKED_TITLE--}';
// List waiting sponsor accounts to be approved
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='PENDING' ORDER BY `id`");
- $WHATs[] = "unlock_sponsor";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_PENDING');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_PENDING_TITLE');
+ addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `status`='PENDING' ORDER BY `id` ASC");
+ $WHATs[] = 'unlock_sponsor';
+ $DESCRs[] = '{--ADMIN_TASK_LIST_SPONSOR_PENDING--}';
+ $TITLEs[] = '{--ADMIN_TASK_LIST_SPONSOR_PENDING_TITLE--}';
// Waiting payments
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_orders` WHERE pay_`status`='PENDING' ORDER BY `id`");
- $WHATs[] = "list_sponsor_pays";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_ORDERS');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_ORDERS_TITLE');
- }
+ addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_orders` WHERE `pay_status`='PENDING' ORDER BY `id` ASC");
+ $WHATs[] = 'list_sponsor_pays';
+ $DESCRs[] = '{--ADMIN_TASK_LIST_SPONSOR_ORDERS--}';
+ $TITLEs[] = '{--ADMIN_TASK_LIST_SPONSOR_ORDERS_TITLE--}';
+ } // END - if
- if (EXT_IS_ACTIVE("country")) {
+ if (isExtensionActive('country')) {
// List country codes
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_countries` ORDER BY `id`");
- $WHATs[] = "list_country";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_COUNTRY');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_COUNTRY_TITLE');
- }
+ 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--}';
+ } // END - if
- if (EXT_IS_ACTIVE("theme")) {
+ if (isExtensionActive('theme')) {
// List all themes
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_themes` ORDER BY `id`");
- $WHATs[] = "theme_edit";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_THEME_ALL');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_THEME_ALL_TITLE');
+ 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--}';
// List active themes
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_themes` WHERE theme_active='Y' ORDER BY `id`");
- $WHATs[] = "theme_edit";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_THEME_ACTIVE');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_THEME_ACTIVE_TITLE');
- }
+ addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_themes` WHERE `theme_active`='Y' ORDER BY `id` ASC");
+ $WHATs[] = 'theme_edit';
+ $DESCRs[] = '{--ADMIN_TASK_LIST_THEME_ACTIVE--}';
+ $TITLEs[] = '{--ADMIN_TASK_LIST_THEME_ACTIVE_TITLE--}';
+ } // END - if
- if (EXT_IS_ACTIVE("admins")) {
+ if (isExtensionActive('admins')) {
// List all administrator logins
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY `id`");
- $WHATs[] = "admins_edit";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_ADMINS_ALL');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_ADMINS_ALL_TITLE');
- }
+ 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--}';
+ } // END - if
- if (EXT_IS_ACTIVE("surfbar")) {
+ if (isExtensionActive('surfbar')) {
// List all URLs in surfbar
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_surfbar_urls` ORDER BY `id`");
- $WHATs[] = "list_surfbar_urls";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_SURFBAR_URLS_ALL');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_SURFBAR_URLS_ALL_TITLE');
+ 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--}';
// List all pending URLs in surfbar
- ADD_SQL("SELECT id FROM `{!_MYSQL_PREFIX!}_surfbar_urls` WHERE `status`='PENDING' ORDER BY `id`");
- $WHATs[] = "unlock_surfbar_urls";
- $DESCRs[] = getMessage('ADMIN_TASK_LIST_SURFBAR_URLS_PENDING');
- $TITLEs[] = getMessage('ADMIN_TASK_LIST_SURFBAR_URLS_PENDING_TITLE');
- }
+ addSql("SELECT `url_id` FROM `{?_MYSQL_PREFIX?}_surfbar_urls` WHERE `url_status`='PENDING' ORDER BY `url_id` ASC");
+ $WHATs[] = 'unlock_surfbar_urls';
+ $DESCRs[] = '{--ADMIN_TASK_LIST_SURFBAR_URLS_PENDING--}';
+ $TITLEs[] = '{--ADMIN_TASK_LIST_SURFBAR_URLS_PENDING_TITLE--}';
+ } // END - if
// Generate extra overview rows
- $EXTRAS .= TASK_CREATE_EXTRA_ROWS($WHATs, $DESCRs, $TITLEs);
+ $EXTRAS .= createExtraTaskRows($WHATs, $DESCRs, $TITLEs);
// If empty just keep a forced-space left for CSS issues
- if (empty($EXTRAS)) $EXTRAS = " ";
+ if (empty($EXTRAS)) $EXTRAS = ' ';
// Add compiled string to constant for final template
- define('__OVERVIEW_EXTRA_TABLE', $EXTRAS);
+ $content['extra_table'] = $EXTRAS;
// Simply load the template... :-)
- LOAD_TEMPLATE("admin_overview_task");
+ loadTemplate('admin_overview_task', false, $content);
}
//
-function TASK_CREATE_EXTRA_ROWS ($WHATs, $DESCRs, $TITLEs) {
+function createExtraTaskRows ($WHATs, $DESCRs, $TITLEs) {
// Init variables
- $OUT = ""; $SW = 2;
+ $OUT = '';
// Sadly this cannot be rewritten to a filter... :(
- foreach (GET_SQLS() as $key => $sql) {
- // 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'] = "bottom2";
-
- if (($value > 0) && (!empty($WHATs[$key]))) {
- if (empty($TITLEs[$key])) $TITLEs[$key] = getMessage('ADMIN_TASK_UNKNOWN_LIST_TITLE');
- $content['row_link'] = "".$value."";
- } else {
- $content['row_link'] = 0;
- }
+ foreach (getSqls() as $sqls) {
+ // New format...
+ foreach ($sqls as $key => $sql) {
+ // Run SQL command, get line numbers and free memory
+ $result = SQL_QUERY($sql, __FUNCTION__, __LINE__);
+
+ // Prepare array for output
+ $content = array(
+ 'row_descr' => $DESCRs[$key],
+ 'bottom' => '',
+ );
+
+ // Rewrite CSS class if not last entry is reached
+ if ($key < (count($sqls) - 1)) $content['bottom'] = 'bottom';
+
+ if ((SQL_NUMROWS($result) > 0) && (!empty($WHATs[$key]))) {
+ if (empty($TITLEs[$key])) {
+ $TITLEs[$key] = '{--ADMIN_TASK_UNKNOWN_LIST_TITLE--}';
+ } // END - if
+ $content['row_link'] = '' . SQL_NUMROWS($result) . '';
+ } else {
+ $content['row_link'] = '0';
+ }
- // And insert the final string into extras template
- $OUT .= LOAD_TEMPLATE("admin_overview_task_rows", true, $content);
+ // Free result
+ SQL_FREERESULT($result);
- // Switch color
- $SW = 3 - $SW;
- } // END - if
+ // 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 LOAD_TEMPLATE("admin_overview_task_extras", true, $OUT);
+ return loadTemplate('admin_overview_task_extras', true, $OUT);
}
//