X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-config_email.php;h=ce0007636b34422a5d7312f477f5c9aa895a66c4;hp=e36c9f5bb6396ac87b83498ce90de303655babb5;hb=db0c6702086eea2c44d0aae1702dc2e77a0afc4e;hpb=963e55ca1ea79e255f235e359cde9f7862191dc5 diff --git a/inc/modules/admin/what-config_email.php b/inc/modules/admin/what-config_email.php index e36c9f5bb6..ce0007636b 100644 --- a/inc/modules/admin/what-config_email.php +++ b/inc/modules/admin/what-config_email.php @@ -1,7 +1,7 @@ ".MAX_VALUE_SAVED.""; + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_max_receive` (`value`, `comment`) VALUES ('%s','%s')", + array(bigintval(postRequestParameter('max')), postRequestParameter('comment')),__FILE__, __LINE__); + $content = '{--ADMIN_MAX_VALUE_SAVED--}'; } else { - // Free memory - SQL_FREERESULT($result); - // Value does alread exists! - $content = "".MAX_VALUE_ALREADY.""; + $content = '{--ADMIN_MAX_VALUE_ALREADY--}'; } + // Free memory + SQL_FREERESULT($result); + // Display message - LOAD_TEMPLATE("admin_settings_saved", false, $content); -} elseif ((isset($_POST['ok'])) && (isset($_GET['do']))) { + displayMessage($content); +} elseif ((isFormSent()) && (isGetRequestParameterSet('do'))) { // Change or delete entries... - $TEXT = ""; - foreach ($_POST['id'] as $id => $value) { - // Secure ID + $TEXT = ''; + foreach (postRequestParameter('id') as $id => $value) { + // Secure id $id = bigintval($id); - switch ($_GET['do']) + switch (getRequestParameter('do')) { - case "edit": // Change entries - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_max_receive SET value='%s', comment='%s' WHERE id=%s 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=%s 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(postRequestParameter('val', $id)), + postRequestParameter('comm', $id), + $id + ),__FILE__, __LINE__); + $TEXT = '{--ADMIN_MAX_RECEIVE_SAVED--}'; + break; + + case 'delete': + SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1", + array($id), __FILE__, __LINE__); + $TEXT = '{--ADMIN_MAX_RECEIVE_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])))) { + displayMessage($TEXT); + } // END - if +} elseif ((isFormSent('delete')) && (ifPostContainsSelections())) { // Delete entries - $SW = 2; $OUT = ""; - foreach ($_POST['sel'] as $id => $value) - { + $OUT = ''; + foreach (postRequestParameter('sel') as $id => $value) { // Load data - $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); + $result = SQL_QUERY_ESC("SELECT `id`, `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1", + array(bigintval($id)), __FILE__, __LINE__); + $content = SQL_FETCHARRAY($result); SQL_FREERESULT($result); - // Prepare data for the row template - $content = array( - 'sw' => $SW, - 'id' => $id, - 'value' => $value, - 'comment' => $comment, - ); - // Load row template and switch color - $OUT .= LOAD_TEMPLATE("admin_config_email_del_row", true, $content); - $SW = 3 - $SW; - } - define('__ROWS', $OUT); + $OUT .= loadTemplate('admin_config_email_del_row', true, $content); + } // END - foreach + $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 ((isFormSent('edit')) && (ifPostContainsSelections())) { // Edit entries - $SW = 2; $OUT = ""; - foreach ($_POST['sel'] as $id => $value) { + $OUT = ''; + foreach (postRequestParameter('sel') as $id => $value) { // Load data - $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); + $result = SQL_QUERY_ESC("SELECT `id`, `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1", + array(bigintval($id)), __FILE__, __LINE__); + $content = SQL_FETCHARRAY($result); SQL_FREERESULT($result); - // Prepare data for the row template - $content = array( - 'sw' => $SW, - 'id' => $id, - 'value' => $value, - 'comment' => $comment, - ); - // Load row template and switch color - $OUT .= LOAD_TEMPLATE("admin_config_email_edit_row", true, $content); - $SW = 3 - $SW; - } - define('__ROWS', $OUT); + $OUT .= loadTemplate('admin_config_email_edit_row', true, $content); + } // END - foreach + $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__); - if (SQL_NUMROWS($result) > 0) { + $result = SQL_QUERY("SELECT `id`, `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` ORDER BY `value` ASC", + __FILE__, __LINE__); + if (!SQL_HASZERONUMS($result)) { // List already existing entries for editing - $SW = 2; $OUT = ""; - while (list($id, $value, $comment) = SQL_FETCHROW($result)) { - // Prepare data for the row template - $content = array( - 'sw' => $SW, - 'id' => $id, - 'value' => $value, - 'comment' => $comment, - ); - + $OUT = ''; + while ($content = SQL_FETCHARRAY($result)) { // Load row template and switch color - $OUT .= LOAD_TEMPLATE("admin_config_email_row", true, $content); - $SW = 3 - $SW; - } + $OUT .= loadTemplate('admin_config_email_row', true, $content); + } // 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] ?>