Project

General

Profile

1
<?php
2

    
3
// $Id: modify_settings.php 784 2008-04-01 15:25:09Z doc $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2008, Ryan Djurovich
9

    
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

    
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

    
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

    
24
*/
25

    
26
/*
27
The Website Baker Project would like to thank Rudolph Lartey <www.carbonect.com>
28
for his contributions to this module - adding extra field types
29
*/
30

    
31
require('../../config.php');
32

    
33
// Include WB admin wrapper script
34
require(WB_PATH.'/modules/admin.php');
35

    
36
// include functions to edit the optional module CSS files (frontend.css, backend.css)
37
require_once('css.functions.php');
38

    
39
// check if module language file exists for the language set by the user (e.g. DE, EN)
40
if(!file_exists(WB_PATH .'/modules/form/languages/'.LANGUAGE .'.php')) {
41
	// no module language file exists for the language set by the user, include default module language file EN.php
42
	require_once(WB_PATH .'/modules/form/languages/EN.php');
43
} else {
44
	// a module language file exists for the language defined by the user, load it
45
	require_once(WB_PATH .'/modules/form/languages/'.LANGUAGE .'.php');
46
}
47

    
48
// Get header and footer
49
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
50
$setting = $query_content->fetchRow();
51

    
52
// Set raw html <'s and >'s to be replace by friendly html code
53
$raw = array('<', '>');
54
$friendly = array('&lt;', '&gt;');
55

    
56
// check if backend.css file needs to be included into the <body></body> of modify.php
57
if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH ."/modules/form/backend.css")) {
58
	echo '<style type="text/css">';
59
	include(WB_PATH .'/modules/form/backend.css');
60
	echo "\n</style>\n";
61
}
62

    
63
?>
64
<h2><?php echo $MOD_FORM['SETTINGS']; ?></h2>
65
<?php
66
	// include the button to edit the optional module CSS files
67
	// Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css")
68
	// Place this call outside of any <form></form> construct!!!
69
	css_edit('form');
70
?>
71

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

    
74
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
75
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
76

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

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

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

    
244
<table cellpadding="0" cellspacing="0" border="0" width="100%">
245
	<tr>
246
		<td align="left">
247
			<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;"></form>
248
		</td>
249
		<td align="right">
250
			<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;" />
251
		</td>
252
	</tr>
253
</table>
254

    
255
<?php
256

    
257
// Print admin footer
258
$admin->print_footer();
259

    
260
?>
(15-15/23)