X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_sponsor_pay.php;h=75dea69fb2d7431f5321fd923c246d5dcdcbb86b;hb=22f132c8d6314f76c69dff58ec0dac21f5ca3bf2;hp=149175e48d4429728c00e41e1617ecfbb3dfa453;hpb=9afd6ec5878544a7982c50ed9c0dd7de37606d5b;p=mailer.git diff --git a/inc/modules/admin/what-list_sponsor_pay.php b/inc/modules/admin/what-list_sponsor_pay.php index 149175e48d..75dea69fb2 100644 --- a/inc/modules/admin/what-list_sponsor_pay.php +++ b/inc/modules/admin/what-list_sponsor_pay.php @@ -1,7 +1,7 @@ $sel) { + foreach (postRequestParameter('id') as $id => $sel) { // Secure id $id = bigintval($id); @@ -79,29 +80,29 @@ SET `pay_min_count`='%s', `pay_currency`='%s' WHERE - `id`='%s' + `id`=%s LIMIT 1", array( - postRequestElement('name', $id), - postRequestElement('rate', $id), - bigintval(postRequestElement('min', $id)), - postRequestElement('curr', $id), + postRequestParameter('name', $id), + postRequestParameter('rate', $id), + bigintval(postRequestParameter('min', $id)), + postRequestParameter('curr', $id), $id ), __FILE__, __LINE__); } // Generate message - $message = getMessage('SPONSOR_PAY_ENTRIES_CHANGED'); - } elseif (isPostRequestElementSet('remove')) { + $message = '{--SPONSOR_PAY_ENTRIES_CHANGED--}'; + } elseif (isFormSent('remove')) { // Remove entries here... - foreach (postRequestElement('id') as $id => $sel) { + foreach (postRequestParameter('id') as $id => $sel) { // Remove entry - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_sponsor_paytypes` WHERE `id`='%s' LIMIT 1", + SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_sponsor_paytypes` WHERE `id`=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__); } // Generate message - $message = getMessage('SPONSOR_PAY_ENTRIES_REMOVED'); + $message = '{--SPONSOR_PAY_ENTRIES_REMOVED--}'; } if (!empty($message)) { @@ -110,55 +111,44 @@ LIMIT 1", } // END - if } -if (isPostRequestElementSet('add')) { +if (isFormSent('add')) { // Check if entry with same name does exists $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_paytypes` WHERE `pay_name`='%s' LIMIT 1", - array(postRequestElement('pay_name')), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == '0') { + array(postRequestParameter('pay_name')), __FILE__, __LINE__); + if (SQL_HASZERONUMS($result)) { // No entry found so add this line SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_sponsor_paytypes` (`pay_name`, `pay_rate`, `pay_min_count`, `pay_currency`) VALUES ('%s','%s','%s','%s')", array( - postRequestElement('pay_name'), - convertCommaToDot(postRequestElement('pay_rate')), - bigintval(postRequestElement('pay_min_count')), - postRequestElement('pay_currency') + postRequestParameter('pay_name'), + convertCommaToDot(postRequestParameter('pay_rate')), + bigintval(postRequestParameter('pay_min_count')), + postRequestParameter('pay_currency') ), __FILE__, __LINE__); // Payment type added! - $message = sprintf(getMessage('ADMIN_SPONSOR_PAYTYPE_ADDED'), postRequestElement('pay_name')); + $message = getMaskedMessage('ADMIN_SPONSOR_PAYTYPE_ADDED', postRequestParameter('pay_name')); } else { - // Free memory - SQL_FREERESULT($result); - // Entry does already exists - $message = sprintf(getMessage('ADMIN_SPONSOR_PAYTYPE_ALREADY'), postRequestElement('pay_name')); + $message = getMaskedMessage('ADMIN_SPONSOR_PAYTYPE_ALREADY', postRequestParameter('pay_name')); } + // Free memory + SQL_FREERESULT($result); + // Output message loadTemplate('admin_settings_saved', false, $message); -} elseif ((isPostRequestElementSet('edit')) || (isPostRequestElementSet('del'))) { +} elseif ((isFormSent('edit')) || (isFormSent('del'))) { // Load all data - $OUT = ''; $SW = 2; - foreach (postRequestElement('id') as $id => $sel) { + $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) - ); - - if (isPostRequestElementSet('edit')) { + $content = SQL_FETCHARRAY($result); + + if (isFormSent('edit')) { // Edit entry $OUT .= loadTemplate('admin_list_sponsor_pay_edit_row', true, $content); } else { @@ -170,12 +160,12 @@ if (isPostRequestElementSet('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) - if (isPostRequestElementSet('edit')) { + if (isFormSent('edit')) { // Load main edit template loadTemplate('admin_list_sponsor_pay_edit', false, $OUT); } else { @@ -184,43 +174,35 @@ if (isPostRequestElementSet('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);