]> git.mxchange.org Git - mailer.git/blob - inc/modules/admin/what-email_archiv.php
Code style changed, ext-user continued:
[mailer.git] / inc / modules / admin / what-email_archiv.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                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  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
20  * For more information visit: http://mxchange.org                      *
21  *                                                                      *
22  * This program is free software; you can redistribute it and/or modify *
23  * it under the terms of the GNU General Public License as published by *
24  * the Free Software Foundation; either version 2 of the License, or    *
25  * (at your option) any later version.                                  *
26  *                                                                      *
27  * This program is distributed in the hope that it will be useful,      *
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
30  * GNU General Public License for more details.                         *
31  *                                                                      *
32  * You should have received a copy of the GNU General Public License    *
33  * along with this program; if not, write to the Free Software          *
34  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if ((!defined('__SECURITY')) || (!isAdmin())) {
40         die();
41 } // END - if
42
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
45
46 // Init SQL
47 $sql = "SELECT
48         `id`,
49         `sender`,
50         `subject`,
51         `text`,
52         `receivers`,
53         `payment_id`,
54         `data_type`,
55         `timestamp`,
56         `url`,
57         `target_send`,
58         `cat_id`
59 FROM
60         `{?_MYSQL_PREFIX?}_pool`
61 WHERE
62         `data_type`='SEND' OR `data_type`='DELETED'
63 ORDER BY
64         `timestamp` DESC";
65
66 // Check for maximum pages
67 $result_maximum = SQL_QUERY($sql, __FILE__, __LINE__);
68
69 // Set offset an current page to default values
70 if (!isGetRequestElementSet('page'))   setGetRequestElement('page'  , 1);
71 if (!isGetRequestElementSet('offset')) setGetRequestElement('offset', getMailsPage());
72
73 // Add limitation to SQL string
74 $sql .= ' LIMIT ' . (getRequestElement('offset') * getRequestElement('page') - getRequestElement('offset')) . ', ' . getRequestElement('offset');
75
76 // Run SQL query for normal mails
77 $result = SQL_QUERY($sql, __FILE__, __LINE__);
78
79 // Calculate pages
80 $numPages = round(SQL_NUMROWS($result_maximum) / getMailsPage() + 0.5);
81
82 // Free the result which we don't need
83 SQL_FREERESULT($result_maximum);
84
85 if (!SQL_HASZERONUMS($result)) {
86         // Mail orders are in pool so we can display them
87
88         // Add navigation table rows
89         $content['top_email_nav']    = addEmailNavigation($numPages, getMailsPage(), TRUE , 3, TRUE);
90         $content['bottom_email_nav'] = addEmailNavigation($numPages, getMailsPage(), FALSE, 3, TRUE);
91
92         // List all entries
93         $OUT = '';
94         while ($pool = SQL_FETCHARRAY($result)) {
95                 // Check sent mails and clicks
96                 $result_mails = SQL_QUERY_ESC("SELECT `max_rec`, `clicks` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1",
97                         array(bigintval($pool['id'])), __FILE__, __LINE__);
98
99                 // Load entries
100                 $pool = merge_array($pool, SQL_FETCHARRAY($result_mails));
101
102                 // Merge result
103                 SQL_FREERESULT($result_mails);
104
105                 // Unconfirmed mails
106                 $pool['unconfirmed'] = generateUnconfirmedAdminLink($pool['id'], ($pool['max_rec'] - $pool['clicks']), 'mid');
107
108                 // Prepare data for the row template
109                 $content['timestamp'] = generateDateTime($pool['timestamp'], 0);
110
111                 // Merge pool data with content
112                 $content = merge_array($content, $pool);
113
114                 // Load row template and switch colors
115                 $OUT .= loadTemplate('admin_email_archiv_row', TRUE, $content);
116         } // END - while
117
118         // Remmber generated rows in array
119         $content['rows'] = $OUT;
120
121         // Load main template
122         loadTemplate('admin_email_archiv', FALSE, $content);
123 } else {
124         // No mail orders fond
125         displayMessage('{--ADMIN_NO_MAILS_IN_POOL--}');
126 }
127
128 // Free memory
129 SQL_FREERESULT($result);
130
131 // [EOF]
132 ?>