Project

General

Profile

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