2 /************************************************************************
\r
3 * MXChange v0.2.1 Start: 10/11/2003 *
\r
4 * =============== Last change: 07/04/2004 *
\r
6 * -------------------------------------------------------------------- *
\r
7 * File : what-config_emails.php *
\r
8 * -------------------------------------------------------------------- *
\r
9 * Short description : Edit all things around email and sending *
\r
10 * -------------------------------------------------------------------- *
\r
11 * Kurzbeschreibung : �ndern aller Email-Einstellungen *
\r
12 * -------------------------------------------------------------------- *
\r
14 * -------------------------------------------------------------------- *
\r
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
\r
16 * For more information visit: http://www.mxchange.org *
\r
18 * This program is free software; you can redistribute it and/or modify *
\r
19 * it under the terms of the GNU General Public License as published by *
\r
20 * the Free Software Foundation; either version 2 of the License, or *
\r
21 * (at your option) any later version. *
\r
23 * This program is distributed in the hope that it will be useful, *
\r
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
\r
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
\r
26 * GNU General Public License for more details. *
\r
28 * You should have received a copy of the GNU General Public License *
\r
29 * along with this program; if not, write to the Free Software *
\r
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
\r
31 * MA 02110-1301 USA *
\r
32 ************************************************************************/
\r
34 // Some security stuff...
\r
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
\r
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
\r
40 // Add description as navigation point
\r
41 ADD_DESCR("admin", basename(__FILE__));
\r
43 OPEN_TABLE("100%", "admin_content admin_content_align", "");
\r
44 if (empty($_POST['max'])) unset($_POST['add_max']);
\r
45 if (isset($_POST['add_max']))
\r
47 // Save all settings
\r
48 $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_max_receive WHERE value='%s' LIMIT 1",
\r
49 array(bigintval($_POST['max'])), __FILE__, __LINE__);
\r
50 if (SQL_NUMROWS($result) == 0)
\r
52 // Add this value (including comment)
\r
53 $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_max_receive (value, comment) VALUES ('%s', '%s')",
\r
54 array(bigintval($_POST['max']), stripslashes($_POST['comment'])),__FILE__, __LINE__);
\r
55 $content = "<SPAN class=\"admin_done\">".MAX_VALUE_SAVED."</SPAN>";
\r
60 SQL_FREERESULT($result);
\r
62 // Value does alread exists!
\r
63 $content = "<SPAN class=\"admin_failed\">".MAX_VALUE_ALREADY."</SPAN>";
\r
67 LOAD_TEMPLATE("admin_settings_saved", false, $content);
\r
69 elseif ((isset($_POST['ok'])) && (isset($_GET['do'])))
\r
71 // Change or delete entries...
\r
73 foreach ($_POST['id'] as $id=>$value)
\r
76 $id = bigintval($id);
\r
78 switch ($_GET['do'])
\r
80 case "edit": // Change entries
\r
81 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_max_receive SET value='%s', comment='%s' WHERE id=%d LIMIT 1",
\r
82 array(bigintval($_POST['val'][$id]), $_POST['comm'][$id], $id),__FILE__, __LINE__);
\r
83 $TEXT = MRECEIVE_SAVED;
\r
87 $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_max_receive WHERE id=%d LIMIT 1",
\r
88 array($id), __FILE__, __LINE__);
\r
89 $TEXT = MRECEIVE_DELETED;
\r
96 LOAD_TEMPLATE("admin_settings_saved", false, $TEXT);
\r
99 elseif ((isset($_POST['del'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0]))))
\r
102 $SW = 2; $OUT = "";
\r
103 foreach ($_POST['sel'] as $id=>$value)
\r
106 $result = SQL_QUERY_ESC("SELECT value, comment FROM "._MYSQL_PREFIX."_max_receive WHERE id=%d LIMIT 1",
\r
107 array(bigintval($id)), __FILE__, __LINE__);
\r
108 list($value, $comment) = SQL_FETCHROW($result);
\r
109 SQL_FREERESULT($result);
\r
111 // Prepare data for the row template
\r
116 'comment' => $comment,
\r
119 // Load row template and switch color
\r
120 $OUT .= LOAD_TEMPLATE("admin_config_email_del_row", true, $content);
\r
123 define('__ROWS', $OUT);
\r
125 // Load main template
\r
126 LOAD_TEMPLATE("admin_config_email_del");
\r
128 elseif ((isset($_POST['edit'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0]))))
\r
131 $SW = 2; $OUT = "";
\r
132 foreach ($_POST['sel'] as $id=>$value)
\r
135 $result = SQL_QUERY_ESC("SELECT value, comment FROM "._MYSQL_PREFIX."_max_receive WHERE id=%d LIMIT 1",
\r
136 array(bigintval($id)), __FILE__, __LINE__);
\r
137 list($value, $comment) = SQL_FETCHROW($result);
\r
138 SQL_FREERESULT($result);
\r
140 // Prepare data for the row template
\r
145 'comment' => $comment,
\r
148 // Load row template and switch color
\r
149 $OUT .= LOAD_TEMPLATE("admin_config_email_edit_row", true, $content);
\r
152 define('__ROWS', $OUT);
\r
154 // Load main template
\r
155 LOAD_TEMPLATE("admin_config_email_edit");
\r
159 $result = SQL_QUERY("SELECT id, value, comment FROM "._MYSQL_PREFIX."_max_receive ORDER BY value", __FILE__, __LINE__);
\r
160 if (SQL_NUMROWS($result) > 0)
\r
162 // List already existing entries for editing
\r
163 $SW = 2; $OUT = "";
\r
164 while (list($id, $value, $comment) = SQL_FETCHROW($result))
\r
166 // Prepare data for the row template
\r
171 'comment' => $comment,
\r
174 // Load row template and switch color
\r
175 $OUT .= LOAD_TEMPLATE("admin_config_email_row", true, $content);
\r
180 SQL_FREERESULT($result);
\r
181 define('__ROWS', $OUT);
\r
183 // Load main template
\r
184 LOAD_TEMPLATE("admin_config_email");
\r
188 LOAD_TEMPLATE("admin_add_max");
\r