2 /************************************************************************
3 * MXChange v0.2.1 Start: 10/11/2003 *
4 * =============== Last change: 07/04/2004 *
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 * -------------------------------------------------------------------- *
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 - 2009 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 ************************************************************************/
39 // Some security stuff...
40 if ((!defined('__SECURITY')) || (!isAdmin())) {
44 // Add description as navigation point
45 addMenuDescription('admin', __FILE__);
47 // Remove empty array index
48 if (!isPostRequestElementSet(('max'))) unsetPostRequestElement(('add_max'));
50 if (isPostRequestElementSet(('add_max'))) {
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');
60 // Value does alread exists!
61 $content = "<span class=\"admin_failed\">{--MAX_VALUE_ALREADY--}</span>";
65 SQL_FREERESULT($result);
68 loadTemplate('admin_settings_saved', false, $content);
69 } elseif ((isFormSent()) && (isGetRequestElementSet('do'))) {
70 // Change or delete entries...
72 foreach (postRequestElement('id') as $id => $value) {
76 switch (getRequestElement('do'))
78 case 'edit': // Change entries
79 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_max_receive` SET value='%s', comment='%s' WHERE `id`=%s LIMIT 1",
81 bigintval(postRequestElement('val', $id)),
82 postRequestElement('comm', $id),
84 ),__FILE__, __LINE__);
85 $TEXT = getMessage('MRECEIVE_SAVED');
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');
98 loadTemplate('admin_settings_saved', false, $TEXT);
100 } elseif ((isPostRequestElementSet('del')) && (countPostSelection() > 0)) {
103 foreach (postRequestElement('sel') as $id => $value) {
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);
110 // Prepare data for the row template
115 'comment' => $comment,
118 // Load row template and switch color
119 $OUT .= loadTemplate('admin_config_email_del_row', true, $content);
122 $content['rows'] = $OUT;
124 // Load main template
125 loadTemplate('admin_config_email_del', false, $content);
126 } elseif ((isPostRequestElementSet('edit')) && (countPostSelection() > 0)) {
129 foreach (postRequestElement('sel') as $id => $value) {
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);
136 // Prepare data for the row template
141 'comment' => $comment,
144 // Load row template and switch color
145 $OUT .= loadTemplate('admin_config_email_edit_row', true, $content);
148 $content['rows'] = $OUT;
150 // Load main template
151 loadTemplate('admin_config_email_edit', false, $content);
153 $result = SQL_QUERY("SELECT `id`, `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` ORDER BY `value` ASC",
155 if (SQL_NUMROWS($result) > 0) {
156 // List already existing entries for editing
158 while ($content = SQL_FETCHARRAY($result)) {
159 // Prepare data for the row template
160 $content['sw'] = $SW;
162 // Load row template and switch color
163 $OUT .= loadTemplate('admin_config_email_row', true, $content);
168 SQL_FREERESULT($result);
169 $content['rows'] = $OUT;
171 // Load main template
172 loadTemplate('admin_config_email', false, $content);
176 loadTemplate('admin_add_max');