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')
71 if (isGetRequestParameterSet('mid')) {
72 // Only a specific mail shall be displayed
73 $sql = sprintf("SELECT
74 `id`, `sender`, `subject`, `text`, `receivers`, `payment_id`, `data_type`, `timestamp`, `url`, `target_send`, `cat_id`
76 `{?_MYSQL_PREFIX?}_pool`
80 bigintval(getRequestParameter('mid'))
82 $WHO = '{--MAIL_ID--}' . ': ' . getRequestParameter('mid');
83 } elseif (isGetRequestParameterSet('userid')) {
84 // All mails by a specific member shall be displayed
85 $sql = sprintf("SELECT
86 `id`, `sender`, `subject`, `text`, `receivers`, `payment_id`, `data_type`, `timestamp`, `url`, `target_send`, `cat_id`
88 `{?_MYSQL_PREFIX?}_pool`
93 bigintval(getRequestParameter('userid'))
95 $WHO = '{--USER_ID--}' . ': ' . getRequestParameter('userid');
99 $result_bonus = false;
101 if ((isExtensionActive('bonus')) && (empty($WHO))) {
102 // Check for maximum pages
103 $result_bonus = SQL_QUERY("SELECT
104 `id`, `subject`, `text`, `receivers`, `points`, `time`, `data_type`, `timestamp`, `url`, `cat_id`, `target_send`, `mails_sent`, `clicks`,
105 (`mails_sent` - `clicks`) AS `unconfirmed`
107 `{?_MYSQL_PREFIX?}_bonus`
111 `timestamp` DESC", __FILE__, __LINE__);
114 // Check for maximum pages
115 $result_normal = SQL_QUERY($sql, __FILE__, __LINE__);
117 // Set offset an current page to default values
118 if (!isGetRequestParameterSet('page')) setGetRequestParameter('page', 1);
120 if (!isGetRequestParameterSet('offset')) {
121 if (isConfigEntrySet('mails_page')) {
123 setGetRequestParameter('offset', getConfig('mails_page'));
126 setGetRequestParameter('offset', 10);
130 // Add limitation to SQL string
131 if (!isGetRequestParameterSet('mid')) {
132 // Create limitation line
133 $add = ' LIMIT ' . (bigintval(getRequestParameter('offset')) * bigintval(getRequestParameter('page')) - bigintval(getRequestParameter('offset'))) . ', ' . bigintval(getRequestParameter('offset'));
139 if (!empty($SQL2)) $SQL2 .= $add;
142 // Run SQL query for normal mails
143 $result_list = SQL_QUERY($sql, __FILE__, __LINE__);
144 if ((!empty($SQL2)) && (empty($WHO))) $result_bonus = SQL_QUERY($SQL2, __FILE__, __LINE__);
148 if (isConfigEntrySet('mails_page')) {
149 $numPages = round(SQL_NUMROWS($result_normal) / getConfig('mails_page') + 0.3);
153 SQL_FREERESULT($result_normal);
156 if (!SQL_HASZERONUMS($result_list)) {
160 // Walk through all entries
161 while ($content = SQL_FETCHARRAY($result_list)) {
162 // Unconfirmed mails and sent mails
163 $result_uncon = SQL_QUERY_ESC("SELECT (`max_rec` - `clicks`) AS `unconfirmed` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1",
164 array(bigintval($content['id'])), __FILE__, __LINE__);
166 // Load and merge data
167 $content = merge_array($content, SQL_FETCHARRAY($result_uncon));
170 SQL_FREERESULT($result_uncon);
173 $content['unconfirmed'] = generateUnconfirmedAdminLink($content['id'], ($content['unconfirmed']), 'mid');
176 $content['timestamp'] = generateDateTime($content['timestamp'], 0);
179 $OUT .= loadTemplate('admin_list_emails_row', true, $content);
183 SQL_FREERESULT($result_list);
185 // Add navigation (with change box and colspan=3)
186 $content['nav'] = addEmailNavigation($numPages, getConfig('mails_page'), false, 3, true);
189 $content['rows'] = $OUT;
190 $content['who'] = $WHO;
192 // Mail orders are in pool so we can display them
193 loadTemplate('admin_list_emails', false, $content);
196 if ((isExtensionActive('bonus')) && (empty($WHO))) {
197 // Only check if bonus extension is active
198 if (!SQL_HASZERONUMS($result_bonus)) outputHtml('<br /><br />');
202 if ((isExtensionActive('bonus')) && (empty($WHO))) {
203 // Load bonus mails only when extension is active
204 if (!SQL_HASZERONUMS($result_bonus)) {
206 $numPages = round(SQL_NUMROWS($result_bonus) / getConfig('mails_page') + 0.5);
210 while ($content = SQL_FETCHARRAY($result_bonus)) {
211 // Add link to list_unconfirmed what-file
212 $content['unconfirmed'] = generateUnconfirmedAdminLink($content['id'], $content['unconfirmed']);
215 $content['timestamp'] = generateDateTime($content['timestamp'], 0);
218 $OUT .= loadTemplate('admin_list_bonus_emails_row', true, $content);
221 // Add navigation (without change box but with colspan=3)
222 $content['nav'] = addEmailNavigation($numPages, getConfig('mails_page'), false, 3, true);
225 $content['rows'] = $OUT;
227 // Load main template
228 loadTemplate('admin_list_bonus_emails', false, $content);
233 if ($MAIL === false) {
234 // No mail orders fond
235 loadTemplate('admin_settings_saved', false, '{--ADMIN_NO_MAILS_IN_POOL--}');