SQL_FETCHROW()->SQL_FETCHARRAY() and other improvements
authorRoland Häder <roland@mxchange.org>
Sun, 6 Jun 2010 16:17:28 +0000 (16:17 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 6 Jun 2010 16:17:28 +0000 (16:17 +0000)
inc/modules/admin/what-config_payouts.php
inc/modules/admin/what-list_payouts.php

index f92bfb20e1708ee2082b5ac3094d69d7b2330307..b3ce3c631e1e76fcaeaf1ec335add52c13ac827e 100644 (file)
@@ -138,7 +138,7 @@ LIMIT 1",
                                'title' => $title,
                                'rate'  => translateComma($rate),
                                'min_points'  => translateComma($min_points),
-                               'allow' => addSelectionBox('yn', $allow, "allow[".$id."]"),
+                               'allow' => addSelectionBox('yn', $allow, 'allow[' . $id . ']'),
                        );
 
                        // Load row template and switch color
index 9575dc8b04707d544642ae419abec91537ceae99..66789a1c30dc71e3bad3fd465b0367754e2a2cd0 100644 (file)
@@ -81,51 +81,55 @@ if (isGetRequestParameterSet(('pid'))) {
                                // Obtain payout type and other data
                                $result = SQL_QUERY_ESC("SELECT `payout_id` FROM `{?_MYSQL_PREFIX?}_user_payouts` WHERE `id`=%s LIMIT 1",
                                        array(bigintval(getRequestParameter('pid'))), __FILE__, __LINE__);
+
+                               // Load ptype (id)
                                list($ptype) = SQL_FETCHROW($result);
+
+                               // Free result
                                SQL_FREERESULT($result);
 
                                if (!empty($ptype)) {
                                        // Obtain data from payout type
-                                       $result = SQL_QUERY_ESC("SELECT `from_account`, `from_pass`, `engine_url`, `engine_ret_ok`, `engine_ret_failed`, `pass_enc`, `allow_url`
+                                       $result = SQL_QUERY_ESC("SELECT
+       `from_account`, `from_pass`, `engine_url`, `engine_ret_ok`, `engine_ret_failed`, `pass_enc`, `allow_url`
 FROM
        `{?_MYSQL_PREFIX?}_payout_types`
 WHERE
        `id`=%s
 LIMIT 1",
                                                array(bigintval($ptype)), __FILE__, __LINE__);
-                                       list($fuserid, $fpass, $eurl, $eok, $failed, $eenc, $allow) = SQL_FETCHROW($result);
+
+                                       // Load data
+                                       $data = SQL_FETCHARRAY($result);
+
+                                       // Free result
                                        SQL_FREERESULT($result);
 
-                                       if (!empty($eurl)) {
+                                       if (!empty($data['engine_url'])) {
                                                // Ok, run URL...
-                                               switch ($eenc) {
+                                               switch ($data['pass_enc']) {
                                                        case 'md5':
-                                                               $fpass = md5($fpass);
+                                                               $data['from_pass'] = md5($data['from_pass']);
                                                                $tpass = md5($tpass);
                                                                break;
 
                                                        case 'base64':
-                                                               $fpass = base64_encode($fpass);
+                                                               $data['from_pass'] = base64_encode($data['from_pass']);
                                                                $tpass = base64_encode($tpass);
                                                                break;
                                                }
 
                                                // Transfer variables...
-                                               $eval = '$url = "' . $eurl . '";';
                                                $reason = encodeString(getMessage('PAYOUT_REASON_PAYOUT'), false);
 
-                                               // Run code...
-                                               // @TODO Do we need this time-consuming eval() here?
-                                               eval($eval);
-
                                                // Execute transfer
-                                               $ret = sendGetRequest($url);
+                                               $ret = sendGetRequest($data['engine_url']);
                                        } else {
                                                // No URL to run
-                                               $ret[0] = $eok;
+                                               $ret[0] = $data['engine_ret_ok'];
                                        }
 
-                                       if ($ret[0] == $eok) {
+                                       if ($ret[0] == $data['engine_ret_ok']) {
                                                // Clear task
                                                if ($task > 0) {
                                                        runFilterChain('solve_task', $task);
@@ -139,7 +143,7 @@ LIMIT 1",
                                                $message = loadEmailTemplate('member_payout_accepted', postRequestParameter('text'), $userid);
 
                                                // Output message
-                                               if ($allow == 'Y') {
+                                               if ($data['allow_url'] == 'Y') {
                                                        // Banner / Textlink request
                                                        loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_BANNER_ACCEPTED_NOTIFIED'));
                                                } else {