2 /************************************************************************
3 * MXChange v0.2.1 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 - 2008 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 * -------------------------------------------------------------------- *
38 * Mod-Copyright (c) 2004 by Robert Niedziela *
39 * www.megacomputing.de *
40 ************************************************************************/
42 // Some security stuff...
43 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
44 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
48 // Add description as navigation point
49 ADD_DESCR('admin', __FILE__);
51 // 0 1 2 3 4 5 6 7 8 9 10
52 $sql = "SELECT id, sender, subject, text, receivers, payment_id, data_type, timestamp, url, target_send, cat_id
53 FROM `{!_MYSQL_PREFIX!}_pool`
54 WHERE data_type='SEND' OR data_type='DELETED'
55 ORDER BY timestamp DESC";
57 // Check for maximum pages
58 $result_normal = SQL_QUERY($sql, __FILE__, __LINE__);
60 // Set offset an current page to default values
61 if (!REQUEST_ISSET_GET('page')) REQUEST_SET_GET('page' , "1");
62 if (!REQUEST_ISSET_GET('offset')) REQUEST_SET_GET('offset', getConfig('mails_page'));
64 // Add limitation to SQL string
65 $sql .= " LIMIT ".(REQUEST_GET('offset') * REQUEST_GET('page') - REQUEST_GET('offset')).", ".REQUEST_GET('offset');
67 // Run SQL query for normal mails
68 $result = SQL_QUERY($sql, __FILE__, __LINE__);
71 $PAGES = round(SQL_NUMROWS($result_normal) / getConfig('mails_page') + 0.5);
72 SQL_FREERESULT($result_normal);
74 if (SQL_NUMROWS($result) > 0) {
75 // Mail orders are in pool so we can display them
77 // Add navigation table rows
79 define('__TOP_EMAIL_NAV' , ADD_EMAIL_NAV($PAGES, getConfig('mails_page'), true , "3", true));
80 define('__BOTTOM_EMAIL_NAV', ADD_EMAIL_NAV($PAGES, getConfig('mails_page'), false, "3", true));
82 define('__TOP_EMAIL_NAV' , '');
83 define('__BOTTOM_EMAIL_NAV', '');
87 while ($pool = SQL_FETCHROW($result)) {
88 // Check sent mails and clicks
89 $result_mails = SQL_QUERY_ESC("SELECT max_rec, clicks FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s LIMIT 1",
90 array(bigintval($pool[0])), __FILE__, __LINE__);
91 list($sent, $clicks) = SQL_FETCHROW($result_mails);
92 SQL_FREERESULT($result_mails);
95 $unconfirmed = $sent - $clicks;
96 if ($unconfirmed > 0) {
97 // Add link to list_unconfirmed what-file
98 $unconfirmed = "<strong><a href=\"{!URL!}/modules.php?module=admin&what=list_unconfirmed&mid=".$pool[0]."\">".$unconfirmed."</a></strong>";
101 // Prepare data for the row template
104 'u_link' => ADMIN_USER_PROFILE_LINK($pool[1]),
105 'subj' => COMPILE_CODE($pool[2]),
106 'text' => COMPILE_CODE($pool[3]),
107 'pay' => GET_PAYMENT($pool[5]),
108 'cat' => GET_CATEGORY($pool[10]),
110 'ruids' => str_replace(';', ", ", $pool[4]),
111 'unconfirmed' => $unconfirmed,
112 'type' => TRANSLATE_POOL_TYPE($pool[6]),
114 'frametester' => FRAMETESTER($pool[8]),
115 'url' => COMPILE_CODE($pool[8]),
116 'stamp' => MAKE_DATETIME($pool[7], "0"),
120 // Load row template and switch colors
121 $OUT .= LOAD_TEMPLATE("admin_email_archiv_row", true, $content);
126 SQL_FREERESULT($result);
127 define('__EMAIL_ROWS', $OUT);
129 // Load main template
130 LOAD_TEMPLATE("admin_email_archiv");
132 // No mail orders fond
133 LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NO_MAILS_IN_POOL'));