Project

General

Profile

1
<?php
2

    
3
// $Id: modify_settings.php 611 2008-01-27 00:17:54Z thorn $
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 optionla module CSS files
67
	// Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css")
68
	css_edit();
69
?>
70

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

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

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

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

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

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

    
242
<?php
243

    
244
// Print admin footer
245
$admin->print_footer();
246

    
247
?>
(15-15/23)