From: Roland Häder <roland@mxchange.org>
Date: Thu, 11 Aug 2011 15:38:41 +0000 (+0000)
Subject: Fix for non-working what-config_payouts
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a16ae225264a183dc4adf24c2d931df231d2ffc7;p=mailer.git

Fix for non-working what-config_payouts
---

diff --git a/inc/modules/admin/what-config_payouts.php b/inc/modules/admin/what-config_payouts.php
index 2b016d0b3e..efd9756206 100644
--- a/inc/modules/admin/what-config_payouts.php
+++ b/inc/modules/admin/what-config_payouts.php
@@ -43,11 +43,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 // Add description as navigation point
 addYouAreHereLink('admin', __FILE__);
 
-// Convert 'rate' if set
-if (isPostRequestElementSet('rate')) {
-	convertCommaToDotInPostData('rate');
-} // END - if
-
+// Do we add an entry?
 if ((isFormSent('add')) && (isPostRequestElementSet('title')) && (postRequestElement('rate') > 0)) {
 	// Add new payout type
 	$result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_payout_types` WHERE type='%s' LIMIT 1",
@@ -120,7 +116,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections())) {
 		$id = bigintval($id);
 
 		// Edit only if something is entered
-		if ((isPostRequestElementSet('title', $id)) && (postRequestElement('rate', $id) > 0)) {
+		if ((isPostRequestElementSet('type', $id)) && (postRequestElement('rate', $id) > 0)) {
 			// Update entry
 			addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_payout_types` SET
 	`type`='%s',
@@ -135,7 +131,7 @@ LIMIT 1",
 				convertCommaToDot(postRequestElement('rate', $id)),
 				convertCommaToDot(postRequestElement('min_points' , $id)),
 				postRequestElement('allow_url', $id),
-				bigintval($id)
+				$id
 			),__FILE__, __LINE__, false));
 		}
 	}
diff --git a/inc/request-functions.php b/inc/request-functions.php
index a3bd5e3966..353e24b4e8 100644
--- a/inc/request-functions.php
+++ b/inc/request-functions.php
@@ -117,7 +117,7 @@ function setGetRequestElement ($element, $value) {
 }
 
 // Wrapper for elements in $_POST
-function postRequestElement ($element, $subElement=null) {
+function postRequestElement ($element, $subElement = NULL) {
 	// By default no element is there
 	$value = NULL;
 
@@ -125,6 +125,7 @@ function postRequestElement ($element, $subElement=null) {
 	if (isset($GLOBALS['cache_request']['post'][$element][$subElement])) {
 		// Then use it
 		$value = $GLOBALS['cache_request']['post'][$element][$subElement];
+		//* DEBUG: */ print $element.'/'.$subElement.'='.$value.'<br />';
 	} elseif (isPostRequestElementSet($element)) {
 		// Then use it
 		$value = $GLOBALS['raw_request']['post'][$element];
@@ -133,12 +134,16 @@ function postRequestElement ($element, $subElement=null) {
 		if ((!is_null($subElement)) && (isPostRequestElementSet($element, $subElement))) {
 			// Then use this
 			$value = SQL_ESCAPE($value[$subElement]);
+			//* DEBUG: */ print 'sub!<br />';
 		} elseif (!is_array($value)) {
 			// Escape it here
 			$value = SQL_ESCAPE($value);
+			//* DEBUG: */ print 'no-array!<br />';
 		}
 
 		// Set it in cache
+		//* DEBUG: */ print $element.'/'.$subElement.'='.$value.'<br />';
+		//* DEBUG: */ print('<pre>'.print_r($_POST,true).'</pre>');
 		$GLOBALS['cache_request']['post'][$element][$subElement] = $value;
 	} // END - if
 
@@ -147,7 +152,7 @@ function postRequestElement ($element, $subElement=null) {
 }
 
 // Checks if an element in $_POST exists
-function isPostRequestElementSet ($element, $subElement=null) {
+function isPostRequestElementSet ($element, $subElement = NULL) {
 	if (is_null($subElement)) {
 		return ((isset($GLOBALS['raw_request']['post'][$element])) && (('' . $GLOBALS['raw_request']['post'][$element] . '') != ''));
 	} else {