X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_payouts.php;h=00a5e0b55da43c9c39006389faf72aa110ea0b2d;hp=4bf5cb37ccbee7c40d0ab0a07b58f6fa7d5a43d7;hb=0715fa7aa8e5e70bcf1d957fb09ae655c3896c4e;hpb=c2e17d983fcbc0c3bd1dd37908d87c678f0367df diff --git a/inc/modules/admin/what-list_payouts.php b/inc/modules/admin/what-list_payouts.php index 4bf5cb37cc..00a5e0b55d 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($userid)), __FILE__, __LINE__); + 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__); list($task) = SQL_FETCHROW($result); SQL_FREERESULT($result); - if (empty($task)) $task = 0; - } elseif ((empty($userid)) || ($userid == 0)) { - // Cannot obtain member ID! + if (empty($task)) $task = '0'; + } elseif ((empty($userid)) || ($userid == '0')) { + // Cannot obtain member id! loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_FAILED_OBTAIN_USERID')); } else { - // Get task ID from URL - $task = getRequestElement('task'); + // Get task id from URL + $task = getRequestParameter('task'); } if ((!empty($task)) && (!empty($userid)) && ($userid > 0)) { // 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($userid)), __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('No user account ' . $userid . ' found.'); + } // END - if - if ((getRequestElement('do') == 'accept') && (!empty($email))) { + if ((getRequestParameter('do') == 'accept') && (!empty(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__); + array(bigintval(getRequestParameter('pid'))), __FILE__, __LINE__); list($ptype) = SQL_FETCHROW($result); SQL_FREERESULT($result); @@ -97,7 +98,6 @@ LIMIT 1", if (!empty($eurl)) { // Ok, run URL... - $eurl = compileCode($eurl); switch ($eenc) { case 'md5': $fpass = md5($fpass); @@ -111,7 +111,7 @@ LIMIT 1", } // Transfer variables... - $eval = "\$URL = \"".$eurl."\";"; + $eval = '$url = "' . $eurl . '";'; $reason = encodeString(getMessage('PAYOUT_REASON_PAYOUT'), false); // Run code... @@ -119,7 +119,7 @@ LIMIT 1", eval($eval); // Execute transfer - $ret = sendGetRequest($URL); + $ret = sendGetRequest($url); } else { // No URL to run $ret[0] = $eok; @@ -133,10 +133,10 @@ LIMIT 1", // Clear payout request SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_payouts` SET `status`='ACCEPTED' WHERE `id`=%s LIMIT 1", - array(bigintval(getRequestElement('pid'))), __FILE__, __LINE__); + array(bigintval(getRequestParameter('pid'))), __FILE__, __LINE__); // Send out mail - $message = loadEmailTemplate('member_payout_accepted', postRequestElement('text'), $userid); + $message = loadEmailTemplate('member_payout_accepted', postRequestParameter('text'), $userid); // Output message if ($allow == 'Y') { @@ -148,7 +148,7 @@ LIMIT 1", } // Finally send mail - sendEmail($email, getMessage('PAYOUT_ACCEPTED_SUBJECT'), $message); + sendEmail(getUserData('email'), getMessage('PAYOUT_ACCEPTED_SUBJECT'), $message); } else { // Something goes wrong... :-( $content = implode("
", $ret); @@ -156,20 +156,20 @@ LIMIT 1", } } else { // Cannot load payout id - loadTemplate('admin_settings_saved', false, "
{--PAYOUT_FAILED_OBTAIN_PAYOUT_ID--}
"); + loadTemplate('admin_settings_saved', false, '
{--PAYOUT_FAILED_OBTAIN_PAYOUT_ID--}
'); } } else { // Prepare content $content = array( 'task' => $task, - 'pid' => bigintval(getRequestElement('pid')), - 'user' => "".translateGender($gender)." ".$surname." ".$family."", + 'pid' => bigintval(getRequestParameter('pid')), + 'user' => '' . translateGender(getUserData('gender')) . ' ' . getUserData('surname') . ' ' . getUserData('family') . '', ); // Load template loadTemplate('admin_payout_accept_form', false, $content); } - } elseif ((getRequestElement('do') == 'reject') && (!empty($email))) { + } elseif ((getRequestParameter('do') == 'reject') && (!empty(getUserData('email')))) { // Ok, now we can output the form or execute rejecting if (isFormSent()) { if ($task > 0) { @@ -179,22 +179,22 @@ LIMIT 1", // Clear payout request SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_payouts` SET `status`='REJECTED' WHERE `id`=%s LIMIT 1", - array(bigintval(getRequestElement('pid'))), __FILE__, __LINE__); + array(bigintval(getRequestParameter('pid'))), __FILE__, __LINE__); // Send out mail - $message = loadEmailTemplate('member_payout_rejected', postRequestElement('text'), $userid); + $message = loadEmailTemplate('member_payout_rejected', postRequestParameter('text'), $userid); // Output message loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_REJECTED_NOTIFIED')); // Finally send mail - sendEmail($email, getMessage('PAYOUT_REJECTED_SUBJECT'), $message); + sendEmail(getUserData('email'), getMessage('PAYOUT_REJECTED_SUBJECT'), $message); } else { // Prepare content $content = array( 'task' => $task, - 'pid' => bigintval(getRequestElement('pid')), - 'user' => "".translateGender($gender)." ".$surname." ".$family."", + 'pid' => bigintval(getRequestParameter('pid')), + 'user' => '' . translateGender(getUserData('gender')) . ' ' . getUserData('surname') . ' ' . getUserData('family') . '', ); // Load template @@ -204,14 +204,12 @@ LIMIT 1", // Cannot load user data loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_FAILED_OBTAIN_USERDATA')); } - } elseif ((empty($task)) || ($task == 0)) { - // Failed loading task ID + } elseif ((empty($task)) || ($task == '0')) { + // Failed loading task id loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_FAILED_OBTAIN_TASK_ID')); } } else { - if (!isGetRequestElementSet('do')) setRequestGetElement('do', ''); - - if (getRequestElement('do') == 'delete') { + if (getRequestParameter('do') == 'delete') { // Delete all requests $result = SQL_QUERY("TRUNCATE `{?_MYSQL_PREFIX?}_user_payouts`", __FILE__, __LINE__); } // END - if @@ -237,11 +235,11 @@ ORDER BY while ($content = SQL_FETCHARRAY($result)) { if ($content['status'] == 'NEW') { // Generate links for direct accepting and rejecting - $content['status'] = "".PAYOUT_ACCEPT_PAYOUT." | ".PAYOUT_REJECT_PAYOUT.""; + $content['status'] = '{--PAYOUT_ACCEPT_PAYOUT--} | {--PAYOUT_REJECT_PAYOUT--}'; } else { // Translate status $content['status'] = getMessage('PAYOUT_STATUS_'.strtoupper($content['status']).''); - $content['status'] = "
".$content['status']."
"; + $content['status'] = '
' . $content['status'] . '
'; } // Nothing entered must be secured in member/what-payputs.php ! @@ -256,7 +254,7 @@ ORDER BY } // Admins can addionally test the URL for framekillers - $content['target_bank'] = "{--CLICK_HERE--}"; + $content['target_bank'] = '{--CLICK_HERE--}'; } else { // e-currency payout request if (empty($content['target_account'])) $content['target_account'] = '---'; @@ -277,7 +275,7 @@ ORDER BY // Add row and switch color $OUT .= loadTemplate('admin_list_payouts_row', true, $content); $SW = 3 - $SW; - } + } // END - while // Free memory SQL_FREERESULT($result);