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 ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
37 $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 OPEN_TABLE("100%", "admin_content admin_content_align", "");
44 if (empty($_POST['max'])) unset($_POST['add_max']);
45 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)
52 // Add this value (including comment)
53 $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_max_receive (value, comment) VALUES ('%s', '%s')",
54 array(bigintval($_POST['max']), $_POST['comment']),__FILE__, __LINE__);
55 $content = "<SPAN class=\"admin_done\">".MAX_VALUE_SAVED."</SPAN>";
60 SQL_FREERESULT($result);
62 // Value does alread exists!
63 $content = "<SPAN class=\"admin_failed\">".MAX_VALUE_ALREADY."</SPAN>";
67 LOAD_TEMPLATE("admin_settings_saved", false, $content);
69 elseif ((isset($_POST['ok'])) && (isset($_GET['do'])))
71 // Change or delete entries...
73 foreach ($_POST['id'] as $id=>$value)
80 case "edit": // Change entries
81 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_max_receive SET value='%s', comment='%s' WHERE id=%d LIMIT 1",
82 array(bigintval($_POST['val'][$id]), $_POST['comm'][$id], $id),__FILE__, __LINE__);
83 $TEXT = MRECEIVE_SAVED;
87 $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_max_receive WHERE id=%d LIMIT 1",
88 array($id), __FILE__, __LINE__);
89 $TEXT = MRECEIVE_DELETED;
96 LOAD_TEMPLATE("admin_settings_saved", false, $TEXT);
99 elseif ((isset($_POST['del'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0]))))
103 foreach ($_POST['sel'] as $id=>$value)
106 $result = SQL_QUERY_ESC("SELECT value, comment FROM "._MYSQL_PREFIX."_max_receive WHERE id=%d LIMIT 1",
107 array(bigintval($id)), __FILE__, __LINE__);
108 list($value, $comment) = SQL_FETCHROW($result);
109 SQL_FREERESULT($result);
111 // Prepare data for the row template
116 'comment' => $comment,
119 // Load row template and switch color
120 $OUT .= LOAD_TEMPLATE("admin_config_email_del_row", true, $content);
123 define('__ROWS', $OUT);
125 // Load main template
126 LOAD_TEMPLATE("admin_config_email_del");
128 elseif ((isset($_POST['edit'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0]))))
132 foreach ($_POST['sel'] as $id=>$value)
135 $result = SQL_QUERY_ESC("SELECT value, comment FROM "._MYSQL_PREFIX."_max_receive WHERE id=%d LIMIT 1",
136 array(bigintval($id)), __FILE__, __LINE__);
137 list($value, $comment) = SQL_FETCHROW($result);
138 SQL_FREERESULT($result);
140 // Prepare data for the row template
145 'comment' => $comment,
148 // Load row template and switch color
149 $OUT .= LOAD_TEMPLATE("admin_config_email_edit_row", true, $content);
152 define('__ROWS', $OUT);
154 // Load main template
155 LOAD_TEMPLATE("admin_config_email_edit");
159 $result = SQL_QUERY("SELECT id, value, comment FROM "._MYSQL_PREFIX."_max_receive ORDER BY value", __FILE__, __LINE__);
160 if (SQL_NUMROWS($result) > 0)
162 // List already existing entries for editing
164 while (list($id, $value, $comment) = SQL_FETCHROW($result))
166 // Prepare data for the row template
171 'comment' => $comment,
174 // Load row template and switch color
175 $OUT .= LOAD_TEMPLATE("admin_config_email_row", true, $content);
180 SQL_FREERESULT($result);
181 define('__ROWS', $OUT);
183 // Load main template
184 LOAD_TEMPLATE("admin_config_email");
188 LOAD_TEMPLATE("admin_add_max");