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 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
18 * This program is free software; you can redistribute it and/or modify *
19 * it under the terms of the GNU General Public License as published by *
20 * the Free Software Foundation; either version 2 of the License, or *
21 * (at your option) any later version. *
23 * This program is distributed in the hope that it will be useful, *
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
26 * GNU General Public License for more details. *
28 * You should have received a copy of the GNU General Public License *
29 * along with this program; if not, write to the Free Software *
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
32 ************************************************************************/
34 // Some security stuff...
35 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
36 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
40 // Add description as navigation point
41 ADD_DESCR("admin", __FILE__);
43 // Remove empty array index
44 if (!REQUEST_ISSET_POST(('max'))) REQUEST_UNSET_POST(('add_max'));
46 if (REQUEST_ISSET_POST(('add_max'))) {
48 $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value='%s' LIMIT 1",
49 array(bigintval(REQUEST_POST('max'))), __FILE__, __LINE__);
50 if (SQL_NUMROWS($result) == 0) {
51 // Add this value (including comment)
52 SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_max_receive` (value, comment) VALUES ('%s','%s')",
53 array(bigintval(REQUEST_POST('max')), REQUEST_POST('comment')),__FILE__, __LINE__);
54 $content = MAX_VALUE_SAVED;
56 // Value does alread exists!
57 $content = "<span class=\"admin_failed\">{--MAX_VALUE_ALREADY--}</span>";
61 SQL_FREERESULT($result);
64 LOAD_TEMPLATE("admin_settings_saved", false, $content);
65 } elseif ((IS_FORM_SENT()) && (REQUEST_ISSET_GET(('do')))) {
66 // Change or delete entries...
68 foreach (REQUEST_POST('id') as $id => $value) {
72 switch (REQUEST_GET('do'))
74 case "edit": // Change entries
75 SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_max_receive` SET value='%s', comment='%s' WHERE id=%s LIMIT 1",
77 bigintval(REQUEST_POST('val', $id)),
78 REQUEST_POST('comm', $id),
80 ),__FILE__, __LINE__);
81 $TEXT = MRECEIVE_SAVED;
85 SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE id=%s LIMIT 1",
86 array($id), __FILE__, __LINE__);
87 $TEXT = MRECEIVE_DELETED;
94 LOAD_TEMPLATE("admin_settings_saved", false, $TEXT);
96 } elseif ((REQUEST_ISSET_POST(('del'))) && ((SELECTION_COUNT(REQUEST_POST('sel')) > 0) || (REQUEST_ISSET_POST(('sel', 0))))) {
99 foreach (REQUEST_POST('sel') as $id => $value)
102 $result = SQL_QUERY_ESC("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE id=%s LIMIT 1",
103 array(bigintval($id)), __FILE__, __LINE__);
104 list($value, $comment) = SQL_FETCHROW($result);
105 SQL_FREERESULT($result);
107 // Prepare data for the row template
112 'comment' => $comment,
115 // Load row template and switch color
116 $OUT .= LOAD_TEMPLATE("admin_config_email_del_row", true, $content);
119 define('__ROWS', $OUT);
121 // Load main template
122 LOAD_TEMPLATE("admin_config_email_del");
123 } elseif ((REQUEST_ISSET_POST(('edit'))) && ((SELECTION_COUNT(REQUEST_POST('sel')) > 0) || (REQUEST_ISSET_POST(('sel', 0))))) {
126 foreach (REQUEST_POST('sel') as $id => $value) {
128 $result = SQL_QUERY_ESC("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE id=%s LIMIT 1",
129 array(bigintval($id)), __FILE__, __LINE__);
130 list($value, $comment) = SQL_FETCHROW($result);
131 SQL_FREERESULT($result);
133 // Prepare data for the row template
138 'comment' => $comment,
141 // Load row template and switch color
142 $OUT .= LOAD_TEMPLATE("admin_config_email_edit_row", true, $content);
145 define('__ROWS', $OUT);
147 // Load main template
148 LOAD_TEMPLATE("admin_config_email_edit");
150 $result = SQL_QUERY("SELECT id, value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` ORDER BY value", __FILE__, __LINE__);
151 if (SQL_NUMROWS($result) > 0) {
152 // List already existing entries for editing
154 while (list($id, $value, $comment) = SQL_FETCHROW($result)) {
155 // Prepare data for the row template
160 'comment' => $comment,
163 // Load row template and switch color
164 $OUT .= LOAD_TEMPLATE("admin_config_email_row", true, $content);
169 SQL_FREERESULT($result);
170 define('__ROWS', $OUT);
172 // Load main template
173 LOAD_TEMPLATE("admin_config_email");
177 LOAD_TEMPLATE("admin_add_max");