2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 06/22/2013 *
4 * =================== Last change: 06/22/2013 *
6 * -------------------------------------------------------------------- *
7 * File : what-transactions.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Confirm transactions of other members *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Transaktionen anderer Mitglieder bestaetigen *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2013 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
41 } elseif (!isMember()) {
42 redirectToIndexMemberOnlyModule();
45 // Add description as navigation point
46 addYouAreHereLink('member', __FILE__);
48 // Continue only if the proper extension is active (admins can always continue)
49 if ((!isExtensionActive('transaction')) && (!isAdmin())) {
50 displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=transaction%}');
52 } elseif ((isFormSent()) && (ifPostContainsSelections('transaction_id'))) {
53 // Try to confirm transactions
54 if (doTryConfirmTransactions($_POST)) {
56 displayMessage('Bestätigung der CAPTCHA(s) abgeschlossen. Vielen Dank.');
59 displayMessage('Es konnten keine CAPTCHA(s) bestätigt werden. Vermutlich weil Sie diese bereits bestätigt haben.');
63 // Load X most oldest transactions this user is not sender and not receiver
64 $result = sqlQueryEscaped("SELECT
67 `{?_MYSQL_PREFIX?}_transaction_log`
69 `transaction_sender` != %s AND
70 `transaction_sender` IS NOT NULL AND
71 `transaction_receiver` != %s AND
72 `transaction_receiver` IS NOT NULL AND
73 `transaction_hash` != 'INVALID' AND
74 `transaction_confirmed`='N' AND
75 `transaction_captcha_failed`='N' AND
76 `transaction_fee_collected`='N' AND
77 `transaction_level` IS NULL AND
78 `transaction_captcha` IS NOT NULL
80 `transaction_hash` ASC
81 LIMIT {?transaction_max_captcha?}",
92 if (sqlNumRows($result) > 0) {
95 while (list($id) = sqlFetchRow($result)) {
96 // Load "row" template
97 $row .= loadTemplate('member_transactions_row', TRUE, $id);
100 // Load form template
101 $OUT .= loadTemplate('member_transactions_form', TRUE, $row);
104 $OUT .= returnMessage('Es sind noch keine Transaktionen zum Bestätigen vorhanden. Neu zu bestätigende Transaktionen gibt es durch den "Stundenreset", der ungefähr zur vollen Stunde läuft.');
108 sqlFreeResult($result);
110 // Get summarizations
111 $result = sqlQuery("SELECT
112 SUM(`transaction_fee_sender`) AS `total_sender`,
113 SUM(`transaction_fee_receiver`) AS `total_receiver`
115 `{?_MYSQL_PREFIX?}_transaction_log`
117 `transaction_fee_collected`='N' AND
118 `transaction_confirmed`='N' AND
119 `transaction_captcha_failed`='N'
120 LIMIT 1", __FILE__, __LINE__);
123 list($totalSenderN, $totalReceiverN) = sqlFetchRow($result);
126 sqlFreeResult($result);
128 // Get summarizations
129 $result = sqlQuery("SELECT
130 SUM(`transaction_fee_sender`) AS `total_sender`,
131 SUM(`transaction_fee_receiver`) AS `total_receiver`
133 `{?_MYSQL_PREFIX?}_transaction_log`
135 `transaction_fee_collected`='Y'
136 LIMIT 1", __FILE__, __LINE__);
139 list($totalSenderY, $totalReceiverY) = sqlFetchRow($result);
142 sqlFreeResult($result);
144 // Get summarizations
145 $result = sqlQuery("SELECT
146 COUNT(`transaction_id`) AS `cnt`,
147 (SUM(`transaction_fee_sender`) + SUM(`transaction_fee_receiver`)) AS `total_confirmed`
149 `{?_MYSQL_PREFIX?}_transaction_log`
151 `transaction_confirmed`='Y'
152 LIMIT 1", __FILE__, __LINE__);
155 list($confirmedCount, $totalConfirmed) = sqlFetchRow($result);
158 sqlFreeResult($result);
162 'captcha_content' => $OUT,
163 'transaction_confirmed' => translateComma(getUserData('transaction_confirmed'), TRUE),
164 'total_sender_uncollected' => $totalSenderN,
165 'total_receiver_uncollected' => $totalReceiverN,
166 'total_sender_collected' => $totalSenderY,
167 'total_receiver_collected' => $totalReceiverY,
168 'total_confirmed_count' => translateComma($confirmedCount, TRUE),
169 'total_confirmed' => $totalConfirmed,
172 // Load main template
173 loadTemplate('member_transactions', FALSE, $content);