X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_payouts.php;h=12f1dd24c2c9d0ae97bcd82f0366e5c651986ff6;hb=1410e014d23f244e73d3a7916a61c2473416bab9;hp=4a1c9db2c7794cd9afdf8af8e7693725f43f5099;hpb=1f2d89e3a6abd36ae030e3bf7ef2e194e5d8f35c;p=mailer.git
diff --git a/inc/modules/admin/what-list_payouts.php b/inc/modules/admin/what-list_payouts.php
index 4a1c9db2c7..12f1dd24c2 100644
--- a/inc/modules/admin/what-list_payouts.php
+++ b/inc/modules/admin/what-list_payouts.php
@@ -1,7 +1,7 @@
0)) {
- // 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($uid)), __FILE__, __LINE__);
- list($task) = SQL_FETCHROW($result);
+ if (!isGetRequestParameterSet('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`=%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($uid)) || ($uid == "0")) {
- // Cannot obtain member ID!
- LOAD_TEMPLATE("admin_settings_saved", false, PAYOUT_FAILED_OBTAIN_USERID);
+ if (empty($taskId)) $taskId = '0';
+ } elseif ((empty($userid)) || ($userid == '0')) {
+ // Cannot obtain member id!
+ displayMessage('{--ADMIN_PAYOUT_FAILED_OBTAIN_USERID--}');
} else {
- // Get task ID from URL
- $task = REQUEST_GET('task');
+ // Get task id from URL
+ $taskId = getRequestParameter('task');
}
- if ((!empty($task)) && (!empty($uid)) && ($uid > 0)) {
+ if ((!empty($taskId)) && (!empty($userid)) && (isValidUserId($userid))) {
// Load user's data
- $result = SQL_QUERY_ESC("SELECT email, gender, surname, family FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
- array(bigintval($uid)), __FILE__, __LINE__);
- list($email, $gender, $surname, $family) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
+ if (!fetchUserData($userid)) {
+ // Abort here because it is not valid!
+ debug_report_bug(__FILE__, __LINE__, 'No user account ' . $userid . ' found.');
+ } // END - if
- // Konstante bauen
- define('PAYOUT_USERDATA_VALUE', "".TRANSLATE_GENDER($gender)." ".$surname." ".$family."");
-
- if ((REQUEST_GET('do') == "accept") && (!empty($email))) {
+ if ((getRequestParameter('do') == 'accept') && (getUserData('email') != '')) {
// Ok, now we can output the form or execute accepting
- if (IS_FORM_SENT()) {
+ 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(REQUEST_GET('pid'))), __FILE__, __LINE__);
+ $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 FROM `{!_MYSQL_PREFIX!}_payout_types` WHERE id=%s LIMIT 1",
- array(bigintval($ptype)), __FILE__, __LINE__);
- list($fuid, $fpass, $eurl, $eok, $failed, $eenc, $allow) = SQL_FETCHROW($result);
+ $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__);
+
+ // Load data
+ $data = SQL_FETCHARRAY($result);
+
+ // Free result
SQL_FREERESULT($result);
- if (!empty($eurl)) {
+ if (!empty($data['engine_url'])) {
// Ok, run URL...
- $eurl = COMPILE_CODE($eurl);
- switch ($eenc)
- {
- case "md5":
- $fpass = md5($fpass);
- $tpass = md5($tpass);
- break;
-
- case "base64":
- $fpass = base64_encode($fpass);
- $tpass = base64_encode($tpass);
- break;
- }
+ switch ($data['pass_enc']) {
+ case 'md5':
+ $data['from_pass'] = md5($data['from_pass']);
+ $tpass = md5($tpass);
+ break;
+
+ case 'base64':
+ $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...
- eval($eval);
+ $reason = encodeString(getMessage('ADMIN_PAYOUT_REASON'), false);
// Execute transfer
- $ret = GET_URL($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
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_payouts` SET `status`='ACCEPTED' WHERE id=%s LIMIT 1",
- array(bigintval(REQUEST_GET('pid'))), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_payouts` SET `status`='ACCEPTED' WHERE `id`=%s LIMIT 1",
+ array(bigintval(getRequestParameter('pid'))), __FILE__, __LINE__);
// Send out mail
- $msg = LOAD_EMAIL_TEMPLATE("member_payout_accepted", REQUEST_POST('text'), $uid);
+ $message = loadEmailTemplate('member_payout_accepted', postRequestParameter('text'), $userid);
// Output message
- if ($allow == "Y") {
+ if ($data['allow_url'] == 'Y') {
// Banner / Textlink request
- LOAD_TEMPLATE("admin_settings_saved", false, PAYOUT_BANNER_ACCEPTED_NOTIFIED);
+ displayMessage('{--ADMIN_PAYOUT_BANNER_ACCEPTED_NOTIFIED--}');
} else {
// Normal request
- LOAD_TEMPLATE("admin_settings_saved", false, PAYOUT_ACCEPTED_NOTIFIED);
+ displayMessage('{--ADMIN_PAYOUT_ACCEPTED_NOTIFIED--}');
}
// Finally send mail
- SEND_EMAIL($email, PAYOUT_ACCEPTED_SUBJECT, $msg);
+ sendEmail(getUserData('email'), '{--MEMBER_PAYOUT_ACCEPTED_SUBJECT--}', $message);
} else {
// Something goes wrong... :-(
- $content = implode("
", $ret);
- LOAD_TEMPLATE("admin_payout_failed_transfer", false, $content);
+ $content = implode('
', $ret);
+ loadTemplate('admin_payout_failed_transfer', false, $content);
}
} else {
// Cannot load payout id
- LOAD_TEMPLATE("admin_settings_saved", false, "