A lot texts rewritten and exclamation signs removed
[mailer.git] / inc / modules / admin / what-config_email.php
index 176e5f991b89ffde313dfcb268f17b9479745af1..9d84ac91df1ff7983c76c8a9d982b08cb0bff140 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Aendern aller Email-Einstellungen                *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  ************************************************************************/
 
 // Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN())) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
-       require($INC);
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+       die();
 }
 
 // Add description as navigation point
-ADD_DESCR("admin", basename(__FILE__));
+addMenuDescription('admin', __FILE__);
 
 // Remove empty array index
-if (empty($_POST['max'])) unset($_POST['add_max']);
+if (!isPostRequestElementSet(('max'))) unsetPostRequestElement(('add_max'));
 
-if (isset($_POST['add_max'])) {
+if (isPostRequestElementSet(('add_max'))) {
        // Save all settings
-       $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_max_receive WHERE value='%s' LIMIT 1",
-        array(bigintval($_POST['max'])), __FILE__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE value='%s' LIMIT 1",
+       array(bigintval(postRequestElement('max'))), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 0) {
                // Add this value (including comment)
-               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_max_receive (value, comment) VALUES ('%s', '%s')",
-                array(bigintval($_POST['max']), $_POST['comment']),__FILE__, __LINE__);
-               $content = "<SPAN class=\"admin_done\">".MAX_VALUE_SAVED."</SPAN>";
+               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_max_receive` (value, comment) VALUES ('%s','%s')",
+               array(bigintval(postRequestElement('max')), postRequestElement('comment')),__FILE__, __LINE__);
+               $content = getMessage('MAX_VALUE_SAVED');
        } else {
-               // Free memory
-               SQL_FREERESULT($result);
-
                // Value does alread exists!
-               $content = "<SPAN class=\"admin_failed\">".MAX_VALUE_ALREADY."</SPAN>";
+               $content = "<span class=\"admin_failed\">{--MAX_VALUE_ALREADY--}</span>";
        }
 
+       // Free memory
+       SQL_FREERESULT($result);
+
        // Display message
-       LOAD_TEMPLATE("admin_settings_saved", false, $content);
-} elseif ((isset($_POST['ok'])) && (isset($_GET['do']))) {
+       loadTemplate('admin_settings_saved', false, $content);
+} elseif ((isFormSent()) && (isGetRequestElementSet('do'))) {
        // Change or delete entries...
-       $TEXT = "";
-       foreach ($_POST['id'] as $id=>$value) {
-               // Secure ID
+       $TEXT = '';
+       foreach (postRequestElement('id') as $id => $value) {
+               // Secure id
                $id = bigintval($id);
 
-               switch ($_GET['do'])
+               switch (getRequestElement('do'))
                {
-               case "edit": // Change entries
-                       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_max_receive SET value='%s', comment='%s' WHERE id=%d LIMIT 1",
-                        array(bigintval($_POST['val'][$id]), $_POST['comm'][$id], $id),__FILE__, __LINE__);
-                       $TEXT = MRECEIVE_SAVED;
-                       break;
-
-               case "del":
-                       $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_max_receive WHERE id=%d LIMIT 1",
-                        array($id), __FILE__, __LINE__);
-                       $TEXT = MRECEIVE_DELETED;
-                       break;
+                       case 'edit': // Change entries
+                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_max_receive` SET value='%s', comment='%s' WHERE `id`=%s LIMIT 1",
+                               array(
+                                       bigintval(postRequestElement('val', $id)),
+                                       postRequestElement('comm', $id),
+                                       $id
+                               ),__FILE__, __LINE__);
+                               $TEXT = getMessage('MRECEIVE_SAVED');
+                               break;
+
+                       case 'del':
+                               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1",
+                                       array($id), __FILE__, __LINE__);
+                               $TEXT = getMessage('MRECEIVE_DELETED');
+                               break;
                }
        }
 
        if (isset($TEXT)) {
                // Display message
-               LOAD_TEMPLATE("admin_settings_saved", false, $TEXT);
-       }
-} elseif ((isset($_POST['del'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0])))) {
+               loadTemplate('admin_settings_saved', false, $TEXT);
+       } // END - if
+} elseif ((isPostRequestElementSet('del')) && (countPostSelection() > 0)) {
        // Delete entries
-       $SW = 2; $OUT = "";
-       foreach ($_POST['sel'] as $id=>$value)
-       {
+       $OUT = ''; $SW = 2;
+       foreach (postRequestElement('sel') as $id => $value) {
                // Load data
-               $result = SQL_QUERY_ESC("SELECT value, comment FROM "._MYSQL_PREFIX."_max_receive WHERE id=%d LIMIT 1",
-                array(bigintval($id)), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT value, comment FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1",
+               array(bigintval($id)), __FILE__, __LINE__);
                list($value, $comment) = SQL_FETCHROW($result);
                SQL_FREERESULT($result);
 
@@ -109,20 +116,20 @@ if (isset($_POST['add_max'])) {
                );
 
                // Load row template and switch color
-               $OUT .= LOAD_TEMPLATE("admin_config_email_del_row", true, $content);
+               $OUT .= loadTemplate('admin_config_email_del_row', true, $content);
                $SW = 3 - $SW;
        }
-       define('__ROWS', $OUT);
+       $content['rows'] = $OUT;
 
        // Load main template
-       LOAD_TEMPLATE("admin_config_email_del");
-} elseif ((isset($_POST['edit'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0])))) {
+       loadTemplate('admin_config_email_del', false, $content);
+} elseif ((isPostRequestElementSet('edit')) && (countPostSelection() > 0)) {
        // Edit entries
-       $SW = 2; $OUT = "";
-       foreach ($_POST['sel'] as $id=>$value) {
+       $OUT = ''; $SW = 2;
+       foreach (postRequestElement('sel') as $id => $value) {
                // Load data
-               $result = SQL_QUERY_ESC("SELECT value, comment FROM "._MYSQL_PREFIX."_max_receive WHERE id=%d LIMIT 1",
-                array(bigintval($id)), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT value, comment FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1",
+               array(bigintval($id)), __FILE__, __LINE__);
                list($value, $comment) = SQL_FETCHROW($result);
                SQL_FREERESULT($result);
 
@@ -135,43 +142,39 @@ if (isset($_POST['add_max'])) {
                );
 
                // Load row template and switch color
-               $OUT .= LOAD_TEMPLATE("admin_config_email_edit_row", true, $content);
+               $OUT .= loadTemplate('admin_config_email_edit_row', true, $content);
                $SW = 3 - $SW;
        }
-       define('__ROWS', $OUT);
+       $content['rows'] = $OUT;
 
        // Load main template
-       LOAD_TEMPLATE("admin_config_email_edit");
+       loadTemplate('admin_config_email_edit', false, $content);
 } else {
-       $result = SQL_QUERY("SELECT id, value, comment FROM "._MYSQL_PREFIX."_max_receive ORDER BY value", __FILE__, __LINE__);
+       $result = SQL_QUERY("SELECT `id`, `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` ORDER BY `value` ASC",
+       __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // List already existing entries for editing
-               $SW = 2; $OUT = "";
-               while (list($id, $value, $comment) = SQL_FETCHROW($result)) {
+               $OUT = ''; $SW = 2;
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Prepare data for the row template
-                       $content = array(
-                               'sw'      => $SW,
-                               'id'      => $id,
-                               'value'   => $value,
-                               'comment' => $comment,
-                       );
+                       $content['sw'] = $SW;
 
                        // Load row template and switch color
-                       $OUT .= LOAD_TEMPLATE("admin_config_email_row", true, $content);
+                       $OUT .= loadTemplate('admin_config_email_row', true, $content);
                        $SW = 3 - $SW;
-               }
+               } // END - while
 
                // Free memory
                SQL_FREERESULT($result);
-               define('__ROWS', $OUT);
+               $content['rows'] = $OUT;
 
                // Load main template
-               LOAD_TEMPLATE("admin_config_email");
-       }
+               loadTemplate('admin_config_email', false, $content);
+       } // END - if
 
        // Display form
-       LOAD_TEMPLATE("admin_add_max");
+       loadTemplate('admin_add_max');
 }
 
-//
+// [EOF]
 ?>