if (isGetRequestElementSet('pid')) {
// First let's get the member's id
- $result = SQL_QUERY_ESC("SELECT `userid`,`target_account`,`payout_total`,`payout_timestamp`,`password` FROM `{?_MYSQL_PREFIX?}_user_payouts` WHERE `id`=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `userid`, `target_account`, `payout_total`, `payout_timestamp`, `password` FROM `{?_MYSQL_PREFIX?}_user_payouts` WHERE `id`=%s LIMIT 1",
array(getRequestElement('pid')), __FILE__, __LINE__);
list($userid, $tuserid, $points, $tstamp, $tpass) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Obtain some data
- if (!isGetRequestElementSet('task') && (!empty($userid)) && (isValidUserId($userid))) {
+ if (!isGetRequestElementSet('task') && (!empty($userid)) && (isValidId($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($taskId)) $taskId = '0';
- } elseif ((empty($userid)) || ($userid == '0')) {
+ } elseif (!isValidId($userid)) {
// Cannot obtain member id!
displayMessage('{--ADMIN_PAYOUT_FAILED_OBTAIN_USERID--}');
} else {
$taskId = getRequestElement('task');
}
- if ((!empty($taskId)) && (!empty($userid)) && (isValidUserId($userid))) {
+ if ((!empty($taskId)) && (!empty($userid)) && (isValidId($userid))) {
// Load user's data
if (!fetchUserData($userid)) {
// Abort here because it is not valid!
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_account`,
+ `from_pass`,
+ `engine_url`,
+ `engine_ret_ok`,
+ `engine_ret_failed`,
+ `pass_enc`,
+ `allow_url`
FROM
`{?_MYSQL_PREFIX?}_payout_types`
WHERE
} // END - switch
// Transfer variables...
- $reason = encodeString(getMessage('ADMIN_PAYOUT_REASON'), false);
+ $reason = encodeString(getMessage('ADMIN_PAYOUT_REASON'), FALSE);
// Execute transfer
- $ret = sendGetRequest($data['engine_url']);
+ $ret = sendHttpGetRequest($data['engine_url']);
} else {
// No URL to run
$ret[0] = $data['engine_ret_ok'];
if ($ret[0] == $data['engine_ret_ok']) {
// Clear task
- if ($taskId > 0) {
+ if (isValidId($taskId)) {
runFilterChain('solve_task', $taskId);
} // END - if
} else {
// Something goes wrong... :-(
$content = implode('<br />', $ret);
- loadTemplate('admin_payout_failed_transfer', false, $content);
+ loadTemplate('admin_payout_failed_transfer', FALSE, $content);
}
} else {
// Cannot load payout id
- loadTemplate('admin_settings_unsaved', false, '{--ADMIN_PAYOUT_FAILED_OBTAIN_PAYOUT_ID--}');
+ displayErrorMessage('{--ADMIN_PAYOUT_FAILED_OBTAIN_PAYOUT_ID--}');
}
} else {
// Prepare content
);
// Load template
- loadTemplate('admin_payout_accept_form', false, $content);
+ loadTemplate('admin_payout_accept_form', FALSE, $content);
}
} elseif ((getRequestElement('do') == 'reject') && (getUserData('email') != '')) {
// Ok, now we can output the form or execute rejecting
if (isFormSent()) {
- if ($taskId > 0) {
+ if (isValidId($taskId)) {
// Clear task
runFilterChain('solve_task', $taskId);
} // END - if
);
// Load template
- loadTemplate('admin_payout_reject_form', false, $content);
+ loadTemplate('admin_payout_reject_form', FALSE, $content);
}
} else {
// Cannot load user data
displayMessage('{--ADMIN_PAYOUT_FAILED_OBTAIN_USERDATA--}');
}
- } elseif ((empty($taskId)) || ($taskId == '0')) {
+ } elseif (!isValidId($taskId)) {
// Failed loading task id
displayMessage('{--ADMIN_PAYOUT_FAILED_OBTAIN_TASK_ID--}');
}
} // END - if
// Search for payouts
- $result = SQL_QUERY("SELECT
- p.id, p.userid, p.payout_total, p.target_account,
- p.target_bank, t.type, p.payout_timestamp, p.status,
- t.allow_url AS allow, p.target_url AS url, p.link_text AS alt,
- p.banner_url AS banner
+ $result = SQL_QUERY('SELECT
+ `p`.`id`,
+ `p`.`userid`,
+ `p`.`payout_total`,
+ `p`.`target_account`,
+ `p`.`target_bank`,
+ `t`.`type`,
+ `p`.`payout_timestamp`,
+ `p`.`status`,
+ `t`.`allow_url`
+ `p`.`target_url`,
+ `p`.`link_text`
+ `p`.`banner_url`
FROM
- `{?_MYSQL_PREFIX?}_user_payouts` AS p
+ `{?_MYSQL_PREFIX?}_user_payouts` AS `p`
LEFT JOIN
- `{?_MYSQL_PREFIX?}_payout_types` AS t
+ `{?_MYSQL_PREFIX?}_payout_types` AS `t`
ON
- p.payout_id=t.id
+ `p`.`payout_id`=`t`.`id`
ORDER BY
- p.payout_timestamp DESC", __FILE__, __LINE__);
+ `p`.`payout_timestamp` DESC', __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// List found payouts
}
// Nothing entered must be secured in member/what-payputs.php !
- if ($content['allow'] == 'Y') {
+ if ($content['allow_url'] == 'Y') {
// Banner/Textlink views/clicks request
- if (!empty($content['banner'])) {
+ if (!empty($content['banner_url'])) {
// Load template for the banner
- $content['target_account'] = loadTemplate('admin_list_payouts_banner', true, $content);
+ $content['target_account'] = loadTemplate('admin_list_payouts_banner', TRUE, $content);
} else {
// Textlink
- $content['target_account'] = loadTemplate('admin_list_payouts_txt', true, $content);
+ $content['target_account'] = loadTemplate('admin_list_payouts_txt', TRUE, $content);
}
// Admins can addionally test the URL for framekillers
- $content['target_bank'] = '<a href="' . generateFrametesterUrl($content['url']) . '" target="_blank">{--CLICK_HERE--}</a>';
+ $content['target_bank'] = '<a href="' . generateFrametesterUrl($content['target_url']) . '" target="_blank">{--CLICK_HERE--}</a>';
} // END - if
// Add/Translate some data
$content['payout_timestamp'] = generateDateTime($content['payout_timestamp'], 2);
// Add row and switch color
- $OUT .= loadTemplate('admin_list_payouts_row', true, $content);
+ $OUT .= loadTemplate('admin_list_payouts_row', TRUE, $content);
} // END - while
// Free memory
SQL_FREERESULT($result);
// Load final template
- loadTemplate('admin_list_payouts', false, $OUT);
+ loadTemplate('admin_list_payouts', FALSE, $OUT);
} else {
// No payout requests are sent so far
displayMessage('{--ADMIN_PAYOUT_NO_REQUESTS_FOUND--}');