2 /************************************************************************
3 * Mailer v0.2.1-FINAL 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 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009, 2010 by Mailer Developer Team *
20 * For more information visit: http://www.mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if ((!defined('__SECURITY')) || (!isAdmin())) {
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
46 // Remove empty array index
47 if (!isPostRequestParameterSet('max')) unsetPostRequestParameter('add_max');
49 if (isPostRequestParameterSet('add_max')) {
51 $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE value='%s' LIMIT 1",
52 array(bigintval(postRequestParameter('max'))), __FILE__, __LINE__);
53 if (SQL_HASZERONUMS($result)) {
54 // Add this value (including comment)
55 SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_max_receive` (`value`, `comment`) VALUES ('%s','%s')",
56 array(bigintval(postRequestParameter('max')), postRequestParameter('comment')),__FILE__, __LINE__);
57 $content = '{--ADMIN_MAX_VALUE_SAVED--}';
59 // Value does alread exists!
60 $content = '<span class="notice">{--ADMIN_MAX_VALUE_ALREADY--}</span>';
64 SQL_FREERESULT($result);
67 loadTemplate('admin_settings_saved', false, $content);
68 } elseif ((isFormSent()) && (isGetRequestParameterSet('do'))) {
69 // Change or delete entries...
71 foreach (postRequestParameter('id') as $id => $value) {
75 switch (getRequestParameter('do'))
77 case 'edit': // Change entries
78 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_max_receive` SET value='%s', comment='%s' WHERE `id`=%s LIMIT 1",
80 bigintval(postRequestParameter('val', $id)),
81 postRequestParameter('comm', $id),
83 ),__FILE__, __LINE__);
84 $TEXT = '{--ADMIN_MAX_RECEIVE_SAVED--}';
88 SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1",
89 array($id), __FILE__, __LINE__);
90 $TEXT = '{--ADMIN_MAX_RECEIVE_DELETED--}';
97 loadTemplate('admin_settings_saved', false, $TEXT);
99 } elseif ((isFormSent('delete')) && (ifPostContainsSelections())) {
102 foreach (postRequestParameter('sel') as $id => $value) {
104 $result = SQL_QUERY_ESC("SELECT `id`, `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1",
105 array(bigintval($id)), __FILE__, __LINE__);
106 $content = SQL_FETCHARRAY($result);
107 SQL_FREERESULT($result);
109 // Load row template and switch color
110 $OUT .= loadTemplate('admin_config_email_del_row', true, $content);
112 $content['rows'] = $OUT;
114 // Load main template
115 loadTemplate('admin_config_email_del', false, $content);
116 } elseif ((isFormSent('edit')) && (ifPostContainsSelections())) {
119 foreach (postRequestParameter('sel') as $id => $value) {
121 $result = SQL_QUERY_ESC("SELECT `id`, `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1",
122 array(bigintval($id)), __FILE__, __LINE__);
123 $content = SQL_FETCHARRAY($result);
124 SQL_FREERESULT($result);
126 // Load row template and switch color
127 $OUT .= loadTemplate('admin_config_email_edit_row', true, $content);
129 $content['rows'] = $OUT;
131 // Load main template
132 loadTemplate('admin_config_email_edit', false, $content);
134 $result = SQL_QUERY("SELECT `id`, `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` ORDER BY `value` ASC",
136 if (!SQL_HASZERONUMS($result)) {
137 // List already existing entries for editing
139 while ($content = SQL_FETCHARRAY($result)) {
140 // Load row template and switch color
141 $OUT .= loadTemplate('admin_config_email_row', true, $content);
145 SQL_FREERESULT($result);
146 $content['rows'] = $OUT;
148 // Load main template
149 loadTemplate('admin_config_email', false, $content);
153 loadTemplate('admin_add_max');