This repository has been archived by the owner on Jun 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodify_settings.php
254 lines (239 loc) · 10.8 KB
/
modify_settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<?php
/**
* @module form
* @version see info.php of this module
* @authors Ryan Djurovich, Rudolph Lartey, John Maats, Dietrich Roland Pehlke, LEPTON project
* @copyright 2004-2010 Ryan Djurovich, Rudolph Lartey, John Maats, Dietrich Roland Pehlke
* @copyright 2010-2014 LEPTON project
* @license see info.php of this module
* @license terms see info.php of this module
*/
// include class.secure.php to protect this file and the whole CMS!
if (defined('LEPTON_PATH')) {
include(LEPTON_PATH.'/framework/class.secure.php');
} else {
$oneback = "../";
$root = $oneback;
$level = 1;
while (($level < 10) && (!file_exists($root.'/framework/class.secure.php'))) {
$root .= $oneback;
$level += 1;
}
if (file_exists($root.'/framework/class.secure.php')) {
include($root.'/framework/class.secure.php');
} else {
trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
}
}
// end include class.secure.php
// Include admin wrapper script
require(LEPTON_PATH.'/modules/admin.php');
// include core functions to edit the optional module CSS files (frontend.css, backend.css)
include_once(LEPTON_PATH .'/framework/summary.module_edit_css.php');
// Load Language file
$lang = (dirname(__FILE__))."/languages/". LANGUAGE .".php";
require_once ( !file_exists($lang) ? (dirname(__FILE__))."/languages/EN.php" : $lang );
// Get header and footer
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
$setting = $query_content->fetchRow();
// Set raw html <'s and >'s to be replace by friendly html code
$raw = array('<', '>');
$friendly = array('<', '>');
?>
<div class="container">
<h2><?php echo $MOD_FORM['SETTINGS']; ?></h2>
<?php
// include the button to edit the optional module CSS files
// Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css")
// Place this call outside of any <form></form> construct!!!
if(function_exists('edit_module_css')) {
edit_module_css('form');
}
?>
<form name="edit" action="<?php echo LEPTON_URL; ?>/modules/form/save_settings.php" method="post" style="margin: 0;">
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
<div class="container">
<table cellpadding="2" cellspacing="0" border="0" width="100%">
<tr>
<td colspan="2"><strong><?php echo $HEADING['GENERAL_SETTINGS']; ?></strong></td>
</tr>
<tr>
<td class="setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td>
<td>
<input type="radio" name="use_captcha" id="use_captcha_true" value="1"<?php if($setting['use_captcha'] == true) { echo ' checked="checked"'; } ?> />
<label for="use_captcha_true"><?php echo $TEXT['ENABLED']; ?></label>
<input type="radio" name="use_captcha" id="use_captcha_false" value="0"<?php if($setting['use_captcha'] == false) { echo ' checked="checked"'; } ?> />
<label for="use_captcha_false"><?php echo $TEXT['DISABLED']; ?></label>
</td>
</tr>
<tr>
<td class="setting_name"><?php echo $TEXT['MAX_SUBMISSIONS_PER_HOUR']; ?>:</td>
<td class="setting_value">
<input type="text" name="max_submissions" style="width: 30px;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['max_submissions'])); ?>" />
</td>
</tr>
<tr>
<td class="setting_name"><?php echo $TEXT['SUBMISSIONS_STORED_IN_DATABASE']; ?>:</td>
<td class="setting_value">
<input type="text" name="stored_submissions" style="width: 30px;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['stored_submissions'])); ?>" />
</td>
</tr>
<tr>
<td class="setting_name"><?php echo $TEXT['HEADER']; ?>:</td>
<td class="setting_value">
<textarea name="header" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo ($setting['header']); ?></textarea>
</td>
</tr>
<tr>
<td class="setting_name"><?php echo $TEXT['FIELD'].' '.$TEXT['LOOP']; ?>:</td>
<td class="setting_value">
<textarea name="field_loop" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo ($setting['field_loop']); ?></textarea>
</td>
</tr>
<tr>
<td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td>
<td class="setting_value">
<textarea name="footer" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($setting['footer'])); ?></textarea>
</td>
</tr>
</table>
</div>
<div class="container">
<table cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;">
<tr>
<td colspan="2"><strong><?php echo $TEXT['EMAIL'].' '.$TEXT['SETTINGS']; ?></strong></td>
</tr>
<tr>
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TO']; ?>:</td>
<td class="setting_value">
<input type="text" name="email_to" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['email_to'])); ?>" />
</td>
</tr>
<tr>
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['FROM']; ?>:</td>
<td class="setting_value">
<select name="email_from_field" style="width: 98%;">
<option value="" onclick="javascript: document.getElementById('email_from').style.display = 'block';"><?php echo $TEXT['CUSTOM']; ?>:</option>
<?php
$email_from_value = str_replace($raw, $friendly, ($setting['email_from']));
$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");
if($query_email_fields->numRows() > 0) {
while($field = $query_email_fields->fetchRow()) {
?>
<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';">
<?php echo $TEXT['FIELD'].': '.$field['title']; ?>
</option>
<?php
}
}
?>
</select>
<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; } ?>" />
</td>
</tr>
<tr>
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['NAME']; ?>:</td>
<td class="setting_value">
<input type="text" name="email_fromname" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['email_fromname'])); ?>" />
</td>
</tr>
<tr>
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
<td class="setting_value">
<input type="text" name="email_subject" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['email_subject'])); ?>" />
</td>
</tr>
</table>
</div>
<div class="container">
<table cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;">
<tr>
<td colspan="2"><strong><?php echo $TEXT['SUCCESS'].' '.$TEXT['SETTINGS']; ?></strong></td>
</tr>
<tr>
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TO']; ?>:</td>
<td class="setting_value">
<select name="success_email_to" style="width: 98%;">
<option value="" onclick="javascript: document.getElementById('success_email_to').style.display = 'block';"><?php echo $TEXT['NONE']; ?></option>
<?php
$success_email_to = str_replace($raw, $friendly, ($setting['success_email_to']));
$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");
if($query_email_fields->numRows() > 0) {
while($field = $query_email_fields->fetchRow()) {
?>
<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';">
<?php echo $TEXT['FIELD'].': '.$field['title']; ?>
</option>
<?php
}
}
?>
</select>
</td>
</tr>
<tr>
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['FROM']; ?>:</td>
<td class="setting_value">
<input type="text" name="success_email_from" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['success_email_from'])); ?>" />
</td>
</tr>
<tr>
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['NAME']; ?>:</td>
<td class="setting_value">
<input type="text" name="success_email_fromname" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['success_email_fromname'])); ?>" />
</td>
</tr>
<tr>
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
<td class="setting_value">
<input type="text" name="success_email_subject" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['success_email_subject'])); ?>" />
</td>
</tr>
<tr>
<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TEXT']; ?>:</td>
<td class="setting_value">
<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>
</td>
</tr>
<tr>
<td class="newsection"><?php echo $TEXT['SUCCESS'].' '.$TEXT['PAGE']; ?>:</td>
<td class="newsection">
<select name="success_page">
<option value="none"><?php echo $TEXT['NONE']; ?></option>
<?php
// Get exisiting pages and show the pagenames
$query = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE visibility <> 'deleted'");
while($mail_page = $query->fetchRow()) {
if(!$admin->page_is_visible($mail_page))
continue;
$mail_pagename = $mail_page['menu_title'];
$success_page = $mail_page['page_id'];
// echo $success_page.':'.$setting['success_page'].':'; not vailde
if($setting['success_page'] == $success_page) {
$selected = ' selected="selected"';
} else {
$selected = '';
}
echo '<option value="'.$success_page.'"'.$selected.'>'.$mail_pagename.'</option>';
}
?>
</select>
</td>
</tr>
</table>
</div>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td align="left">
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;">
<input class="reset" 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;" />
</td>
</tr>
</table>
</form>
</div>
<?php
// Print admin footer
$admin->print_footer();
?>