X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_payouts.php;h=1ad813d8af72d96916d7ba5f5ae5845a199afbd8;hb=ee3a0b42f93de7676fca549c866c1c2e6f3f0576;hp=479c54100c817adf4a20488b70de93d4574ae20d;hpb=9f6c30cc0e06098171d773d671292081ecee3d29;p=mailer.git
diff --git a/inc/modules/admin/what-list_payouts.php b/inc/modules/admin/what-list_payouts.php
index 479c54100c..1ad813d8af 100644
--- a/inc/modules/admin/what-list_payouts.php
+++ b/inc/modules/admin/what-list_payouts.php
@@ -1,7 +1,7 @@
0)) {
+ if (!isGetRequestElementSet('task') && (!empty($userid)) && (isValidUserId($userid))) {
// Get task id from database
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `userid`=%s AND `task_type`='PAYOUT_REQUEST' AND task_created='".$tstamp."' LIMIT 1",
- array(bigintval($userid)), __FILE__, __LINE__);
- list($task) = SQL_FETCHROW($result);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `userid`=%s AND `task_type`='PAYOUT_REQUEST' AND `task_created`=%s LIMIT 1",
+ array(bigintval($userid), bigintval($tstamp)), __FILE__, __LINE__);
+ list($taskId) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- if (empty($task)) $task = 0;
- } elseif ((empty($userid)) || ($userid == 0)) {
+ if (empty($taskId)) $taskId = '0';
+ } elseif ((empty($userid)) || ($userid == '0')) {
// Cannot obtain member id!
- loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_FAILED_OBTAIN_USERID'));
+ displayMessage('{--ADMIN_PAYOUT_FAILED_OBTAIN_USERID--}');
} else {
// Get task id from URL
- $task = getRequestElement('task');
+ $taskId = getRequestElement('task');
}
- if ((!empty($task)) && (!empty($userid)) && ($userid > 0)) {
+ if ((!empty($taskId)) && (!empty($userid)) && (isValidUserId($userid))) {
// Load user's data
if (!fetchUserData($userid)) {
// Abort here because it is not valid!
- debug_report_bug('No user account ' . $userid . ' found.');
+ debug_report_bug(__FILE__, __LINE__, 'No user account ' . $userid . ' found.');
} // END - if
- if ((getRequestElement('do') == 'accept') && (!empty(getUserData('email')))) {
+ if ((getRequestElement('do') == 'accept') && (getUserData('email') != '')) {
// Ok, now we can output the form or execute accepting
if (isFormSent()) {
// 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(getRequestElement('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...
- $eurl = compileCode($eurl);
- 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;
- }
+ } // END - switch
// 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);
+ $reason = encodeString(getMessage('ADMIN_PAYOUT_REASON'), false);
// 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);
+ if ($taskId > 0) {
+ runFilterChain('solve_task', $taskId);
}
// Clear payout request
@@ -139,42 +141,42 @@ LIMIT 1",
$message = loadEmailTemplate('member_payout_accepted', postRequestElement('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'));
+ displayMessage('{--ADMIN_PAYOUT_BANNER_ACCEPTED_NOTIFIED--}');
} else {
// Normal request
- loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_ACCEPTED_NOTIFIED'));
+ displayMessage('{--ADMIN_PAYOUT_ACCEPTED_NOTIFIED--}');
}
// Finally send mail
- sendEmail(getUserData('email'), getMessage('PAYOUT_ACCEPTED_SUBJECT'), $message);
+ sendEmail(getUserData('userid'), '{--MEMBER_PAYOUT_ACCEPTED_SUBJECT--}', $message);
} else {
// Something goes wrong... :-(
- $content = implode("
", $ret);
+ $content = implode('
', $ret);
loadTemplate('admin_payout_failed_transfer', false, $content);
}
} else {
// Cannot load payout id
- loadTemplate('admin_settings_saved', false, "