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