249a757ec1d1b7f59acebde16dcb4675116b5496
[mailer.git] / 0.2.1 / inc / libs / task_functions.php
1 <?php\r
2 /************************************************************************\r
3  * MXChange v0.2.1                                    Start: 08/03/2004 *\r
4  * ================                             Last change: 11/19/2005 *\r
5  *                                                                      *\r
6  * -------------------------------------------------------------------- *\r
7  * File              : task_functions.php                               *\r
8  * -------------------------------------------------------------------- *\r
9  * Short description : Special task functions                           *\r
10  * -------------------------------------------------------------------- *\r
11  * Kurzbeschreibung  : Spezielle task-Funktionen                        *\r
12  * -------------------------------------------------------------------- *\r
13  *                                                                      *\r
14  * -------------------------------------------------------------------- *\r
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *\r
16  * For more information visit: http://www.mxchange.org                  *\r
17  *                                                                      *\r
18  * This program is free software; you can redistribute it and/or modify *\r
19  * it under the terms of the GNU General Public License as published by *\r
20  * the Free Software Foundation; either version 2 of the License, or    *\r
21  * (at your option) any later version.                                  *\r
22  *                                                                      *\r
23  * This program is distributed in the hope that it will be useful,      *\r
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *\r
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *\r
26  * GNU General Public License for more details.                         *\r
27  *                                                                      *\r
28  * You should have received a copy of the GNU General Public License    *\r
29  * along with this program; if not, write to the Free Software          *\r
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *\r
31  * MA  02110-1301  USA                                                  *\r
32  ************************************************************************/\r
33 \r
34 // Some security stuff...\r
35 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))\r
36 {\r
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";\r
38         require($INC);\r
39 }\r
40 //\r
41 // The advanced overview shows detailed informations to your exchange script:\r
42 //  - Unconfirmed / locked accounts\r
43 //  - Mails waiting to be approved\r
44 //  - Open tasks\r
45 //  - Your own tasks\r
46 //  - ...\r
47 //\r
48 function OUTPUT_ADVANCED_OVERVIEW (&$result_main)\r
49 {\r
50         global $_COOKIE, $CONFIG;\r
51 \r
52         // Init variables/arrays\r
53         $EXTRAS = ""; $OUT = ""; $SQLs = array(); $WHATs = array(); $DESCRs = array(); $TITLEs = array();\r
54 \r
55         // Chheck for new extensions and updates\r
56         $JOBS_DONE = OUTPUT_STANDARD_OVERVIEW($result_main);\r
57 \r
58         if (!$JOBS_DONE)\r
59         {\r
60                 // New extensions or updates found\r
61                 $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE assigned_admin='%s' AND status='NEW' AND task_type='EXTENSION_UPDATE'",\r
62                  array(GET_ADMIN_ID($_COOKIE['admin_login'])), __FILE__, __LINE__);\r
63 \r
64                 $value = SQL_NUMROWS($result);\r
65                 SQL_FREERESULT($result);\r
66 \r
67                 if ($value > 0)\r
68                 {\r
69                         define ('__TASK_UPDATE_VALUE', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_task&amp;type=updates\">".$value."</A>");\r
70                 }\r
71                  else\r
72                 {\r
73                         define ('__TASK_UPDATE_VALUE', "0");\r
74                 }\r
75         }\r
76          else\r
77         {\r
78                 define ('__TASK_UPDATE_VALUE', "0");\r
79         }\r
80 \r
81         //\r
82         // First check for all account status seperately\r
83         //\r
84         // Confirmed accounts\r
85         $result = SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE status='CONFIRMED'", __FILE__, __LINE__);\r
86         $value = SQL_NUMROWS($result);\r
87         SQL_FREERESULT($result);\r
88 \r
89         if ($value > 0)\r
90         {\r
91                 define('__CONFIRMED_VALUE', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_user&amp;mode=confirmed\">".$value."</A>");\r
92         }\r
93          else\r
94         {\r
95                 define('__CONFIRMED_VALUE', "0");\r
96         }\r
97         // Unconfirmed accounts\r
98         $result = SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE status='UNCONFIRMED'", __FILE__, __LINE__);\r
99         $value = SQL_NUMROWS($result);\r
100         SQL_FREERESULT($result);\r
101 \r
102         if ($value > 0)\r
103         {\r
104                 define('__UNCONFIRMED_VALUE', "<A href=\"".URL."/modules.php?module=admin&amp;what=chk_regs\">".$value."</A>");\r
105         }\r
106          else\r
107         {\r
108                 define('__UNCONFIRMED_VALUE', "0");\r
109         }\r
110         // And locked accounts\r
111         $result = SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE status='LOCKED'", __FILE__, __LINE__);\r
112         $value = SQL_NUMROWS($result);\r
113         SQL_FREERESULT($result);\r
114 \r
115         if ($value > 0)\r
116         {\r
117                 define('__LOCKED_VALUE', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_user&amp;mode=locked\">".$value."</A>");\r
118         }\r
119          else\r
120         {\r
121                 define('__LOCKED_VALUE', "0");\r
122         }\r
123         //\r
124         // Unassigned tasks\r
125         //\r
126         $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE assigned_admin='0' AND status != 'DELETED'", __FILE__, __LINE__);\r
127         $value = SQL_NUMROWS($result);\r
128         SQL_FREERESULT($result);\r
129 \r
130         if ($value > 0)\r
131         {\r
132                 define('__TASK_NEW_VALUE', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_task&amp;type=unassigned\">".$value."</A>");\r
133         }\r
134          else\r
135         {\r
136                 define('__TASK_NEW_VALUE', "0");\r
137         }\r
138         //\r
139         // Closed tasks\r
140         //\r
141         $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE status = 'CLOSED'", __FILE__, __LINE__);\r
142         $value = SQL_NUMROWS($result);\r
143         SQL_FREERESULT($result);\r
144 \r
145         if ($value > 0)\r
146         {\r
147                 define('__TASK_CLOSED_VALUE', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_task&amp;type=closed\">".$value."</A>");\r
148         }\r
149          else\r
150         {\r
151                 define('__TASK_CLOSED_VALUE', "0");\r
152         }\r
153         //\r
154         // Deleted tasks\r
155         //\r
156         $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE status = 'DELETED'", __FILE__, __LINE__);\r
157         $value = SQL_NUMROWS($result);\r
158         SQL_FREERESULT($result);\r
159 \r
160         if ($value > 0)\r
161         {\r
162                 define('__TASK_DELETED_VALUE', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_task&amp;type=deleted\">".$value."</A>");\r
163         }\r
164          else\r
165         {\r
166                 define('__TASK_DELETED_VALUE', "0");\r
167         }\r
168         //\r
169         // Solved tasks\r
170         //\r
171         $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE status = 'SOLVED' AND assigned_admin='%s'",\r
172          array(GET_ADMIN_ID($_COOKIE['admin_login'])), __FILE__, __LINE__);\r
173         $value = SQL_NUMROWS($result);\r
174         SQL_FREERESULT($result);\r
175 \r
176         if ($value > 0)\r
177         {\r
178                 define('__TASK_SOLVED_VALUE', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_task&amp;type=solved\">".$value."</A>");\r
179         }\r
180          else\r
181         {\r
182                 define('__TASK_SOLVED_VALUE', "0");\r
183         }\r
184         //\r
185         // Your tasks\r
186         //\r
187         $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE assigned_admin='%s' AND status = 'NEW' AND task_type != 'EXTENSION_UPDATE'",\r
188          array(GET_ADMIN_ID($_COOKIE['admin_login'])), __FILE__, __LINE__);\r
189         $value = SQL_NUMROWS($result);\r
190         SQL_FREERESULT($result);\r
191 \r
192         if ($value > 0)\r
193         {\r
194                 define('__TASK_YOUR_VALUE', "<A href=\"".URL."/modules.php?module=admin&amp;what=list_task\">".$value."</A>");\r
195         }\r
196          else\r
197         {\r
198                 define('__TASK_YOUR_VALUE', "0");\r
199         }\r
200         //\r
201         // Mails waiting to be approved\r
202         //\r
203         $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_pool WHERE data_type='ADMIN'", __FILE__, __LINE__);\r
204         $value = SQL_NUMROWS($result);\r
205         SQL_FREERESULT($result);\r
206 \r
207         if ($value > 0)\r
208         {\r
209                 define('__MAIL_ADMIN_VALUE', "<A href=\"".URL."/modules.php?module=admin&amp;what=unlock_emails\">".$value."</A>");\r
210         }\r
211          else\r
212         {\r
213                 define('__MAIL_ADMIN_VALUE', "0");\r
214         }\r
215         //\r
216         // Unfinished mail orders\r
217         //\r
218         $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_pool WHERE data_type='TEMP'", __FILE__, __LINE__);\r
219         $value = SQL_NUMROWS($result);\r
220         SQL_FREERESULT($result);\r
221 \r
222         if ($value > 0)\r
223         {\r
224                 define('__MAIL_TEMP_VALUE', "<A href=\"".URL."/modules.php?module=admin&amp;what=email_details\">".$value."</A>");\r
225         }\r
226          else\r
227         {\r
228                 define('__MAIL_TEMP_VALUE', "0");\r
229         }\r
230         //\r
231         // Sent mail orders\r
232         //\r
233         $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_pool WHERE data_type='SEND'", __FILE__, __LINE__);\r
234         $value = SQL_NUMROWS($result);\r
235         SQL_FREERESULT($result);\r
236 \r
237         if ($value > 0)\r
238         {\r
239                 define('__MAIL_SEND_VALUE', "<A href=\"".URL."/modules.php?module=admin&amp;what=email_archiv\">".$value."</A>");\r
240         }\r
241          else\r
242         {\r
243                 define('__MAIL_SEND_VALUE', "0");\r
244         }\r
245         //\r
246         // Autopurged mails\r
247         //\r
248         if (EXT_IS_ACTIVE("autopurge"))\r
249         {\r
250                 $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_pool WHERE data_type='DELETED'", __FILE__, __LINE__);\r
251                 $value = SQL_NUMROWS($result);\r
252                 SQL_FREERESULT($result);\r
253 \r
254                 if ($value > 0)\r
255                 {\r
256                         define('__MAIL_DELETED_VALUE', "<A href=\"".URL."/modules.php?module=admin&amp;what=email_details\">".$value."</A>");\r
257                 }\r
258                  else\r
259                 {\r
260                         define('__MAIL_DELETED_VALUE', "0");\r
261                 }\r
262                 //\r
263                 // Autopurged bonus mails\r
264                 //\r
265                 if (GET_EXT_VERSION("bonus") >= "0.1.8")\r
266                 {\r
267                         $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_bonus WHERE data_type='DELETED'", __FILE__, __LINE__);\r
268                         $value = SQL_NUMROWS($result);\r
269                         SQL_FREERESULT($result);\r
270 \r
271                         if ($value > 0)\r
272                         {\r
273                                 define('__MAIL_BONUS_AP_VALUE', "<A href=\"".URL."/modules.php?module=admin&amp;what=email_details\">".$value."</A>");\r
274                         }\r
275                          else\r
276                         {\r
277                                 define('__MAIL_BONUS_AP_VALUE', "0");\r
278                         }\r
279                 }\r
280                  elseif (EXT_IS_ACTIVE("bonus"))\r
281                 {\r
282                         define('__MAIL_BONUS_AP_VALUE', ADMIN_EXT_BONUS_OUTDATED_1."0.1.8".ADMIN_EXT_BONUS_OUTDATED_2);\r
283                 }\r
284                  else\r
285                 {\r
286                         define('__MAIL_BONUS_AP_VALUE', "<FONT class=\"admin_note\">".ADMIN_EXT_BONUS_404."</FONT>");\r
287                 }\r
288         }\r
289          else\r
290         {\r
291                 define('__MAIL_BONUS_AP_VALUE', "<FONT class=\"admin_note\">".ADMIN_EXT_AUTOPURGE_404."</FONT>");\r
292                 define('__MAIL_DELETED_VALUE', "<FONT class=\"admin_note\">".ADMIN_EXT_AUTOPURGE_404."</FONT>");\r
293         }\r
294         //\r
295         // Sent bonus mails\r
296         //\r
297         if (GET_EXT_VERSION("bonus") >= "0.1.8")\r
298         {\r
299                 $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_bonus WHERE data_type='SEND'", __FILE__, __LINE__);\r
300                 $value = SQL_NUMROWS($result);\r
301                 SQL_FREERESULT($result);\r
302 \r
303                 if ($value > 0)\r
304                 {\r
305                         define('__MAIL_BONUS_SEND_VALUE', "<A href=\"".URL."/modules.php?module=admin&amp;what=email_details\">".$value."</A>");\r
306                 }\r
307                  else\r
308                 {\r
309                         define('__MAIL_BONUS_SEND_VALUE', "0");\r
310                 }\r
311         }\r
312          elseif (EXT_IS_ACTIVE("bonus"))\r
313         {\r
314                 define('__MAIL_BONUS_SEND_VALUE', ADMIN_EXT_BONUS_OUTDATED_1."0.1.8".ADMIN_EXT_BONUS_OUTDATED_2);\r
315         }\r
316          else\r
317         {\r
318                 define('__MAIL_BONUS_SEND_VALUE', ADMIN_EXT_BONUS_404);\r
319         }\r
320         if (EXT_IS_ACTIVE("autopurge"))\r
321         {\r
322                 // Start finding them...\r
323                 $since = (time() - $CONFIG['ap_in_since']);\r
324                 $EXCLUDE_LIST = " AND d.userid != c.def_refid";\r
325 \r
326                 // Check for more extensions\r
327                 if (EXT_IS_ACTIVE("beg"))     $EXCLUDE_LIST .= " AND d.userid != c.beg_uid";\r
328                 if (EXT_IS_ACTIVE("bonus"))   $EXCLUDE_LIST .= " AND d.userid != c.bonus_uid";\r
329                 if (EXT_IS_ACTIVE("doubler")) $EXCLUDE_LIST .= " AND d.userid != c.doubler_uid";\r
330 \r
331                 // Check for new holiday system\r
332                 if (GET_EXT_VERSION("holiday") >= "0.1.3")\r
333                 {\r
334                         $EXCLUDE_LIST .= " AND d.holiday_active = 'N'";\r
335                 }\r
336 \r
337                 // Check for all accounts\r
338                 $SQLs[] = "SELECT DISTINCT d.userid, d.email, d.last_online\r
339 FROM "._MYSQL_PREFIX."_user_data AS d, "._MYSQL_PREFIX."_config AS c\r
340 WHERE d.status='CONFIRMED' AND d.joined < ".$since." AND d.last_online < ".$since." AND d.ap_notified < ".$since."\r
341 ".$EXCLUDE_LIST."\r
342 ORDER BY d.userid";\r
343                 $WHATs[]  = "list_autopurge";\r
344                 $DESCRs[] = TASK_ADMIN_INACTIVE_AUTOPURGE;\r
345                 $TITLEs[] = TASK_ADMIN_INACTIVE_AUTOPURGE_TITLE;\r
346         }\r
347         if (GET_EXT_VERSION("sql_patches") >= "0.3.4")\r
348         {\r
349                 // Check for accounts without referral\r
350                 $SQLs[]   = "SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE refid='0' ORDER BY userid";\r
351                 $DESCRs[] = TAKS_ADMIN_LIST_ACCOUNT_NOREF;\r
352                 $TITLEs[] = TAKS_ADMIN_LIST_ACCOUNT_NOREF_TITLE;\r
353                 $WHATs[]  = "list_norefs";\r
354         }\r
355         if (EXT_IS_ACTIVE("payout"))\r
356         {\r
357                 // List new payout requests\r
358                 $SQLs[]   = "SELECT userid FROM "._MYSQL_PREFIX."_user_payouts WHERE status='NEW' ORDER BY userid";\r
359                 $WHATs[]  = "list_payouts";\r
360                 $DESCRs[] = TASK_ADMIN_LIST_PAYOUTS_WAITING;\r
361                 $TITLEs[] = TASK_ADMIN_LIST_PAYOUTS_WAITING_TITLE;\r
362                 $SQLs[]   = "SELECT userid FROM "._MYSQL_PREFIX."_user_payouts ORDER BY userid";\r
363                 $WHATs[]  = "list_payouts";\r
364                 $DESCRs[] = TASK_ADMIN_LIST_PAYOUTS_ALL;\r
365                 $TITLEs[] = TASK_ADMIN_LIST_PAYOUTS_ALL_TITLE;\r
366         }\r
367         if (EXT_IS_ACTIVE("wernis"))\r
368         {\r
369                 // List new wernis requests\r
370                 $SQLs[]   = "SELECT userid FROM "._MYSQL_PREFIX."_user_wernis ORDER BY userid";\r
371                 $WHATs[]  = "list_wernis";\r
372                 $DESCRs[] = TASK_ADMIN_LIST_WERNIS_ALL;\r
373                 $TITLEs[] = TASK_ADMIN_LIST_WERNIS_ALL_TITLE;\r
374         }\r
375         if (EXT_IS_ACTIVE("holiday"))\r
376         {\r
377                 // List holiday requests\r
378                 $SQLs[]   = "SELECT userid FROM "._MYSQL_PREFIX."_user_holidays ORDER BY userid";\r
379                 $WHATs[]  = "list_holiday";\r
380                 $DESCRs[] = TASK_ADMIN_LIST_HOLIDAYS;\r
381                 $TITLEs[] = TASK_ADMIN_LIST_HOLIDAYS_TITLE;\r
382         }\r
383         if (GET_EXT_VERSION("bonus") >= "0.2.3")\r
384         {\r
385                 // Active rallye\r
386                 if (GET_EXT_VERSION("bonus") >= "0.6.9")\r
387                 {\r
388                         // Add more bonus points here\r
389                         $USE = "(0";\r
390                         if ($CONFIG['bonus_click_yn'] == "Y") $USE .= " + turbo_bonus";\r
391                         if ($CONFIG['bonus_login_yn'] == "Y") $USE .= " + login_bonus";\r
392                         if ($CONFIG['bonus_order_yn'] == "Y") $USE .= " + bonus_order";\r
393                         if ($CONFIG['bonus_stats_yn'] == "Y") $USE .= " + bonus_stats";\r
394                         if ($CONFIG['bonus_ref_yn']   == "Y") $USE .= " + bonus_ref";\r
395                         $USE .= ")";\r
396                 }\r
397                  else\r
398                 {\r
399                         // Old version ???\r
400                         $USE = "turbo_bonus";\r
401                 }\r
402 \r
403                 // Autopurge installed?\r
404                 $LAST = ""; $ONLINE = "";\r
405                 if ((EXT_IS_ACTIVE("autopurge")) && ($CONFIG['ap_inactive'] == "Y") && ($CONFIG['ap_in_since'] > 0))\r
406                 {\r
407                         // Use last online timestamp to keep inactive members away from here\r
408                         $LAST   = " AND last_online >= ";\r
409                         $ONLINE = bigintval(time() - $CONFIG['ap_in_since']);\r
410                 }\r
411 \r
412                 $SQLs[]   = "SELECT ".$USE." AS active_bonus FROM "._MYSQL_PREFIX."_user_data\r
413 WHERE status='CONFIRMED' AND ".$USE.">0".$LAST."".$ONLINE."\r
414 ORDER BY active_bonus DESC, userid";\r
415                 $WHATs[]  = "list_bonus";\r
416                 $DESCRs[] = TASK_ADMIN_LIST_BONUS;\r
417                 $TITLEs[] = TASK_ADMIN_LIST_BONUS_TITLE;\r
418         }\r
419         if (GET_EXT_VERSION("beg") >= "0.1.2")\r
420         {\r
421                 // Begging rallye\r
422 \r
423                 // Autopurge installed?\r
424                 $LAST = ""; $ONLINE = "";\r
425                 if ((EXT_IS_ACTIVE("autopurge")) && ($CONFIG['ap_inactive'] == "Y") && ($CONFIG['ap_in_since'] > 0))\r
426                 {\r
427                         // Use last online timestamp to keep inactive members away from here\r
428                         $LAST   = " AND last_online >= ";\r
429                         $ONLINE = bigintval(time() - $CONFIG['ap_in_since']);\r
430                 }\r
431 \r
432                 $SQLs[]   = "SELECT userid FROM "._MYSQL_PREFIX."_user_data\r
433 WHERE status='CONFIRMED' AND beg_points>0".$LAST."".$ONLINE."\r
434 ORDER BY beg_points DESC, userid";\r
435                 $WHATs[]  = "list_beg";\r
436                 $DESCRs[] = TASK_ADMIN_LIST_BEG;\r
437                 $TITLEs[] = TASK_ADMIN_LIST_BEG_TITLE;\r
438         }\r
439         if (EXT_IS_ACTIVE("doubler"))\r
440         {\r
441                 // List waiting payouts\r
442                 $SQLs[]   = "SELECT id FROM "._MYSQL_PREFIX."_doubler WHERE completed='N' ORDER BY id";\r
443                 $WHATs[]  = "list_doubler&amp;mode=waiting&amp;select=all";\r
444                 $DESCRs[] = TASK_ADMIN_LIST_DOUBLER_WAITING;\r
445                 $TITLEs[] = TASK_ADMIN_LIST_DOUBLER_WAITING_TITLE;\r
446                 $SQLs[]   = "SELECT id FROM "._MYSQL_PREFIX."_doubler ORDER BY id";\r
447                 $WHATs[]  = "list_doubler";\r
448                 $DESCRs[] = TASK_ADMIN_LIST_DOUBLER_ALL;\r
449                 $TITLEs[] = TASK_ADMIN_LIST_DOUBLER_ALL_TITLE;\r
450         }\r
451         //\r
452         // All referral banner\r
453         //\r
454         $SQLs[] = "SELECT id FROM "._MYSQL_PREFIX."_refbanner ORDER BY id";\r
455         $WHATs[] = "refbanner";\r
456         $DESCRs[] = TASK_ADMIN_LIST_REFBANNER_ALL;\r
457         $TITLEs[] = TASK_ADMIN_LIST_REFBANNER_ALL_TITLE;\r
458         //\r
459         // All activated referral banner\r
460         //\r
461         $SQLs[] = "SELECT id FROM "._MYSQL_PREFIX."_refbanner WHERE visible='Y' ORDER BY id";\r
462         $WHATs[] = "refbanner";\r
463         $DESCRs[] = TASK_ADMIN_LIST_REFBANNER_ACTIVE;\r
464         $TITLEs[] = TASK_ADMIN_LIST_REFBANNER_ACTIVE_TITLE;\r
465         //\r
466         // All extensions\r
467         //\r
468         $SQLs[] = "SELECT id FROM "._MYSQL_PREFIX."_extensions ORDER BY id";\r
469         $WHATs[] = "extensions";\r
470         $DESCRs[] = TASK_ADMIN_LIST_EXTENSIONS_ALL;\r
471         $TITLEs[] = TASK_ADMIN_LIST_EXTENSIONS_ALL_TITLE;\r
472         //\r
473         // All activated extensions\r
474         //\r
475         $SQLs[] = "SELECT id FROM "._MYSQL_PREFIX."_extensions WHERE ext_active='Y' ORDER BY id";\r
476         $WHATs[] = "extensions";\r
477         $DESCRs[] = TASK_ADMIN_LIST_EXTENSIONS_ACTIVE;\r
478         $TITLEs[] = TASK_ADMIN_LIST_EXTENSIONS_ACTIVE_TITLE;\r
479         //\r
480         if (EXT_IS_ACTIVE("engine"))\r
481         {\r
482                 // List all export accounts\r
483                 $SQLs[] = "SELECT id FROM "._MYSQL_PREFIX."_engine_accounts ORDER BY id";\r
484                 $WHATs[] = "list_engine";\r
485                 $DESCRs[] = TASK_ADMIN_LIST_ENGINE;\r
486                 // List all pending accounts\r
487                 $SQLs[] = "SELECT id FROM "._MYSQL_PREFIX."_engine_accounts WHERE status='UNCONFIRMED' ORDER BY id";\r
488                 $WHATs[] = "unlock_engine";\r
489                 $DESCRs[] = TASK_ADMIN_UNLOCK_ENGINE;\r
490                 // List all safes\r
491                 $SQLs[] = "SELECT id FROM "._MYSQL_PREFIX."_engine_safe ORDER BY id";\r
492                 $WHATs[] = "list_engine&amp;mode=safe";\r
493                 $DESCRs[] = TASK_ADMIN_LIST_ENGINE_SAFES;\r
494                 // List all export URLs\r
495                 $SQLs[] = "SELECT id FROM "._MYSQL_PREFIX."_engine_urls ORDER BY id";\r
496                 $WHATs[] = "engine_urls";\r
497                 $DESCRs[] = TASK_ADMIN_LIST_ENGINE_URLS;\r
498         }\r
499         if (EXT_IS_ACTIVE("sponsor"))\r
500         {\r
501                 // List all sponsors\r
502                 $SQLs[]   = "SELECT id FROM "._MYSQL_PREFIX."_sponsor_data ORDER BY id";\r
503                 $WHATs[]  = "list_sponsor";\r
504                 $DESCRs[] = TASK_ADMIN_LIST_SPONSOR;\r
505                 $TITLEs[] = TASK_ADMIN_LIST_SPONSOR_TITLE;\r
506                 // List confirmed sponsor accounts\r
507                 $SQLs[]   = "SELECT id FROM "._MYSQL_PREFIX."_sponsor_data WHERE status='CONFIRMED' ORDER BY id";\r
508                 $WHATs[]  = "list_sponsor";\r
509                 $DESCRs[] = TASK_ADMIN_LIST_SPONSOR_CONFIRMED;\r
510                 $TITLEs[] = TASK_ADMIN_LIST_SPONSOR_CONFIRMED_TITLE;\r
511                 // List unconfirmed sponsor accounts\r
512                 $SQLs[]   = "SELECT id FROM "._MYSQL_PREFIX."_sponsor_data WHERE status='UNCONFIRMED' ORDER BY id";\r
513                 $WHATs[]  = "list_sponsor";\r
514                 $DESCRs[] = TASK_ADMIN_LIST_SPONSOR_UNCONFIRMED;\r
515                 $TITLEs[] = TASK_ADMIN_LIST_SPONSOR_UNCONFIRMED_TITLE;\r
516                 // List locked sponsor accounts\r
517                 $SQLs[]   = "SELECT id FROM "._MYSQL_PREFIX."_sponsor_data WHERE status='LOCKED' ORDER BY id";\r
518                 $WHATs[]  = "list_sponsor";\r
519                 $DESCRs[] = TASK_ADMIN_LIST_SPONSOR_LOCKED;\r
520                 $TITLEs[] = TASK_ADMIN_LIST_SPONSOR_LOCKED_TITLE;\r
521                 // List waiting sponsor accounts to be approved\r
522                 $SQLs[]   = "SELECT id FROM "._MYSQL_PREFIX."_sponsor_data WHERE status='PENDING' ORDER BY id";\r
523                 $WHATs[]  = "unlock_sponsor";\r
524                 $DESCRs[] = TASK_ADMIN_LIST_SPONSOR_PENDING;\r
525                 $TITLEs[] = TASK_ADMIN_LIST_SPONSOR_PENDING_TITLE;\r
526                 // Waiting payments\r
527                 $SQLs[]   = "SELECT id FROM "._MYSQL_PREFIX."_sponsor_orders WHERE pay_status='PENDING' ORDER BY id";\r
528                 $WHATs[]  = "list_sponsor_pays";\r
529                 $DESCRs[] = TASK_ADMIN_LIST_SPONSOR_ORDERS;\r
530                 $TITLEs[] = TASK_ADMIN_LIST_SPONSOR_ORDERS_TITLE;\r
531         }\r
532         if (EXT_IS_ACTIVE("country"))\r
533         {\r
534                 // List country codes\r
535                 $SQLs[]   = "SELECT id FROM "._MYSQL_PREFIX."_countries ORDER BY id";\r
536                 $WHATs[]  = "list_country";\r
537                 $DESCRs[] = TASK_ADMIN_LIST_COUNTRY;\r
538                 $TITLEs[] = TASK_ADMIN_LIST_COUNTRY_TITLE;\r
539         }\r
540         if (EXT_IS_ACTIVE("theme"))\r
541         {\r
542                 // List all themes\r
543                 $SQLs[]   = "SELECT id FROM "._MYSQL_PREFIX."_themes ORDER BY id";\r
544                 $WHATs[]  = "theme_edit";\r
545                 $DESCRs[] = TASK_ADMIN_LIST_THEME_ALL;\r
546                 $TITLEs[] = TASK_ADMIN_LIST_THEME_ALL_TITLE;\r
547                 // List active themes\r
548                 $SQLs[]   = "SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_active='Y' ORDER BY id";\r
549                 $WHATs[]  = "theme_edit";\r
550                 $DESCRs[] = TASK_ADMIN_LIST_THEME_ACTIVE;\r
551                 $TITLEs[] = TASK_ADMIN_LIST_THEME_ACTIVE_TITLE;\r
552         }\r
553         if (EXT_IS_ACTIVE("admins"))\r
554         {\r
555                 // List all administrator logins\r
556                 $SQLs[]   = "SELECT id FROM "._MYSQL_PREFIX."_admins ORDER BY id";\r
557                 $WHATs[]  = "admins_edit";\r
558                 $DESCRs[] = TASK_ADMIN_LIST_ADMINS_ALL;\r
559                 $TITLEs[] = TASK_ADMIN_LIST_ADMINS_ALL_TITLE;\r
560         }\r
561 \r
562         // Generate extra overview rows\r
563         $EXTRAS .= TASK_CREATE_EXTRA_ROWS($SQLs, $WHATs, $DESCRs, $TITLEs);\r
564 \r
565         // If empty just keep a forced-space left for CSS issues\r
566         if (empty($EXTRAS)) $EXTRAS = "&nbsp;";\r
567 \r
568         // Add compiled string to constant for final template\r
569         define('__OVERVIEW_EXTRA_TABLE', $EXTRAS);\r
570 \r
571         // Simply load the template... :-)\r
572         LOAD_TEMPLATE("admin_overview_task");\r
573 }\r
574 //\r
575 function TASK_CREATE_EXTRA_ROWS($SQLs, $WHATs, $DESCRs, $TITLEs)\r
576 {\r
577         $OUT = ""; $SW = 2; $MAX = sizeof($SQLs) - 1;\r
578         foreach ($SQLs as $key=>$sql)\r
579         {\r
580                 // Run SQL command, get line numbers and free memory\r
581                 $result = SQL_QUERY($sql, __FILE__, __LINE__);\r
582                 $value = SQL_NUMROWS($result);\r
583                 SQL_FREERESULT($result);\r
584 \r
585                 $content = array(\r
586                         'row_descr' => $DESCRs[$key],\r
587                         'row_sw'    => $SW,\r
588                         'bottom'    => "",\r
589                 );\r
590                 if ($key < $MAX) $content['bottom'] = "bottom2";\r
591                 if (($value > 0) && (!empty($WHATs[$key])))\r
592                 {\r
593                         if (empty($TITLEs[$key])) $TITLEs[$key] = TASK_ADMIN_UNKNOWN_LIST_TITLE;\r
594                         $content['row_link'] = "<A href=\"".URL."/modules.php?module=admin&amp;what=".$WHATs[$key]."\" title=\"".$TITLEs[$key]."\">".$value."</A>";\r
595                 }\r
596                  else\r
597                 {\r
598                         $content['row_link'] = "0";\r
599                 }\r
600 \r
601                 // Switch color\r
602                 $SW = 3 - $SW;\r
603 \r
604                 // And insert the final string into extras template\r
605                 $OUT .= LOAD_TEMPLATE("admin_overview_task_rows", true, $content);\r
606         }\r
607 \r
608         // Return output\r
609         return LOAD_TEMPLATE("admin_overview_task_extras", true, $OUT);\r
610 }\r
611 //\r
612 ?>\r