]> git.mxchange.org Git - mailer.git/blob - inc/modules/admin/what-email_archiv.php
57e51bd49763b572422db031ecfebc7fd0a4dc51
[mailer.git] / inc / modules / admin / what-email_archiv.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 09/28/2003 *
4  * ===============                              Last change: 04/03/2004 *
5  *                                                                      *
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  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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                  *
22  *                                                                      *
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.                                  *
27  *                                                                      *
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.                         *
32  *                                                                      *
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,               *
36  * MA  02110-1301  USA                                                  *
37  * -------------------------------------------------------------------- *
38  * Mod-Copyright (c) 2004 by Robert Niedziela                           *
39  * www.megacomputing.de                                                 *
40  ************************************************************************/
41
42 // Some security stuff...
43 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
44         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
45         require($INC);
46 }
47
48 // Add description as navigation point
49 ADD_DESCR('admin', __FILE__);
50
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";
56
57 // Check for maximum pages
58 $result_normal = SQL_QUERY($sql, __FILE__, __LINE__);
59
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'));
63
64 // Add limitation to SQL string
65 $sql .= " LIMIT ".(REQUEST_GET('offset') * REQUEST_GET('page') - REQUEST_GET('offset')).", ".REQUEST_GET('offset');
66
67 // Run SQL query for normal mails
68 $result = SQL_QUERY($sql, __FILE__, __LINE__);
69
70 // Calculate pages
71 $PAGES = round(SQL_NUMROWS($result_normal) / getConfig('mails_page') + 0.5);
72 SQL_FREERESULT($result_normal);
73
74 if (SQL_NUMROWS($result) > 0) {
75         // Mail orders are in pool so we can display them
76
77         // Add navigation table rows
78         if ($PAGES > 1) {
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));
81         } else {
82                 define('__TOP_EMAIL_NAV'   , '');
83                 define('__BOTTOM_EMAIL_NAV', '');
84         }
85
86         $OUT = ''; $SW = 2;
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);
93
94                 // Unconfirmed 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&amp;what=list_unconfirmed&amp;mid=".$pool[0]."\">".$unconfirmed."</a></strong>";
99                 }
100
101                 // Prepare data for the row template
102                 $content = array(
103                         'sw'          => $SW,
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]),
109                         'sent'        => $sent,
110                         'ruids'       => str_replace(';', ", ", $pool[4]),
111                         'unconfirmed' => $unconfirmed,
112                         'type'        => TRANSLATE_POOL_TYPE($pool[6]),
113                         'tsend'       => $pool[9],
114                         'frametester' => FRAMETESTER($pool[8]),
115                         'url'         => COMPILE_CODE($pool[8]),
116                         'stamp'       => MAKE_DATETIME($pool[7], "0"),
117                         'mid'         => $pool[0],
118                 );
119
120                 // Load row template and switch colors
121                 $OUT .= LOAD_TEMPLATE("admin_email_archiv_row", true, $content);
122                 $SW = 3 - $SW;
123         }
124
125         // Free memory
126         SQL_FREERESULT($result);
127         define('__EMAIL_ROWS', $OUT);
128
129         // Load main template
130         LOAD_TEMPLATE("admin_email_archiv");
131 } else {
132         // No mail orders fond
133         LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NO_MAILS_IN_POOL'));
134 }
135
136 //
137 ?>