Project

General

Profile

1
<?php
2

    
3
// $Id: modify_settings.php 310 2006-02-19 05:31:10Z ryan $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2006, 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
// 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
?>
45

    
46
<style type="text/css">
47
.setting_name {
48
	vertical-align: top;
49
}
50
</style>
51

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

    
54
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
55
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
56

    
57
<table cellpadding="2" cellspacing="0" border="0" width="100%">
58
<tr>
59
	<td class="setting_name" width="220"><?php echo $TEXT['HEADER']; ?>:</td>
60
	<td class="setting_name">
61
		<textarea name="header" style="width: 100%; height: 80px;"><?php echo ($setting['header']); ?></textarea>
62
	</td>
63
</tr>
64
<tr>
65
	<td class="setting_name"><?php echo $TEXT['FIELD'].' '.$TEXT['LOOP']; ?>:</td>
66
	<td class="setting_name">
67
		<textarea name="field_loop" style="width: 100%; height: 60px;"><?php echo ($setting['field_loop']); ?></textarea>
68
	</td>
69
</tr>
70
<tr>
71
	<td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td>
72
	<td class="setting_name">
73
		<textarea name="footer" style="width: 100%; height: 80px;"><?php echo str_replace($raw, $friendly, ($setting['footer'])); ?></textarea>
74
	</td>
75
</tr>
76
<tr>
77
	<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TO']; ?>:</td>
78
	<td class="setting_name">
79
		<textarea name="email_to" style="width: 100%; height: 30px;"><?php echo str_replace($raw, $friendly, ($setting['email_to'])); ?></textarea>
80
	</td>
81
</tr>
82
<tr>
83
	<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['FROM']; ?>:</td>
84
	<td class="setting_name">
85
		<select name="email_from_field" style="width: 100%;">
86
			<option value="" onclick="javascript: document.getElementById('email_from').style.display = 'block';"><?php echo $TEXT['CUSTOM']; ?>:</option>
87
			<?php
88
			$email_from_value = str_replace($raw, $friendly, ($setting['email_from']));
89
			$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");
90
			if($query_email_fields->numRows() > 0) {
91
				while($field = $query_email_fields->fetchRow()) {
92
					?>
93
					<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';">
94
						<?php echo $TEXT['FIELD'].': '.$field['title']; ?>
95
					</option>
96
					<?php
97
				}
98
			}
99
			?>
100
		</select>
101
		<input type="text" name="email_from" id="email_from" style="width: 100%; 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; } ?>" />
102
	</td>
103
</tr>
104
<tr>
105
	<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
106
	<td class="setting_name">
107
		<input type="text" name="email_subject" style="width: 100%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['email_subject'])); ?>" />
108
	</td>
109
</tr>
110
<tr>
111
	<td class="setting_name"><?php echo $TEXT['SUCCESS'].' '.$TEXT['MESSAGE']; ?>:</td>
112
	<td class="setting_name">
113
		<textarea name="success_message" style="width: 100%; height: 80px;"><?php echo str_replace($raw, $friendly, ($setting['success_message'])); ?></textarea>
114
	</td>
115
</tr>
116
<tr>
117
	<td class="setting_name"><?php echo $TEXT['MAX_SUBMISSIONS_PER_HOUR']; ?>:</td>
118
	<td class="setting_name">
119
		<input type="text" name="max_submissions" style="width: 100%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['max_submissions'])); ?>" />
120
	</td>
121
</tr>
122
<tr>
123
	<td class="setting_name"><?php echo $TEXT['SUBMISSIONS_STORED_IN_DATABASE']; ?>:</td>
124
	<td class="setting_name">
125
		<input type="text" name="stored_submissions" style="width: 100%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['stored_submissions'])); ?>" />
126
	</td>
127
</tr>
128
<?php if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */ ?>
129
<tr>
130
	<td class="setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td>
131
	<td>
132
		<input type="radio" name="use_captcha" id="use_captcha_true" value="1"<?php if($setting['use_captcha'] == true) { echo ' checked'; } ?> />
133
		<label for="use_captcha_true"><?php echo $TEXT['ENABLED']; ?></label>
134
		<input type="radio" name="use_captcha" id="use_captcha_false" value="0"<?php if($setting['use_captcha'] == false) { echo ' checked'; } ?> />
135
		<label for="use_captcha_false"><?php echo $TEXT['DISABLED']; ?></label>
136
	</td>
137
</tr>
138
<?php } ?>
139
</table>
140
<table cellpadding="0" cellspacing="0" border="0" width="100%">
141
<tr>
142
	<td width="225">&nbsp;</td>
143
	<td align="left">
144
		<input name="save" type="submit" value="<?php echo $TEXT['SAVE'].' '.$TEXT['SETTINGS']; ?>" style="width: 200px; margin-top: 5px;"></form>
145
	</td>
146
	<td align="right">
147
		<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;" />
148
	</td>
149
</tr>
150
</table>
151

    
152

    
153
<?php
154

    
155
// Print admin footer
156
$admin->print_footer();
157

    
158
?>
(11-11/17)