* $Author:: $ *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team *
- * For more information visit: http://www.mxchange.org *
+ * 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 *
* it under the terms of the GNU General Public License as published by *
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'),
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--}';
} 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--}';
$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
$content['is_active'] = $isActive;
// Insert row template and switch color
- $OUT .= loadTemplate($row, true, $content);
+ $OUT .= loadTemplate($row, TRUE, $content);
} // END - if
// Free result
// Prepare content for template
$content = array(
'rows' => $OUT,
- 'mode' => $post,
+ 'do' => $do,
'class' => $class,
'title' => $title,
'submit' => $submit,
);
// 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?
if ((isPostRequestElementSet('modify')) && (isPostRequestElementSet('id'))) {
// Modify
foreach (postRequestElement('id') as $id => $sel) {
- addSql("UPDATE `{?_MYSQL_PREFIX?}_countries` SET `code`='" . postRequestElement('code', $id) . "', `descr`='" . postRequestElement('descr', $id) . "', `is_active`='" . postRequestElement('is_active', $id) . "' WHERE `id`=" . bigintval($id) . " LIMIT 1");
+ addSql("UPDATE
+ `{?_MYSQL_PREFIX?}_countries`
+SET
+ `code`='" . postRequestElement('code', $id) . "',
+ `descr`='" . postRequestElement('descr', $id) . "',
+ `is_active`='" . postRequestElement('is_active', $id) . "'
+WHERE
+ `id`=" . bigintval($id) . "
+LIMIT 1");
} // END - foreach
// Create message
} 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--}';
} // 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]