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