X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_sponsor_pay.php;h=ad8ff06b09af15e50387dbf9c7245cf2aaf0f47d;hb=eb301334eb0960dd060cc0d59e6021260a41f835;hp=e6c83b70457156f5c42e0dd10ef394c714fd0d16;hpb=21b7ff95974945f80a5569c49071406527e22066;p=mailer.git
diff --git a/inc/modules/admin/what-list_sponsor_pay.php b/inc/modules/admin/what-list_sponsor_pay.php
index e6c83b7045..ad8ff06b09 100644
--- a/inc/modules/admin/what-list_sponsor_pay.php
+++ b/inc/modules/admin/what-list_sponsor_pay.php
@@ -10,14 +10,20 @@
* -------------------------------------------------------------------- *
* Kurzbeschreibung : Auflisten/Aendern/Loeschen aller Buchungspakete *
* -------------------------------------------------------------------- *
- * *
+ * $Revision:: $ *
+ * $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 - 2008 by Roland Haeder *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
* For more information visit: http://www.mxchange.org *
* *
- * This program is free software. You can redistribute it and/or modify *
+ * 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 *
- * the Free Software Foundation; either version 2 of the License. *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
@@ -31,95 +37,112 @@
************************************************************************/
// Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin())) {
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
- require($INC);
-}
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+ die();
+} // END - if
// Add description as navigation point
-ADD_DESCR("admin", basename(__FILE__));
-$MSG = "";
+addMenuDescription('admin', __FILE__);
+
+$message = '';
-if (isset($_POST['add'])) {
+if (isPostRequestElementSet('add')) {
// Check input variables
- if (empty($_POST['pay_name'])) unset($_POST['add']);
- if ((round($_POST['pay_rate']) == 0) || (empty($_POST['pay_rate']))) unset($_POST['add']);
- $_POST['pay_min_count'] = bigintval($_POST['pay_min_count']);
- if (($_POST['pay_min_count'] == 0) || (empty($_POST['pay_min_count']))) unset($_POST['add']);
- if (empty($_POST['pay_currency'])) unset($_POST['add']);
-} elseif ((isset($_POST['edit'])) || (isset($_POST['del'])) || (isset($_POST['change'])) || (isset($_POST['remove']))) {
+ if (!isPostRequestElementSet('pay_name')) unsetPostRequestElement('add');
+ if ((round(postRequestElement('pay_rate')) == 0) || (!isPostRequestElementSet('pay_rate'))) unsetPostRequestElement('add');
+
+ setRequestPostElement('pay_min_count', bigintval(postRequestElement('pay_min_count')));
+
+ if ((postRequestElement('pay_min_count') == 0) || (!isPostRequestElementSet('pay_min_count'))) unsetPostRequestElement('add');
+ if (!isPostRequestElementSet('pay_currency')) unsetPostRequestElement('add');
+
+} elseif ((isPostRequestElementSet('edit')) || (isPostRequestElementSet('del')) || (isPostRequestElementSet('change')) || (isPostRequestElementSet('remove'))) {
// Check if at least one entry was selected
- if (empty($_POST['id'])) {
+ if (!isPostRequestElementSet('id')) {
// Nothing selected for editing / deleting???
- unset($_POST['edit']);
- unset($_POST['del']);
- unset($_POST['change']);
- unset($_POST['remove']);
- } elseif (isset($_POST['change'])) {
+ unsetPostRequestElement('edit');
+ unsetPostRequestElement('del');
+ unsetPostRequestElement('change');
+ unsetPostRequestElement('remove');
+ } elseif (isPostRequestElementSet('change')) {
// Change entries here...
- foreach ($_POST['id'] as $id => $sel) {
+ foreach (postRequestElement('id') as $id => $sel) {
// Secure ID
$id = bigintval($id);
// Save entry
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_sponsor_paytypes
-SET pay_name='%s', pay_rate='%s', pay_min_count='%s', pay_currency='%s' WHERE id='%s' LIMIT 1",
- array($_POST['name'][$id], $_POST['rate'][$id], bigintval($_POST['min'][$id]), $_POST['curr'][$id], $id),
- __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE
+ `{?_MYSQL_PREFIX?}_sponsor_paytypes`
+SET
+ `pay_name`='%s',
+ `pay_rate`='%s',
+ `pay_min_count`='%s',
+ `pay_currency`='%s'
+WHERE
+ `id`='%s'
+LIMIT 1",
+ array(
+ postRequestElement('name', $id),
+ postRequestElement('rate', $id),
+ bigintval(postRequestElement('min', $id)),
+ postRequestElement('curr', $id),
+ $id
+ ), __FILE__, __LINE__);
}
// Generate message
- $MSG = SPONSOR_PAY_ENTRIES_CHANGED;
- } elseif (isset($_POST['remove'])) {
+ $message = getMessage('SPONSOR_PAY_ENTRIES_CHANGED');
+ } elseif (isPostRequestElementSet('remove')) {
// Remove entries here...
- foreach ($_POST['id'] as $id => $sel) {
+ foreach (postRequestElement('id') as $id => $sel) {
// Remove entry
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_sponsor_paytypes WHERE id='%s' LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_sponsor_paytypes` WHERE `id`='%s' LIMIT 1",
+ array(bigintval($id)), __FILE__, __LINE__);
}
// Generate message
- $MSG = SPONSOR_PAY_ENTRIES_REMOVED;
+ $message = getMessage('SPONSOR_PAY_ENTRIES_REMOVED');
}
- if (!empty($MSG)) {
+ if (!empty($message)) {
// Output message
- LOAD_TEMPLATE("admin_settings_saved", false, $MSG);
- OUTPUT_HTML("
");
- }
+ loadTemplate('admin_settings_saved', false, $message);
+ } // END - if
}
-if (isset($_POST['add'])) {
+if (isPostRequestElementSet('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($_POST['pay_name']), __FILE__, __LINE__);
+ $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) {
// No entry found so add this line
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_sponsor_paytypes (pay_name, pay_rate, pay_min_count, pay_currency)
- VALUES ('%s', '%s', '%s', '%s')",
- array(htmlspecialchars($_POST['pay_name']), str_replace(",", ".", $_POST['pay_rate']), bigintval($_POST['pay_min_count']), htmlspecialchars($_POST['pay_currency'])),
- __FILE__, __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')
+ ), __FILE__, __LINE__);
// Payment type added!
- $MSG = SPONSOR_ADMIN_PAYTYPE_ADDED_1.$_POST['pay_name'].SPONSOR_ADMIN_PAYTYPE_ADDED_2;
+ $message = sprintf(getMessage('ADMIN_SPONSOR_PAYTYPE_ADDED'), postRequestElement('pay_name'));
} else {
// Free memory
SQL_FREERESULT($result);
// Entry does already exists
- $MSG = SPONSOR_ADMIN_PAYTYPE_ALREADY_1.$_POST['pay_name'].SPONSOR_ADMIN_PAYTYPE_ALREADY_2;
+ $message = sprintf(getMessage('ADMIN_SPONSOR_PAYTYPE_ALREADY'), postRequestElement('pay_name'));
}
// Output message
- LOAD_TEMPLATE("admin_settings_saved", false, $MSG);
- OUTPUT_HTML("
");
-} elseif ((isset($_POST['edit'])) || (isset($_POST['del']))) {
+ loadTemplate('admin_settings_saved', false, $message);
+} elseif ((isPostRequestElementSet('edit')) || (isPostRequestElementSet('del'))) {
// Load all data
- $OUT = ""; $SW = 2;
- foreach ($_POST['id'] as $id => $sel) {
+ $OUT = ''; $SW = 2;
+ foreach (postRequestElement('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",
- array(bigintval($id)), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `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);
@@ -130,86 +153,80 @@ if (isset($_POST['add'])) {
'id' => bigintval($id),
'sw' => bigintval($SW),
'name' => htmlspecialchars($name),
- 'rate' => TRANSLATE_COMMA($rate),
+ 'rate' => translateComma($rate),
'min' => bigintval($min),
'curr' => htmlspecialchars($curr)
);
- if (isset($_POST['edit'])) {
+ if (isPostRequestElementSet('edit')) {
// Edit entry
- $OUT .= LOAD_TEMPLATE("admin_list_sponsor_pay_edit_row", true, $content);
+ $OUT .= loadTemplate('admin_list_sponsor_pay_edit_row', true, $content);
} else {
// Delete entry
- $OUT .= LOAD_TEMPLATE("admin_list_sponsor_pay_del_row", true, $content);
+ $OUT .= loadTemplate('admin_list_sponsor_pay_del_row', true, $content);
}
} else {
// Entry invalid
- $OUT .= LOAD_TEMPLATE("admin_list_sponsor_pay_404", true, $id);
+ $OUT .= loadTemplate('admin_list_sponsor_pay_404', true, $id);
}
// Switch colors
$SW = 3 - $SW;
- }
-
- // Remember content in constant
- define('__SPONSOR_ROWS', $OUT);
+ } // END - foreach
// Load main template depending on mode (edit/delete)
- if (isset($_POST['edit'])) {
+ if (isPostRequestElementSet('edit')) {
// Load main edit template
- LOAD_TEMPLATE("admin_list_sponsor_pay_edit");
+ loadTemplate('admin_list_sponsor_pay_edit', false, $OUT);
} else {
// Load main delete template
- LOAD_TEMPLATE("admin_list_sponsor_pay_del");
+ loadTemplate('admin_list_sponsor_pay_del', false, $OUT);
}
} 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",
- __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) {
// Prepare variables for listing
- $SW = 2; $OUT = "";
+ $OUT = ''; $SW = 2;
// List alle found payment types
- while(list($id, $name, $rate, $min, $currency) = SQL_FETCHROW($result)) {
+ while ($content = SQL_FETCHARRAY($result)) {
// Remember data in array
$content = array(
'sw' => $SW,
- 'id' => $id,
- 'name' => $name,
- 'rate' => TRANSLATE_COMMA($rate),
- 'min' => $min,
- 'currency' => $currency
+ 'id' => $content['id'],
+ 'name' => $content['pay_name'],
+ 'rate' => translateComma($content['pay_rate']),
+ 'min' => $content['pay_min_count'],
+ 'currency' => $content['pay_currency']
);
// Add row
- $OUT .= LOAD_TEMPLATE("admin_list_sponsor_pay_row", true, $content);
+ $OUT .= loadTemplate('admin_list_sponsor_pay_row', true, $content);
// Switch colors
$SW = 3 - $SW;
- }
+ } // END - while
// Free memory
SQL_FREERESULT($result);
- // Remember rows in constant for the template
- define('__LIST_ROWS', $OUT);
-
// Load list template
- define('__LIST_CONTENT', LOAD_TEMPLATE("admin_list_sponsor_pay", true));
+ $content['list_out'] = loadTemplate('admin_list_sponsor_pay', true, $OUT);
} else {
// Noting setup so far!
- define('__LIST_CONTENT', LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_ADMIN_NO_PAYTYPES));
+ $content['list_out'] = loadTemplate('admin_settings_saved', true, getMessage('ADMIN_SPONSOR_NO_PAYTYPES'));
}
// Add new payment types here
- define('__ADD_CONTENT', LOAD_TEMPLATE("admin_add_sponsor_paytype", true));
+ $content['add_out'] = loadTemplate('admin_add_sponsor_paytype', true);
// Load final template
- LOAD_TEMPLATE("admin_sponsor_paytypes");
+ loadTemplate('admin_sponsor_paytypes', false, $content);
}
-//
+// [EOF]
?>