// Add description as navigation point
addMenuDescription('admin', __FILE__);
-if (isGetRequestParameterSet(('pid'))) {
+if (isGetRequestParameterSet('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",
array(getRequestParameter('pid')), __FILE__, __LINE__);
SQL_FREERESULT($result);
// Obtain some data
- if (!isGetRequestParameterSet(('task')) && (!empty($userid)) && ($userid > 0)) {
+ if (!isGetRequestParameterSet('task') && (!empty($userid)) && ($userid > 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`=%s LIMIT 1",
array(bigintval($userid), bigintval($tstamp)), __FILE__, __LINE__);
if (empty($task)) $task = '0';
} elseif ((empty($userid)) || ($userid == '0')) {
// Cannot obtain member id!
- loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_FAILED_OBTAIN_USERID'));
+ loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_FAILED_OBTAIN_USERID--}');
} else {
// Get task id from URL
$task = getRequestParameter('task');
// 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 ((getRequestParameter('do') == 'accept') && (!empty(getUserData('email')))) {
+ if ((getRequestParameter('do') == 'accept') && (getUserData('email') != '')) {
// Ok, now we can output the form or execute accepting
if (isFormSent()) {
// Obtain payout type and other data
}
// Transfer variables...
- $reason = encodeString(getMessage('PAYOUT_REASON_PAYOUT'), false);
+ $reason = encodeString(getMessage('ADMIN_PAYOUT_REASON'), false);
// Execute transfer
$ret = sendGetRequest($data['engine_url']);
// Output message
if ($data['allow_url'] == 'Y') {
// Banner / Textlink request
- loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_BANNER_ACCEPTED_NOTIFIED'));
+ loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_BANNER_ACCEPTED_NOTIFIED--}');
} else {
// Normal request
- loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_ACCEPTED_NOTIFIED'));
+ loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_ACCEPTED_NOTIFIED--}');
}
// Finally send mail
- sendEmail(getUserData('email'), getMessage('PAYOUT_ACCEPTED_SUBJECT'), $message);
+ sendEmail(getUserData('email'), '{--MEMBER_PAYOUT_ACCEPTED_SUBJECT--}', $message);
} else {
// Something goes wrong... :-(
- $content = implode("<br />", $ret);
+ $content = implode('<br />', $ret);
loadTemplate('admin_payout_failed_transfer', false, $content);
}
} else {
// Cannot load payout id
- loadTemplate('admin_settings_saved', false, '<div class="admin_failed">{--PAYOUT_FAILED_OBTAIN_PAYOUT_ID--}</div>');
+ loadTemplate('admin_settings_saved', false, '<div class="admin_failed">{--ADMIN_PAYOUT_FAILED_OBTAIN_PAYOUT_ID--}</div>');
}
} else {
// Prepare content
// Load template
loadTemplate('admin_payout_accept_form', false, $content);
}
- } elseif ((getRequestParameter('do') == 'reject') && (!empty(getUserData('email')))) {
+ } elseif ((getRequestParameter('do') == 'reject') && (getUserData('email') != '')) {
// Ok, now we can output the form or execute rejecting
if (isFormSent()) {
if ($task > 0) {
$message = loadEmailTemplate('member_payout_rejected', postRequestParameter('text'), $userid);
// Output message
- loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_REJECTED_NOTIFIED'));
+ loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_REJECTED_NOTIFIED--}');
// Finally send mail
- sendEmail(getUserData('email'), getMessage('PAYOUT_REJECTED_SUBJECT'), $message);
+ sendEmail(getUserData('email'), '{--MEMBER_PAYOUT_REJECTED_SUBJECT--}', $message);
} else {
// Prepare content
$content = array(
}
} else {
// Cannot load user data
- loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_FAILED_OBTAIN_USERDATA'));
+ loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_FAILED_OBTAIN_USERDATA--}');
}
} elseif ((empty($task)) || ($task == '0')) {
// Failed loading task id
- loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_FAILED_OBTAIN_TASK_ID'));
+ loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_FAILED_OBTAIN_TASK_ID--}');
}
} else {
if (getRequestParameter('do') == 'delete') {
ORDER BY
p.payout_timestamp DESC", __FILE__, __LINE__);
- if (SQL_NUMROWS($result) > 0) {
+ if (!SQL_HASZERONUMS($result)) {
// List found payouts
- $OUT = ''; $SW = 2;
+ $OUT = '';
while ($content = SQL_FETCHARRAY($result)) {
if ($content['status'] == 'NEW') {
// Generate links for direct accepting and rejecting
- $content['status'] = '<a href="{%url=modules.php?module=admin&what=list_payouts&do=accept&pid=' . $content['id'] . '%}">{--PAYOUT_ACCEPT_PAYOUT--}</a>|<a href="{%url=modules.php?module=admin&what=list_payouts&do=reject&pid=' . $content['id'] . '%}">{--PAYOUT_REJECT_PAYOUT--}</a>';
+ $content['status'] = '<a href="{%url=modules.php?module=admin&what=list_payouts&do=accept&pid=' . $content['id'] . '%}">{--ADMIN_PAYOUT_ACCEPT_PAYOUT--}</a>|<a href="{%url=modules.php?module=admin&what=list_payouts&do=reject&pid=' . $content['id'] . '%}">{--ADMIN_PAYOUT_REJECT_PAYOUT--}</a>';
} else {
// Translate status
- $content['status'] = getMessage('PAYOUT_STATUS_'.strtoupper($content['status']).'');
- $content['status'] = '<div class="admin_failed">' . $content['status'] . '</div>';
+ $content['status'] = translatePayoutStatus($content['status']);
}
// Nothing entered must be secured in member/what-payputs.php !
// Admins can addionally test the URL for framekillers
$content['target_bank'] = '<a href="' . generateFrametesterUrl($content['url']) . '" target="_blank">{--CLICK_HERE--}</a>';
- } else {
- // e-currency payout request
- if (empty($content['target_account'])) $content['target_account'] = '---';
- if (empty($content['target_bank'])) $content['target_bank'] = '---';
- }
+ } // END - if
- // Remember data in array for the template
- $content = array(
- 'sw' => $SW,
- 'ulink' => generateUserProfileLink($content['userid']),
- 'ptype' => translateComma($content['payout_total']) . ' ' . $content['type'],
- 'account' => $content['target_account'],
- 'bank' => $content['target_bank'],
- 'tstamp' => generateDateTime($content['payout_timestamp'], 2),
- 'status' => $content['status'],
- );
+ // 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);
- $SW = 3 - $SW;
} // END - while
// Free memory
loadTemplate('admin_list_payouts', false, $OUT);
} else {
// No payout requests are sent so far
- loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_ADMIN_NO_REQUESTS_FOUND'));
+ loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_NO_REQUESTS_FOUND--}');
}
}