Project

General

Profile

1
<?php
2

    
3
// $Id$
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
	<?php if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */ ?>
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
	<?php } ?>
91
	<tr>
92
		<td class="setting_name" width="30%"><?php echo $TEXT['MAX_SUBMISSIONS_PER_HOUR']; ?>:</td>
93
		<td class="setting_name">
94
			<input type="text" name="max_submissions" style="width: 30px;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['max_submissions'])); ?>" />
95
		</td>
96
	</tr>
97
	<tr>
98
		<td class="setting_name"><?php echo $TEXT['SUBMISSIONS_STORED_IN_DATABASE']; ?>:</td>
99
		<td class="setting_name">
100
			<input type="text" name="stored_submissions" style="width: 30px;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['stored_submissions'])); ?>" />
101
		</td>
102
	</tr>
103
	<tr>
104
		<td class="setting_name"><?php echo $TEXT['HEADER']; ?>:</td>
105
		<td class="setting_name">
106
			<textarea name="header" style="width: 98%; height: 80px;"><?php echo ($setting['header']); ?></textarea>
107
		</td>
108
	</tr>
109
	<tr>
110
		<td class="setting_name"><?php echo $TEXT['FIELD'].' '.$TEXT['LOOP']; ?>:</td>
111
		<td class="setting_name">
112
			<textarea name="field_loop" style="width: 98%; height: 80px;"><?php echo ($setting['field_loop']); ?></textarea>
113
		</td>
114
	</tr>
115
	<tr>
116
		<td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td>
117
		<td class="setting_name">
118
			<textarea name="footer" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($setting['footer'])); ?></textarea>
119
		</td>
120
	</tr>
121
</table>	
122

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

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