1 |
2
|
Manuela
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @category module
|
5 |
|
|
* @package Form
|
6 |
|
|
* @author WebsiteBaker Project
|
7 |
|
|
* @copyright WebsiteBaker Org. e.V.
|
8 |
|
|
* @link http://websitebaker.org/
|
9 |
|
|
* @license http://www.gnu.org/licenses/gpl.html
|
10 |
|
|
* @platform WebsiteBaker 2.8.3
|
11 |
|
|
* @requirements PHP 5.3.6 and higher
|
12 |
|
|
* @version $Id$
|
13 |
|
|
* @filesource $HeadURL$
|
14 |
|
|
* @lastmodified $Date$
|
15 |
|
|
* @description
|
16 |
|
|
*/
|
17 |
|
|
|
18 |
|
|
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
|
19 |
|
|
|
20 |
|
|
$print_info_banner = true;
|
21 |
|
|
// Tells script to update when this page was last updated
|
22 |
|
|
$update_when_modified = false;
|
23 |
|
|
// Include WB admin wrapper script
|
24 |
|
|
require(WB_PATH.'/modules/admin.php');
|
25 |
|
|
|
26 |
|
|
$sAddonName = basename(__DIR__);
|
27 |
|
|
$ModuleRel = '/modules/'.$sAddonName;
|
28 |
|
|
$ModuleUrl = WB_URL.$ModuleRel;
|
29 |
|
|
$ModulePath = WB_PATH.$ModuleRel;
|
30 |
|
|
|
31 |
|
|
// include core functions of WB 2.7 to edit the optional module CSS files (frontend.css, backend.css)
|
32 |
|
|
include_once(WB_PATH .'/framework/module.functions.php');
|
33 |
|
|
|
34 |
|
|
// load module language file
|
35 |
|
|
//$sAddonName = basename(__DIR__);
|
36 |
|
|
require(__DIR__.'/languages/EN.php');
|
37 |
|
|
if(file_exists(__DIR__.'/languages/'.LANGUAGE .'.php')) {
|
38 |
|
|
require(__DIR__.'/languages/'.LANGUAGE .'.php');
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
$sSectionIdPrefix = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' ) ? SEC_ANCHOR : 'Sec' );
|
42 |
|
|
|
43 |
|
|
$sBacklink = ADMIN_URL.'/pages/modify.php?page_id='.$page_id;
|
44 |
|
|
|
45 |
|
|
if (!$admin->checkFTAN())
|
46 |
|
|
{
|
47 |
|
|
// $admin->print_header();
|
48 |
|
|
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $sBacklink);
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
if (!function_exists('emailAdmin')) {
|
52 |
|
|
function emailAdmin() {
|
53 |
|
|
global $database,$admin;
|
54 |
|
|
$retval = $admin->get_email();
|
55 |
|
|
if($admin->get_user_id()!='1') {
|
56 |
|
|
$sql = 'SELECT `email` FROM `'.TABLE_PREFIX.'users` '
|
57 |
|
|
. 'WHERE `user_id`=\'1\' ';
|
58 |
|
|
$retval = $database->get_one($sql);
|
59 |
|
|
}
|
60 |
|
|
return $retval;
|
61 |
|
|
}
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
// Get Settings from DB $aSettings['
|
65 |
|
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_settings` '
|
66 |
|
|
. 'WHERE `section_id` = '.(int)$section_id.'';
|
67 |
|
|
if($oSetting = $database->query($sql)) {
|
68 |
|
|
$aSettings = $oSetting->fetchRow(MYSQLI_ASSOC);
|
69 |
|
|
$aSettings['email_to'] = ( ($aSettings['email_to'] != '') ? $aSettings['email_to'] : emailAdmin());
|
70 |
|
|
$aSettings['email_subject'] = ( ($aSettings['email_subject'] != '') ? $aSettings['email_subject'] : '' );
|
71 |
|
|
$aSettings['success_email_subject'] = ($aSettings['success_email_subject'] != '') ? $aSettings['success_email_subject'] : '';
|
72 |
|
|
$aSettings['success_email_from'] = $admin->add_slashes(SERVER_EMAIL);
|
73 |
|
|
$aSettings['success_email_fromname'] = ($aSettings['success_email_fromname'] != '' ? $aSettings['success_email_fromname'] : WBMAILER_DEFAULT_SENDERNAME);
|
74 |
|
|
$aSettings['success_email_subject'] = ($aSettings['success_email_subject'] != '') ? $aSettings['success_email_subject'] : '';
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
// Set raw html <'s and >'s to be replace by friendly html code
|
78 |
|
|
$raw = array('<', '>');
|
79 |
|
|
$friendly = array('<', '>');
|
80 |
|
|
?>
|
81 |
|
|
<?php
|
82 |
|
|
if ($print_info_banner) {
|
83 |
|
|
?>
|
84 |
|
|
</div><!--end class="block-outer" -->
|
85 |
|
|
<?php } ?>
|
86 |
|
|
<h2><?php echo $MOD_FORM['SETTINGS']; ?></h2>
|
87 |
|
|
<?php
|
88 |
|
|
// include the button to edit the optional module CSS files
|
89 |
|
|
// Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css")
|
90 |
|
|
// Place this call outside of any <form></form> construct!!!
|
91 |
|
|
?>
|
92 |
|
|
<div class="form">
|
93 |
|
|
<?php
|
94 |
|
|
if(function_exists('edit_module_css')) {
|
95 |
|
|
edit_module_css('form');
|
96 |
|
|
}
|
97 |
|
|
?><form name="edit" action="<?php echo $ModuleUrl; ?>/save_settings.php" method="post" style="margin: 0;">
|
98 |
|
|
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
|
99 |
|
|
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
|
100 |
|
|
<input type="hidden" name="success_email_to" value="" />
|
101 |
|
|
<?php echo $admin->getFTAN(); ?>
|
102 |
|
|
<div class="form block-outer">
|
103 |
|
|
<table class="form frm-table">
|
104 |
|
|
<caption class="form-header w3-header-blue-wb"><?php echo $HEADING['GENERAL_SETTINGS']; ?></caption>
|
105 |
|
|
<tbody>
|
106 |
|
|
<tr>
|
107 |
|
|
<td class="frm-setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td>
|
108 |
|
|
<td>
|
109 |
|
|
<input type="radio" name="use_captcha" id="use_captcha_true" value="1"<?php if($aSettings['use_captcha'] == true) { echo ' checked="checked"'; } ?> />
|
110 |
|
|
<label for="use_captcha_true"><?php echo $TEXT['ENABLED']; ?></label>
|
111 |
|
|
<input type="radio" name="use_captcha" id="use_captcha_false" value="0"<?php if($aSettings['use_captcha'] == false) { echo ' checked="checked"'; } ?> />
|
112 |
|
|
<label for="use_captcha_false"><?php echo $TEXT['DISABLED']; ?></label>
|
113 |
|
|
</td>
|
114 |
|
|
</tr>
|
115 |
|
|
<tr>
|
116 |
|
|
<td class="frm-setting_name"><?php echo $TEXT['MAX_SUBMISSIONS_PER_HOUR']; ?>:</td>
|
117 |
|
|
<td class="frm-setting_value">
|
118 |
|
|
<input type="text" name="max_submissions" style="width: 30px;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($aSettings['max_submissions'])); ?>" />
|
119 |
|
|
</td>
|
120 |
|
|
</tr>
|
121 |
|
|
<tr>
|
122 |
|
|
<td class="frm-setting_name"><?php echo $TEXT['SUBMISSIONS_STORED_IN_DATABASE']; ?>:</td>
|
123 |
|
|
<td class="frm-setting_value">
|
124 |
|
|
<input type="text" name="stored_submissions" style="width: 30px;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($aSettings['stored_submissions'])); ?>" />
|
125 |
|
|
</td>
|
126 |
|
|
</tr>
|
127 |
|
|
<tr>
|
128 |
|
|
<td class="frm-setting_name"><?php echo $TEXT['SUBMISSIONS_PERPAGE']; ?>:</td>
|
129 |
|
|
<td class="frm-setting_value">
|
130 |
|
|
<input type="text" name="perpage_submissions" style="width: 30px;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($aSettings['perpage_submissions'])); ?>" />
|
131 |
|
|
</td>
|
132 |
|
|
</tr>
|
133 |
|
|
<tr>
|
134 |
|
|
<td class="frm-setting_name"><?php echo $TEXT['HEADER']; ?>:</td>
|
135 |
|
|
<td class="frm-setting_value">
|
136 |
|
|
<textarea name="header" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo ($aSettings['header']); ?></textarea>
|
137 |
|
|
</td>
|
138 |
|
|
</tr>
|
139 |
|
|
<tr>
|
140 |
|
|
<td class="frm-setting_name"><?php echo $TEXT['FIELD'].' '.$TEXT['LOOP']; ?>:</td>
|
141 |
|
|
<td class="frm-setting_value">
|
142 |
|
|
<textarea name="field_loop" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo ($aSettings['field_loop']); ?></textarea>
|
143 |
|
|
</td>
|
144 |
|
|
</tr>
|
145 |
|
|
<tr>
|
146 |
|
|
<td class="frm-setting_name"><?php echo $TEXT['FOOTER']; ?>:</td>
|
147 |
|
|
<td class="frm-setting_value">
|
148 |
|
|
<textarea name="footer" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($aSettings['footer'])); ?></textarea>
|
149 |
|
|
</td>
|
150 |
|
|
</tr>
|
151 |
|
|
</tbody>
|
152 |
|
|
</table>
|
153 |
|
|
</div>
|
154 |
|
|
<div class="form block-outer" style="margin-top: 2.225em;">
|
155 |
|
|
<!-- E-Mail Optionen -->
|
156 |
|
|
<table title="<?php echo $TEXT['EMAIL'].' '.$TEXT['SETTINGS'].' '.$TEXT['ADMIN']; ?>" class="form frm-table" style="margin-top: 3px;">
|
157 |
|
|
<caption class="form-header w3-header-blue-wb"><?php echo $TEXT['EMAIL'].' '.$TEXT['SETTINGS'].' '.$TEXT['ADMIN']; ?></caption>
|
158 |
|
|
</thead>
|
159 |
|
|
<tbody>
|
160 |
|
|
<tr>
|
161 |
|
|
<td class="frm-setting_name"><?php echo $TEXT['EMAIL'].' '.$MOD_FORM['TO']; ?>:</td>
|
162 |
|
|
<td class="frm-setting_value">
|
163 |
|
|
<input type="text" name="email_to" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($aSettings['email_to'])); ?>" />
|
164 |
|
|
</td>
|
165 |
|
|
</tr>
|
166 |
|
|
|
167 |
|
|
<tr>
|
168 |
|
|
<td class="frm-setting_name"><?php echo $TEXT['DISPLAY_NAME']; ?>:</td>
|
169 |
|
|
<td class="frm-setting_value">
|
170 |
|
|
<input type="text" name="email_fromname" id="email_fromname" style="width: 98%;" maxlength="255" value="<?php echo $aSettings['email_fromname']; ?>" />
|
171 |
|
|
</td>
|
172 |
|
|
</tr>
|
173 |
|
|
<tr>
|
174 |
|
|
<td class="frm-setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
|
175 |
|
|
<td class="frm-setting_value">
|
176 |
|
|
<input type="text" name="email_subject" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($aSettings['email_subject'])); ?>" />
|
177 |
|
|
</td>
|
178 |
|
|
</tr>
|
179 |
|
|
<tr><td> </td></tr>
|
180 |
|
|
</tbody>
|
181 |
|
|
</table>
|
182 |
|
|
</div>
|
183 |
|
|
<div class="form block-outer" style="margin-top: 2.225em;">
|
184 |
|
|
<!-- Erfolgreich Optionen -->
|
185 |
|
|
<table title="<?php echo $TEXT['EMAIL'].' '.$MOD_FORM['CONFIRM'].' '.$MENU['USERS']; ?>" class="form frm-table w3-table" style="margin-top: 3px;">
|
186 |
|
|
<caption class="form-header w3-header-blue-wb"><?php echo $TEXT['EMAIL'].' '.$MOD_FORM['CONFIRM'].' '.$MENU['USERS']; ?></caption>
|
187 |
|
|
<tbody>
|
188 |
|
|
<tr>
|
189 |
|
|
<td class="frm-setting_name"><?php echo $TEXT['EMAIL'].' '.$MOD_FORM['TO']; ?>:</td>
|
190 |
|
|
<td class="frm-setting_value "><p class="frm-warning w3-container w3-section w3-pale-red w3-leftbar w3-border-red w3-hover-border-green"><?php echo $MOD_FORM['RECIPIENT'] ?><br /><?php echo $MOD_FORM['SPAM']; ?> </p> </td>
|
191 |
|
|
</tr>
|
192 |
|
|
<tr>
|
193 |
|
|
<td colspan="2"><p></p></td>
|
194 |
|
|
</tr>
|
195 |
|
|
<tr>
|
196 |
|
|
<td class="frm-setting_name"><?php echo $MOD_FORM['REPLYTO']; ?>:</td>
|
197 |
|
|
<td class="frm-setting_value">
|
198 |
|
|
<select name="success_email_to" style="width: 98%;">
|
199 |
|
|
<option value="" onclick="javascript: document.getElementById('success_email_to').style.display = 'block';"><?php echo $TEXT['NONE']; ?></option>
|
200 |
|
|
<?php
|
201 |
|
|
$success_email_to = str_replace($raw, $friendly, ($aSettings['success_email_to']));
|
202 |
|
|
$sql = 'SELECT `field_id`, `title` FROM `'.TABLE_PREFIX.'mod_form_fields` '
|
203 |
|
|
. 'WHERE `section_id` = '.(int)$section_id.' '
|
204 |
|
|
. ' AND `type` = \'email\' '
|
205 |
|
|
. 'ORDER BY `position` ASC ';
|
206 |
|
|
if($query_email_fields = $database->query($sql)) {
|
207 |
|
|
if($query_email_fields->numRows() > 0) {
|
208 |
|
|
while($field = $query_email_fields->fetchRow(MYSQL_ASSOC)) {
|
209 |
|
|
?>
|
210 |
|
|
<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';">
|
211 |
|
|
<?php echo $TEXT['FIELD'].': '.$field['title']; ?>
|
212 |
|
|
</option>
|
213 |
|
|
<?php
|
214 |
|
|
}
|
215 |
|
|
}
|
216 |
|
|
}
|
217 |
|
|
?>
|
218 |
|
|
</select>
|
219 |
|
|
</td>
|
220 |
|
|
</tr>
|
221 |
|
|
<tr>
|
222 |
|
|
|
223 |
|
|
<td class="frm-setting_name"><?php echo $TEXT['DISPLAY_NAME']; ?>:</td>
|
224 |
|
|
<td class="frm-setting_value">
|
225 |
|
|
<?php $aSettings['success_email_fromname'] = ($aSettings['success_email_fromname'] != '' ? $aSettings['success_email_fromname'] : WBMAILER_DEFAULT_SENDERNAME); ?>
|
226 |
|
|
<input type="text" name="success_email_fromname" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($aSettings['success_email_fromname'])); ?>" />
|
227 |
|
|
</td>
|
228 |
|
|
</tr>
|
229 |
|
|
|
230 |
|
|
<tr>
|
231 |
|
|
<td class="frm-setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
|
232 |
|
|
<td class="frm-setting_value">
|
233 |
|
|
<input type="text" name="success_email_subject" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($aSettings['success_email_subject'])); ?>" />
|
234 |
|
|
</td>
|
235 |
|
|
</tr>
|
236 |
|
|
<tr>
|
237 |
|
|
<td class="frm-setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TEXT']; ?>:</td>
|
238 |
|
|
<td class="frm-setting_value">
|
239 |
|
|
<textarea name="success_email_text" cols="80" rows="1" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($aSettings['success_email_text'])); ?></textarea>
|
240 |
|
|
</td>
|
241 |
|
|
</tr>
|
242 |
|
|
<tr><td> </td></tr>
|
243 |
|
|
<tr>
|
244 |
|
|
<td class="frm-setting_name frm-newsection"><?php echo $TEXT['SUCCESS'].' '.$TEXT['PAGE']; ?>:</td>
|
245 |
|
|
<td class="frm-newsection">
|
246 |
|
|
<?php
|
247 |
|
|
// Get exisiting pages and show the pagenames
|
248 |
|
|
$aSelectPages = array();
|
249 |
|
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` '
|
250 |
|
|
. 'WHERE `visibility` <> \'deleted\' ';
|
251 |
|
|
$old_page_id = $page_id;
|
252 |
|
|
$query = $database->query($sql);
|
253 |
|
|
while($mail_page = $query->fetchRow(MYSQL_ASSOC)) {
|
254 |
|
|
if(!$admin->page_is_visible($mail_page)) { continue; }
|
255 |
|
|
$page_id = $mail_page['page_id'];
|
256 |
|
|
$success_page = $aSettings['success_page'];
|
257 |
|
|
// echo $success_page.':'.$aSettings['success_page'].':'; not vailde
|
258 |
|
|
$aSelectPages[$page_id]['menu_title'] = $mail_page['menu_title'];
|
259 |
|
|
$aSelectPages[$page_id]['success_page'] = $mail_page['page_id'];
|
260 |
|
|
$aSelectPages[$page_id]['selected'] = ( ($success_page == $page_id)? ' selected="selected"':'');
|
261 |
|
|
}
|
262 |
|
|
?>
|
263 |
|
|
<select name="success_page">
|
264 |
|
|
<option value=""><?php echo $TEXT['NONE']; ?></option>
|
265 |
|
|
<?php
|
266 |
|
|
foreach( $aSelectPages as $key=> $aValues ) {
|
267 |
|
|
echo '<option value="'.$aValues['success_page'].'"'.$aValues['selected'].'>'.$aValues['menu_title'].'</option>';
|
268 |
|
|
}
|
269 |
|
|
?>
|
270 |
|
|
</select>
|
271 |
|
|
</td>
|
272 |
|
|
</tr>
|
273 |
|
|
</tbody>
|
274 |
|
|
</table>
|
275 |
|
|
</div>
|
276 |
|
|
|
277 |
|
|
<table class="form frm-table">
|
278 |
|
|
<tr>
|
279 |
|
|
<td>
|
280 |
|
|
<input class="btn btn-default w3-blue-wb w3-round-small w3-hover-green w3-medium w3-padding-4" name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 25%; margin-top: 5px;margin-left:10px;margin-bottom:6px;">
|
281 |
|
|
</td>
|
282 |
|
|
<td>
|
283 |
|
|
<input class="btn btn-default w3-blue-wb w3-round-small w3-hover-green w3-medium w3-padding-4" type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript:window.location='<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $old_page_id.'#'.$sSectionIdPrefix.$section_id; ?>';" style="width: 25%; margin-top: 5px;margin-bottom:6px; float: right;" />
|
284 |
|
|
</td>
|
285 |
|
|
</tr>
|
286 |
|
|
</table>
|
287 |
|
|
</form>
|
288 |
|
|
</div><!--end class="form" -->
|
289 |
|
|
|
290 |
|
|
<?php
|
291 |
|
|
|
292 |
|
|
// Print admin footer
|
293 |
|
|
$admin->print_footer();
|