From 1c87b7e7db7d527da613687f34b16eaceaa3bd18 Mon Sep 17 00:00:00 2001 From: quix0r Date: Sun, 6 Jun 2010 16:17:28 +0000 Subject: [PATCH] SQL_FETCHROW()->SQL_FETCHARRAY() and other improvements --- inc/modules/admin/what-config_payouts.php | 2 +- inc/modules/admin/what-list_payouts.php | 34 +++++++++++++---------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/inc/modules/admin/what-config_payouts.php b/inc/modules/admin/what-config_payouts.php index f92bfb20e1..b3ce3c631e 100644 --- a/inc/modules/admin/what-config_payouts.php +++ b/inc/modules/admin/what-config_payouts.php @@ -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 diff --git a/inc/modules/admin/what-list_payouts.php b/inc/modules/admin/what-list_payouts.php index 9575dc8b04..66789a1c30 100644 --- a/inc/modules/admin/what-list_payouts.php +++ b/inc/modules/admin/what-list_payouts.php @@ -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 { -- 2.39.5