Fix for non-working what-config_payouts
authorRoland Häder <roland@mxchange.org>
Thu, 11 Aug 2011 15:38:41 +0000 (15:38 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 11 Aug 2011 15:38:41 +0000 (15:38 +0000)
inc/modules/admin/what-config_payouts.php
inc/request-functions.php

index 2b016d0b3e9aaf2621c1accf892c8bd031ca04bb..efd97562061f73404abc85a6a64567be01d98b29 100644 (file)
@@ -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));
                }
        }
index a3bd5e3966db704757664c07209c7fc97e8c4708..353e24b4e8a6acba00e0c8fb770d44fd25022c0a 100644 (file)
@@ -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 {