X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_payouts.php;h=b312d6533852f3a03abe0704279273b99026544f;hb=9b93cb80c13ee59fbd935b2988127cf4a1135000;hp=23f72e3068a174d93c91a36e89f1ea0f97d6e375;hpb=29385a0483bbcbbe940a32a49d488b1d5add15c5;p=mailer.git diff --git a/inc/modules/admin/what-list_payouts.php b/inc/modules/admin/what-list_payouts.php index 23f72e3068..b312d65338 100644 --- a/inc/modules/admin/what-list_payouts.php +++ b/inc/modules/admin/what-list_payouts.php @@ -14,11 +14,9 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * + * Copyright (c) 2009 - 2011 by Mailer Developer Team * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -43,9 +41,9 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { } // END - if // Add description as navigation point -addMenuDescription('admin', __FILE__); +addYouAreHereLink('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__); @@ -53,22 +51,22 @@ if (isGetRequestParameterSet(('pid'))) { SQL_FREERESULT($result); // Obtain some data - if (!isGetRequestParameterSet(('task')) && (!empty($userid)) && ($userid > 0)) { + 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($task) = SQL_FETCHROW($result); + list($taskId) = SQL_FETCHROW($result); SQL_FREERESULT($result); - if (empty($task)) $task = '0'; + if (empty($taskId)) $taskId = '0'; } elseif ((empty($userid)) || ($userid == '0')) { // Cannot obtain member id! - loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_FAILED_OBTAIN_USERID--}'); + displayMessage('{--ADMIN_PAYOUT_FAILED_OBTAIN_USERID--}'); } else { // Get task id from URL - $task = getRequestParameter('task'); + $taskId = getRequestParameter('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! @@ -117,7 +115,7 @@ LIMIT 1", $data['from_pass'] = base64_encode($data['from_pass']); $tpass = base64_encode($tpass); break; - } + } // END - switch // Transfer variables... $reason = encodeString(getMessage('ADMIN_PAYOUT_REASON'), false); @@ -131,8 +129,8 @@ LIMIT 1", 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 @@ -145,14 +143,14 @@ LIMIT 1", // Output message if ($data['allow_url'] == 'Y') { // Banner / Textlink request - loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_BANNER_ACCEPTED_NOTIFIED--}'); + displayMessage('{--ADMIN_PAYOUT_BANNER_ACCEPTED_NOTIFIED--}'); } else { // Normal request - loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_ACCEPTED_NOTIFIED--}'); + displayMessage('{--ADMIN_PAYOUT_ACCEPTED_NOTIFIED--}'); } // Finally send mail - sendEmail(getUserData('email'), '{--MEMBER_PAYOUT_ACCEPTED_SUBJECT--}', $message); + sendEmail(getUserData('userid'), '{--MEMBER_PAYOUT_ACCEPTED_SUBJECT--}', $message); } else { // Something goes wrong... :-( $content = implode('
', $ret); @@ -160,14 +158,14 @@ LIMIT 1", } } else { // Cannot load payout id - loadTemplate('admin_settings_saved', false, '
{--ADMIN_PAYOUT_FAILED_OBTAIN_PAYOUT_ID--}
'); + loadTemplate('admin_settings_unsaved', false, '{--ADMIN_PAYOUT_FAILED_OBTAIN_PAYOUT_ID--}'); } } else { // Prepare content $content = array( - 'task' => $task, + 'task' => $taskId, 'pid' => bigintval(getRequestParameter('pid')), - 'user' => '' . translateGender(getUserData('gender')) . ' ' . getUserData('surname') . ' ' . getUserData('family') . '', + 'user' => '{%pipe,translateGender=' . getUserData('gender') . '%} ' . getUserData('surname') . ' ' . getUserData('family') . '', ); // Load template @@ -176,9 +174,9 @@ LIMIT 1", } elseif ((getRequestParameter('do') == 'reject') && (getUserData('email') != '')) { // Ok, now we can output the form or execute rejecting if (isFormSent()) { - if ($task > 0) { + if ($taskId > 0) { // Clear task - runFilterChain('solve_task', $task); + runFilterChain('solve_task', $taskId); } // END - if // Clear payout request @@ -189,16 +187,16 @@ LIMIT 1", $message = loadEmailTemplate('member_payout_rejected', postRequestParameter('text'), $userid); // Output message - loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_REJECTED_NOTIFIED--}'); + displayMessage('{--ADMIN_PAYOUT_REJECTED_NOTIFIED--}'); // Finally send mail - sendEmail(getUserData('email'), '{--MEMBER_PAYOUT_REJECTED_SUBJECT--}', $message); + sendEmail(getUserData('userid'), '{--MEMBER_PAYOUT_REJECTED_SUBJECT--}', $message); } else { // Prepare content $content = array( - 'task' => $task, + 'task' => $taskId, 'pid' => bigintval(getRequestParameter('pid')), - 'user' => '' . translateGender(getUserData('gender')) . ' ' . getUserData('surname') . ' ' . getUserData('family') . '', + 'user' => '{%pipe,translateGender=' . getUserData('gender') . '%} ' . getUserData('surname') . ' ' . getUserData('family') . '', ); // Load template @@ -206,11 +204,11 @@ LIMIT 1", } } else { // Cannot load user data - loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_FAILED_OBTAIN_USERDATA--}'); + displayMessage('{--ADMIN_PAYOUT_FAILED_OBTAIN_USERDATA--}'); } - } elseif ((empty($task)) || ($task == '0')) { + } elseif ((empty($taskId)) || ($taskId == '0')) { // Failed loading task id - loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_FAILED_OBTAIN_TASK_ID--}'); + displayMessage('{--ADMIN_PAYOUT_FAILED_OBTAIN_TASK_ID--}'); } } else { if (getRequestParameter('do') == 'delete') { @@ -233,9 +231,9 @@ ON 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 @@ -243,7 +241,6 @@ ORDER BY } else { // Translate status $content['status'] = translatePayoutStatus($content['status']); - $content['status'] = '
' . $content['status'] . '
'; } // Nothing entered must be secured in member/what-payputs.php ! @@ -262,12 +259,10 @@ ORDER BY } // END - if // Add/Translate some data - $content['sw'] = $SW; $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 @@ -277,7 +272,7 @@ ORDER BY loadTemplate('admin_list_payouts', false, $OUT); } else { // No payout requests are sent so far - loadTemplate('admin_settings_saved', false, '{--ADMIN_PAYOUT_NO_REQUESTS_FOUND--}'); + displayMessage('{--ADMIN_PAYOUT_NO_REQUESTS_FOUND--}'); } }