]> git.mxchange.org Git - mailer.git/blob - inc/libs/task_functions.php
4b85d3da37d46554f8ee81278a61b72668b6fde8
[mailer.git] / inc / libs / task_functions.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 08/03/2004 *
4  * ===================                          Last change: 11/19/2005 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : task_functions.php                               *
8  * -------------------------------------------------------------------- *
9  * Short description : Special task functions                           *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Spezielle task-Funktionen                        *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * Needs to be in all Files and every File needs "svn propset           *
18  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
19  * -------------------------------------------------------------------- *
20  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
21  * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
22  * For more information visit: http://www.mxchange.org                  *
23  *                                                                      *
24  * This program is free software; you can redistribute it and/or modify *
25  * it under the terms of the GNU General Public License as published by *
26  * the Free Software Foundation; either version 2 of the License, or    *
27  * (at your option) any later version.                                  *
28  *                                                                      *
29  * This program is distributed in the hope that it will be useful,      *
30  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
31  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
32  * GNU General Public License for more details.                         *
33  *                                                                      *
34  * You should have received a copy of the GNU General Public License    *
35  * along with this program; if not, write to the Free Software          *
36  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
37  * MA  02110-1301  USA                                                  *
38  ************************************************************************/
39
40 // Some security stuff...
41 if (!defined('__SECURITY')) {
42         die();
43 } // END - if
44
45 //
46 // The advanced overview shows detailed informations to your exchange script:
47 //  - Unconfirmed / locked accounts
48 //  - Mails waiting to be approved
49 //  - Open tasks
50 //  - Your own tasks
51 //  - ...
52 //
53 // @TODO Move all extension-dependent queries into filters
54 function outputAdvancedOverview (&$result_main) {
55         // Init variables/arrays
56         $EXTRAS = '';
57         $OUT    = '';
58         $WHATs  = array();
59         $DESCRs = array();
60         $TITLEs = array();
61
62         // Chheck for new extensions and updates
63         $jobsDone = outputStandardOverview($result_main);
64
65         // Init SQLs
66         initSqls();
67
68         // Init contentn
69         foreach (
70                 array(
71                         // Member accounts
72                         'confirmed_members','unconfirmed_members','locked_members',
73                         // Tasks
74                         'update_tasks','new_tasks','closed_tasks','your_tasks','deleted_tasks','solved_tasks',
75                         // Mail orders
76                         'pending_mails','canceled_mails','send_emails',
77                         // Bonus mails
78                         'send_bonus_mails',
79                         // Purging
80                         'purged_mails','purged_bonus_mails'
81                 ) as $entry) {
82                 // Set it to zero
83                 $content[$entry] = '0';
84         } // END - foreach
85
86         // Extension updates found
87         $value = countSumTotalData(getCurrentAdminId(), 'task_system', 'id', 'assigned_admin', true, " AND `status`='NEW' AND `task_type`='EXTENSION_UPDATE'");
88
89         if ($value > 0) {
90                 $content['update_tasks'] = '<a href="{%url=modules.php?module=admin&amp;what=list_task&amp;type=updates%}">' . $value . '</a>';
91         } // END - if
92
93         //
94         // First check for all account status seperately
95         //
96         // Confirmed accounts
97         $value = getTotalConfirmedUser();
98
99         if ($value > 0) {
100                 $content['confirmed_members'] = '<a href="{%url=modules.php?module=admin&amp;what=list_user&amp;status=confirmed%}">' . $value . '</a>';
101         } // END - if
102
103         // Unconfirmed accounts
104         $value = countSumTotalData('UNCONFIRMED', 'user_data', 'userid', 'status', true);
105
106         if ($value > 0) {
107                 $content['unconfirmed_members'] = '<a href="{%url=modules.php?module=admin&amp;what=chk_regs%}">' . $value . '</a>';
108         } // END - if
109
110
111         // And locked accounts
112         $value = countSumTotalData('LOCKED', 'user_data', 'userid', 'status', true);
113         if ($value > 0) {
114                 $content['locked_members'] = '<a href="{%url=modules.php?module=admin&amp;what=list_user&amp;status=locked%}">' . $value . '</a>';
115         } // END - if
116
117         //
118         // Unassigned tasks
119         //
120         $value = countSumTotalData(0, 'task_system', 'id', 'assigned_admin', true, " AND `status` != 'DELETED'");
121
122         if ($value > 0) {
123                 $content['new_tasks'] = '<a href="{%url=modules.php?module=admin&amp;what=list_task&amp;type=unassigned%}">' . $value . '</a>';
124         } // END - if
125
126         //
127         // Closed tasks
128         //
129         $value = countSumTotalData('CLOSED', 'task_system', 'id', 'status', true);
130
131         if ($value > 0) {
132                 $content['closed_tasks'] = '<a href="{%url=modules.php?module=admin&amp;what=list_task&amp;type=closed%}">' . $value . '</a>';
133         } // END - if
134
135         //
136         // Deleted tasks
137         //
138         $value = countSumTotalData('DELETED', 'task_system', 'id', 'status', true);
139
140         if ($value > 0) {
141                 $content['deleted_tasks'] = '<a href="{%url=modules.php?module=admin&amp;what=list_task&amp;type=deleted%}">' . $value . '</a>';
142         } // END - if
143
144         //
145         // Solved tasks
146         //
147         $value = countSumTotalData('SOLVED', 'task_system', 'id', 'status', true, sprintf(" AND `assigned_admin`=%s", getCurrentAdminId()));
148
149         if ($value > 0) {
150                 $content['solved_tasks'] = '<a href="{%url=modules.php?module=admin&amp;what=list_task&amp;type=solved%}">' . $value . '</a>';
151         } // END - if
152
153         //
154         // Your tasks
155         //
156         $value = countSumTotalData(getCurrentAdminId(), 'task_system', 'id', 'assigned_admin', true, " AND `status`='NEW' AND task_type != 'EXTENSION_UPDATE'");
157
158         if ($value > 0) {
159                 $content['your_tasks'] = '<a href="{%url=modules.php?module=admin&amp;what=list_task%}">' . $value . '</a>';
160         } // END - if
161
162         //
163         // Mails waiting to be approved
164         //
165         $value = countSumTotalData('ADMIN', 'pool', 'id', 'data_type', true);
166
167         if ($value > 0) {
168                 $content['pending_mails'] = '<a href="{%url=modules.php?module=admin&amp;what=unlock_emails%}">' . $value . '</a>';
169         } // END - if
170
171         //
172         // Unfinished mail orders
173         //
174         $value = countSumTotalData('TEMP', 'pool', 'id', 'data_type', true);
175
176         if ($value > 0) {
177                 $content['canceled_mails'] = '<a href="{%url=modules.php?module=admin&amp;what=email_details%}">' . $value . '</a>';
178         } // END - if
179
180         //
181         // Sent mail orders
182         //
183         $value = countSumTotalData('SEND', 'pool', 'id', 'data_type', true);
184
185         if ($value > 0) {
186                 $content['send_emails'] = '<a href="{%url=modules.php?module=admin&amp;what=email_archiv%}">' . $value . '</a>';
187         } // END - if
188
189         //
190         // Autopurged mails
191         //
192         if (isExtensionActive('autopurge')) {
193                 // Get auto-purged mails
194                 $value = countSumTotalData('DELETED', 'pool', 'id', 'data_type', true);
195
196                 if ($value > 0) {
197                         $content['purged_mails'] = '<a href="{%url=modules.php?module=admin&amp;what=email_details%}">' . $value . '</a>';
198                 } // END - if
199
200                 //
201                 // Autopurged bonus mails
202                 //
203                 if (isExtensionInstalledAndNewer('bonus', '0.1.8')) {
204                         // Get auto-purged bonus mails
205                         $value = countSumTotalData('DELETED', 'bonus', 'id', 'data_type', true);
206
207                         if ($value > 0) {
208                                 $content['purged_bonus_mails'] = '<a href="{%url=modules.php?module=admin&amp;what=email_details%}">' . $value . '</a>';
209                         } // END - if
210                 } elseif (isExtensionActive('bonus')) {
211                         $content['purged_bonus_mails'] = getMaskedMessage('ADMIN_EXTENSION_BONUS_OUTDATED', '0.1.8');
212                 } else {
213                         $content['purged_bonus_mails'] = '<span class="admin_note">{--ADMIN_EXTENSION_BONUS_404--}</span>';
214                 }
215         } else {
216                 $content['purged_bonus_mails'] = '<span class="admin_note">{--ADMIN_EXTENSION_AUTOPURGE_404--}</span>';
217                 $content['purged_mails'] = '<span class="admin_note">{--ADMIN_EXTENSION_AUTOPURGE_404--}</span>';
218         }
219
220         //
221         // Sent bonus mails
222         //
223         if (isExtensionInstalledAndNewer('bonus', '0.1.8')) {
224                 // Get sent bonus mails (but not notifications)
225                 $value = countSumTotalData('SEND', 'bonus', 'id', 'data_type', true, " AND `is_notify`='N'");
226
227                 if ($value > 0) {
228                         $content['send_bonus_mails'] = '<a href="{%url=modules.php?module=admin&amp;what=email_details%}">' . $value . '</a>';
229                 } // END - if
230         } elseif (isExtensionActive('bonus')) {
231                 $content['send_bonus_mails'] = getMaskedMessage('ADMIN_EXTENSION_BONUS_OUTDATED', '0.1.8');
232         } else {
233                 $content['send_bonus_mails'] = getMessage('ADMIN_EXTENSION_BONUS_404');
234         }
235
236         if (isExtensionActive('autopurge')) {
237                 // Start finding them...
238                 $since = getConfig('ap_inactive_since');
239                 $EXCLUDE_LIST = '';
240                 if (getConfig('def_refid') > 0) {
241                         $EXCLUDE_LIST = ' AND d.userid != {?def_refid?}';
242                 } // END - if
243
244                 // Check for more extensions
245                 // @TODO These can be rewritten to filter
246                 if (isExtensionActive('beg'))                  $EXCLUDE_LIST .= ' AND d.userid != {?beg_userid?}';
247                 if (isExtensionActive('bonus'))                $EXCLUDE_LIST .= ' AND d.userid != {?bonus_userid?}';
248                 if (isExtensionActive('doubler'))              $EXCLUDE_LIST .= ' AND d.userid != {?doubler_userid?}';
249                 if (isExtensionInstalledAndNewer('holiday', '0.1.3')) {
250                         // Recent ext-holiday found
251                         $EXCLUDE_LIST .= " AND d.`holiday_active`='N'";
252                 } // END - if
253
254                 // Check for all accounts
255                 addSql("SELECT
256         d.userid, d.email, d.last_online
257 FROM
258         `{?_MYSQL_PREFIX?}_user_data` AS d
259 WHERE
260         d.`status`='CONFIRMED' AND
261         d.joined < (UNIX_TIMESTAMP() - ".$since.") AND
262         d.last_online < (UNIX_TIMESTAMP() - ".$since.") AND
263         d.ap_notified < (UNIX_TIMESTAMP() - ".$since.")
264 ".$EXCLUDE_LIST."
265 ORDER BY
266         d.userid ASC");
267                 $WHATs[]  = 'list_autopurge';
268                 $DESCRs[] = getMessage('ADMIN_TASK_INACTIVE_AUTOPURGE');
269                 $TITLEs[] = getMessage('ADMIN_TASK_INACTIVE_AUTOPURGE_TITLE');
270         }
271
272         if (isExtensionInstalledAndNewer('sql_patches', '0.3.4')) {
273                 // Check for accounts without referal
274                 addSql("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `refid`=0 ORDER BY `userid` ASC");
275                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_ACCOUNT_NOREF');
276                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_ACCOUNT_NOREF_TITLE');
277                 $WHATs[]  = 'list_user&amp;mode=norefs';
278         }
279
280         if (isExtensionActive('payout')) {
281                 // List new payout requests
282                 addSql("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_payouts` WHERE `status`='NEW' ORDER BY `userid` ASC");
283                 $WHATs[]  = 'list_payouts';
284                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_PAYOUTS_WAITING');
285                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_PAYOUTS_WAITING_TITLE');
286                 addSql("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_payouts` ORDER BY `userid` ASC");
287                 $WHATs[]  = 'list_payouts';
288                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_PAYOUTS_ALL');
289                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_PAYOUTS_ALL_TITLE');
290         }
291
292         if (isExtensionActive('wernis')) {
293                 // List new wernis requests
294                 addSql("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_wernis` ORDER BY `userid` ASC");
295                 $WHATs[]  = 'list_wernis';
296                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_WERNIS_ALL');
297                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_WERNIS_ALL_TITLE');
298         }
299
300         if (isExtensionActive('primera')) {
301                 // List new primera requests
302                 addSql("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_primera` ORDER BY `userid` ASC");
303                 $WHATs[]  = 'list_primera';
304                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_PRIMERA_ALL');
305                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_PRIMERA_ALL_TITLE');
306         }
307
308         if (isExtensionActive('holiday')) {
309                 // List holiday requests
310                 addSql("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_holidays` ORDER BY `userid` ASC");
311                 $WHATs[]  = 'list_holiday';
312                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_HOLIDAYS');
313                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_HOLIDAYS_TITLE');
314         }
315
316         if (isExtensionInstalledAndNewer('bonus', '0.8.7')) {
317                 // List all notifications
318                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `is_notify`='Y' ORDER BY `timestamp` DESC");
319                 $WHATs[]  = 'list_notifications';
320                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_NOTIFICATIONS');
321                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_NOTIFICATIONS_TITLE');
322         } // END - if
323
324         if (isExtensionInstalledAndNewer('bonus', '0.2.3')) {
325                 // Active rallye
326                 if (isExtensionInstalledAndNewer('bonus', '0.6.9')) {
327                         // Add more bonus points here
328                         $USE = '(0';
329                         if (getConfig('bonus_click_yn') == 'Y') $USE .= ' + `turbo_bonus`';
330                         if (getConfig('bonus_login_yn') == 'Y') $USE .= ' + `login_bonus`';
331                         if (getConfig('bonus_order_yn') == 'Y') $USE .= ' + `bonus_order`';
332                         if (getConfig('bonus_stats_yn') == 'Y') $USE .= ' + `bonus_stats`';
333                         if (getConfig('bonus_ref_yn')   == 'Y') $USE .= ' + `bonus_ref`';
334                         $USE .= ')';
335                 } else {
336                         // Old version ???
337                         $USE = 'turbo_bonus';
338                 }
339
340                 // Autopurge installed?
341                 $lastOnline = '';
342                 if ((isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getConfig('ap_inactive_since') > 0)) {
343                         // Use last online timestamp to keep inactive members away from here
344                         $lastOnline   = ' AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})';
345                 } // END - if
346
347                 addSql("SELECT
348         ".$USE." AS points
349 FROM
350         `{?_MYSQL_PREFIX?}_user_data`
351 WHERE
352         `status`='CONFIRMED' AND ".$USE." > 0".$lastOnline."
353 ORDER BY
354         `points` DESC,
355         `userid` ASC");
356                 $WHATs[]  = 'list_bonus';
357                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_BONUS');
358                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_BONUS_TITLE');
359         }
360
361         if (isExtensionInstalledAndNewer('beg', '0.1.2')) {
362                 // Begging rallye
363
364                 // Autopurge installed?
365                 $lastOnline = '';
366                 if ((isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getConfig('ap_inactive_since') > 0)) {
367                         // Use last online timestamp to keep inactive members away from here
368                         $lastOnline   = ' AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})';
369                 } // END - if
370
371                 addSql("SELECT
372         `userid`
373 FROM
374         `{?_MYSQL_PREFIX?}_user_data`
375 WHERE
376         `status`='CONFIRMED' AND
377         `beg_points` > 0
378         ".$lastOnline."
379 ORDER BY
380         `beg_points` DESC,
381         `userid` ASC");
382                 $WHATs[]  = 'list_beg';
383                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_BEG');
384                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_BEG_TITLE');
385         }
386
387         if (isExtensionActive('doubler')) {
388                 // List waiting payouts
389                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_doubler` WHERE `completed`='N' ORDER BY `id` ASC");
390                 $WHATs[]  = 'list_doubler&amp;mode=waiting&amp;select=all';
391                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_WAITING');
392                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_WAITING_TITLE');
393                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_doubler` ORDER BY `id` ASC");
394                 $WHATs[]  = 'list_doubler';
395                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_ALL');
396                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_ALL_TITLE');
397         }
398
399         //
400         // All referal banner
401         //
402         addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_refbanner` ORDER BY `id` ASC");
403         $WHATs[] = 'refbanner';
404         $DESCRs[] = getMessage('ADMIN_TASK_LIST_REFBANNER_ALL');
405         $TITLEs[] = getMessage('ADMIN_TASK_LIST_REFBANNER_ALL_TITLE');
406
407         //
408         // All activated referal banner
409         //
410         addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_refbanner` WHERE `visible`='Y' ORDER BY `id` ASC");
411         $WHATs[] = 'refbanner';
412         $DESCRs[] = getMessage('ADMIN_TASK_LIST_REFBANNER_ACTIVE');
413         $TITLEs[] = getMessage('ADMIN_TASK_LIST_REFBANNER_ACTIVE_TITLE');
414
415         //
416         // All extensions
417         //
418         addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_extensions` ORDER BY `id` ASC");
419         $WHATs[] = 'extensions';
420         $DESCRs[] = getMessage('ADMIN_TASK_LIST_EXTENSIONS_ALL');
421         $TITLEs[] = getMessage('ADMIN_TASK_LIST_EXTENSIONS_ALL_TITLE');
422
423         //
424         // All activated extensions
425         //
426         addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_active`='Y' ORDER BY `id` ASC");
427         $WHATs[]  = 'extensions&amp;active=Y';
428         $DESCRs[] = getMessage('ADMIN_TASK_LIST_EXTENSIONS_ACTIVE');
429         $TITLEs[] = getMessage('ADMIN_TASK_LIST_EXTENSIONS_ACTIVE_TITLE');
430
431         if (isExtensionActive('engine')) {
432                 // List all export accounts
433                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_engine_accounts` ORDER BY `id` ASC");
434                 $WHATs[]  = 'list_engine';
435                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_ENGINE');
436                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_ENGINE_TITLE');
437
438                 // List all pending accounts
439                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_engine_accounts` WHERE `status`='UNCONFIRMED' ORDER BY `id` ASC");
440                 $WHATs[]  = 'unlock_engine';
441                 $DESCRs[] = getMessage('ADMIN_TASK_UNLOCK_ENGINE');
442                 $TITLEs[] = getMessage('ADMIN_TASK_UNLOCK_ENGINE_TITLE');
443
444                 // List all safes
445                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_engine_safe` ORDER BY `id` ASC");
446                 $WHATs[]  = 'list_engine&amp;mode=safe';
447                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_ENGINE_SAFES');
448                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_ENGINE_SAFES_TITLE');
449
450                 // List all export URLs
451                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_engine_urls` ORDER BY `id` ASC");
452                 $WHATs[]  = 'engine_urls';
453                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_ENGINE_URLS');
454                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_ENGINE_URLS_TITLE');
455         } // END - if
456
457         if (isExtensionActive('sponsor')) {
458                 // List all sponsors
459                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` ORDER BY `id` ASC");
460                 $WHATs[]  = 'list_sponsor';
461                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR');
462                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_TITLE');
463
464                 // List confirmed sponsor accounts
465                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `status`='CONFIRMED' ORDER BY `id` ASC");
466                 $WHATs[]  = 'list_sponsor';
467                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_CONFIRMED');
468                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_CONFIRMED_TITLE');
469
470                 // List unconfirmed sponsor accounts
471                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `status`='UNCONFIRMED' ORDER BY `id` ASC");
472                 $WHATs[]  = 'list_sponsor';
473                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_UNCONFIRMED');
474                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_UNCONFIRMED_TITLE');
475
476                 // List locked sponsor accounts
477                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `status`='LOCKED' ORDER BY `id` ASC");
478                 $WHATs[]  = 'list_sponsor';
479                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_LOCKED');
480                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_LOCKED_TITLE');
481
482                 // List waiting sponsor accounts to be approved
483                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `status`='PENDING' ORDER BY `id` ASC");
484                 $WHATs[]  = 'unlock_sponsor';
485                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_PENDING');
486                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_PENDING_TITLE');
487
488                 // Waiting payments
489                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_orders` WHERE `pay_status`='PENDING' ORDER BY `id` ASC");
490                 $WHATs[]  = 'list_sponsor_pays';
491                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_ORDERS');
492                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_SPONSOR_ORDERS_TITLE');
493         } // END - if
494
495         if (isExtensionActive('country')) {
496                 // List country codes
497                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_countries` ORDER BY `id` ASC");
498                 $WHATs[]  = 'list_country';
499                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_COUNTRY');
500                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_COUNTRY_TITLE');
501         } // END - if
502
503         if (isExtensionActive('theme')) {
504                 // List all themes
505                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_themes` ORDER BY `id` ASC");
506                 $WHATs[]  = 'theme_edit';
507                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_THEME_ALL');
508                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_THEME_ALL_TITLE');
509
510                 // List active themes
511                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_themes` WHERE `theme_active`='Y' ORDER BY `id` ASC");
512                 $WHATs[]  = 'theme_edit';
513                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_THEME_ACTIVE');
514                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_THEME_ACTIVE_TITLE');
515         } // END - if
516
517         if (isExtensionActive('admins')) {
518                 // List all administrator logins
519                 addSql("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `id` ASC");
520                 $WHATs[]  = 'admins_edit';
521                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_ADMINS_ALL');
522                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_ADMINS_ALL_TITLE');
523         } // END - if
524
525         if (isExtensionActive('surfbar')) {
526                 // List all URLs in surfbar
527                 addSql("SELECT `url_id` FROM `{?_MYSQL_PREFIX?}_surfbar_urls` ORDER BY `url_id` ASC");
528                 $WHATs[]  = 'list_surfbar_urls';
529                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_SURFBAR_URLS_ALL');
530                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_SURFBAR_URLS_ALL_TITLE');
531
532                 // List all pending URLs in surfbar
533                 addSql("SELECT `url_id` FROM `{?_MYSQL_PREFIX?}_surfbar_urls` WHERE `url_status`='PENDING' ORDER BY `url_id` ASC");
534                 $WHATs[]  = 'unlock_surfbar_urls';
535                 $DESCRs[] = getMessage('ADMIN_TASK_LIST_SURFBAR_URLS_PENDING');
536                 $TITLEs[] = getMessage('ADMIN_TASK_LIST_SURFBAR_URLS_PENDING_TITLE');
537         } // END - if
538
539         // Generate extra overview rows
540         $EXTRAS .= createExtraTaskRows($WHATs, $DESCRs, $TITLEs);
541
542         // If empty just keep a forced-space left for CSS issues
543         if (empty($EXTRAS)) $EXTRAS = '&nbsp;';
544
545         // Add compiled string to constant for final template
546         $content['extra_table'] = $EXTRAS;
547
548         // Simply load the template... :-)
549         loadTemplate('admin_overview_task', false, $content);
550 }
551
552 //
553 function createExtraTaskRows ($WHATs, $DESCRs, $TITLEs) {
554         // Init variables
555         $OUT = ''; $SW = 2;
556
557         // Sadly this cannot be rewritten to a filter... :(
558         foreach (getSqls() as $sqls) {
559                 // New format...
560                 foreach ($sqls as $key => $sql) {
561                         // Run SQL command, get line numbers and free memory
562                         $result = SQL_QUERY($sql, __FUNCTION__, __LINE__);
563
564                         // Get rows
565                         $value = SQL_NUMROWS($result);
566
567                         // Free result
568                         SQL_FREERESULT($result);
569
570                         // Prepare array for output
571                         $content = array(
572                                 'row_descr' => $DESCRs[$key],
573                                 'row_sw'    => $SW,
574                                 'bottom'    => '',
575                         );
576
577                         // Rewrite CSS class if not last entry is reached
578                         if ($key < (count($sqls) - 1)) $content['bottom'] = 'bottom';
579
580                         if (($value > 0) && (!empty($WHATs[$key]))) {
581                                 if (empty($TITLEs[$key])) $TITLEs[$key] = getMessage('ADMIN_TASK_UNKNOWN_LIST_TITLE');
582                                 $content['row_link'] = '<a href="{%url=modules.php?module=admin&amp;what=' . $WHATs[$key] . '%}" title="' . $TITLEs[$key] . '">' . $value . '</a>';
583                         } else {
584                                 $content['row_link'] = '0';
585                         }
586
587                         // And insert the final string into extras template
588                         $OUT .= loadTemplate('admin_overview_task_rows', true, $content);
589
590                         // Switch color
591                         $SW = 3 - $SW;
592                 } // END- foreach
593         } // END - foreach
594
595         // Return output in the template
596         return loadTemplate('admin_overview_task_extras', true, $OUT);
597 }
598
599 //
600 ?>