2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 09/28/2003 *
4 * =================== Last change: 10/29/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-email_details.php *
8 * -------------------------------------------------------------------- *
9 * Short description : See all email details of ordered mails *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Alle Details einer gebuchten Mail ansehen *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 * -------------------------------------------------------------------- *
39 * Moded What-email_details.php / also Editet ! *
40 * Auf langsammen Servern (wie mein z.B Dauert das Laden) *
41 * enorm hoch zu lang. Jetzt werden nur auftraege aufgelistet die *
42 * NEU sind ( DB NEW) oder ADMIN freischalten muss (DB ADMIN ) *
43 * oder noch als TEMP gespecihert sind *
44 * der rest der schon als SEND sich melden darf wird per *
45 * what-email_archiv .php aufgerufen *
46 * beste gruesse Robert Niedziela / www.personal-webserver.de *
47 * oder auch www.mc-p.org *
48 ************************************************************************/
50 // Some security stuff...
51 if ((!defined('__SECURITY')) || (!isAdmin())) {
55 // Add description as navigation point
56 addMenuDescription('admin', __FILE__);
58 // Normal mails ordered by your members
60 `id`, `sender`, `subject`, `text`, `receivers`, `payment_id`, `data_type`, `timestamp`, `url`, `target_send`, `cat_id`
62 `{?_MYSQL_PREFIX?}_pool`
64 `data_type` IN('ADMIN','TEMP','NEW','ACTIVE')
68 $WHO = getMessage('_ALL');
71 if (isGetRequestParameterSet(('mid'))) {
72 // Only a specific mail shall be displayed
74 `id`, `sender`, `subject`, `text`, `receivers`, `payment_id`, `data_type`, `timestamp`, `url`, `target_send`, `cat_id`
76 `{?_MYSQL_PREFIX?}_pool`
78 `id`='".bigintval(getRequestParameter('mid'))."'
80 $WHO = getMessage('MAIL_ID') . ': ' . getRequestParameter('mid');
81 } elseif (isGetRequestParameterSet('userid')) {
82 // All mails by a specific member shall be displayed
84 `id`, `sender`, `subject`, `text`, `receivers`, `payment_id`, `data_type`, `timestamp`, `url`, `target_send`, `cat_id`
86 `{?_MYSQL_PREFIX?}_pool`
88 `sender`='".bigintval(getRequestParameter('userid'))."'
91 $WHO = getMessage('USER_ID') . ': ' . getRequestParameter('userid');
95 $result_bonus = false;
97 if ((isExtensionActive('bonus')) && ($WHO == getMessage('_ALL'))) {
98 // Check for maximum pages
99 $result_bonus = SQL_QUERY("SELECT
100 `id`, `subject`, `text`, `receivers`, `points`, `time`, `data_type`, `timestamp`, `url`, `cat_id`, `target_send`, `mails_sent`, `clicks`
101 (`mails_sent` - `clicks`) AS `unconfirmed`
103 `{?_MYSQL_PREFIX?}_bonus`
107 `timestamp` DESC", __FILE__, __LINE__);
110 // Check for maximum pages
111 $result_normal = SQL_QUERY($sql, __FILE__, __LINE__);
113 // Set offset an current page to default values
114 if (!isGetRequestParameterSet('page')) setGetRequestParameter('page', 1);
116 if (!isGetRequestParameterSet('offset')) {
117 if (isConfigEntrySet('mails_page')) {
119 setGetRequestParameter('offset', getConfig('mails_page'));
122 setGetRequestParameter('offset', 10);
126 // Add limitation to SQL string
127 if (!isGetRequestParameterSet(('mid'))) {
128 // Create limitation line
129 $add = ' LIMIT ' . (bigintval(getRequestParameter('offset')) * bigintval(getRequestParameter('page')) - bigintval(getRequestParameter('offset'))) . ', ' . bigintval(getRequestParameter('offset'));
135 if (!empty($SQL2)) $SQL2 .= $add;
138 // Run SQL query for normal mails
139 $result_list = SQL_QUERY($sql, __FILE__, __LINE__);
140 if ((!empty($SQL2)) && ($WHO == getMessage('_ALL'))) $result_bonus = SQL_QUERY($SQL2, __FILE__, __LINE__);
144 if (isConfigEntrySet('mails_page')) {
145 $numPages = round(SQL_NUMROWS($result_normal) / getConfig('mails_page') + 0.3);
149 SQL_FREERESULT($result_normal);
152 if (SQL_NUMROWS($result_list) > 0) {
156 // Walk through all entries
157 while ($content = SQL_FETCHARRAY($result_list)) {
158 // Unconfirmed mails and sent mails
159 $result_uncon = SQL_QUERY_ESC("SELECT (`max_rec` - `clicks`) AS `unconfirmed` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1",
160 array(bigintval($content['id'])), __FILE__, __LINE__);
162 // Load and merge data
163 $content = merge_array($content, SQL_FETCHARRAY($result_uncon));
166 SQL_FREERESULT($result_uncon);
169 $content['unconfirmed'] = generateUnconfirmedAdminLink($content['id'], ($content['unconfirmed']), 'mid');
172 $content['timestamp'] = generateDateTime($content['timestamp'], 0);
175 $OUT .= loadTemplate('admin_list_emails_row', true, $content);
179 SQL_FREERESULT($result_list);
181 // Add navigation (with change box and colspan=3)
182 $content['nav'] = addEmailNavigation($numPages, getConfig('mails_page'), false, 3, true);
185 $content['rows'] = $OUT;
186 $content['who'] = $WHO;
188 // Mail orders are in pool so we can display them
189 loadTemplate('admin_list_emails', false, $content);
192 if ((isExtensionActive('bonus')) && ($WHO == getMessage('_ALL'))) {
193 // Only check if bonus extension is active
194 if (SQL_NUMROWS($result_bonus) > 0) outputHtml('<br /><br />');
198 if ((isExtensionActive('bonus')) && ($WHO == getMessage('_ALL'))) {
199 // Load bonus mails only when extension is active
200 if (SQL_NUMROWS($result_bonus) > 0) {
202 $numPages = round(SQL_NUMROWS($result_bonus) / getConfig('mails_page') + 0.5);
206 while ($content = SQL_FETCHARRAY($result_bonus)) {
207 // Add link to list_unconfirmed what-file
208 $content['unconfirmed'] = generateUnconfirmedAdminLink($content['id'], $content['unconfirmed']);
211 $content['timestamp'] = generateDateTime($content['timestamp'], 0);
214 $OUT .= loadTemplate('admin_list_bonus_emails_row', true, $content);
217 // Add navigation (without change box but with colspan=3)
218 $content['nav'] = addEmailNavigation($numPages, getConfig('mails_page'), false, 3, true);
221 $content['rows'] = $OUT;
223 // Load main template
224 loadTemplate('admin_list_bonus_emails', false, $content);
229 if ($MAIL === false) {
230 // No mail orders fond
231 loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NO_MAILS_IN_POOL'));