New naming convention applied to many functions, see #118 for details
[mailer.git] / inc / modules / admin / what-list_country.php
index 5739f8d512d5d53ffedb05a38ffaf11ae9bd1dd9..e3f0ab16e972711fffb6042abacf817063f3ddc7 100644 (file)
@@ -48,7 +48,7 @@ ADD_DESCR('admin', __FILE__);
 // Add new code?
 if ((REQUEST_ISSET_POST(('add'))) && (REQUEST_ISSET_POST(('code'))) && (REQUEST_ISSET_POST(('descr')))) {
        // Check if country code does already exist
-       $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_countries` WHERE code='%s' LIMIT 1",
+       $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_countries` WHERE code='%s' LIMIT 1",
         array(strtoupper(REQUEST_POST('code'))), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 0) {
                // Save entry
@@ -71,7 +71,7 @@ if ((REQUEST_ISSET_POST(('add'))) && (REQUEST_ISSET_POST(('code'))) && (REQUEST_
 
        // Display message
        LOAD_TEMPLATE('admin_settings_saved', false, $message);
-} elseif ((REQUEST_ISSET_POST('change')) && (REQUEST_ISSET_POST(('id')))) {
+} elseif ((REQUEST_ISSET_POST('change')) && (REQUEST_ISSET_POST('id'))) {
        // Change all status
        ADMIN_CHANGE_ACTIVATION_STATUS(REQUEST_POST('id'), "countries", "is_active");
 
@@ -80,7 +80,7 @@ if ((REQUEST_ISSET_POST(('add'))) && (REQUEST_ISSET_POST(('code'))) && (REQUEST_
                'url'   => 'modules.php?module=admin&what=list_country',
                'title' => getMessage('ADMIN_COUNTRY_ACTIVATION_NEXT_LINK')
        ));
-} elseif (((REQUEST_ISSET_POST('edit')) || (REQUEST_ISSET_POST('delete'))) && (REQUEST_ISSET_POST(('id')))) {
+} elseif (((REQUEST_ISSET_POST('edit')) || (REQUEST_ISSET_POST('delete'))) && (REQUEST_ISSET_POST('id'))) {
        if (count(REQUEST_POST('id')) > 0) {
                if (REQUEST_ISSET_POST('edit')) {
                        // Edit template
@@ -104,7 +104,7 @@ if ((REQUEST_ISSET_POST(('add'))) && (REQUEST_ISSET_POST(('code'))) && (REQUEST_
                $OUT = ''; $SW = 2;
                foreach (REQUEST_POST('id') as $id => $status) {
                        // Load data from DB
-                       $result = SQL_QUERY_ESC("SELECT code, descr FROM `{!_MYSQL_PREFIX!}_countries` WHERE id=%s LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT code, descr FROM `{!_MYSQL_PREFIX!}_countries` WHERE `id`=%s LIMIT 1",
                                array(bigintval($id)), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result) == 1) {
                                // Load data
@@ -121,10 +121,10 @@ if ((REQUEST_ISSET_POST(('add'))) && (REQUEST_ISSET_POST(('code'))) && (REQUEST_
 
                                if ($post == 'modify') {
                                        // Generate default selection in edit-mode
-                                       $content['status'] = ADD_OPTION_LINES('/ARRAY/', array('Y', 'N'), array(getMessage('YES'), getMessage('NO')), $status);
+                                       $content['status'] = generateOptionList('/ARRAY/', array('Y', 'N'), array(getMessage('YES'), getMessage('NO')), $status);
                                } else {
                                        // Only display status when in delete-mode
-                                       $content['status'] = TRANSLATE_YESNO($status);
+                                       $content['status'] = translateYesNo($status);
                                }
 
                                // Insert row template and switch color
@@ -145,7 +145,7 @@ if ((REQUEST_ISSET_POST(('add'))) && (REQUEST_ISSET_POST(('code'))) && (REQUEST_
 } else {
        // Shall we modify / remove entries now?
        $message = ''; INIT_SQLS();
-       if ((REQUEST_ISSET_POST(('modify'))) && (REQUEST_ISSET_POST(('id')))) {
+       if ((REQUEST_ISSET_POST(('modify'))) && (REQUEST_ISSET_POST('id'))) {
                // Modify
                foreach (REQUEST_POST('id') as $id => $sel) {
                        ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_countries` SET `code`='".REQUEST_POST('code', $id)."', `descr`='".REQUEST_POST('descr', $id)."', `is_active`='".REQUEST_POST('is_active', $id)."' WHERE `id`='".$id."' LIMIT 1");
@@ -153,7 +153,7 @@ if ((REQUEST_ISSET_POST(('add'))) && (REQUEST_ISSET_POST(('code'))) && (REQUEST_
 
                // Create message
                $message = getMessage('ADMIN_COUNTRIES_MODIFIED');
-       } elseif ((REQUEST_ISSET_POST('remove')) && (REQUEST_ISSET_POST(('id')))) {
+       } elseif ((REQUEST_ISSET_POST('remove')) && (REQUEST_ISSET_POST('id'))) {
                // Remove
                $IDs = implode(',', array_keys(REQUEST_POST('id')));
                ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_countries` WHERE `id` IN (".$IDs.") LIMIT ".count(REQUEST_POST('id'))."");
@@ -183,7 +183,7 @@ if ((REQUEST_ISSET_POST(('add'))) && (REQUEST_ISSET_POST(('code'))) && (REQUEST_
                                'id'     => $content['id'],
                                'code'   => $content['code'],
                                'name'   => $content['descr'],
-                               'active' => TRANSLATE_YESNO($content['is_active']),
+                               'active' => translateYesNo($content['is_active']),
                                'sw'     => $SW,
                                'status' => $content['is_active'],
                        );