X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_sponsor_pay.php;h=dee8f22e8c23bfecee08533590b697127b7622c3;hp=4d8ed2f88b22306c34dd3eeeba0f0294887ad236;hb=30ae22f62ae87c53a56baf0d134569ba91011111;hpb=18e32f1a8971b18bace4f051094acf27800bd7d9 diff --git a/inc/modules/admin/what-list_sponsor_pay.php b/inc/modules/admin/what-list_sponsor_pay.php index 4d8ed2f88b..dee8f22e8c 100644 --- a/inc/modules/admin/what-list_sponsor_pay.php +++ b/inc/modules/admin/what-list_sponsor_pay.php @@ -92,7 +92,7 @@ LIMIT 1", } // Generate message - $message = getMessage('SPONSOR_PAY_ENTRIES_CHANGED'); + $message = '{--SPONSOR_PAY_ENTRIES_CHANGED--}'; } elseif (isFormSent('remove')) { // Remove entries here... foreach (postRequestParameter('id') as $id => $sel) { @@ -102,7 +102,7 @@ LIMIT 1", } // Generate message - $message = getMessage('SPONSOR_PAY_ENTRIES_REMOVED'); + $message = '{--SPONSOR_PAY_ENTRIES_REMOVED--}'; } if (!empty($message)) { @@ -128,36 +128,25 @@ if (isFormSent('add')) { // Payment type added! $message = getMaskedMessage('ADMIN_SPONSOR_PAYTYPE_ADDED', postRequestParameter('pay_name')); } else { - // Free memory - SQL_FREERESULT($result); - // Entry does already exists $message = getMaskedMessage('ADMIN_SPONSOR_PAYTYPE_ALREADY', postRequestParameter('pay_name')); } + // Free memory + SQL_FREERESULT($result); + // Output message loadTemplate('admin_settings_saved', false, $message); } elseif ((isFormSent('edit')) || (isFormSent('del'))) { // Load all data - $OUT = ''; $SW = 2; + $OUT = ''; foreach (postRequestParameter('id') as $id => $sel) { // Load entry - $result = SQL_QUERY_ESC("SELECT `pay_name`, `pay_rate`, `pay_min_count`, `pay_currency` FROM `{?_MYSQL_PREFIX?}_sponsor_paytypes` WHERE `id`='%s' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id`, `pay_name`, `pay_rate`, `pay_min_count`, `pay_currency` FROM `{?_MYSQL_PREFIX?}_sponsor_paytypes` WHERE `id`=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Load data - list($name, $rate, $min, $curr) = SQL_FETCHROW($result); - SQL_FREERESULT($result); - - // Transfer data to array - $content = array( - 'id' => bigintval($id), - 'sw' => bigintval($SW), - 'name' => htmlspecialchars($name), - 'rate' => translateComma($rate), - 'min' => bigintval($min), - 'curr' => htmlspecialchars($curr) - ); + $content = SQL_FETCHARRAY($result); if (isFormSent('edit')) { // Edit entry @@ -171,8 +160,8 @@ if (isFormSent('add')) { $OUT .= loadTemplate('admin_list_sponsor_pay_404', true, $id); } - // Switch colors - $SW = 3 - $SW; + // Free result + SQL_FREERESULT($result); } // END - foreach // Load main template depending on mode (edit/delete) @@ -185,43 +174,35 @@ if (isFormSent('add')) { } } else { // Load all payment types - $result = SQL_QUERY("SELECT `id`, `pay_name`, `pay_rate`, `pay_min_count`, `pay_currency` FROM `{?_MYSQL_PREFIX?}_sponsor_paytypes` ORDER BY `pay_name` ASC", - __FILE__, __LINE__); + $result = SQL_QUERY("SELECT + `id`, `pay_name`, `pay_rate`, `pay_min_count`, `pay_currency` +FROM + `{?_MYSQL_PREFIX?}_sponsor_paytypes` +ORDER BY + `pay_name` ASC", + __FILE__, __LINE__); // Do we have some paytypes setup? - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Prepare variables for listing - $OUT = ''; $SW = 2; + $OUT = ''; // List alle found payment types while ($content = SQL_FETCHARRAY($result)) { - // Remember data in array - $content = array( - 'sw' => $SW, - 'id' => $content['id'], - 'name' => $content['pay_name'], - 'rate' => translateComma($content['pay_rate']), - 'min' => $content['pay_min_count'], - 'currency' => $content['pay_currency'] - ); - // Add row $OUT .= loadTemplate('admin_list_sponsor_pay_row', true, $content); - - // Switch colors - $SW = 3 - $SW; } // END - while - // Free memory - SQL_FREERESULT($result); - // Load list template $content['list_out'] = loadTemplate('admin_list_sponsor_pay', true, $OUT); } else { // Noting setup so far! - $content['list_out'] = loadTemplate('admin_settings_saved', true, getMessage('ADMIN_SPONSOR_NO_PAYTYPES')); + $content['list_out'] = loadTemplate('admin_settings_saved', true, '{--ADMIN_SPONSOR_NO_PAYTYPES--}'); } + // Free memory + SQL_FREERESULT($result); + // Add new payment types here $content['add_out'] = loadTemplate('admin_add_sponsor_paytype', true);