2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 09/28/2003 *
4 * =================== Last change: 04/03/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-email_archiv .php *
8 * -------------------------------------------------------------------- *
9 * Short description : See send emails details of ordered mails *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Alle Mails ansehen die versand wurden *
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 * Mod-Copyright (c) 2004 by Robert Niedziela *
40 * www.megacomputing.de *
41 ************************************************************************/
43 // Some security stuff...
44 if ((!defined('__SECURITY')) || (!isAdmin())) {
48 // Add description as navigation point
49 addMenuDescription('admin', __FILE__);
53 `id`, `sender`, `subject`, `text`, `receivers`, `payment_id`, `data_type`, `timestamp`, `url`, `target_send`, `cat_id`
55 `{?_MYSQL_PREFIX?}_pool`
57 `data_type`='SEND' OR `data_type`='DELETED'
61 // Check for maximum pages
62 $result_maximum = SQL_QUERY($sql, __FILE__, __LINE__);
64 // Set offset an current page to default values
65 if (!isGetRequestParameterSet('page')) setGetRequestParameter('page' , 1);
66 if (!isGetRequestParameterSet('offset')) setGetRequestParameter('offset', getConfig('mails_page'));
68 // Add limitation to SQL string
69 $sql .= " LIMIT ".(getRequestParameter('offset') * getRequestParameter('page') - getRequestParameter('offset')) . ', ' . getRequestParameter('offset');
71 // Run SQL query for normal mails
72 $result = SQL_QUERY($sql, __FILE__, __LINE__);
75 $pages = round(SQL_NUMROWS($result_maximum) / getConfig('mails_page') + 0.5);
77 // Free the result which we don't need
78 SQL_FREERESULT($result_maximum);
80 if (SQL_NUMROWS($result) > 0) {
81 // Mail orders are in pool so we can display them
83 // Add navigation table rows
84 $content['top_email_nav'] = '';
85 $content['bottom_email_nav'] = '';
87 $content['top_email_nav'] = addEmailNavigation($pages, getConfig('mails_page'), true , 3, true);
88 $content['bottom_email_nav'] = addEmailNavigation($pages, getConfig('mails_page'), false, 3, true);
93 while ($pool = SQL_FETCHARRAY($result)) {
94 // Check sent mails and clicks
95 $result_mails = SQL_QUERY_ESC("SELECT `max_rec`, `clicks` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1",
96 array(bigintval($pool['id'])), __FILE__, __LINE__);
99 $pool = merge_array($pool, SQL_FETCHARRAY($result_mails));
102 SQL_FREERESULT($result_mails);
105 $pool['unconfirmed'] = $pool['max_rec'] - $pool['clicks'];
106 if ($pool['unconfirmed'] > 0) {
107 // Add link to list_unconfirmed what-file
108 $pool['unconfirmed'] = '<strong><a href="{%url=modules.php?module=admin&what=list_unconfirmed&mid=' . $pool['id'] . '%}">' . $pool['unconfirmed'] . '</a></strong>';
111 // Prepare data for the row template
112 $content = merge_array($content, array(
114 'u_link' => generateUserProfileLink($pool['sender']),
115 'subject' => $pool['subject'],
116 'text' => $pool['text'],
117 'pay' => getPaymentTitlePrice($pool['payment_id']),
118 'cat' => getCategory($pool['cat_id']),
119 'sent' => $pool['max_rec'],
120 'ruserids' => convertReceivers($pool['receivers']),
121 'unconfirmed' => $pool['unconfirmed'],
122 'type' => translatePoolType($pool['data_type']),
123 'target_send' => $pool['target_send'],
124 'frametester' => generateFrametesterUrl($pool['url']),
125 'url' => $pool['url'],
126 'timestamp' => generateDateTime($pool['timestamp'], 0),
127 'mid' => $pool['id'],
130 // Load row template and switch colors
131 $OUT .= loadTemplate('admin_email_archiv_row', true, $content);
135 // Remmber generated rows in array
136 $content['rows'] = $OUT;
138 // Load main template
139 loadTemplate('admin_email_archiv', false, $content);
141 // No mail orders fond
142 loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NO_MAILS_IN_POOL'));
146 SQL_FREERESULT($result);