X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_payouts.php;h=d2f9d6e6ac9e3f475b333f490a37de76700826c6;hb=7858ec10092071d595c3814264c537cd16695875;hp=fd368ebdeeaf45666c59869d2c44ec26371b2f4e;hpb=2379934be6a196a54f4155bb8e24c49b20736969;p=mailer.git diff --git a/inc/modules/admin/what-list_payouts.php b/inc/modules/admin/what-list_payouts.php index fd368ebdee..d2f9d6e6ac 100644 --- a/inc/modules/admin/what-list_payouts.php +++ b/inc/modules/admin/what-list_payouts.php @@ -16,8 +16,8 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2012 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -51,14 +51,14 @@ if (isGetRequestElementSet('pid')) { 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 { @@ -66,11 +66,11 @@ if (isGetRequestElementSet('pid')) { $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! - debug_report_bug(__FILE__, __LINE__, 'No user account ' . $userid . ' found.'); + reportBug(__FILE__, __LINE__, 'No user account ' . $userid . ' found.'); } // END - if if ((getRequestElement('do') == 'accept') && (getUserData('email') != '')) { @@ -89,7 +89,13 @@ if (isGetRequestElementSet('pid')) { 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 @@ -118,10 +124,10 @@ LIMIT 1", } // 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']; @@ -129,9 +135,9 @@ LIMIT 1", if ($ret[0] == $data['engine_ret_ok']) { // Clear task - if ($taskId > 0) { + if (isValidId($taskId)) { runFilterChain('solve_task', $taskId); - } + } // END - if // Clear payout request SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_payouts` SET `status`='ACCEPTED' WHERE `id`=%s LIMIT 1", @@ -154,11 +160,11 @@ LIMIT 1", } else { // Something goes wrong... :-( $content = implode('
', $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 @@ -169,12 +175,12 @@ LIMIT 1", ); // 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 @@ -200,13 +206,13 @@ LIMIT 1", ); // 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--}'); } @@ -217,19 +223,27 @@ LIMIT 1", } // 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 @@ -244,32 +258,32 @@ ORDER BY } // 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'] = '{--CLICK_HERE--}'; + $content['target_bank'] = '{--CLICK_HERE--}'; } // 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--}');