]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/overview-inc.php
Fixes for #113, task texts where too much secured, resolved
[mailer.git] / inc / modules / admin / overview-inc.php
index 8bd6d81f1b47d01766f239967540297702f0386a..6840cbe603d36df4ebe92fe6969c4aff999af256 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Standart-Aufgaben-Management ausgeben            *
  * -------------------------------------------------------------------- *
- * $Revision:: 856                                                    $ *
- * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009)              $ *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author:: stelzi                                                   $ *
+ * $Author::                                                          $ *
  * Needs to be in all Files and every File needs "svn propset           *
  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
@@ -49,11 +49,11 @@ function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) {
 
        // We currently don't want to install an extension so let's find out if we need...
        $EXT_LOAD_MODE = "register";
-       $JOBS_DONE = true;
+       $jobsDone = true;
 
        // Open the extension directory
-       $handle = opendir(constant('PATH')."inc/extensions/") or mxchange_die("Cannot read extension directory!");
-       while ($file = readdir($handle)) {
+       $extensionList = GET_DIR_AS_ARRAY("inc/extensions/", "ext-", false, false);
+       foreach ($extensionList as $file) {
                // Is this file an extension?
                if ((substr($file, 0, 4) == "ext-") && (substr($file, -4) == ".php")) {
                        //* DEBUG: */ echo $file."<br />\n";
@@ -96,10 +96,7 @@ function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) {
                                } // END - if
                        }
                } // END - if
-       } // END - while
-
-       // Close directory handle
-       closedir($handle);
+       } // END - foreach
 
        // At last - but not least - check for own and new unassigned tasks...
        $result_tasks = SQL_QUERY_ESC("SELECT id, assigned_admin, userid, task_type, subject, text, task_created
@@ -110,19 +107,18 @@ ORDER BY userid DESC, task_type DESC, subject, task_created DESC",
 
        if (SQL_NUMROWS($result_tasks) > 0) {
                // New jobs found!
-               $JOBS_DONE = false;
+               $jobsDone = false;
        } // END - if
 
        // Free the result
        SQL_FREERESULT($result);
 
        // Return status
-       return $JOBS_DONE;
+       return $jobsDone;
 }
 
 // Outputs selected tasks
 function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
-       global $NOTES;
        if ((isset($POST['assign'])) && (count($POST['task']) > 0)) {
                // Assign / do tasks
                $OUT = ""; $SW = 2;
@@ -140,11 +136,11 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
                                                array(GET_CURRENT_ADMIN_ID(), bigintval($tid)), __FILE__, __LINE__);
                                } // END - if
 
-                               $ADD = "";
+                               $add = "";
                                if ($type == "SUPPORT_MEMBER") {
                                        $mode = substr($text, 0, strpos($text, ":"));
                                        $text = substr($text, strpos($text, ":") + 1);
-                                       $ADD = "<li>{--ADMIN_TASK_SUPPORT_MODE--}: <strong>".$mode."</strong></li>";
+                                       $add = "<li>{--ADMIN_TASK_SUPPORT_MODE--}: <strong>".$mode."</strong></li>";
                                } // END - if
 
                                if ($uid > 0) {
@@ -153,7 +149,7 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
                                        if (SQL_NUMROWS($result_user) == 1) {
                                                list($gender, $sname, $fname, $email) = SQL_FETCHROW($result_user);
                                                SQL_FREERESULT($result_user);
-                                               $ADD = "<li>{--ADMIN_MEMBER_UID--}: <strong>".ADMIN_USER_PROFILE_LINK($uid)." (<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".TRANSLATE_GENDER($gender)." ".$sname." ".$fname."</a>)</strong></li>";
+                                               $add = "<li>{--ADMIN_MEMBER_UID--}: <strong>".ADMIN_USER_PROFILE_LINK($uid)." (<a href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".TRANSLATE_GENDER($gender)." ".$sname." ".$fname."</a>)</strong></li>";
                                        } // END - if
                                } // END - if
 
@@ -172,10 +168,10 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
                                        $ext_name = substr($subj, 1, strpos($subj, ":") - 1);
                                        if ($type == "EXTENSION") {
                                                // Load SQL commands for registering
-                                               SET_SQLS(EXTENSION_REGISTER($ext_name, $id, true));
+                                               REGISTER_EXTENSION($ext_name, $id, true);
 
                                                // Add notes to text
-                                               $text .= $NOTES;
+                                               $text .= EXT_GET_NOTES();
 
                                                // Set title
                                                $title = getMessage('ADMIN_SQLS_EXECUTED_ON_REGISTER');
@@ -191,7 +187,7 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
                                                EXTENSION_UPDATE($ext_name, $ext_ver, true);
 
                                                // Add notes to text
-                                               $text .= $NOTES;
+                                               $text .= EXT_GET_NOTES();
 
                                                // Set title
                                                $title = getMessage('ADMIN_SQLS_EXECUTED_ON_UPDATE');
@@ -210,14 +206,14 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
                                } else {
                                        // Run SQL commands in dry mode but only return the notes
                                        EXTENSION_UPDATE($ext_name, $ext_ver, true);
-                                       $text .= $NOTES;
+                                       $text .= EXT_GET_NOTES();
                                }
 
                                // Prepare array for the template
                                $content = array(
                                        'sw'        => $SW,
                                        'subj'      => $subj,
-                                       'add'       => $ADD,
+                                       'add'       => $add,
                                        'text'      => $text,
                                        'created'   => MAKE_DATETIME($created, "1"),
                                        'extension' => $ext_name
@@ -271,7 +267,7 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
                                        {
                                        default: // @TODO Unknown support mode
                                                DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown support mode %s detected. This part is under construction!", $mode));
-                                               $OUT .= "<div class=\"admin_failed medium\">".ADMIN_UNKNOWN_SUPPORT_MODE_1.$mode.ADMIN_UNKNOWN_SUPPORT_MODE_2."</div>\n";
+                                               $OUT .= "<div class=\"admin_failed medium\">".sprintf(getMessage('ADMIN_UNKNOWN_SUPPORT_MODE'), $mode)."</div>\n";
                                                break;
                                        }
                                        break;
@@ -351,7 +347,7 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
 
                                default: // Unknown task type
                                        DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown task type %s detected.", $type));
-                                       $OUT .= "<div class=\"admin_failed medium\">".ADMIN_UNKNOWN_TASK_TYPE_1.$type.ADMIN_UNKNOWN_TASK_TYPE_2.$id.ADMIN_UNKNOWN_TASK_TYPE_3."</div>\n";
+                                       $OUT .= "<div class=\"admin_failed medium\">".sprintf(getMessage('ADMIN_UNKNOWN_TASK_TYPE'), $type, $id)."</div>\n";
                                        break;
                                }
                                $OUT .= "  </td>
@@ -387,8 +383,6 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
                } // END - if
 
                // There are uncompleted jobs!
-               // @TODO Rewrite this to one template and use $OUT = ...
-               LOAD_TEMPLATE("admin_overview_header");
                $OUT = ""; $SW = 2;
                while ($content = SQL_FETCHARRAY($result_tasks)) {
                        // Init infos
@@ -429,12 +423,10 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
                        // Do we have extension task?
                        if (($content['task_type'] == "EXTENSION") && (GET_EXT_VERSION($content['infos']) == "")) {
                                // Load extension row template
-                               // @TODO Rewrite this to $OUT .= ..., true, ...
-                               LOAD_TEMPLATE("admin_overview_list_ext_rows", false, $content);
+                               $OUT .= LOAD_TEMPLATE("admin_overview_list_ext_rows", true, $content);
                        } else {
                                // Load default row template
-                               // @TODO Rewrite this to $OUT .= ..., true, ...
-                               LOAD_TEMPLATE("admin_overview_list_rows", false, $content);
+                               $OUT .= LOAD_TEMPLATE("admin_overview_list_rows", true, $content);
                        }
 
                        // Switch color
@@ -445,7 +437,7 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
                SQL_FREERESULT($result_tasks);
 
                // Load footer template
-               LOAD_TEMPLATE("admin_overview_footer");
+               LOAD_TEMPLATE("admin_overview_table", false, $OUT);
        }
 }
 //