X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_country.php;h=518ce7690bf1b9883d8a21c23b2de1e54c05b598;hb=a6aaa866eff075c408f58cc0bc24f08562d51b7c;hp=069d2ea0b113fb5914ce04e419d6c214fcb8cc27;hpb=78fb6abc2b4141d107610f20e75980e1a58ac939;p=mailer.git diff --git a/inc/modules/admin/what-list_country.php b/inc/modules/admin/what-list_country.php index 069d2ea0b1..518ce7690b 100644 --- a/inc/modules/admin/what-list_country.php +++ b/inc/modules/admin/what-list_country.php @@ -16,7 +16,7 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2011 by Mailer Developer Team * + * Copyright (c) 2009 - 2012 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -50,7 +50,7 @@ if ((isFormSent('add')) && (isPostRequestElementSet('code')) && (isPostRequestEl array(strtoupper(postRequestElement('code'))), __FILE__, __LINE__); if (SQL_HASZERONUMS($result)) { // Save entry - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_countries` (`code`,`descr`,`is_active`) VALUES ('%s','%s','%s')", + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_countries` (`code`, `descr`, `is_active`) VALUES ('%s','%s','%s')", array( strtoupper(substr(postRequestElement('code'), 0, 2)), postRequestElement('descr'), @@ -74,16 +74,18 @@ if ((isFormSent('add')) && (isPostRequestElementSet('code')) && (isPostRequestEl adminChangeActivationStatus(postRequestElement('id'), 'countries', 'is_active'); // Show next link - loadTemplate('admin_next_link', false, array( + loadTemplate('admin_next_link', FALSE, array( 'url' => 'modules.php?module=admin&what=list_country', 'title' => '{--ADMIN_COUNTRY_ACTIVATION_NEXT_LINK--}' )); } elseif (((isFormSent('edit')) || (isPostRequestElementSet('delete'))) && (isPostRequestElementSet('id'))) { - if (count(postRequestElement('id')) > 0) { + // Are there entries? + if (ifPostContainsSelections('id')) { + // Is the proper form sent? if (isFormSent('edit')) { // Edit template $row = 'admin_edit_country_row'; - $post = 'modify'; + $do = 'modify'; $class = 'form_submit'; $submit = '{--ADMIN_COUNTRY_EDIT_NOW--}'; $title = '{--ADMIN_COUNTRY_EDIT_TITLE--}'; @@ -91,7 +93,7 @@ if ((isFormSent('add')) && (isPostRequestElementSet('code')) && (isPostRequestEl } else { // Delete template $row = 'admin_delete_country_row'; - $post = 'remove'; + $do = 'remove'; $class = 'form_delete'; $submit = '{--ADMIN_COUNTRY_DELETE_NOW--}'; $title = '{--ADMIN_COUNTRY_DELETE_TITLE--}'; @@ -102,7 +104,7 @@ if ((isFormSent('add')) && (isPostRequestElementSet('code')) && (isPostRequestEl $OUT = ''; foreach (postRequestElement('id') as $id => $isActive) { // Load data from DB - $result = SQL_QUERY_ESC("SELECT `id`,`code`,`descr` FROM `{?_MYSQL_PREFIX?}_countries` WHERE `id`=%s LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id`, `code`, `descr` FROM `{?_MYSQL_PREFIX?}_countries` WHERE `id`=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Load data @@ -112,7 +114,7 @@ if ((isFormSent('add')) && (isPostRequestElementSet('code')) && (isPostRequestEl $content['is_active'] = $isActive; // Insert row template and switch color - $OUT .= loadTemplate($row, true, $content); + $OUT .= loadTemplate($row, TRUE, $content); } // END - if // Free result @@ -122,7 +124,7 @@ if ((isFormSent('add')) && (isPostRequestElementSet('code')) && (isPostRequestEl // Prepare content for template $content = array( 'rows' => $OUT, - 'mode' => $post, + 'do' => $do, 'class' => $class, 'title' => $title, 'submit' => $submit, @@ -130,7 +132,7 @@ if ((isFormSent('add')) && (isPostRequestElementSet('code')) && (isPostRequestEl ); // Load main template - loadTemplate('admin_list_country_form', false, $content); + loadTemplate('admin_list_country_form', FALSE, $content); } // END - if } else { // Shall we modify / remove entries now? @@ -155,7 +157,7 @@ LIMIT 1"); } elseif ((isFormSent('do_delete')) && (isPostRequestElementSet('id'))) { // Remove $IDs = implode(',', array_keys(postRequestElement('id'))); - addSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_countries` WHERE `id` IN (".$IDs.") LIMIT ".count(postRequestElement('id')).""); + addSql('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_countries` WHERE `id` IN (' . $IDs . ') LIMIT ' . countPostSelection('id') . ''); // Create message $message = '{--ADMIN_COUNTRIES_REMOVED--}'; @@ -170,33 +172,33 @@ LIMIT 1"); } // END - if // Load currenty setup country codes to list - $result = SQL_QUERY('SELECT `id`,`code`,`descr`,`is_active` FROM `{?_MYSQL_PREFIX?}_countries` ORDER BY `code` ASC', + $result = SQL_QUERY('SELECT `id`, `code`, `descr`, `is_active` FROM `{?_MYSQL_PREFIX?}_countries` ORDER BY `code` ASC', __FILE__, __LINE__); - // Do we have entries? + // Are there entries? if (!SQL_HASZERONUMS($result)) { // List all countries $OUT = ''; while ($content = SQL_FETCHARRAY($result)) { // Load row template and switch colors - $OUT .= loadTemplate('admin_list_country_row', true, $content); + $OUT .= loadTemplate('admin_list_country_row', TRUE, $content); } // END - while // Free memory SQL_FREERESULT($result); } else { // No code setup so far (not possible by this software! 'DE' for 'Deutschland' is default - $OUT = loadTemplate('admin_list_country_no_row', true); + $OUT = loadTemplate('admin_list_country_no_row', TRUE); } // Add list to constant for the template $content['rows'] = $OUT; // Include add template - $content['add_form'] = loadTemplate('admin_add_country', true); + $content['add_form'] = loadTemplate('admin_add_country', TRUE); // Load main template - loadTemplate('admin_list_country', false, $content); + loadTemplate('admin_list_country', FALSE, $content); } // [EOF]