Revision 298
Added by stefan over 18 years ago
modify_settings.php | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
|
3 | 3 |
// $Id$ |
4 |
|
|
4 |
|
|
5 | 5 |
/* |
6 | 6 |
|
7 | 7 |
Website Baker Project <http://www.websitebaker.org/> |
... | ... | |
27 | 27 |
The Website Baker Project would like to thank Rudolph Lartey <www.carbonect.com> |
28 | 28 |
for his contributions to this module - adding extra field types |
29 | 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('<', '>'); |
|
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> |
|
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('<', '>'); |
|
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> |
|
84 | 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 | 85 |
<select name="email_from_field" style="width: 100%;"> |
86 | 86 |
<option value="" onclick="javascript: document.getElementById('email_from').style.display = 'block';"><?php echo $TEXT['CUSTOM']; ?>:</option> |
87 | 87 |
<?php |
88 | 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' ORDER BY position ASC"); |
|
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 | 90 |
if($query_email_fields->numRows() > 0) { |
91 | 91 |
while($field = $query_email_fields->fetchRow()) { |
92 | 92 |
?> |
... | ... | |
97 | 97 |
} |
98 | 98 |
} |
99 | 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> |
|
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> |
|
115 | 103 |
</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>
|
|
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> |
|
121 | 109 |
</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>
|
|
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> |
|
127 | 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 | 128 |
<?php if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */ ?> |
129 | 129 |
<tr> |
130 | 130 |
<td class="setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td> |
... | ... | |
135 | 135 |
<label for="use_captcha_false"><?php echo $TEXT['DISABLED']; ?></label> |
136 | 136 |
</td> |
137 | 137 |
</tr> |
138 |
<?php } ?>
|
|
139 |
</table>
|
|
140 |
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
|
141 |
<tr>
|
|
142 |
<td width="225"> </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 |
|
|
138 |
<?php } ?> |
|
139 |
</table> |
|
140 |
<table cellpadding="0" cellspacing="0" border="0" width="100%"> |
|
141 |
<tr> |
|
142 |
<td width="225"> </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 | 158 |
?> |
Also available in: Unified diff
/modules/form/save_settings.php
/modules/form/view.php