New feature of repaying points to user/jackpot/shred added
[mailer.git] / inc / modules / admin / overview-inc.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 07/13/2004 *
4  * ===============                              Last change: 08/02/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : overview-inc.php                                 *
8  * -------------------------------------------------------------------- *
9  * Short description : Output standard task management                  *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Standart-Aufgaben-Management ausgeben            *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
18  * This program is free software; you can redistribute it and/or modify *
19  * it under the terms of the GNU General Public License as published by *
20  * the Free Software Foundation; either version 2 of the License, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
36 {
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
38         require($INC);
39 }
40
41 function OUTPUT_STANDARD_OVERVIEW(&$result_tasks)
42 {
43         global $cacheArray, $cacheArray;
44
45         // First check for solved and not assigned tasks and assign them to current admin
46         $result_task = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET assigned_admin='%s' WHERE assigned_admin < 1 AND status != 'NEW'",
47          array(GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
48
49         // We currently don't want to install an extension so let's find out if we need...
50         $EXT_LOAD_MODE = "register";
51         $JOBS_DONE = true;
52
53         // Open the extension directory
54         $handle = opendir(PATH."inc/extensions/") or mxchange_die("Cannot read extension directory!");
55         while ($file = readdir($handle)) {
56                 // Is this file an extension?
57                 if ((substr($file, 0, 4) == "ext-") && (substr($file, -4) == ".php")) {
58                         //* DEBUG: */ echo $file."<br />\n";
59                         // Possible newly installed extension found so we extract extension's name
60                         $ext = strtolower(substr($file, 4, -4)); // Keep always extension names on lower case!!!
61
62                         // Check if extension is installed or not
63                         $ext_ver = "";
64                         if ((!is_array($cacheArray['extensions']['ext_version'])) || (empty($cacheArray['extensions']['ext_version'][$ext]))) {
65                                 // Load data from database
66                                 $result = SQL_QUERY_ESC("SELECT id, ext_version FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
67                                  array($ext), __FILE__, __LINE__);
68                         } else {
69                                 // Load version from cache
70                                 if (!empty($cacheArray['extensions']['ext_version'][$ext])) {
71                                         // Extension is installed so we can get it's version number
72                                         $ext_ver = $cacheArray['extensions']['ext_version'][$ext];
73                                 } else {
74                                         // Extension is not installed so no version number was found
75                                         $ext_ver = "";
76                                 }
77
78                                 // Disable load from database
79                                 $result = false;
80                         }
81
82                         // Is the extension not yet installed?
83                         if ((SQL_NUMROWS($result) == 0) && (empty($ext_ver))) {
84                                 // Generate subject line
85                                 $ext_subj = sprintf("[%s:]", $ext);
86
87                                 // Not installed and do we have created a task for the admin?
88                                 //* DEBUG: */ echo $ext.":".$ext_ver."=";
89                                 $result = SQL_QUERY_ESC("SELECT `id` FROM `"._MYSQL_PREFIX."_task_system` WHERE `subject` LIKE '%s%%' LIMIT 1",
90                                  array($ext_subj), __FILE__, __LINE__);
91                                 //* DEBUG: */ echo SQL_NUMROWS($result)."<br />\n";
92                                 if ((SQL_NUMROWS($result) == 0) && (GET_EXT_VERSION($ext) == "")) {
93                                         // Template file
94                                         $tpl = sprintf("%stemplates/%s/html/ext/ext_%s.tpl",
95                                                 PATH,
96                                                 GET_LANGUAGE(),
97                                                 $ext
98                                         );
99
100                                         // Load text for task
101                                         if ((file_exists($tpl)) && (is_readable($tpl))) {
102                                                 // Load extension's own text template (HTML!)
103                                                 $MSG = LOAD_TEMPLATE("ext_".$ext, true);
104                                         } else {
105                                                 // Load default message
106                                                 $MSG = LOAD_EMAIL_TEMPLATE("admin_new_ext","", 0);
107                                         }
108
109                                         // Task not created so it's a brand-new extension which we need to register and create a task for!
110                                         $result_insert = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created)
111 VALUES ('%s', '0', 'NEW', 'EXTENSION', '%s', '%s', UNIX_TIMESTAMP())",
112                                          array(
113                                                 GET_ADMIN_ID(get_session('admin_login')),
114                                                 $ext_subj,
115                                                 addslashes($MSG),
116                                         ),  __FILE__, __LINE__, true, false);
117                                 }
118
119                                 // Free memory
120                                 SQL_FREERESULT($result);
121
122                                 // We maybe want to install an extension so let's test-drive it...
123                                 include(PATH."inc/extensions/".$file);
124                         } else {
125                                 // Maybe we want to update?
126                                 if ((empty($cacheArray['extensions']['ext_version'][$ext])) && (SQL_NUMROWS($result) == 1)) {
127                                         list($dummy, $ext_ver) = SQL_FETCHROW($result);
128                                         SQL_FREERESULT($result);
129                                 }
130
131                                 // Update extension
132                                 if (!empty($ext_ver)) EXTENSION_UPDATE($file, $ext, $ext_ver);
133
134                                 if (!empty($cacheArray['active_extensions'][$ext])) {
135                                         // Maybe we want to keept the current extension active?
136                                         if (($cacheArray['active_extensions'][$ext] == 'Y') && (!EXT_IS_ACTIVE($ext, true, true))) {
137                                                 // Reactivate this extension!
138                                                 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_active='Y' WHERE ext_name='%s' LIMIT 1",
139                                                  array($ext), __FILE__, __LINE__);
140                                                 EXTENSION_RUN_SQLS(GET_EXT_ID($ext), "activate");
141                                         }
142                                 }
143                         }
144                 }
145         }
146
147         // Close directory handle
148         closedir($handle);
149
150         // At last - but not least - check for own and new unassigned tasks...
151         $result_tasks = SQL_QUERY_ESC("SELECT id, assigned_admin, userid, task_type, subject, text, task_created
152 FROM "._MYSQL_PREFIX."_task_system
153 WHERE assigned_admin='%s' OR (assigned_admin='0' AND status='NEW')
154 ORDER BY userid DESC, task_type DESC, subject, task_created DESC",
155          array(GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
156
157         if (SQL_NUMROWS($result_tasks) > 0) {
158                 // New jobs found!
159                 $JOBS_DONE = false;
160         }
161
162         // Free the result
163         SQL_FREERESULT($result);
164
165         // Return status
166         return $JOBS_DONE;
167 }
168
169 //
170 function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) {
171         global $_CONFIG, $NOTES;
172         if ((isset($_POST['assign'])) && (count($_POST['task']) > 0)) {
173                 // Assign / do tasks
174                 $OUT = ""; $SW = 2;
175                 foreach ($_POST['task'] as $id=>$sel) {
176                         $result_task = SQL_QUERY_ESC("SELECT id, userid, task_type, subject, text, task_created, status, assigned_admin FROM "._MYSQL_PREFIX."_task_system WHERE id=%d AND (assigned_admin='%s' OR (assigned_admin='0' AND status='NEW')) LIMIT 1",
177                          array(bigintval($id), GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
178                         if (SQL_NUMROWS($result_task) == 1) {
179                                 // Task is valid...
180                                 list($tid, $uid, $type, $subj, $text, $created, $status, $aid) = SQL_FETCHROW($result_task);
181                                 SQL_FREERESULT($result_task);
182
183                                 if ($aid == "0") {
184                                         // Assgin current admin to unassgigned task
185                                         $result_assign = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET assigned_admin='%s' WHERE id=%d LIMIT 1",
186                                          array(GET_ADMIN_ID(get_session('admin_login')), bigintval($tid)), __FILE__, __LINE__);
187                                 }
188
189                                 $ADD = "";
190                                 if ($type == "SUPPORT_MEMBER") {
191                                         $mode = substr($text, 0, strpos($text, ":"));
192                                         $text = substr($text, strpos($text, ":") + 1);
193                                         $ADD = "<LI>".ADMIN_TASK_SUPPORT_MODE.": <STRONG>".$mode."</STRONG></LI>";
194                                 }
195
196                                 if ($uid > 0) {
197                                         $result_user = SQL_QUERY_ESC("SELECT sex, surname, family, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
198                                          array(bigintval($uid)), __FILE__, __LINE__);
199                                         if (SQL_NUMROWS($result_user) == 1)
200                                         {
201                                                 list($sex, $sname, $fname, $email) = SQL_FETCHROW($result_user);
202                                                 SQL_FREERESULT($result_user);
203                                                 $ADD = "<LI>".ADMIN_MEMBER_UID.": <STRONG>".ADMIN_USER_PROFILE_LINK($uid)." (<A href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".TRANSLATE_SEX($sex)." ".$sname." ".$fname."</A>)</STRONG></LI>";
204                                         }
205                                 }
206
207                                 // Compile and insert text from task into table template
208                                 $text = LOAD_TEMPLATE("admin_extensions_text", true, COMPILE_CODE($text));
209
210                                 // Initialize variables (no title for SQL commands by default)
211                                 $ext_name = "";
212                                 $title = TASK_NO_TITLE;
213
214                                 // Shall I list SQL commands assigned to an extension installation or update task?
215                                 if (((GET_EXT_VERSION("sql_patches") != '') && ($_CONFIG['verbose_sql'] == 'Y')) || (!EXT_IS_ACTIVE("sql_patches"))) {
216                                         $ext_name = substr($subj, 1, strpos($subj, ":") - 1);
217                                         if ($type == "EXTENSION") {
218                                                 // Load SQL commands for registering
219                                                 $SQLs = EXTENSION_REGISTER($ext_name, $id, true);
220
221                                                 // Add notes to text
222                                                 $text .= $NOTES;
223
224                                                 // Set title
225                                                 $title = ADMIN_SQLS_EXECUTED_ON_REGISTER;
226                                         } elseif ($type == "EXTENSION_UPDATE") {
227                                                 // Load SQL commands for update (already done!)
228                                                 $ext_name = substr($ext_name, 7);
229                                                 $ext_name = substr($ext_name, 0, strpos($ext_name, "-"));
230                                                 $test = "[UPDATE-".$ext_name."-";
231                                                 $ext_ver = substr($subj, strlen($test));
232                                                 $ext_ver = substr($ext_ver, 0, strpos($ext_ver, ":"));
233
234                                                 // Load SQLs from file
235                                                 $SQLs = EXTENSION_UPDATE("ext-".$ext_name.".php", $ext_name, $ext_ver, true);
236
237                                                 // Add notes to text
238                                                 $text .= $NOTES;
239
240                                                 // Set title
241                                                 $title = ADMIN_SQLS_EXECUTED_ON_UPDATE;
242                                         } else {
243                                                 // Remove extension's name
244                                                 $ext_name = "";
245                                         }
246
247                                         // Add SQLs to a table
248                                         if (empty($SQLs)) $SQLs = array();
249                                         if (empty($title)) $title = "";
250                                         if ((!empty($ext_name)) && (GET_EXT_VERSION("sql_patches")) && ($_CONFIG['verbose_sql'] == 'Y')) {
251                                                 // Add verbose SQL table
252                                                 $text .= EXTENSION_VERBOSE_TABLE($SQLs, $title, " class=\"admin_table top2 left2 right2\"", true, "100%")."<br />\n";
253                                         }
254                                 } else {
255                                         // Run SQL commands in dry mode but only return the notes
256                                         $SQLs = EXTENSION_UPDATE("ext-".$ext_name.".php", $ext_name, $ext_ver, true);
257                                         $text .= $NOTES;
258                                 }
259
260                                 // Prepare array for the template
261                                 $content = array(
262                                         'sw'        => $SW,
263                                         'subj'      => $subj,
264                                         'add'       => $ADD,
265                                         'text'      => $text,
266                                         'created'   => MAKE_DATETIME($created, "1"),
267                                         'extension' => $ext_name
268                                 );
269
270                                 // Load template
271                                 $OUT .= LOAD_TEMPLATE("admin_overview_row", true, $content);
272
273                                 // Which task do we actually have here?
274                                 switch ($type)
275                                 {
276                                 case "EXTENSION": // Install new extensions
277                                         $ext_name = substr($subj, 1, strpos($subj, ":") - 1);
278                                         $result_lines = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
279                                          array($ext_name), __FILE__, __LINE__);
280                                         $lines = SQL_NUMROWS($result_lines);
281                                         SQL_FREERESULT($result_lines);
282                                         if ($lines == "0") {
283                                                 // New extension found
284                                                 $OUT .= LOAD_TEMPLATE("admin_ext_reg_form", true, array(
285                                                         'id'       => bigintval($id),
286                                                         'ext_name' => $ext_name
287                                                 ));
288                                         } else {
289                                                 // Task is closed so nothing is todo
290                                                 $OUT .= "<FONT class=\"admin_failed\">".ADMIN_EXT_ALREADY_REGISTERED."</FONT>\n";
291
292                                                 // Close task but not already closes or deleted or update tasks
293                                                 if (($status != "CLOSED") && ($status != "DELETED") && ($type != "EXTENSION_UPDATE"))
294                                                 {
295                                                         $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET status='SOLVED' WHERE id=%d LIMIT 1",
296                                                          array(bigintval($tid)), __FILE__, __LINE__);
297                                                 }
298                                         }
299                                         break;
300
301                                 case "EXTENSION_UPDATE":
302                                         // Extension updates are installed automatically
303                                         $OUT .= "<FONT class=\"admin_failed medium\">".ADMIN_EXTENSION_UPDATED."</FONT>\n";
304
305                                         // Close task
306                                         if (($status != "CLOSED") && ($status != "DELETED")) {
307                                                 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET status='SOLVED' WHERE id=%d LIMIT 1",
308                                                  array(bigintval($tid)), __FILE__, __LINE__);
309                                         }
310                                         break;
311
312                                 case "SUPPORT_MEMBER": // Assign on member's support request
313                                         switch ($mode)
314                                         {
315                                         default: // Unknown support mode
316                                                 $OUT .= "<FONT class=\"admin_failed medium\">".ADMIN_UNKNOWN_SUPPORT_MODE_1.$mode.ADMIN_UNKNOWN_SUPPORT_MODE_2."</FONT>\n";
317                                                 break;
318                                         }
319                                         break;
320
321                                 case "PAYOUT_REQUEST": // Payout requests
322                                         if (EXT_IS_ACTIVE("payout"))
323                                         {
324                                                 // Extension is installed so let him send a notification to the user
325                                                 $result_pay = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_payouts WHERE userid=%d AND payout_timestamp=%d LIMIT 1",
326                                                  array(bigintval($uid), bigintval($created)), __FILE__, __LINE__);
327                                                 list($pid) = SQL_FETCHROW($result_pay);
328                                                 SQL_FREERESULT($result_pay);
329
330                                                 if ((!empty($pid)) && ($pid > 0))
331                                                 {
332                                                         // Payout ID can be obtained
333                                                         $content = array(
334                                                                 'pid' => $pid,
335                                                                 'tid' => $tid,
336                                                         );
337                                                         $OUT .= LOAD_TEMPLATE("admin_payout_overview_form", true, $content);
338                                                 }
339                                                  else
340                                                 {
341                                                         // Problem obtaining payout ID
342                                                         $OUT .= "<FONT class=\"admin_failed medium\">".PAYOUT_OBTAIN_ID_FAILED."</FONT>\n";
343                                                 }
344                                         }
345                                          else
346                                         {
347                                                 // Extension is not installed
348                                                 $OUT .= "<FONT class=\"admin_failed medium\">".ADMIN_PAYOUT_NOT_INSTALLED."</FONT>\n";
349                                         }
350                                         break;
351
352                                 case "WERNIS_REQUEST": // Wernis requests
353                                         if (EXT_IS_ACTIVE("wernis"))
354                                         {
355                                                 // Extension is installed so let him send a notification to the user
356                                                 $result_pay = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_wernis WHERE userid=%d AND wernis_timestamp=%d LIMIT 1",
357                                                  array(bigintval($uid), bigintval($created)), __FILE__, __LINE__);
358                                                 list($pid) = SQL_FETCHROW($result_pay);
359                                                 SQL_FREERESULT($result_pay);
360
361                                                 if ((!empty($pid)) && ($pid > 0))
362                                                 {
363                                                         // Payout ID can be obtained
364                                                         $content = array(
365                                                                 'pid' => $pid,
366                                                                 'tid' => $tid,
367                                                         );
368                                                         $OUT .= LOAD_TEMPLATE("admin_wernis_overview_form", true, $content);
369                                                 }
370                                                  else
371                                                 {
372                                                         // Problem obtaining wernis ID
373                                                         $OUT .= "<FONT class=\"admin_failed medium\">".WERNIS_OBTAIN_ID_FAILED."</FONT>\n";
374                                                 }
375                                         }
376                                          else
377                                         {
378                                                 // Extension is not installed
379                                                 $OUT .= "<FONT class=\"admin_failed medium\">".ADMIN_WERNIS_NOT_INSTALLED."</FONT>\n";
380                                         }
381                                         break;
382
383                                 case "HOLIDAY_REQUEST": // Holiday requests
384                                         $OUT .= LOAD_TEMPLATE("admin_task_holiday", true, $uid);
385                                         break;
386
387                                 case "NL_UNSUBSCRIBE": // Newsletter unsubscriptions
388                                         $result = SQL_QUERY_ESC("SELECT nl_timespan FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
389                                          array(bigintval($uid)), __FILE__, __LINE__);
390                                         list($span) = SQL_FETCHROW($result);
391                                         SQL_FREERESULT($result);
392
393                                         if ($span > 0)
394                                         {
395                                                 // Undone unscubscribe request
396                                                 $content = array(
397                                                         'uid' => $uid,
398                                                         'id'  => $tid
399                                                 );
400                                                 $OUT .= LOAD_TEMPLATE("admin_newsletter_tsk", true, $content);
401                                         }
402                                          else
403                                         {
404                                                 // Already unsubscribed
405                                                 $OUT .= "<FONT class=\"admin_failed medium\">".ADMIN_NL_UNSUBSCRIBE_ALREADY."</FONT>\n";
406                                         }
407                                         break;
408
409                                 default: // Unknown task type
410                                         $OUT .= "<FONT class=\"admin_failed medium\">".ADMIN_UNKNOWN_TASK_TYPE_1.$type.ADMIN_UNKNOWN_TASK_TYPE_2.$id.ADMIN_UNKNOWN_TASK_TYPE_3."</FONT>\n";
411                                         break;
412                                 }
413                                 $OUT .= "  </TD>
414   <TD width=\"1%\" class=\"switch_sw".$SW." bottom2 right2\">&nbsp;</TD>
415 </TR>\n";
416                         }
417                         $SW = 3 - $SW;
418                 }
419                 define('__TASK_ROWS', $OUT);
420
421                 // Load final template
422                 LOAD_TEMPLATE("admin_overview_list");
423         }
424          else
425         {
426                 if ((isset($_POST['task'])) && ((sizeof($_POST['task']) > 0) || ($_POST['task'][0] == "1")))
427                 {
428                         // Only unassign / delete tasks when there are selected tasks posted
429                         if (!empty($_POST['unassign']))
430                         {
431                                 // Unassign from tasks
432                                 foreach ($_POST['task'] as $id=>$sel)
433                                 {
434                                         $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET assigned_admin='0' WHERE id=%d AND assigned_admin='%s' LIMIT 1",
435                                          array(bigintval($id), GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
436                                 }
437                         }
438                          elseif (isset($_POST['del']))
439                         {
440                                 // Delete tasks
441                                 foreach ($_POST['task'] as $id=>$sel)
442                                 {
443                                         $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE id=%d AND (assigned_admin='%s' OR assigned_admin='0') LIMIT 1",
444                                          array(bigintval($id), GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
445                                 }
446                         }
447
448                         // Update query
449                         $result_tasks = SQL_QUERY_ESC("SELECT id, assigned_admin, userid, task_type, subject, text, task_created FROM "._MYSQL_PREFIX."_task_system WHERE assigned_admin='%s' OR (assigned_admin='0' AND status='NEW') ORDER BY task_created DESC",
450                          array(GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
451                 }
452
453                 // There are uncompleted jobs!
454                 LOAD_TEMPLATE("admin_overview_header");
455                 $SW = 2;
456                 while (list($id, $admin, $uid, $type, $subj, $text, $created) = SQL_FETCHROW($result_tasks))
457                 {
458                         $infos = "---";
459                         if ($admin == "0")
460                         {
461                                 // No admin currently is assigned
462                                 $admin = "<FONT class=\"admin_note\">".ADMIN_NO_ADMIN_ASSIGNED."</FONT>";
463                         }
464                          else
465                         {
466                                 // Load admin's data
467                                 $login = GET_ADMIN_LOGIN($admin);
468                                 if ($login != "***")
469                                 {
470                                         // Admin found
471                                         $admin = "<A href=\"".URL."/modules.php?module=admin&amp;what=admins_contct&amp;admin=".$admin."\">".$login."</A>";
472                                 }
473                                  else
474                                 {
475                                         // Maybe deleted?
476                                         $admin = "<FONT class=\"admin_note\">".ADMIN_ID_404_1.$admin.ADMIN_ID_404_2."</FONT>";
477                                 }
478                         }
479                         $evl = "\$type_out = ADMIN_TASK_IS_".strtoupper($type).";";
480                         eval($evl);
481                         $type2 = substr($text, 0, strpos($text, ":"));
482                         // Generate infos
483                         switch ($type)
484                         {
485                         case "EXTENSION":
486                         case "EXTENSION_UPDATE":
487                                 $infos = substr($subj, 1, strpos($subj, ":") - 1);
488                                 break;
489                         }
490                         if ($uid > 0)
491                         {
492                                 // Member found otherwise it's a system task
493                                 $uid = ADMIN_USER_PROFILE_LINK($uid);
494                         }
495                          else
496                         {
497                                 $uid = "<I>".ADMIN_IS_SYSTEM_TASK."</I>";
498                         }
499
500                         $content = array(
501                                 'sw'      => $SW,
502                                 'id'      => $id,
503                                 'admin'   => $admin,
504                                 'infos'   => $infos,
505                                 'uid'     => $uid,
506                                 'type'    => $type_out,
507                                 'created' => MAKE_DATETIME($created, "2")
508                         );
509
510                         LOAD_TEMPLATE("admin_overview_list_rows", false, $content);
511                         $SW = 3 - $SW;
512                 }
513                 // Free memory
514                 SQL_FREERESULT($result_tasks);
515
516                 // Load footer template
517                 LOAD_TEMPLATE("admin_overview_footer");
518         }
519 }
520 //
521 ?>