Missing SVN properties set
[mailer.git] / inc / modules / admin / what-list_notifications.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 10/07/2008 *
4  * ===================                          Last change: 10/07/2008 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-list_notifications.php                      *
8  * -------------------------------------------------------------------- *
9  * Short description : See all notification emails (beg/active rallye)  *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Alle Benachrichtigungen sehen (Bettel-/Aktiv-R.) *
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 - 2009 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
39 // Some security stuff...
40 if ((!defined('__SECURITY')) || (!isAdmin())) {
41         die();
42 } // END - if
43
44 // Add description as navigation point
45 addMenuDescription('admin', __FILE__);
46
47 // Init variables
48 $SQL2 = '';
49 $result_max = false;
50
51 // Set offset an current page to default values
52 if (!isGetRequestElementSet('page'))   setRequestGetElement('page'  , 1);
53 if (!isGetRequestElementSet('offset')) setRequestGetElement('offset', getConfig('mails_page'));
54
55 if (isExtensionActive('bonus')) {
56         // Bonus mails sent by you
57         //               0     1       2        3        4      5       6          7       8      9         10          11        12
58         $SQL2 = "SELECT id, subject, text, receivers, points, time, data_type, timestamp, url, cat_id, target_send, mails_sent, clicks
59 FROM `{?_MYSQL_PREFIX?}_bonus`
60 WHERE is_notify='Y'
61 ORDER BY timestamp DESC";
62
63         // Check for maximum pages
64         $result_max = SQL_QUERY($SQL2, __FILE__, __LINE__);
65 } else {
66         // Bonus extension required!
67         loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_EXTENSION_PROBLEM_EXT_NOT_INSTALLED'), 'bonus'));
68 }
69
70 // Create limitation line
71 $add = " LIMIT ".(bigintval(getRequestElement('offset')) * bigintval(getRequestElement('page')) - bigintval(getRequestElement('offset'))).", ".bigintval(getRequestElement('offset'));
72
73 // Add limitation
74 if (!empty($SQL2)) $SQL2 .= $add;
75
76 if ((isExtensionActive('bonus')) && (SQL_NUMROWS($result_max) > 0) && (!empty($SQL2))) {
77         // Run SQL query for notification mails
78         $result_bonus = SQL_QUERY($SQL2, __FILE__, __LINE__);
79
80         // Load bonus mails only when extension is active
81         if (SQL_NUMROWS($result_bonus) > 0) {
82                 // Calculate pages
83                 $PAGES = round(SQL_NUMROWS($result_bonus) / getConfig('mails_page') + 0.5);
84
85                 // List emails
86                 $OUT = ''; $content = array();
87                 while ($bonus = SQL_FETCHARRAY($result_bonus)) {
88                         // Calculate unconfirmed emails
89                         $bonus['unconfirmed'] = $bonus['mails_sent'] - $bonus['clicks'];
90
91                         // Add link?
92                         if ($bonus['unconfirmed'] > 0) {
93                                 // Add link to list_unconfirmed what-file
94                                 $bonus['unconfirmed'] = "<strong><a href=\"{?URL?}/modules.php?module=admin&amp;what=list_unconfirmed&amp;bid=".$bonus['id']."\">".$bonus['unconfirmed']."</a></strong>";
95                         } // END - if
96
97                         // Prepare content
98                         $content = $bonus;
99                         $content['time']        = createFancyTime($content['time']);
100                         $content['category']    = getCategory($content['cat_id']);
101                         $content['receivers']   = convertReceivers($content['receivers']);
102                         $content['type']        = translatePoolType($content['data_type']);
103                         $content['frametester'] = generateFrametesterUrl($content['url']);
104                         $content['timestamp']   = generateDateTime($content['timestamp'], 0);
105
106                         // Load row template
107                         $OUT .= loadTemplate('admin_list_notify_emails_row', true, $content);
108                 }
109
110                 // Add navigation (without change box but with colspan=3)
111                 $content['nav'] = '';
112                 if ($PAGES > 1) $content['nav'] = addEmailNavigation($PAGES, getConfig('mails_page'), false, 3, true);
113
114                 // Prepare content
115                 $content['rows'] = $OUT;
116
117                 // Load main template
118                 loadTemplate('admin_list_notify_emails', false, $content);
119         }
120 } elseif ((SQL_NUMROWS($result_max) === 0) && (is_resource($result_max))) {
121         // No notifications found
122         loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NO_NOTIFICATIONS'));
123 }
124
125 // [EOF]
126 ?>