]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-list_payouts.php
Filters for configurable userid exclusion added:
[mailer.git] / inc / modules / admin / what-list_payouts.php
index 222abf1140b93ada763e42657c7f1ed37c638183..be043aceac4c6b3f2e5828de868aa42fd2436be8 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * 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 *
@@ -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('<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--}');
+                                       loadTemplate('admin_settings_unsaved', FALSE, '{--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` AS `allow`,
+       `p`.`target_url` AS `url`,
+       `p`.`link_text` AS `alt`,
+       `p`.`banner_url` AS `banner`
 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
@@ -248,10 +262,10 @@ ORDER BY
                                // Banner/Textlink views/clicks request
                                if (!empty($content['banner'])) {
                                        // 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
@@ -262,14 +276,14 @@ ORDER BY
                        $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--}');