- switch ($type)
- {
- case "EXTENSION": // Install new extensions
- $ext_name = substr($subj, 1, strpos($subj, ":") - 1);
- $result_lines = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
- array($ext_name), __FILE__, __LINE__);
- $lines = SQL_NUMROWS($result_lines);
- SQL_FREERESULT($result_lines);
- if ($lines == "0") {
- // New extension found
- $OUT .= LOAD_TEMPLATE("admin_ext_reg_form", true, array(
- 'id' => bigintval($id),
- 'ext_name' => $ext_name
- ));
- } else {
- // Task is closed so nothing is todo
- $OUT .= "<FONT class=\"admin_failed\">".ADMIN_EXT_ALREADY_REGISTERED."</FONT>\n";
-
- // Close task but not already closes or deleted or update tasks
- if (($status != "CLOSED") && ($status != "DELETED") && ($type != "EXTENSION_UPDATE")) {
- ADMIN_SOLVE_TASK($tid);
+ // @TODO Rewrite this to something with include files and/or filter
+ switch ($taskData['task_type']) {
+ case 'EXTENSION': // Install new extensions
+ $ext_name = substr($taskData['subject'], 1, strpos($taskData['subject'], ':') - 1);
+ $result_lines = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
+ array($ext_name), __FILE__, __LINE__);
+ $lines = SQL_NUMROWS($result_lines);
+ SQL_FREERESULT($result_lines);
+ if ($lines == '0') {
+ // New extension found
+ $OUT .= loadTemplate('admin_ext_reg_form', true, array(
+ 'id' => bigintval($id),
+ 'ext_name' => $ext_name
+ ));
+ } else {
+ // Task is closed so nothing is todo
+ $OUT .= '<div class="admin_failed">{--ADMIN_EXTENSION_ALREADY_REGISTERED--}</div>';
+
+ // Close task but not already closed, solved, deleted or update tasks
+ if ((!in_array($taskData['status'], array('CLOSED','DELETED','SOLVED'))) && ($taskData['task_type'] != 'EXTENSION_UPDATE')) {
+ // Solve the task
+ runFilterChain('solve_task', $taskData['id']);
+ } // END - if