Project

General

Profile

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 1375 2011-01-10 19:43:34Z FrankH $
14
 * @filesource		$HeadURL:  $
15
 * @lastmodified    $Date:  $
16
 * @description     
17
 */
18

    
19
require('../../config.php');
20

    
21
// Include WB admin wrapper script
22
require(WB_PATH.'/modules/admin.php');
23

    
24
// include core functions of WB 2.7 to edit the optional module CSS files (frontend.css, backend.css)
25
@include_once(WB_PATH .'/framework/module.functions.php');
26

    
27
// check if module language file exists for the language set by the user (e.g. DE, EN)
28
if(!file_exists(WB_PATH .'/modules/form/languages/'.LANGUAGE .'.php')) {
29
	// no module language file exists for the language set by the user, include default module language file EN.php
30
	require_once(WB_PATH .'/modules/form/languages/EN.php');
31
} else {
32
	// a module language file exists for the language defined by the user, load it
33
	require_once(WB_PATH .'/modules/form/languages/'.LANGUAGE .'.php');
34
}
35

    
36
// Get header and footer
37
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
38
$setting = $query_content->fetchRow();
39

    
40
// Set raw html <'s and >'s to be replace by friendly html code
41
$raw = array('<', '>');
42
$friendly = array('&lt;', '&gt;');
43

    
44
// check if backend.css file needs to be included into the <body></body> of modify.php
45
if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH ."/modules/form/backend.css")) {
46
	echo '<style type="text/css">';
47
	include(WB_PATH .'/modules/form/backend.css');
48
	echo "\n</style>\n";
49
}
50

    
51
?>
52
<h2><?php echo $MOD_FORM['SETTINGS']; ?></h2>
53
<?php
54
// include the button to edit the optional module CSS files
55
// Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css")
56
// Place this call outside of any <form></form> construct!!!
57
if(function_exists('edit_module_css')) {
58
	edit_module_css('form');
59
}
60
?>
61

    
62
<form name="edit" action="<?php echo WB_URL; ?>/modules/form/save_settings.php" method="post" style="margin: 0;">
63

    
64
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
65
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
66
<?php echo $admin->getFTAN(); ?>
67

    
68
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
69
	<tr>
70
		<td colspan="2"><strong><?php echo $HEADING['GENERAL_SETTINGS']; ?></strong></td>
71
	</tr>
72
	<tr>
73
		<td class="setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td>
74
		<td>
75
			<input type="radio" name="use_captcha" id="use_captcha_true" value="1"<?php if($setting['use_captcha'] == true) { echo ' checked="checked"'; } ?> />
76
			<label for="use_captcha_true"><?php echo $TEXT['ENABLED']; ?></label>
77
			<input type="radio" name="use_captcha" id="use_captcha_false" value="0"<?php if($setting['use_captcha'] == false) { echo ' checked="checked"'; } ?> />
78
			<label for="use_captcha_false"><?php echo $TEXT['DISABLED']; ?></label>
79
		</td>
80
	</tr>
81
	<tr>
82
		<td class="setting_name"><?php echo $TEXT['MAX_SUBMISSIONS_PER_HOUR']; ?>:</td>
83
		<td class="setting_value">
84
			<input type="text" name="max_submissions" style="width: 30px;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['max_submissions'])); ?>" />
85
		</td>
86
	</tr>
87
	<tr>
88
		<td class="setting_name"><?php echo $TEXT['SUBMISSIONS_STORED_IN_DATABASE']; ?>:</td>
89
		<td class="setting_value">
90
			<input type="text" name="stored_submissions" style="width: 30px;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['stored_submissions'])); ?>" />
91
		</td>
92
	</tr>
93
	<tr>
94
		<td class="setting_name"><?php echo $TEXT['HEADER']; ?>:</td>
95
		<td class="setting_value">
96
			<textarea name="header" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo ($setting['header']); ?></textarea>
97
		</td>
98
	</tr>
99
	<tr>
100
		<td class="setting_name"><?php echo $TEXT['FIELD'].' '.$TEXT['LOOP']; ?>:</td>
101
		<td class="setting_value">
102
			<textarea name="field_loop" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo ($setting['field_loop']); ?></textarea>
103
		</td>
104
	</tr>
105
	<tr>
106
		<td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td>
107
		<td class="setting_value">
108
			<textarea name="footer" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($setting['footer'])); ?></textarea>
109
		</td>
110
	</tr>
111
</table>	
112

    
113
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;">
114
	<tr>
115
		<td colspan="2"><strong><?php echo $TEXT['EMAIL'].' '.$TEXT['SETTINGS']; ?></strong></td>
116
	</tr>
117
	<tr>
118
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TO']; ?>:</td>
119
		<td class="setting_value">
120
			<input type="text" name="email_to" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['email_to'])); ?>" />
121
		</td>
122
	</tr>
123
	<tr>
124
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['FROM']; ?>:</td>
125
		<td class="setting_value">
126
			<select name="email_from_field" style="width: 98%;">
127
			<option value="" onclick="javascript: document.getElementById('email_from').style.display = 'block';"><?php echo $TEXT['CUSTOM']; ?>:</option>
128
			<?php
129
			$email_from_value = str_replace($raw, $friendly, ($setting['email_from']));
130
			$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");
131
			if($query_email_fields->numRows() > 0) {
132
				while($field = $query_email_fields->fetchRow()) {
133
					?>
134
					<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';">
135
						<?php echo $TEXT['FIELD'].': '.$field['title']; ?>
136
					</option>
137
					<?php
138
				}
139
			}
140
			?>
141
			</select>
142
			<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; } ?>" />
143
		</td>
144
	</tr>
145
	<tr>
146
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['NAME']; ?>:</td>
147
		<td class="setting_value">
148
			<input type="text" name="email_fromname" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['email_fromname'])); ?>" />
149
		</td>
150
	</tr>
151
	<tr>
152
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
153
		<td class="setting_value">
154
			<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
</table>	
158

    
159
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;">
160
	<tr>
161
		<td colspan="2"><strong><?php echo $TEXT['SUCCESS'].' '.$TEXT['SETTINGS']; ?></strong></td>
162
	</tr>
163
	<tr>
164
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TO']; ?>:</td>
165
		<td class="setting_value">
166
			<select name="success_email_to" style="width: 98%;">
167
			<option value="" onclick="javascript: document.getElementById('success_email_to').style.display = 'block';"><?php echo $TEXT['NONE']; ?></option>
168
			<?php
169
			$success_email_to = str_replace($raw, $friendly, ($setting['success_email_to']));
170
			$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");
171
			if($query_email_fields->numRows() > 0) {
172
				while($field = $query_email_fields->fetchRow()) {
173
					?>
174
					<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';">
175
						<?php echo $TEXT['FIELD'].': '.$field['title']; ?>
176
					</option>
177
					<?php
178
				}
179
			}
180
			?>
181
			</select>
182
		</td>
183
	</tr>
184
	<tr>
185
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['FROM']; ?>:</td>
186
		<td class="setting_value">
187
			<input type="text" name="success_email_from" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['success_email_from'])); ?>" />
188
		</td>
189
	</tr>
190
	<tr>
191
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['NAME']; ?>:</td>
192
		<td class="setting_value">
193
			<input type="text" name="success_email_fromname" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['success_email_fromname'])); ?>" />
194
		</td>
195
	</tr>
196
	<tr>
197
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
198
		<td class="setting_value">
199
			<input type="text" name="success_email_subject" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['success_email_subject'])); ?>" />
200
		</td>
201
	</tr>
202
	<tr>
203
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TEXT']; ?>:</td>
204
		<td class="setting_value">
205
			<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>
206
		</td>
207
	</tr>
208
	<tr>
209
		<td class="newsection"><?php echo $TEXT['SUCCESS'].' '.$TEXT['PAGE']; ?>:</td>
210
		<td class="newsection">
211
			<select name="success_page">
212
			<option value="none"><?php echo $TEXT['NONE']; ?></option>
213
			<?php 
214
			// Get exisiting pages and show the pagenames
215
			$query = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE visibility <> 'deleted'");
216
			while($mail_page = $query->fetchRow()) {
217
				if(!$admin->page_is_visible($mail_page))
218
					continue;
219
				$mail_pagename = $mail_page['menu_title'];		
220
				$success_page = $mail_page['page_id'];
221
			  //	echo $success_page.':'.$setting['success_page'].':'; not vailde
222
				if($setting['success_page'] == $success_page) {
223
					$selected = ' selected="selected"';
224
				} else { 
225
					$selected = '';
226
				}
227
				echo '<option value="'.$success_page.'"'.$selected.'>'.$mail_pagename.'</option>';
228
		 	}
229
			?>
230
			</select>
231
		</td>
232
	</tr>
233
</table>
234

    
235
<table cellpadding="0" cellspacing="0" border="0" width="100%">
236
	<tr>
237
		<td align="left">
238
			<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;">
239
		</td>
240
		<td align="right">
241
			<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;" />
242
		</td>
243
	</tr>
244
</table>
245
</form>
246
<?php
247

    
248
// Print admin footer
249
$admin->print_footer();
250

    
251
?>
(13-13/21)