A lot texts rewritten and exclamation signs removed
[mailer.git] / inc / modules / admin / what-config_email.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 10/11/2003 *
4  * ===============                              Last change: 07/04/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-config_emails.php                           *
8  * -------------------------------------------------------------------- *
9  * Short description : Edit all things around email and sending         *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Aendern aller Email-Einstellungen                *
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 }
43
44 // Add description as navigation point
45 addMenuDescription('admin', __FILE__);
46
47 // Remove empty array index
48 if (!isPostRequestElementSet(('max'))) unsetPostRequestElement(('add_max'));
49
50 if (isPostRequestElementSet(('add_max'))) {
51         // Save all settings
52         $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE value='%s' LIMIT 1",
53         array(bigintval(postRequestElement('max'))), __FILE__, __LINE__);
54         if (SQL_NUMROWS($result) == 0) {
55                 // Add this value (including comment)
56                 SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_max_receive` (value, comment) VALUES ('%s','%s')",
57                 array(bigintval(postRequestElement('max')), postRequestElement('comment')),__FILE__, __LINE__);
58                 $content = getMessage('MAX_VALUE_SAVED');
59         } else {
60                 // Value does alread exists!
61                 $content = "<span class=\"admin_failed\">{--MAX_VALUE_ALREADY--}</span>";
62         }
63
64         // Free memory
65         SQL_FREERESULT($result);
66
67         // Display message
68         loadTemplate('admin_settings_saved', false, $content);
69 } elseif ((isFormSent()) && (isGetRequestElementSet('do'))) {
70         // Change or delete entries...
71         $TEXT = '';
72         foreach (postRequestElement('id') as $id => $value) {
73                 // Secure id
74                 $id = bigintval($id);
75
76                 switch (getRequestElement('do'))
77                 {
78                         case 'edit': // Change entries
79                                 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_max_receive` SET value='%s', comment='%s' WHERE `id`=%s LIMIT 1",
80                                 array(
81                                         bigintval(postRequestElement('val', $id)),
82                                         postRequestElement('comm', $id),
83                                         $id
84                                 ),__FILE__, __LINE__);
85                                 $TEXT = getMessage('MRECEIVE_SAVED');
86                                 break;
87
88                         case 'del':
89                                 SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1",
90                                         array($id), __FILE__, __LINE__);
91                                 $TEXT = getMessage('MRECEIVE_DELETED');
92                                 break;
93                 }
94         }
95
96         if (isset($TEXT)) {
97                 // Display message
98                 loadTemplate('admin_settings_saved', false, $TEXT);
99         } // END - if
100 } elseif ((isPostRequestElementSet('del')) && (countPostSelection() > 0)) {
101         // Delete entries
102         $OUT = ''; $SW = 2;
103         foreach (postRequestElement('sel') as $id => $value) {
104                 // Load data
105                 $result = SQL_QUERY_ESC("SELECT value, comment FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1",
106                 array(bigintval($id)), __FILE__, __LINE__);
107                 list($value, $comment) = SQL_FETCHROW($result);
108                 SQL_FREERESULT($result);
109
110                 // Prepare data for the row template
111                 $content = array(
112                         'sw'      => $SW,
113                         'id'      => $id,
114                         'value'   => $value,
115                         'comment' => $comment,
116                 );
117
118                 // Load row template and switch color
119                 $OUT .= loadTemplate('admin_config_email_del_row', true, $content);
120                 $SW = 3 - $SW;
121         }
122         $content['rows'] = $OUT;
123
124         // Load main template
125         loadTemplate('admin_config_email_del', false, $content);
126 } elseif ((isPostRequestElementSet('edit')) && (countPostSelection() > 0)) {
127         // Edit entries
128         $OUT = ''; $SW = 2;
129         foreach (postRequestElement('sel') as $id => $value) {
130                 // Load data
131                 $result = SQL_QUERY_ESC("SELECT value, comment FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1",
132                 array(bigintval($id)), __FILE__, __LINE__);
133                 list($value, $comment) = SQL_FETCHROW($result);
134                 SQL_FREERESULT($result);
135
136                 // Prepare data for the row template
137                 $content = array(
138                         'sw'      => $SW,
139                         'id'      => $id,
140                         'value'   => $value,
141                         'comment' => $comment,
142                 );
143
144                 // Load row template and switch color
145                 $OUT .= loadTemplate('admin_config_email_edit_row', true, $content);
146                 $SW = 3 - $SW;
147         }
148         $content['rows'] = $OUT;
149
150         // Load main template
151         loadTemplate('admin_config_email_edit', false, $content);
152 } else {
153         $result = SQL_QUERY("SELECT `id`, `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` ORDER BY `value` ASC",
154         __FILE__, __LINE__);
155         if (SQL_NUMROWS($result) > 0) {
156                 // List already existing entries for editing
157                 $OUT = ''; $SW = 2;
158                 while ($content = SQL_FETCHARRAY($result)) {
159                         // Prepare data for the row template
160                         $content['sw'] = $SW;
161
162                         // Load row template and switch color
163                         $OUT .= loadTemplate('admin_config_email_row', true, $content);
164                         $SW = 3 - $SW;
165                 } // END - while
166
167                 // Free memory
168                 SQL_FREERESULT($result);
169                 $content['rows'] = $OUT;
170
171                 // Load main template
172                 loadTemplate('admin_config_email', false, $content);
173         } // END - if
174
175         // Display form
176         loadTemplate('admin_add_max');
177 }
178
179 // [EOF]
180 ?>