X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Fmodules%2Fadmin%2Fwhat-list_sponsor_pay.php;h=61d759bff005f4646615430f4e7d274cbc886163;hb=ad16f516e254e67b221dd72d518821e9a0853610;hp=4d8ed2f88b22306c34dd3eeeba0f0294887ad236;hpb=0ff49cce0f61b9ad28162f824e45777eb768a133;p=mailer.git diff --git a/inc/modules/admin/what-list_sponsor_pay.php b/inc/modules/admin/what-list_sponsor_pay.php index 4d8ed2f88b..61d759bff0 100644 --- a/inc/modules/admin/what-list_sponsor_pay.php +++ b/inc/modules/admin/what-list_sponsor_pay.php @@ -14,11 +14,9 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * + * Copyright (c) 2009 - 2011 by Mailer Developer Team * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -43,7 +41,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { } // END - if // Add description as navigation point -addMenuDescription('admin', __FILE__); +addYouAreHereLink('admin', __FILE__); $message = ''; @@ -57,15 +55,15 @@ if (isFormSent('add')) { if ((postRequestParameter('pay_min_count') == '0') || (!isPostRequestParameterSet('pay_min_count'))) unsetPostRequestParameter('add'); if (!isPostRequestParameterSet('pay_currency')) unsetPostRequestParameter('add'); -} elseif ((isFormSent('edit')) || (isFormSent('del')) || (isFormSent('change')) || (isFormSent('remove'))) { +} elseif ((isFormSent('edit')) || (isFormSent('delete')) || (isFormSent('do_edit')) || (isFormSent('do_delete'))) { // Check if at least one entry was selected if (!isPostRequestParameterSet('id')) { // Nothing selected for editing / deleting??? unsetPostRequestParameter('edit'); - unsetPostRequestParameter('del'); - unsetPostRequestParameter('change'); - unsetPostRequestParameter('remove'); - } elseif (isFormSent('change')) { + unsetPostRequestParameter('delete'); + unsetPostRequestParameter('do_edit'); + unsetPostRequestParameter('do_delete'); + } elseif (isFormSent('do_edit')) { // Change entries here... foreach (postRequestParameter('id') as $id => $sel) { // Secure id @@ -80,7 +78,7 @@ SET `pay_min_count`='%s', `pay_currency`='%s' WHERE - `id`='%s' + `id`=%s LIMIT 1", array( postRequestParameter('name', $id), @@ -92,22 +90,22 @@ LIMIT 1", } // Generate message - $message = getMessage('SPONSOR_PAY_ENTRIES_CHANGED'); - } elseif (isFormSent('remove')) { + $message = '{--SPONSOR_PAY_ENTRIES_CHANGED--}'; + } elseif (isFormSent('do_delete')) { // Remove entries here... 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)) { // Output message - loadTemplate('admin_settings_saved', false, $message); + displayMessage($message); } // END - if } @@ -117,7 +115,7 @@ if (isFormSent('add')) { 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')", + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_sponsor_paytypes` (`pay_name`,`pay_rate`,`pay_min_count`,`pay_currency`) VALUES ('%s','%s','%s','%s')", array( postRequestParameter('pay_name'), convertCommaToDot(postRequestParameter('pay_rate')), @@ -126,38 +124,27 @@ if (isFormSent('add')) { ), __FILE__, __LINE__); // Payment type added! - $message = getMaskedMessage('ADMIN_SPONSOR_PAYTYPE_ADDED', postRequestParameter('pay_name')); + $message = '{%message,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')); + $message = '{%message,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'))) { + displayMessage($message); +} elseif ((isFormSent('edit')) || (isFormSent('delete'))) { // 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 +158,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 +172,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'] = displayMessage('{--ADMIN_SPONSOR_NO_PAYTYPES--}', true); } + // Free memory + SQL_FREERESULT($result); + // Add new payment types here $content['add_out'] = loadTemplate('admin_add_sponsor_paytype', true);