Revision 560
Added by Matthias almost 17 years ago
trunk/CHANGELOG | ||
---|---|---|
13 | 13 |
------------------------------------- 2.7.0 ------------------------------------- |
14 | 14 |
|
15 | 15 |
18-Jan-2008 Matthias Gallas |
16 |
! Updated form modul with features from the advanced form modul |
|
16 | 17 |
# Fixed hardcoded /pages issue in intro page feature |
17 | 18 |
+ Added example .htaccess to parse .html files, fixed bug in changeset 555 |
18 | 19 |
! Revoked parts of changeset 547 and again introduced changeset 540 |
trunk/wb/upgrade-script.php | ||
---|---|---|
198 | 198 |
} |
199 | 199 |
|
200 | 200 |
|
201 |
//****************************************************************************** |
|
202 |
//The following lines upgrades the form modul from 2.6.x to the andvanced version from 2.7.x |
|
203 |
//****************************************************************************** |
|
201 | 204 |
|
205 |
$database = new database(DB_URL); |
|
202 | 206 |
|
207 |
echo "<BR><B>Adding new field to database table mod_form_settings</B><BR>"; |
|
208 |
|
|
209 |
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` ADD `success_email_subject` VARCHAR(255) NOT NULL AFTER `success_message`")) { |
|
210 |
echo 'Database Field success_email_subject added successfully<br />'; |
|
211 |
} |
|
212 |
echo mysql_error().'<br />'; |
|
213 |
|
|
214 |
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` ADD `success_email_text` TEXT NOT NULL AFTER `success_message`")) { |
|
215 |
echo 'Database Field success_email_text added successfully<br />'; |
|
216 |
} |
|
217 |
echo mysql_error().'<br />'; |
|
218 |
|
|
219 |
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` ADD `success_email_from` VARCHAR(255) NOT NULL AFTER `success_message`")) { |
|
220 |
echo 'Database Field success_email_from added successfully<br />'; |
|
221 |
} |
|
222 |
echo mysql_error().'<br />'; |
|
223 |
|
|
224 |
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` ADD `success_email_to` TEXT NOT NULL AFTER `success_message`")) { |
|
225 |
echo 'Database Field success_email_to added successfully<br />'; |
|
226 |
} |
|
227 |
echo mysql_error().'<br />'; |
|
228 |
|
|
229 |
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` ADD `success_page` TEXT NOT NULL AFTER `success_message`")) { |
|
230 |
echo 'Database Field success_page added successfully<br />'; |
|
231 |
} |
|
232 |
echo mysql_error().'<br />'; |
|
233 |
|
|
234 |
echo "<BR><B>Deleting field success_message from table mod_form_settings</B><BR>"; |
|
235 |
|
|
236 |
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` DROP `success_message`")) { |
|
237 |
echo 'Database field success_message droped successfully<br>'; |
|
238 |
} |
|
239 |
echo mysql_error().'<br />'; |
|
240 |
|
|
241 |
|
|
242 |
// UPDATING DATA INTO FIELDS |
|
243 |
echo "<BR>"; |
|
244 |
|
|
245 |
// These are the default setting |
|
246 |
$success_page = 'none'; |
|
247 |
$success_email_to = ''; |
|
248 |
$success_email_text = 'Thank you for submitting your form on '.WEBSITE_TITLE; |
|
249 |
$success_email_text = addslashes($success_email_text); |
|
250 |
$success_email_subject = 'You have submitted a form'; |
|
251 |
|
|
252 |
// Insert default settings into database |
|
253 |
$query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings where section_id != 0 and page_id != 0"); |
|
254 |
while($result = $query_dates->fetchRow()) { |
|
255 |
|
|
256 |
echo "<B>Add default settings data to database for form section_id= ".$result['section_id']."</b><BR>"; |
|
257 |
$section_id = $result['section_id']; |
|
258 |
|
|
259 |
if($database->query("UPDATE `".TABLE_PREFIX."mod_form_settings` SET `success_page` = '$success_page' WHERE `section_id` = $section_id")) { |
|
260 |
echo 'Database data success_page added successfully<br>'; |
|
261 |
} |
|
262 |
echo mysql_error().'<br />'; |
|
263 |
|
|
264 |
if($database->query("UPDATE `".TABLE_PREFIX."mod_form_settings` SET `success_email_to` = '$success_email_to' WHERE `section_id` = $section_id")) { |
|
265 |
echo 'Database data success_email_to added successfully<br>'; |
|
266 |
} |
|
267 |
echo mysql_error().'<br />'; |
|
268 |
|
|
269 |
if($database->query("UPDATE `".TABLE_PREFIX."mod_form_settings` SET `success_email_text` = '$success_email_text' WHERE `section_id` = $section_id")) { |
|
270 |
echo 'Database data success_email_text added successfully<br>'; |
|
271 |
} |
|
272 |
echo mysql_error().'<br />'; |
|
273 |
|
|
274 |
if($database->query("UPDATE `".TABLE_PREFIX."mod_form_settings` SET `success_email_subject` = '$success_email_subject' WHERE `section_id` = $section_id")) { |
|
275 |
echo 'Database data success_email_subject added successfully<br>'; |
|
276 |
} |
|
277 |
echo mysql_error().'<br />'; |
|
278 |
|
|
279 |
} |
|
280 |
|
|
281 |
// copy field email_to to success_email_from |
|
282 |
$query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings where section_id != 0 and page_id != 0"); |
|
283 |
while($result = $query_dates->fetchRow()) { |
|
284 |
|
|
285 |
echo "<B>Copying field email_to to success_email_from for form section_id= ".$result['section_id']."</B><BR>"; |
|
286 |
$section_id = $result['section_id']; |
|
287 |
|
|
288 |
$success_email_from = $result['email_to']; |
|
289 |
if($database->query("UPDATE `".TABLE_PREFIX."mod_form_settings` SET `success_email_from` = '$success_email_from' WHERE `section_id` = $section_id")) { |
|
290 |
echo 'Copyied field email_to to success_email_from successfully<br>'; |
|
291 |
} |
|
292 |
echo mysql_error().'<br />'; |
|
293 |
} |
|
294 |
|
|
295 |
//****************************************************************************** |
|
296 |
//End of upgrade script for the form modul |
|
297 |
//****************************************************************************** |
|
298 |
|
|
203 | 299 |
echo "<br /><br />Done<br />"; |
204 | 300 |
|
205 | 301 |
?> |
trunk/wb/modules/form/modify_field.php | ||
---|---|---|
60 | 60 |
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>"> |
61 | 61 |
<input type="hidden" name="field_id" value="<?php echo $field_id; ?>"> |
62 | 62 |
|
63 |
<table cellpadding="4" cellspacing="0" border="0" width="100%"> |
|
64 |
<tr> |
|
65 |
<td width="80"><?php echo $TEXT['TITLE']; ?>:</td> |
|
66 |
<td> |
|
67 |
<input type="text" name="title" value="<?php echo htmlspecialchars(($form['title'])); ?>" style="width: 100%;" maxlength="255" /> |
|
68 |
</td> |
|
69 |
</tr> |
|
70 |
<tr> |
|
71 |
<td><?php echo $TEXT['TYPE']; ?>:</td> |
|
72 |
<td> |
|
73 |
<select name="type" style="width: 100%;"> |
|
74 |
<option value=""><?php echo $TEXT['PLEASE_SELECT']; ?>...</option> |
|
75 |
<option value="heading"<?php if($type == 'heading') { echo ' selected'; } ?>><?php echo $TEXT['HEADING']; ?></option> |
|
76 |
<option value="textfield"<?php if($type == 'textfield') { echo ' selected'; } ?>><?php echo $TEXT['SHORT'].' '.$TEXT['TEXT']; ?> (Textfield)</option> |
|
77 |
<option value="textarea"<?php if($type == 'textarea') { echo ' selected'; } ?>><?php echo $TEXT['LONG'].' '.$TEXT['TEXT']; ?> (Textarea)</option> |
|
78 |
<option value="select"<?php if($type == 'select') { echo ' selected'; } ?>><?php echo $TEXT['SELECT_BOX']; ?></option> |
|
79 |
<option value="checkbox"<?php if($type == 'checkbox') { echo ' selected'; } ?>><?php echo $TEXT['CHECKBOX_GROUP']; ?></option> |
|
80 |
<option value="radio"<?php if($type == 'radio') { echo ' selected'; } ?>><?php echo $TEXT['RADIO_BUTTON_GROUP']; ?></option> |
|
81 |
<option value="email"<?php if($type == 'email') { echo ' selected'; } ?>><?php echo $TEXT['EMAIL_ADDRESS']; ?></option> |
|
82 |
</select> |
|
83 |
</td> |
|
84 |
</tr> |
|
63 |
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%"> |
|
64 |
<tr> |
|
65 |
<td colspan="2"><strong><?php echo $TEXT['MODIFY'].' '.$TEXT['FIELD']; ?></strong></td> |
|
66 |
</tr> |
|
67 |
<tr> |
|
68 |
<td width="20%"><?php echo $TEXT['TITLE']; ?>:</td> |
|
69 |
<td> |
|
70 |
<input type="text" name="title" value="<?php echo htmlspecialchars(($form['title'])); ?>" style="width: 98%;" maxlength="255" /> |
|
71 |
</td> |
|
72 |
</tr> |
|
73 |
<tr> |
|
74 |
<td><?php echo $TEXT['TYPE']; ?>:</td> |
|
75 |
<td> |
|
76 |
<select name="type" style="width: 98%;"> |
|
77 |
<option value=""><?php echo $TEXT['PLEASE_SELECT']; ?>...</option> |
|
78 |
<option value="heading"<?php if($type == 'heading') { echo ' selected'; } ?>><?php echo $TEXT['HEADING']; ?></option> |
|
79 |
<option value="textfield"<?php if($type == 'textfield') { echo ' selected'; } ?>><?php echo $TEXT['SHORT'].' '.$TEXT['TEXT']; ?> (Textfield)</option> |
|
80 |
<option value="textarea"<?php if($type == 'textarea') { echo ' selected'; } ?>><?php echo $TEXT['LONG'].' '.$TEXT['TEXT']; ?> (Textarea)</option> |
|
81 |
<option value="select"<?php if($type == 'select') { echo ' selected'; } ?>><?php echo $TEXT['SELECT_BOX']; ?></option> |
|
82 |
<option value="checkbox"<?php if($type == 'checkbox') { echo ' selected'; } ?>><?php echo $TEXT['CHECKBOX_GROUP']; ?></option> |
|
83 |
<option value="radio"<?php if($type == 'radio') { echo ' selected'; } ?>><?php echo $TEXT['RADIO_BUTTON_GROUP']; ?></option> |
|
84 |
<option value="email"<?php if($type == 'email') { echo ' selected'; } ?>><?php echo $TEXT['EMAIL_ADDRESS']; ?></option> |
|
85 |
</select> |
|
86 |
</td> |
|
87 |
</tr> |
|
85 | 88 |
<?php if($type != 'none' AND $type != 'email') { ?> |
86 | 89 |
<?php if($type == 'heading') { ?> |
87 | 90 |
<tr> |
88 | 91 |
<td valign="top"><?php echo $TEXT['TEMPLATE']; ?>:</td> |
89 | 92 |
<td> |
90 |
<textarea name="template" style="width: 100%; height: 20px;"><?php echo htmlspecialchars(($form['extra'])); ?></textarea>
|
|
93 |
<textarea name="template" style="width: 98%; height: 20px;"><?php echo htmlspecialchars(($form['extra'])); ?></textarea>
|
|
91 | 94 |
</td> |
92 | 95 |
</tr> |
93 | 96 |
<?php } elseif($type == 'textfield') { ?> |
94 | 97 |
<tr> |
95 | 98 |
<td><?php echo $TEXT['LENGTH']; ?>:</td> |
96 | 99 |
<td> |
97 |
<input type="text" name="length" value="<?php echo $form['extra']; ?>" style="width: 100%;" maxlength="3" />
|
|
100 |
<input type="text" name="length" value="<?php echo $form['extra']; ?>" style="width: 98%;" maxlength="3" />
|
|
98 | 101 |
</td> |
99 | 102 |
</tr> |
100 | 103 |
<tr> |
101 | 104 |
<td><?php echo $TEXT['DEFAULT_TEXT']; ?>:</td> |
102 | 105 |
<td> |
103 |
<input type="text" name="value" value="<?php echo $form['value']; ?>" style="width: 100%;" />
|
|
106 |
<input type="text" name="value" value="<?php echo $form['value']; ?>" style="width: 98%;" />
|
|
104 | 107 |
</td> |
105 | 108 |
</tr> |
106 | 109 |
<?php } elseif($type == 'textarea') { ?> |
107 | 110 |
<tr> |
108 | 111 |
<td valign="top"><?php echo $TEXT['DEFAULT_TEXT']; ?>:</td> |
109 | 112 |
<td> |
110 |
<textarea name="value" style="width: 100%; height: 100px;"><?php echo $form['value']; ?></textarea>
|
|
113 |
<textarea name="value" style="width: 98%; height: 100px;"><?php echo $form['value']; ?></textarea>
|
|
111 | 114 |
</td> |
112 | 115 |
</tr> |
113 | 116 |
<?php } elseif($type == 'select' OR $type = 'radio' OR $type = 'checkbox') { ?> |
... | ... | |
153 | 156 |
<td><?php echo $TEXT['SIZE']; ?>:</td> |
154 | 157 |
<td> |
155 | 158 |
<?php $form['extra'] = explode(',',$form['extra']); ?> |
156 |
<input type="text" name="size" value="<?php echo trim($form['extra'][0]); ?>" style="width: 100%;" maxlength="3" />
|
|
159 |
<input type="text" name="size" value="<?php echo trim($form['extra'][0]); ?>" style="width: 98%;" maxlength="3" />
|
|
157 | 160 |
</td> |
158 | 161 |
</tr> |
159 | 162 |
<tr> |
... | ... | |
174 | 177 |
<tr> |
175 | 178 |
<td valign="top"><?php echo $TEXT['SEPERATOR']; ?>:</td> |
176 | 179 |
<td> |
177 |
<input type="text" name="seperator" value="<?php echo $form['extra']; ?>" style="width: 100%;" />
|
|
180 |
<input type="text" name="seperator" value="<?php echo $form['extra']; ?>" style="width: 98%;" />
|
|
178 | 181 |
</td> |
179 | 182 |
</tr> |
180 | 183 |
<?php } ?> |
181 | 184 |
<?php } ?> |
182 | 185 |
<?php if($type != 'heading' AND $type != 'none') { ?> |
183 |
<tr> |
|
184 |
<td><?php echo $TEXT['REQUIRED']; ?>:</td> |
|
185 |
<td> |
|
186 |
<input type="radio" name="required" id="required_true" value="1" <?php if($form['required'] == 1) { echo ' checked'; } ?> /> |
|
187 |
<a href="#" onclick="javascript: document.getElementById('required_true').checked = true;"> |
|
188 |
<?php echo $TEXT['YES']; ?> |
|
189 |
</a> |
|
190 |
|
|
191 |
<input type="radio" name="required" id="required_false" value="0" <?php if($form['required'] == 0) { echo ' checked'; } ?> /> |
|
192 |
<a href="#" onclick="javascript: document.getElementById('required_false').checked = true;"> |
|
193 |
<?php echo $TEXT['NO']; ?> |
|
194 |
</a> |
|
195 |
</td> |
|
196 |
</tr> |
|
186 |
<tr>
|
|
187 |
<td><?php echo $TEXT['REQUIRED']; ?>:</td>
|
|
188 |
<td>
|
|
189 |
<input type="radio" name="required" id="required_true" value="1" <?php if($form['required'] == 1) { echo ' checked'; } ?> />
|
|
190 |
<a href="#" onclick="javascript: document.getElementById('required_true').checked = true;">
|
|
191 |
<?php echo $TEXT['YES']; ?>
|
|
192 |
</a>
|
|
193 |
|
|
194 |
<input type="radio" name="required" id="required_false" value="0" <?php if($form['required'] == 0) { echo ' checked'; } ?> />
|
|
195 |
<a href="#" onclick="javascript: document.getElementById('required_false').checked = true;">
|
|
196 |
<?php echo $TEXT['NO']; ?>
|
|
197 |
</a>
|
|
198 |
</td>
|
|
199 |
</tr>
|
|
197 | 200 |
<?php } ?> |
198 | 201 |
</table> |
199 | 202 |
|
200 | 203 |
<table cellpadding="0" cellspacing="0" border="0" width="100%"> |
201 |
<tr> |
|
202 |
<td width="90"> |
|
203 |
|
|
204 |
</td> |
|
205 |
<td align="left"> |
|
206 |
<input name="save" type="submit" value="<?php echo $TEXT['SAVE'].' '.$TEXT['FIELD']; ?>" style="width: 200px; margin-top: 5px;"></form> |
|
207 |
</td> |
|
208 |
<td align="right"> |
|
209 |
<input type="button" value="<?php echo $TEXT['CLOSE']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" /> |
|
210 |
</td> |
|
211 |
</tr> |
|
204 |
<tr> |
|
205 |
<td align="left"> |
|
206 |
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;"></form> |
|
207 |
</td> |
|
208 |
<?php |
|
209 |
// added by John Maats, PCWacht, 12 januar 2006 |
|
210 |
if ($type<>'none') { |
|
211 |
?> |
|
212 |
<td align="center"> |
|
213 |
<input type="button" value="<?php echo $TEXT['ADD'].' '.$TEXT['FIELD']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/form/add_field.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section_id; ?>';" style="width: 200px; margin-top: 5px;" /> |
|
214 |
</td> |
|
215 |
<?php } |
|
216 |
// end addition |
|
217 |
?> |
|
218 |
<td align="right"> |
|
219 |
<input type="button" value="<?php echo $TEXT['CLOSE']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" /> |
|
220 |
</td> |
|
221 |
</tr> |
|
212 | 222 |
</table> |
213 | 223 |
|
214 | 224 |
<?php |
215 | 225 |
trunk/wb/modules/form/info.php | ||
---|---|---|
28 | 28 |
for his contributions to this module - adding extra field types |
29 | 29 |
*/ |
30 | 30 |
|
31 |
/* |
|
32 |
revision: |
|
33 |
2.6.2.0 21 jan 2007 |
|
34 |
minor fixes in the search tabel entries |
|
35 |
2.6.1.9 24 dez 2006 |
|
36 |
adapted all files to be compatible with 2.6.5 |
|
37 |
2.6.1.8 03 oct 2006 |
|
38 |
fixed double )) in save_field.php line 76 |
|
39 |
2.6.1.7 24 jan 2006 |
|
40 |
added header to modify_fields |
|
41 |
removed a typo (captcha) |
|
42 |
2.6.1.6 23 jan 2006 |
|
43 |
added exit(0); after each header("Location: ...) call |
|
44 |
added language text for 'none' thanks to Ruebenwurzel |
|
45 |
2.6.1.5 23 jan 2006 |
|
46 |
added anti caching to captcha |
|
47 |
changed the way thankyou page works, if chosen page is none, mail still could be sent, thank you message is shown! |
|
48 |
|
|
49 |
2.6.1.4 22 jan 2006 |
|
50 |
added email to mailto/from selected fields -> Ticket #118 |
|
51 |
removed last separator in radiobutton and checkbox |
|
52 |
2.6.1.3 21 jan 2006 |
|
53 |
restored thankyou text |
|
54 |
fixed mail lines, format of maillines -> Ticket #86 |
|
55 |
fixed max_submissions -> Ticket #115 |
|
56 |
fixed mailto/from selected fields (only textfields) -> Ticket #118 |
|
57 |
2.6.1.2 16 jan 2006 |
|
58 |
fixed ' in websitetitle |
|
59 |
2.6.1.1 14 jan 2006 |
|
60 |
changed thank you text to thank you page |
|
61 |
added thank you mail |
|
62 |
changed behaviour of adding fields |
|
63 |
*/ |
|
64 |
/* |
|
65 |
todo: |
|
66 |
- display of fieldlengths as variable, |
|
67 |
- back after error with filled in stuff? |
|
68 |
- validation link for submissions??? |
|
69 |
*/ |
|
70 |
|
|
31 | 71 |
$module_directory = 'form'; |
32 | 72 |
$module_name = 'Form'; |
33 | 73 |
$module_function = 'page'; |
34 |
$module_version = '2.6'; |
|
74 |
$module_version = '2.6.2.0';
|
|
35 | 75 |
$module_platform = '2.6.x'; |
36 |
$module_author = 'Ryan Djurovich & Rudolph Lartey'; |
|
76 |
$module_author = 'Ryan Djurovich & Rudolph Lartey - additions John Maats - PCWacht';
|
|
37 | 77 |
$module_license = 'GNU General Public License'; |
38 | 78 |
$module_description = 'This module allows you to create customised online forms, such as a feedback form. '. |
39 | 79 |
'Thank-you to Rudolph Lartey who help enhance this module, providing code for extra field types, etc.'; |
40 | 80 |
trunk/wb/modules/form/edit_css.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id:$ |
|
4 |
|
|
5 |
###################################################################################################################### |
|
6 |
# |
|
7 |
# PURPOSE OF THIS FILE: |
|
8 |
# This file contains the routines required to edit the optional module files: frontend.css and backend.css. |
|
9 |
# Nothing needs to be changed in this file. Keep it as is. |
|
10 |
# |
|
11 |
# INVOKED BY: |
|
12 |
# This file should be invoked by clicking on a text link shown in modify.php. |
|
13 |
# |
|
14 |
###################################################################################################################### |
|
15 |
|
|
16 |
/** |
|
17 |
Module developed for the Open Source Content Management System Website Baker (http://websitebaker.org) |
|
18 |
Copyright (C) year, Authors name |
|
19 |
Contact me: author(at)domain.xxx, http://authorwebsite.xxx |
|
20 |
|
|
21 |
This module is free software. You can redistribute it and/or modify it |
|
22 |
under the terms of the GNU General Public License - version 2 or later, |
|
23 |
as published by the Free Software Foundation: http://www.gnu.org/licenses/gpl.html. |
|
24 |
|
|
25 |
This module is distributed in the hope that it will be useful, |
|
26 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
27 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
28 |
GNU General Public License for more details. |
|
29 |
**/ |
|
30 |
|
|
31 |
// include configuration file and admin wrapper script |
|
32 |
require('../../config.php'); |
|
33 |
require(WB_PATH.'/modules/admin.php'); |
|
34 |
|
|
35 |
// include functions to edit the optional module CSS files (frontend.css, backend.css) |
|
36 |
require_once('css.functions.php'); |
|
37 |
|
|
38 |
// check if action is: save or edit |
|
39 |
if(isset($_GET['action']) && $_GET['action'] == 'save' && isset($_POST['edit_file']) && mod_file_exists($_POST['edit_file'])) { |
|
40 |
/** |
|
41 |
SAVE THE UPDATED CONTENTS TO THE CSS FILE |
|
42 |
*/ |
|
43 |
$css_content = ''; |
|
44 |
if(isset($_POST['css_codepress']) && strlen($_POST['css_codepress']) > 0) { |
|
45 |
// if Javascript is enabled, take contents from hidden field: css_codepress |
|
46 |
$css_content = stripslashes($_POST['css_codepress']); |
|
47 |
} elseif(isset($_POST['css_data']) && strlen($_POST['css_data']) > 0) { |
|
48 |
// if Javascript is disabled, take contens from textarea: css_data |
|
49 |
$css_content = stripslashes($_POST['css_data']); |
|
50 |
} |
|
51 |
|
|
52 |
$bytes = 0; |
|
53 |
if ($css_content != '') { |
|
54 |
// open the module CSS file for writting |
|
55 |
$mod_file = @fopen(dirname(__FILE__) .'/' .$_POST['edit_file'], "wb"); |
|
56 |
// write new content to the module CSS file |
|
57 |
$bytes = @fwrite($mod_file, $css_content); |
|
58 |
// close the file |
|
59 |
@fclose($mod_file); |
|
60 |
} |
|
61 |
|
|
62 |
// write out status message |
|
63 |
if($bytes == 0 ) { |
|
64 |
$admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
65 |
} else { |
|
66 |
$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
67 |
} |
|
68 |
|
|
69 |
} else { |
|
70 |
/** |
|
71 |
MODIFY CONTENTS OF THE CSS FILE VIA TEXT AREA |
|
72 |
*/ |
|
73 |
|
|
74 |
// check which module file to edit (frontend.css, backend.css or '') |
|
75 |
$css_file = ''; |
|
76 |
if(isset($_GET['edit_file'])) $css_file = edit_mod_file($_GET['edit_file']); |
|
77 |
|
|
78 |
// display output |
|
79 |
if($css_file == '') { |
|
80 |
// no valid module file to edit; display error message and backlink to modify.php |
|
81 |
echo "<h2>Nothing to edit</h2>"; |
|
82 |
echo "<p>No valid module file exists for this module.</p>"; |
|
83 |
$output = "<a href=\"#\" onclick=\"javascript: window.location = '"; |
|
84 |
$output .= ADMIN_URL ."/pages/modify.php?page_id=" .$page_id ."'\">back</a>"; |
|
85 |
echo $output; |
|
86 |
} else { |
|
87 |
// store content of the module file in variable |
|
88 |
$css_content = @file_get_contents(dirname(__FILE__) .'/' .$css_file); |
|
89 |
// output content of module file to textareas |
|
90 |
?> |
|
91 |
|
|
92 |
<form name="edit_module_file" action="<?php echo $_SERVER['PHP_SELF'] .'?action=save';?>" method="post" style="margin: 0;"> |
|
93 |
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>"> |
|
94 |
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>"> |
|
95 |
<input type="hidden" name="css_codepress" value="" /> |
|
96 |
<input type="hidden" name="edit_file" value="<?php echo $css_file; ?>" /> |
|
97 |
|
|
98 |
<h2><?php echo $HEADING_CSS_FILE .'"' .$css_file; ?>"</h2> |
|
99 |
<?php |
|
100 |
// include the toggle button to switch between frontend.css and backend.css (if both files exists) |
|
101 |
toggle_css_file($css_file); |
|
102 |
?> |
|
103 |
|
|
104 |
<p><?php echo $TXT_EDIT_CSS_FILE; ?></p> |
|
105 |
|
|
106 |
<textarea name="css_data" id="css_data" class="codepress css" cols="115" rows="25" wrap="VIRTUAL" style="margin:2px;"><?php echo $css_content; ?></textarea> |
|
107 |
|
|
108 |
<table cellpadding="0" cellspacing="0" border="0" width="100%"> |
|
109 |
<tr> |
|
110 |
<td align="left"> |
|
111 |
<input name="save" type="submit" value="<?php echo $TEXT['SAVE'];?>" onclick="javascript: css_codepress.value = css_data.getCode();" style="width: 100px; margin-top: 5px;" /> |
|
112 |
</td> |
|
113 |
<td align="right"> |
|
114 |
<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;" /> |
|
115 |
</td> |
|
116 |
</tr> |
|
117 |
</table> |
|
118 |
</form> |
|
119 |
<?php |
|
120 |
} |
|
121 |
} |
|
122 |
|
|
123 |
// Print admin footer |
|
124 |
$admin->print_footer(); |
|
125 |
|
|
126 |
?> |
|
0 | 127 |
trunk/wb/modules/form/css.functions.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
###################################################################################################################### |
|
6 |
# |
|
7 |
# PURPOSE OF THIS FILE: |
|
8 |
# This file contains functions to edit the module CSS files (frontend.css and backend.css) |
|
9 |
# |
|
10 |
# INVOKED BY: |
|
11 |
# This file is invoked when a user clicks on the edit CSS button in the modify.php file |
|
12 |
# |
|
13 |
###################################################################################################################### |
|
14 |
|
|
15 |
/** |
|
16 |
Module developed for the Open Source Content Management System Website Baker (http://websitebaker.org) |
|
17 |
Copyright (C) year, Authors name |
|
18 |
Contact me: author(at)domain.xxx, http://authorwebsite.xxx |
|
19 |
|
|
20 |
This module is free software. You can redistribute it and/or modify it |
|
21 |
under the terms of the GNU General Public License - version 2 or later, |
|
22 |
as published by the Free Software Foundation: http://www.gnu.org/licenses/gpl.html. |
|
23 |
|
|
24 |
This module is distributed in the hope that it will be useful, |
|
25 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
26 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
27 |
GNU General Public License for more details. |
|
28 |
**/ |
|
29 |
|
|
30 |
// prevent this file from being accesses directly |
|
31 |
if(defined('WB_PATH') == false) { |
|
32 |
exit("Cannot access this file directly"); |
|
33 |
} |
|
34 |
|
|
35 |
/** |
|
36 |
DEFINE LANGUAGE DEPENDING OUTPUTS FOR THE EDIT CSS PART |
|
37 |
*/ |
|
38 |
$lang_dir = WB_PATH .'/modules/' .basename(dirname(__FILE__)) .'/languages/'; |
|
39 |
if(file_exists($lang_dir .LANGUAGE .'.php')) { |
|
40 |
// try to include custom language file if exists |
|
41 |
require_once($lang_dir .LANGUAGE .'.php'); |
|
42 |
} elseif(file_exists($lang_dir .'EN.php')) { |
|
43 |
// try to include default module language file |
|
44 |
require_once($lang_dir .'EN.php'); |
|
45 |
} |
|
46 |
|
|
47 |
// set defaults if output varibles are not set in the languages files |
|
48 |
if(!isset($CAP_EDIT_CSS)) $CAP_EDIT_CSS = 'Edit CSS'; |
|
49 |
if(!isset($CAP_TOGGLE_CSS)) $CAP_TOGGLE_CSS = 'Switch to '; |
|
50 |
if(!isset($HEADING_CSS_FILE)) $HEADING_CSS_FILE = 'Actual module file: '; |
|
51 |
if(!isset($TXT_EDIT_CSS_FILE)) $TXT_EDIT_CSS_FILE = 'Edit the CSS definitions in the textarea below.'; |
|
52 |
|
|
53 |
// this function checks if the specified optional module file exists |
|
54 |
if (!function_exists('mod_file_exists')) { |
|
55 |
function mod_file_exists($mod_file='frontend.css') { |
|
56 |
// extract the module directory |
|
57 |
$mod_dir = basename(dirname(__FILE__)) .'/' .$mod_file; |
|
58 |
return file_exists(WB_PATH .'/modules/' .$mod_dir); |
|
59 |
} |
|
60 |
} |
|
61 |
|
|
62 |
// this function displays a "Edit CSS" button in modify.php |
|
63 |
// if the optional module files (module.css, module.js) if exists |
|
64 |
if (!function_exists('css_edit')) { |
|
65 |
function css_edit() { |
|
66 |
global $page_id, $section_id, $CAP_EDIT_CSS; |
|
67 |
// extract the module directory |
|
68 |
$mod_dir = basename(dirname(__FILE__)); |
|
69 |
$frontend_css = mod_file_exists('frontend.css'); |
|
70 |
$backend_css = mod_file_exists('backend.css'); |
|
71 |
if($frontend_css || $backend_css) { |
|
72 |
// display link to edit the optional CSS module files |
|
73 |
$file = $frontend_css ? 'frontend.css' : 'backend.css'; |
|
74 |
$output = '<div class="mod_' .$mod_dir .'_edit_css"><a href="' .WB_URL .'/modules/' .$mod_dir .'/edit_css.php'; |
|
75 |
$output .= '?page_id=' .$page_id .'§ion_id=' .$section_id .'&edit_file=' .$file .'">'; |
|
76 |
$output .= $CAP_EDIT_CSS .'</a></div>'; |
|
77 |
echo $output; |
|
78 |
} |
|
79 |
} |
|
80 |
} |
|
81 |
|
|
82 |
// this function returns a secure module file from $_GET['edit_file'] |
|
83 |
if (!function_exists('edit_mod_file')) { |
|
84 |
function edit_mod_file() { |
|
85 |
$allowed_files = array('frontend.css', 'backend.css'); |
|
86 |
if(isset($_GET['edit_file']) && in_array($_GET['edit_file'], $allowed_files)) { |
|
87 |
return $_GET['edit_file']; |
|
88 |
} elseif(mod_file_exists('frontend.css')) { |
|
89 |
return 'frontend.css'; |
|
90 |
} elseif(mod_file_exists('backend_css')) { |
|
91 |
return 'backend.css'; |
|
92 |
} else { |
|
93 |
return ''; |
|
94 |
} |
|
95 |
} |
|
96 |
} |
|
97 |
|
|
98 |
// this function displays a button to toggle between the optional module CSS files |
|
99 |
// function is invoked from edit_css.php file |
|
100 |
if (!function_exists('toggle_css_file')) { |
|
101 |
function toggle_css_file($base_css_file = 'frontend.css') { |
|
102 |
$allowed_mod_files = array('frontend.css', 'backend.css'); |
|
103 |
if(!in_array($base_css_file, $allowed_mod_files)) return; |
|
104 |
global $page_id, $section_id, $CAP_TOGGLE_CSS; |
|
105 |
// extract the module directory |
|
106 |
$mod_dir = basename(dirname(__FILE__)); |
|
107 |
$toggle_file = ($base_css_file == 'frontend.css') ? 'backend.css' : 'frontend.css'; |
|
108 |
if(mod_file_exists($toggle_file)) { |
|
109 |
// display button to toggle between the two CSS files: frontend.css, backend.css |
|
110 |
$output = '<div class="mod_' .$mod_dir .'_edit_css"><a href="' .WB_URL .'/modules/' .$mod_dir .'/edit_css.php'; |
|
111 |
$output .= '?page_id=' .$page_id .'§ion_id=' .$section_id .'&edit_file=' .$toggle_file .'">'; |
|
112 |
$output .= $CAP_TOGGLE_CSS .$toggle_file .'</a></div>'; |
|
113 |
echo $output; |
|
114 |
} |
|
115 |
} |
|
116 |
} |
|
117 |
|
|
118 |
?> |
|
0 | 119 |
trunk/wb/modules/form/install.php | ||
---|---|---|
54 | 54 |
. ' `email_to` TEXT NOT NULL ,' |
55 | 55 |
. ' `email_from` VARCHAR(255) NOT NULL DEFAULT \'\' ,' |
56 | 56 |
. ' `email_subject` VARCHAR(255) NOT NULL DEFAULT \'\' ,' |
57 |
. ' `success_message` TEXT NOT NULL ,' |
|
57 |
. ' `success_page` TEXT NOT NULL ,' |
|
58 |
. ' `success_email_to` TEXT NOT NULL ,' |
|
59 |
. ' `success_email_from` VARCHAR(255) NOT NULL DEFAULT \'\' ,' |
|
60 |
. ' `success_email_text` TEXT NOT NULL ,' |
|
61 |
. ' `success_email_subject` VARCHAR(255) NOT NULL DEFAULT \'\' ,' |
|
58 | 62 |
. ' `stored_submissions` INT NOT NULL DEFAULT \'0\' ,' |
59 | 63 |
. ' `max_submissions` INT NOT NULL DEFAULT \'0\' ,' |
60 | 64 |
. ' `use_captcha` INT NOT NULL DEFAULT \'0\' ,' |
61 | 65 |
. ' PRIMARY KEY ( `section_id` ) ' |
62 | 66 |
. ' )'; |
63 | 67 |
$database->query($mod_form); |
68 |
|
|
64 | 69 |
$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_submissions`"); |
65 | 70 |
$mod_form = 'CREATE TABLE `'.TABLE_PREFIX.'mod_form_submissions` ( `submission_id` INT NOT NULL AUTO_INCREMENT,' |
66 | 71 |
. ' `section_id` INT NOT NULL DEFAULT \'0\' ,' |
67 | 72 |
trunk/wb/modules/form/modify_settings.php | ||
---|---|---|
33 | 33 |
// Include WB admin wrapper script |
34 | 34 |
require(WB_PATH.'/modules/admin.php'); |
35 | 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 |
|
|
36 | 48 |
// Get header and footer |
37 | 49 |
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'"); |
38 | 50 |
$setting = $query_content->fetchRow(); |
... | ... | |
41 | 53 |
$raw = array('<', '>'); |
42 | 54 |
$friendly = array('<', '>'); |
43 | 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 |
|
|
44 | 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 |
?> |
|
45 | 70 |
|
46 |
<style type="text/css"> |
|
47 |
.setting_name { |
|
48 |
vertical-align: top; |
|
49 |
} |
|
50 |
</style> |
|
51 |
|
|
52 | 71 |
<form name="edit" action="<?php echo WB_URL; ?>/modules/form/save_settings.php" method="post" style="margin: 0;"> |
53 | 72 |
|
54 | 73 |
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>"> |
55 | 74 |
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>"> |
56 | 75 |
|
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%;"> |
|
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%;"> |
|
86 | 137 |
<option value="" onclick="javascript: document.getElementById('email_from').style.display = 'block';"><?php echo $TEXT['CUSTOM']; ?>:</option> |
87 | 138 |
<?php |
88 | 139 |
$email_from_value = str_replace($raw, $friendly, ($setting['email_from'])); |
... | ... | |
97 | 148 |
} |
98 | 149 |
} |
99 | 150 |
?> |
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 } ?> |
|
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> |
|
139 | 229 |
</table> |
230 |
|
|
140 | 231 |
<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> |
|
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> |
|
150 | 240 |
</table> |
151 | 241 |
|
152 |
|
|
153 | 242 |
<?php |
154 | 243 |
|
155 | 244 |
// Print admin footer |
156 | 245 |
trunk/wb/modules/form/uninstall.php | ||
---|---|---|
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 |
// Must include code to stop this file being access directly |
|
32 |
if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); } |
|
33 |
|
|
34 |
$database->query("DELETE FROM ".TABLE_PREFIX."search WHERE name = 'module' AND value = 'form'"); |
|
35 |
$database->query("DELETE FROM ".TABLE_PREFIX."search WHERE extra = 'form'"); |
|
36 |
|
|
37 |
$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_fields`"); |
|
38 |
$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_settings`"); |
|
39 |
$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_submissions`"); |
|
40 |
|
|
41 |
?> |
|
0 | 42 |
trunk/wb/modules/form/view.php | ||
---|---|---|
31 | 31 |
// Must include code to stop this file being access directly |
32 | 32 |
if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); } |
33 | 33 |
|
34 |
// check if frontend.css file needs to be included into the <body></body> of view.php |
|
35 |
if((!function_exists('register_frontend_modfiles') || !defined('MOD_FRONTEND_CSS_REGISTERED')) && file_exists(WB_PATH .'/modules/form/frontend.css')) { |
|
36 |
echo '<style type="text/css">'; |
|
37 |
include(WB_PATH .'/modules/form/frontend.css'); |
|
38 |
echo "\n</style>\n"; |
|
39 |
} |
|
40 |
|
|
34 | 41 |
// Function for generating an optionsfor a select field |
42 |
if (!function_exists(make_option)) { |
|
35 | 43 |
function make_option(&$n) { |
36 | 44 |
// start option group if it exists |
37 | 45 |
if (substr($n,0,2) == '[=') { |
... | ... | |
42 | 50 |
$n = '<option value="'.$n.'">'.$n.'</option>'; |
43 | 51 |
} |
44 | 52 |
} |
45 |
|
|
53 |
} |
|
46 | 54 |
// Function for generating a checkbox |
55 |
if (!function_exists(make_checkbox)) { |
|
47 | 56 |
function make_checkbox(&$n, $idx, $params) { |
48 | 57 |
$field_id = $params[0]; |
49 | 58 |
$seperator = $params[1]; |
50 | 59 |
//$n = '<input class="field_checkbox" type="checkbox" id="'.$n.'" name="field'.$field_id.'" value="'.$n.'">'.'<font class="checkbox_label" onclick="javascript: document.getElementById(\''.$n.'\').checked = !document.getElementById(\''.$n.'\').checked;">'.$n.'</font>'.$seperator; |
51 | 60 |
$n = '<input class="field_checkbox" type="checkbox" id="'.$n.'" name="field'.$field_id.'['.$idx.']" value="'.$n.'">'.'<font class="checkbox_label" onclick="javascript: document.getElementById(\''.$n.'\').checked = !document.getElementById(\''.$n.'\').checked;">'.$n.'</font>'.$seperator; |
52 | 61 |
} |
53 |
|
|
62 |
} |
|
54 | 63 |
// Function for generating a radio button |
64 |
if (!function_exists(make_radio)) { |
|
55 | 65 |
function make_radio(&$n, $idx, $params) { |
56 | 66 |
$field_id = $params[0]; |
57 | 67 |
$group = $params[1]; |
58 | 68 |
$seperator = $params[2]; |
59 | 69 |
$n = '<input class="field_radio" type="radio" id="'.$n.'" name="field'.$field_id.'" value="'.$n.'">'.'<font class="radio_label" onclick="javascript: document.getElementById(\''.$n.'\').checked = true;">'.$n.'</font>'.$seperator; |
60 | 70 |
} |
61 |
|
|
71 |
} |
|
62 | 72 |
// Generate temp submission id |
63 | 73 |
function new_submission_id() { |
64 | 74 |
$submission_id = ''; |
... | ... | |
80 | 90 |
// Set new submission ID in session |
81 | 91 |
$_SESSION['form_submission_id'] = new_submission_id(); |
82 | 92 |
|
83 |
?> |
|
84 |
<style type="text/css"> |
|
85 |
.required { |
|
86 |
color: #FF0000; |
|
87 |
} |
|
88 |
.field_title { |
|
89 |
font-size: 12px; |
|
90 |
width: 100px; |
|
91 |
vertical-align: top; |
|
92 |
text-align:right; |
|
93 |
} |
|
94 |
.textfield { |
|
95 |
font-size: 12px; |
|
96 |
width: 200px; |
|
97 |
} |
|
98 |
.textarea { |
|
99 |
font-size: 12px; |
|
100 |
width: 90%; |
|
101 |
height: 100px; |
|
102 |
} |
|
103 |
.field_heading { |
|
104 |
font-size: 12px; |
|
105 |
font-weight: bold; |
|
106 |
border-bottom-width: 2px; |
|
107 |
border-bottom-style: solid; |
|
108 |
border-bottom-color: #666666; |
|
109 |
padding-top: 10px; |
|
110 |
color: #666666; |
|
111 |
} |
|
112 |
.select { |
|
113 |
font-size: 12px; |
|
114 |
} |
|
115 |
.checkbox_label { |
|
116 |
font-size: 11px; |
|
117 |
cursor: pointer; |
|
118 |
} |
|
119 |
.radio_label { |
|
120 |
font-size: 11px; |
|
121 |
cursor: pointer; |
|
122 |
} |
|
123 |
.email { |
|
124 |
font-size: 12px; |
|
125 |
width: 200px; |
|
126 |
} |
|
127 |
</style> |
|
128 |
<?php |
|
129 |
|
|
130 | 93 |
// Get settings |
131 | 94 |
$query_settings = $database->query("SELECT header,field_loop,footer,use_captcha FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'"); |
132 | 95 |
if($query_settings->numRows() > 0) { |
... | ... | |
141 | 104 |
$footer = ''; |
142 | 105 |
} |
143 | 106 |
|
107 |
$java_fields = ''; |
|
108 |
$java_titles = ''; |
|
109 |
$java_tween = ''; // I know kinda stupid, anyone better idea? |
|
110 |
$java_mailcheck = ''; |
|
111 |
|
|
144 | 112 |
// Add form starter code |
145 | 113 |
?> |
146 |
<form name="form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> |
|
114 |
<form name="form" onsubmit="return formCheck(this);" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
|
|
147 | 115 |
<input type="hidden" name="submission_id" value="<?php echo $_SESSION['form_submission_id']; ?>" /> |
148 | 116 |
<?php |
149 | 117 |
|
... | ... | |
162 | 130 |
$values = array($field['title']); |
163 | 131 |
if($field['required'] == 1) { |
164 | 132 |
$values[] = '<font class="required">*</font>'; |
133 |
$java_fields .= $java_tween.'"field'.$field_id.'"'; |
|
134 |
$java_titles .= $java_tween.'"'.$field['title'].'"'; |
|
135 |
$java_tween = ', '; |
|
165 | 136 |
} else { |
166 | 137 |
$values[] = ''; |
167 | 138 |
} |
... | ... | |
186 | 157 |
$vars[] = '{FIELD}'; |
187 | 158 |
$options = explode(',', $value); |
188 | 159 |
array_walk($options, 'make_checkbox',array($field_id,$field['extra'])); |
160 |
$options[count($options)-1]=substr($options[count($options)-1],0,strlen($options[count($options)-1])-strlen($field['extra'])); |
|
189 | 161 |
$values[] = implode($options); |
190 | 162 |
} elseif($field['type'] == 'radio') { |
191 | 163 |
$vars[] = '{FIELD}'; |
192 | 164 |
$options = explode(',', $value); |
193 | 165 |
array_walk($options, 'make_radio',array($field_id,$field['title'],$field['extra'])); |
166 |
$options[count($options)-1]=substr($options[count($options)-1],0,strlen($options[count($options)-1])-strlen($field['extra'])); |
|
194 | 167 |
$values[] = implode($options); |
195 | 168 |
} elseif($field['type'] == 'email') { |
196 | 169 |
$vars[] = '{FIELD}'; |
197 |
$values[] = '<input type="text" name="field'.$field_id.'" id="field'.$field_id.'" maxlength="'.$field['extra'].'" class="email" />'; |
|
170 |
$values[] = '<input type="text" name="field'.$field_id.'" onChange="return checkmail(this.form.field'.$field_id.')" id="field'.$field_id.'" maxlength="'.$field['extra'].'" class="email" />'; |
|
171 |
$java_mailcheck .= 'onChange="return checkmail(this.form'.$field_id.'" '; |
|
198 | 172 |
} |
199 | 173 |
if($field['type'] != '') { |
200 | 174 |
echo str_replace($vars, $values, $field_loop); |
... | ... | |
217 | 191 |
</td></tr> |
218 | 192 |
<?php |
219 | 193 |
} |
194 |
echo ' |
|
195 |
<script language="JavaScript"> |
|
196 |
<!-- |
|
220 | 197 |
|
198 |
/*********************************************** |
|
199 |
* Required field(s) validation v1.10- By NavSurf |
|
200 |
* Visit Nav Surf at http://navsurf.com |
|
201 |
* Visit http://www.dynamicdrive.com/ for full source code |
|
202 |
***********************************************/ |
|
203 |
|
|
204 |
function formCheck(formobj){ |
|
205 |
// Enter name of mandatory fields |
|
206 |
var fieldRequired = Array('.$java_fields.'); |
|
207 |
// Enter field description to appear in the dialog box |
|
208 |
var fieldDescription = Array('.$java_titles.'); |
|
209 |
// dialog message |
|
210 |
var alertMsg = "'.$MESSAGE['MOD_FORM']['REQUIRED_FIELDS'].':\n"; |
|
211 |
|
|
212 |
var l_Msg = alertMsg.length; |
|
213 |
|
|
214 |
for (var i = 0; i < fieldRequired.length; i++){ |
|
215 |
var obj = formobj.elements[fieldRequired[i]]; |
|
216 |
if (obj){ |
|
217 |
switch(obj.type){ |
|
218 |
case "select-one": |
|
219 |
if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){ |
|
220 |
alertMsg += " - " + fieldDescription[i] + "\n"; |
|
221 |
} |
|
222 |
break; |
|
223 |
case "select-multiple": |
|
224 |
if (obj.selectedIndex == -1){ |
|
225 |
alertMsg += " - " + fieldDescription[i] + "\n"; |
|
226 |
} |
|
227 |
break; |
|
228 |
case "text": |
|
229 |
case "textarea": |
|
230 |
if (obj.value == "" || obj.value == null){ |
|
231 |
alertMsg += " - " + fieldDescription[i] + "\n"; |
|
232 |
} |
|
233 |
break; |
|
234 |
default: |
|
235 |
} |
|
236 |
if (obj.type == undefined){ |
|
237 |
var blnchecked = false; |
|
238 |
for (var j = 0; j < obj.length; j++){ |
|
239 |
if (obj[j].checked){ |
|
240 |
blnchecked = true; |
|
241 |
} |
|
242 |
} |
|
243 |
if (!blnchecked){ |
|
244 |
alertMsg += " - " + fieldDescription[i] + "\n"; |
|
245 |
} |
|
246 |
} |
|
247 |
} |
|
248 |
} |
|
249 |
|
|
250 |
if (alertMsg.length == l_Msg){ |
|
251 |
return true; |
|
252 |
}else{ |
|
253 |
alert(alertMsg); |
|
254 |
return false; |
|
255 |
} |
|
256 |
} |
|
257 |
/*********************************************** |
|
258 |
* Email Validation script- ? Dynamic Drive (www.dynamicdrive.com) |
|
259 |
* This notice must stay intact for legal use. |
|
260 |
* Visit http://www.dynamicdrive.com/ for full source code |
|
261 |
***********************************************/ |
|
262 |
|
|
263 |
var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i |
|
264 |
|
|
265 |
function checkmail(e){ |
|
266 |
var returnval=emailfilter.test(e.value); |
|
267 |
if (returnval==false){ |
|
268 |
alert("Please enter a valid email address."); |
|
269 |
e.select(); |
|
270 |
} |
|
271 |
return returnval; |
|
272 |
} |
|
273 |
--> |
|
274 |
|
|
275 |
</script>'; |
|
276 |
|
|
277 |
|
|
221 | 278 |
// Print footer |
222 | 279 |
echo $footer; |
223 | 280 |
|
... | ... | |
236 | 293 |
|
237 | 294 |
// Submit form data |
238 | 295 |
// First start message settings |
239 |
$query_settings = $database->query("SELECT email_to,email_from,email_subject,success_message,max_submissions,stored_submissions,use_captcha FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
|
|
296 |
$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
|
|
240 | 297 |
if($query_settings->numRows() > 0) { |
241 | 298 |
$fetch_settings = $query_settings->fetchRow(); |
242 | 299 |
$email_to = $fetch_settings['email_to']; |
... | ... | |
246 | 303 |
$email_from = $wb->add_slashes($_POST[$email_from]); |
247 | 304 |
} |
248 | 305 |
$email_subject = $fetch_settings['email_subject']; |
249 |
$success_message = $fetch_settings['success_message']; |
|
306 |
$success_page = $fetch_settings['success_page']; |
|
307 |
$success_email_to = $fetch_settings['success_email_to']; |
|
308 |
if(substr($success_email_to, 0, 5) == 'field') { |
|
309 |
// Set the success_email to field to what the user entered in the specified field |
|
310 |
$success_email_to = $wb->add_slashes($_POST[$success_email_to]); |
|
311 |
} |
|
312 |
$success_email_from = $fetch_settings['success_email_from']; |
|
313 |
$success_email_text = $fetch_settings['success_email_text']; |
|
314 |
$success_email_subject = $fetch_settings['success_email_subject']; |
|
250 | 315 |
$max_submissions = $fetch_settings['max_submissions']; |
251 | 316 |
$stored_submissions = $fetch_settings['stored_submissions']; |
252 | 317 |
$use_captcha = $fetch_settings['use_captcha']; |
... | ... | |
343 | 408 |
// Now send the email |
344 | 409 |
if($email_to != '') { |
345 | 410 |
if($email_from != '') { |
346 |
if($wb->mail($email_from,$email_to,$email_subject,$email_body)) { $success = true; } |
|
411 |
if($wb->mail($email_from,$email_to,$email_subject,$email_body)) { |
|
412 |
$success = true; |
|
413 |
} |
|
414 |
} else { |
|
415 |
if($wb->mail('',$email_to,$email_subject,$email_body)) { |
|
416 |
$success = true; |
|
417 |
} |
|
347 | 418 |
} |
348 | 419 |
} |
420 |
if($success_email_to != '') { |
|
421 |
if($success_email_from != '') { |
|
422 |
if($wb->mail($success_email_from,$success_email_to,$success_email_subject,$success_email_text)) { |
|
423 |
$success = true; |
|
424 |
} |
|
425 |
} else { |
|
426 |
if($wb->mail('',$success_email_to,$success_email_subject,$success_email_text)) { |
|
427 |
$success = true; |
|
428 |
} |
|
429 |
} |
|
430 |
} |
|
431 |
|
|
349 | 432 |
// Write submission to database |
350 | 433 |
if(isset($admin) AND $admin->get_user_id() > 0) { |
351 | 434 |
$admin->get_user_id(); |
... | ... | |
378 | 461 |
|
379 | 462 |
// Now check if the email was sent successfully |
380 | 463 |
if(isset($success) AND $success == true) { |
381 |
echo $success_message; |
|
464 |
if ($success_page=='none') { |
|
465 |
echo str_replace("\n","<br />",$success_email_text); |
|
466 |
} else { |
|
467 |
$query_menu = $database->query("SELECT link,target FROM ".TABLE_PREFIX."pages WHERE `page_id` = '$success_page'"); |
|
468 |
if($query_menu->numRows() > 0) { |
|
469 |
$fetch_settings = $query_menu->fetchRow(); |
|
470 |
$link = WB_URL.PAGES_DIRECTORY.$fetch_settings['link'].PAGE_EXTENSION; |
|
471 |
echo "<script type='text/javascript'>location.href='".$link."';</script>"; |
|
472 |
} |
|
473 |
} |
|
382 | 474 |
} else { |
383 |
if(isset($success) AND $success == false) { |
|
384 |
echo $TEXT['ERROR']; |
|
385 |
} |
|
475 |
echo $TEXT['ERROR']; |
|
386 | 476 |
} |
387 | 477 |
|
388 | 478 |
} |
389 | 479 |
Also available in: Unified diff
Updated form modul with features from the advanced form modul