2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/09/2004 *
4 * =================== Last change: 10/31/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-list_unconfirmed.php *
8 * -------------------------------------------------------------------- *
9 * Short description : List unconfirmed mail links *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Unbest. Mail-Links auflisten *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2012 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')) || (!isAdmin())) {
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
46 if (!isExtensionActive('mailid')) {
47 displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=mailid%}');
51 // Don't load the admin_list_unconfirmed template by default
57 // List confirmation links from normal or bonus mails
58 if (isGetRequestElementSet('mid')) {
59 // SQL query for mail data
60 $sql = sprintf("SELECT
69 `{?_MYSQL_PREFIX?}_pool` AS `p`
71 `{?_MYSQL_PREFIX?}_user_stats` AS `s`
77 bigintval(getRequestElement('mid'))
80 // Column, type and id for member's mail
85 // Load admin_list_unconfirmed template
87 $DATA = getRequestElement('mid');
89 } elseif ((isGetRequestElementSet('bid')) && (isExtensionActive('bonus'))) {
90 // @TODO This constant might be unused? define('__LIST_UNCON_TITLE', '{--ADMIN_LIST_UNCONFIRMED_BONUS_LINKS--}');
92 // SQL query for mail data (both ids are required for compatiblity to above normal mail
93 // @TODO `id` has been used two times???
94 $sql = sprintf("SELECT
101 `mails_sent` AS `max_rec`
103 `{?_MYSQL_PREFIX?}_bonus`
107 bigintval(getRequestElement('bid'))
110 // Column, type and id for member's mail
113 $ID = getRequestElement('bid');
115 // Load admin_list_unconfirmed template
118 $mailType = 'bonusid';
120 // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus
121 displayMessage('{--ADMIN_CALL_NOT_DIRECTLY--}');
124 // Shall I display links or not?
125 if (($listed === TRUE) && (!empty($sql))) {
127 $result_master = SQL_QUERY($sql, __FILE__, __LINE__);
129 // Is there an entry?
130 if (SQL_NUMROWS($result_master) == 1) {
131 // Mail order / bonus mail found
132 $poolData = SQL_FETCHARRAY($result_master);
134 // If there is a pool id and $ID is not set, we take it
135 if (($poolData['id'] > 0) && ($ID == '-1')) {
136 $ID = $poolData['id'];
139 // Bonus mails do always have a sender 'NULL'
140 if ($col == 'bonus_id') {
141 $poolData['sender'] = NULL;
144 // Load unconfirmed mail links. Hmmm, this select query is pretty cool
145 // but it does only show unconfirmed mail links from existing user
146 // accounts. So if you have delete one you did not see those links
147 $result = SQL_QUERY_ESC("SELECT
155 `{?_MYSQL_PREFIX?}_user_links` AS `l`
157 `{?_MYSQL_PREFIX?}_user_data` AS `u`
159 l.`userid`=`u`.`userid`
168 bigintval($poolData['max_rec'])
169 ),__FILE__, __LINE__);
171 // Are there entries?
172 if (!SQL_HASZERONUMS($result)) {
173 // At least one link left to confirm
175 while ($row = SQL_FETCHARRAY($result)) {
176 // User data found? We can take any field of u.
177 if (!is_null($row['status'])) {
178 // Prepare data for the row template
180 'userid' => $row['userid'],
183 'email' => '<a href="' . generateEmailLink($row['email'], 'user_data') . '">{%pipe,translateGender=' . $row['gender'] . '%} ' . $row['surname'] . ' ' . $row['family'] . '</a>',
184 'status' => $row['status'],
187 // Load row template and switch colors
188 $OUT .= loadTemplate('admin_list_unconfirmed_row', TRUE, $row);
190 // No user data found
191 $OUT .= loadTemplate('admin_list_unconfirmed_row_404', TRUE, $row);
195 // Render it in our new listing
196 $OUT = loadTemplate('admin_list_unconfirmed_list', TRUE, $OUT);
198 // All links are confirmed... strange, you shall normally not get a link to this place in this scenario... hmmm.
199 $OUT = displayMessage('{--ADMIN_UNCONFIRMED_NO_LINK_LEFT--}', TRUE);
203 $content = $poolData;
204 $content['unconfirmed'] = SQL_NUMROWS($result);
205 $content['timestamp'] = generateDateTime($poolData['timestamp'], 2);
206 $content['rows'] = $OUT;
209 SQL_FREERESULT($result);
211 // Load final template
212 loadTemplate('admin_list_unconfirmed', FALSE, $content);
213 } elseif (getRequestElement('mid') > 0) {
214 // Data in pool or in user_stats not found, so let's find out where data is missing
215 if (countSumTotalData(bigintval($ID), 'pool', 'id', 'id', TRUE) == 1) {
217 displayMessage('{%message,ADMIN_UNCONFIRMED_POOL_MISSING=' . $ID . '%}');
218 } elseif (countSumTotalData(bigintval($ID), 'user_stats', 'id', 'pool_id', TRUE) == 1) {
220 displayMessage('{%message,ADMIN_UNCONFIRMED_STATS_MISSING=' . $ID . '%}');
222 // both or link is invalid
223 displayMessage('{--ADMIN_UNCONFIRMED_INVALID_LINK--}');
225 } elseif (isGetRequestElementSet('bid')) {
226 // Data in bonus table not found
227 displayMessage('{--ADMIN_UNCONFIRMED_INVALID_LINK--}');
231 SQL_FREERESULT($result_master);