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", basename(__FILE__));
43 // Remove empty array index
44 if (empty($_POST['max'])) unset($_POST['add_max']);
46 if (isset($_POST['add_max'])) {
48 $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_max_receive WHERE value='%s' LIMIT 1",
49 array(bigintval($_POST['max'])), __FILE__, __LINE__);
50 if (SQL_NUMROWS($result) == 0) {
51 // Add this value (including comment)
52 $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_max_receive (value, comment) VALUES ('%s', '%s')",
53 array(bigintval($_POST['max']), $_POST['comment']),__FILE__, __LINE__);
54 $content = "<SPAN class=\"admin_done\">".MAX_VALUE_SAVED."</SPAN>";
57 SQL_FREERESULT($result);
59 // Value does alread exists!
60 $content = "<SPAN class=\"admin_failed\">".MAX_VALUE_ALREADY."</SPAN>";
64 LOAD_TEMPLATE("admin_settings_saved", false, $content);
65 } elseif ((isset($_POST['ok'])) && (isset($_GET['do']))) {
66 // Change or delete entries...
68 foreach ($_POST['id'] as $id => $value) {
74 case "edit": // Change entries
75 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_max_receive SET value='%s', comment='%s' WHERE id=%s LIMIT 1",
76 array(bigintval($_POST['val'][$id]), $_POST['comm'][$id], $id),__FILE__, __LINE__);
77 $TEXT = MRECEIVE_SAVED;
81 $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_max_receive WHERE id=%s LIMIT 1",
82 array($id), __FILE__, __LINE__);
83 $TEXT = MRECEIVE_DELETED;
90 LOAD_TEMPLATE("admin_settings_saved", false, $TEXT);
92 } elseif ((isset($_POST['del'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0])))) {
95 foreach ($_POST['sel'] as $id => $value)
98 $result = SQL_QUERY_ESC("SELECT value, comment FROM "._MYSQL_PREFIX."_max_receive WHERE id=%s LIMIT 1",
99 array(bigintval($id)), __FILE__, __LINE__);
100 list($value, $comment) = SQL_FETCHROW($result);
101 SQL_FREERESULT($result);
103 // Prepare data for the row template
108 'comment' => $comment,
111 // Load row template and switch color
112 $OUT .= LOAD_TEMPLATE("admin_config_email_del_row", true, $content);
115 define('__ROWS', $OUT);
117 // Load main template
118 LOAD_TEMPLATE("admin_config_email_del");
119 } elseif ((isset($_POST['edit'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0])))) {
122 foreach ($_POST['sel'] as $id => $value) {
124 $result = SQL_QUERY_ESC("SELECT value, comment FROM "._MYSQL_PREFIX."_max_receive WHERE id=%s LIMIT 1",
125 array(bigintval($id)), __FILE__, __LINE__);
126 list($value, $comment) = SQL_FETCHROW($result);
127 SQL_FREERESULT($result);
129 // Prepare data for the row template
134 'comment' => $comment,
137 // Load row template and switch color
138 $OUT .= LOAD_TEMPLATE("admin_config_email_edit_row", true, $content);
141 define('__ROWS', $OUT);
143 // Load main template
144 LOAD_TEMPLATE("admin_config_email_edit");
146 $result = SQL_QUERY("SELECT id, value, comment FROM "._MYSQL_PREFIX."_max_receive ORDER BY value", __FILE__, __LINE__);
147 if (SQL_NUMROWS($result) > 0) {
148 // List already existing entries for editing
150 while (list($id, $value, $comment) = SQL_FETCHROW($result)) {
151 // Prepare data for the row template
156 'comment' => $comment,
159 // Load row template and switch color
160 $OUT .= LOAD_TEMPLATE("admin_config_email_row", true, $content);
165 SQL_FREERESULT($result);
166 define('__ROWS', $OUT);
168 // Load main template
169 LOAD_TEMPLATE("admin_config_email");
173 LOAD_TEMPLATE("admin_add_max");