1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category module
|
5
|
* @package Form
|
6
|
* @author WebsiteBaker Project
|
7
|
* @copyright 2004-2009, Ryan Djurovich
|
8
|
* @copyright 2009-2011, Website Baker Org. e.V.
|
9
|
* @link http://www.websitebaker2.org/
|
10
|
* @license http://www.gnu.org/licenses/gpl.html
|
11
|
* @platform WebsiteBaker 2.8.x
|
12
|
* @requirements PHP 5.2.2 and higher
|
13
|
* @version $Id: modify_settings.php 1457 2011-06-25 17:18:50Z Luisehahne $
|
14
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/tags/2.8.2/wb/modules/form/modify_settings.php $
|
15
|
* @lastmodified $Date: 2011-06-25 19:18:50 +0200 (Sat, 25 Jun 2011) $
|
16
|
* @description
|
17
|
*/
|
18
|
|
19
|
require('../../config.php');
|
20
|
|
21
|
$print_info_banner = true;
|
22
|
// Tells script to update when this page was last updated
|
23
|
$update_when_modified = false;
|
24
|
// Include WB admin wrapper script
|
25
|
require(WB_PATH.'/modules/admin.php');
|
26
|
|
27
|
// include core functions of WB 2.7 to edit the optional module CSS files (frontend.css, backend.css)
|
28
|
@include_once(WB_PATH .'/framework/module.functions.php');
|
29
|
|
30
|
// load module language file
|
31
|
$lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
|
32
|
require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
|
33
|
|
34
|
// Get header and footer
|
35
|
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
|
36
|
$setting = $query_content->fetchRow();
|
37
|
|
38
|
// Set raw html <'s and >'s to be replace by friendly html code
|
39
|
$raw = array('<', '>');
|
40
|
$friendly = array('<', '>');
|
41
|
/*
|
42
|
// check if backend.css file needs to be included into the <body></body> of modify.php
|
43
|
if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH ."/modules/form/backend.css")) {
|
44
|
echo '<style type="text/css">';
|
45
|
include(WB_PATH .'/modules/form/backend.css');
|
46
|
echo "\n</style>\n";
|
47
|
}
|
48
|
*/
|
49
|
?>
|
50
|
<h2><?php echo $MOD_FORM['SETTINGS']; ?></h2>
|
51
|
<?php
|
52
|
// include the button to edit the optional module CSS files
|
53
|
// Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css")
|
54
|
// Place this call outside of any <form></form> construct!!!
|
55
|
if(function_exists('edit_module_css')) {
|
56
|
edit_module_css('form');
|
57
|
}
|
58
|
?>
|
59
|
|
60
|
<form name="edit" action="<?php echo WB_URL; ?>/modules/form/save_settings.php" method="post" style="margin: 0;">
|
61
|
|
62
|
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
|
63
|
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
|
64
|
<?php echo $admin->getFTAN(); ?>
|
65
|
|
66
|
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
|
67
|
<tr>
|
68
|
<td colspan="2"><strong><?php echo $HEADING['GENERAL_SETTINGS']; ?></strong></td>
|
69
|
</tr>
|
70
|
<tr>
|
71
|
<td class="setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td>
|
72
|
<td>
|
73
|
<input type="radio" name="use_captcha" id="use_captcha_true" value="1"<?php if($setting['use_captcha'] == true) { echo ' checked="checked"'; } ?> />
|
74
|
<label for="use_captcha_true"><?php echo $TEXT['ENABLED']; ?></label>
|
75
|
<input type="radio" name="use_captcha" id="use_captcha_false" value="0"<?php if($setting['use_captcha'] == false) { echo ' checked="checked"'; } ?> />
|
76
|
<label for="use_captcha_false"><?php echo $TEXT['DISABLED']; ?></label>
|
77
|
</td>
|
78
|
</tr>
|
79
|
<tr>
|
80
|
<td class="setting_name"><?php echo $TEXT['MAX_SUBMISSIONS_PER_HOUR']; ?>:</td>
|
81
|
<td class="setting_value">
|
82
|
<input type="text" name="max_submissions" style="width: 30px;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['max_submissions'])); ?>" />
|
83
|
</td>
|
84
|
</tr>
|
85
|
<tr>
|
86
|
<td class="setting_name"><?php echo $TEXT['SUBMISSIONS_STORED_IN_DATABASE']; ?>:</td>
|
87
|
<td class="setting_value">
|
88
|
<input type="text" name="stored_submissions" style="width: 30px;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['stored_submissions'])); ?>" />
|
89
|
</td>
|
90
|
</tr>
|
91
|
<tr>
|
92
|
<td class="setting_name"><?php echo $TEXT['HEADER']; ?>:</td>
|
93
|
<td class="setting_value">
|
94
|
<textarea name="header" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo ($setting['header']); ?></textarea>
|
95
|
</td>
|
96
|
</tr>
|
97
|
<tr>
|
98
|
<td class="setting_name"><?php echo $TEXT['FIELD'].' '.$TEXT['LOOP']; ?>:</td>
|
99
|
<td class="setting_value">
|
100
|
<textarea name="field_loop" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo ($setting['field_loop']); ?></textarea>
|
101
|
</td>
|
102
|
</tr>
|
103
|
<tr>
|
104
|
<td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td>
|
105
|
<td class="setting_value">
|
106
|
<textarea name="footer" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($setting['footer'])); ?></textarea>
|
107
|
</td>
|
108
|
</tr>
|
109
|
</table>
|
110
|
|
111
|
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;">
|
112
|
<tr>
|
113
|
<td colspan="2"><strong><?php echo $TEXT['EMAIL'].' '.$TEXT['SETTINGS']; ?></strong></td>
|
114
|
</tr>
|
115
|
<tr>
|
116
|
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TO']; ?>:</td>
|
117
|
<td class="setting_value">
|
118
|
<input type="text" name="email_to" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['email_to'])); ?>" />
|
119
|
</td>
|
120
|
</tr>
|
121
|
<tr>
|
122
|
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['FROM']; ?>:</td>
|
123
|
<td class="setting_value">
|
124
|
<select name="email_from_field" style="width: 98%;">
|
125
|
<option value="" onclick="javascript: document.getElementById('email_from').style.display = 'block';"><?php echo $TEXT['CUSTOM']; ?>:</option>
|
126
|
<?php
|
127
|
$email_from_value = str_replace($raw, $friendly, ($setting['email_from']));
|
128
|
$query_email_fields = $database->query("SELECT field_id,title FROM ".TABLE_PREFIX."mod_form_fields WHERE section_id = '$section_id' AND ( type = 'textfield' OR type = 'email' ) ORDER BY position ASC");
|
129
|
if($query_email_fields->numRows() > 0) {
|
130
|
while($field = $query_email_fields->fetchRow()) {
|
131
|
?>
|
132
|
<option value="field<?php echo $field['field_id']; ?>"<?php if($email_from_value == 'field'.$field['field_id']) { echo ' selected'; $selected = true; } ?> onclick="javascript: document.getElementById('email_from').style.display = 'none';">
|
133
|
<?php echo $TEXT['FIELD'].': '.$field['title']; ?>
|
134
|
</option>
|
135
|
<?php
|
136
|
}
|
137
|
}
|
138
|
?>
|
139
|
</select>
|
140
|
<input type="text" name="email_from" id="email_from" style="width: 98%; display: <?php if(isset($selected) AND $selected == true) { echo 'none'; } else { echo 'block'; } ?>;" maxlength="255" value="<?php if(substr($email_from_value, 0, 5) != 'field') { echo $email_from_value; } ?>" />
|
141
|
</td>
|
142
|
</tr>
|
143
|
<tr>
|
144
|
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['NAME']; ?>:</td>
|
145
|
<td class="setting_value">
|
146
|
<input type="text" name="email_fromname" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['email_fromname'])); ?>" />
|
147
|
</td>
|
148
|
</tr>
|
149
|
<tr>
|
150
|
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
|
151
|
<td class="setting_value">
|
152
|
<input type="text" name="email_subject" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['email_subject'])); ?>" />
|
153
|
</td>
|
154
|
</tr>
|
155
|
</table>
|
156
|
|
157
|
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;">
|
158
|
<tr>
|
159
|
<td colspan="2"><strong><?php echo $TEXT['SUCCESS'].' '.$TEXT['SETTINGS']; ?></strong></td>
|
160
|
</tr>
|
161
|
<tr>
|
162
|
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TO']; ?>:</td>
|
163
|
<td class="setting_value">
|
164
|
<select name="success_email_to" style="width: 98%;">
|
165
|
<option value="" onclick="javascript: document.getElementById('success_email_to').style.display = 'block';"><?php echo $TEXT['NONE']; ?></option>
|
166
|
<?php
|
167
|
$success_email_to = str_replace($raw, $friendly, ($setting['success_email_to']));
|
168
|
$query_email_fields = $database->query("SELECT field_id,title FROM ".TABLE_PREFIX."mod_form_fields WHERE section_id = '$section_id' AND ( type = 'textfield' OR type = 'email' ) ORDER BY position ASC");
|
169
|
if($query_email_fields->numRows() > 0) {
|
170
|
while($field = $query_email_fields->fetchRow()) {
|
171
|
?>
|
172
|
<option value="field<?php echo $field['field_id']; ?>"<?php if($success_email_to == 'field'.$field['field_id']) { echo ' selected'; $selected = true; } ?> onclick="javascript: document.getElementById('email_from').style.display = 'none';">
|
173
|
<?php echo $TEXT['FIELD'].': '.$field['title']; ?>
|
174
|
</option>
|
175
|
<?php
|
176
|
}
|
177
|
}
|
178
|
?>
|
179
|
</select>
|
180
|
</td>
|
181
|
</tr>
|
182
|
<tr>
|
183
|
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['FROM']; ?>:</td>
|
184
|
<td class="setting_value">
|
185
|
<input type="text" name="success_email_from" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['success_email_from'])); ?>" />
|
186
|
</td>
|
187
|
</tr>
|
188
|
<tr>
|
189
|
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['NAME']; ?>:</td>
|
190
|
<td class="setting_value">
|
191
|
<input type="text" name="success_email_fromname" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['success_email_fromname'])); ?>" />
|
192
|
</td>
|
193
|
</tr>
|
194
|
<tr>
|
195
|
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
|
196
|
<td class="setting_value">
|
197
|
<input type="text" name="success_email_subject" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['success_email_subject'])); ?>" />
|
198
|
</td>
|
199
|
</tr>
|
200
|
<tr>
|
201
|
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TEXT']; ?>:</td>
|
202
|
<td class="setting_value">
|
203
|
<textarea name="success_email_text" cols="80" rows="1" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($setting['success_email_text'])); ?></textarea>
|
204
|
</td>
|
205
|
</tr>
|
206
|
<tr>
|
207
|
<td class="newsection"><?php echo $TEXT['SUCCESS'].' '.$TEXT['PAGE']; ?>:</td>
|
208
|
<td class="newsection">
|
209
|
<select name="success_page">
|
210
|
<option value="none"><?php echo $TEXT['NONE']; ?></option>
|
211
|
<?php
|
212
|
// Get exisiting pages and show the pagenames
|
213
|
$query = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE visibility <> 'deleted'");
|
214
|
while($mail_page = $query->fetchRow()) {
|
215
|
if(!$admin->page_is_visible($mail_page))
|
216
|
continue;
|
217
|
$mail_pagename = $mail_page['menu_title'];
|
218
|
$success_page = $mail_page['page_id'];
|
219
|
// echo $success_page.':'.$setting['success_page'].':'; not vailde
|
220
|
if($setting['success_page'] == $success_page) {
|
221
|
$selected = ' selected="selected"';
|
222
|
} else {
|
223
|
$selected = '';
|
224
|
}
|
225
|
echo '<option value="'.$success_page.'"'.$selected.'>'.$mail_pagename.'</option>';
|
226
|
}
|
227
|
?>
|
228
|
</select>
|
229
|
</td>
|
230
|
</tr>
|
231
|
</table>
|
232
|
|
233
|
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
234
|
<tr>
|
235
|
<td align="left">
|
236
|
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;">
|
237
|
</td>
|
238
|
<td align="right">
|
239
|
<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" />
|
240
|
</td>
|
241
|
</tr>
|
242
|
</table>
|
243
|
</form>
|
244
|
<?php
|
245
|
|
246
|
// Print admin footer
|
247
|
$admin->print_footer();
|