Revision 313
Added by ryan over 19 years ago
| tags/2.6.2/wb/modules/form/add.php | ||
|---|---|---|
| 1 | <?php | |
| 2 |  | |
| 3 | // $Id$ | |
| 4 |  | |
| 5 | /* | |
| 6 |  | |
| 7 | Website Baker Project <http://www.websitebaker.org/> | |
| 8 | Copyright (C) 2004-2005, 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 | // Insert an extra rows into the database | |
| 32 | $header = '<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">'; | |
| 33 | $field_loop = '<tr><td class=\"field_title\">{TITLE}{REQUIRED}:</td><td>{FIELD}</td></tr>';
 | |
| 34 | $footer = '<tr><td> </td> | |
| 35 | <td> | |
| 36 | <input type=\"submit\" name=\"submit\" value=\"Submit Form\" /> | |
| 37 | </td> | |
| 38 | </tr> | |
| 39 | </table>'; | |
| 40 | $email_to = $admin->get_email(); | |
| 41 | $email_from = ''; | |
| 42 | $email_subject = 'Results from form on website...'; | |
| 43 | $success_message = 'Thank-you.'; | |
| 44 | $max_submissions = 50; | |
| 45 | $stored_submissions = 100; | |
| 46 | if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
 | |
| 47 | $use_captcha = true; | |
| 48 | } else {
 | |
| 49 | $use_captcha = false; | |
| 50 | } | |
| 51 | $database->query("INSERT INTO ".TABLE_PREFIX."mod_form_settings (page_id,section_id,header,field_loop,footer,email_to,email_from,email_subject,success_message,max_submissions,stored_submissions,use_captcha) VALUES ('$page_id','$section_id','$header','$field_loop','$footer','$email_to','$email_from','$email_subject','$success_message','$max_submissions','$stored_submissions','$use_captcha')");
 | |
| 52 |  | |
| 53 | ?> | |
| 0 | 54 | |
| tags/2.6.2/wb/modules/form/modify_field.php | ||
|---|---|---|
| 1 | <?php | |
| 2 |  | |
| 3 | // $Id$ | |
| 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 | // Get id | |
| 34 | if(!isset($_GET['field_id']) OR !is_numeric($_GET['field_id'])) {
 | |
| 35 | 	header("Location: ".ADMIN_URL."/pages/index.php");
 | |
| 36 | exit(0); | |
| 37 | } else {
 | |
| 38 | $field_id = $_GET['field_id']; | |
| 39 | } | |
| 40 |  | |
| 41 | // Include WB admin wrapper script | |
| 42 | require(WB_PATH.'/modules/admin.php'); | |
| 43 |  | |
| 44 | // Get header and footer | |
| 45 | $query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_fields WHERE field_id = '$field_id'");
 | |
| 46 | $form = $query_content->fetchRow(); | |
| 47 | $type = $form['type']; | |
| 48 | if($type == '') {
 | |
| 49 | $type = 'none'; | |
| 50 | } | |
| 51 |  | |
| 52 | // Set raw html <'s and >'s to be replaced by friendly html code | |
| 53 | $raw = array('<', '>');
 | |
| 54 | $friendly = array('<', '>');
 | |
| 55 | ?> | |
| 56 |  | |
| 57 | <form name="modify" action="<?php echo WB_URL; ?>/modules/form/save_field.php" method="post" style="margin: 0;"> | |
| 58 |  | |
| 59 | <input type="hidden" name="section_id" value="<?php echo $section_id; ?>"> | |
| 60 | <input type="hidden" name="page_id" value="<?php echo $page_id; ?>"> | |
| 61 | <input type="hidden" name="field_id" value="<?php echo $field_id; ?>"> | |
| 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> | |
| 85 | <?php if($type != 'none' AND $type != 'email') { ?>
 | |
| 86 | 	<?php if($type == 'heading') { ?>
 | |
| 87 | <tr> | |
| 88 | <td valign="top"><?php echo $TEXT['TEMPLATE']; ?>:</td> | |
| 89 | <td> | |
| 90 | <textarea name="template" style="width: 100%; height: 20px;"><?php echo htmlspecialchars(($form['extra'])); ?></textarea> | |
| 91 | </td> | |
| 92 | </tr> | |
| 93 | 	<?php } elseif($type == 'textfield') { ?>
 | |
| 94 | <tr> | |
| 95 | <td><?php echo $TEXT['LENGTH']; ?>:</td> | |
| 96 | <td> | |
| 97 | <input type="text" name="length" value="<?php echo $form['extra']; ?>" style="width: 100%;" maxlength="3" /> | |
| 98 | </td> | |
| 99 | </tr> | |
| 100 | <tr> | |
| 101 | <td><?php echo $TEXT['DEFAULT_TEXT']; ?>:</td> | |
| 102 | <td> | |
| 103 | <input type="text" name="value" value="<?php echo $form['value']; ?>" style="width: 100%;" /> | |
| 104 | </td> | |
| 105 | </tr> | |
| 106 | 	<?php } elseif($type == 'textarea') { ?>
 | |
| 107 | <tr> | |
| 108 | <td valign="top"><?php echo $TEXT['DEFAULT_TEXT']; ?>:</td> | |
| 109 | <td> | |
| 110 | <textarea name="value" style="width: 100%; height: 100px;"><?php echo $form['value']; ?></textarea> | |
| 111 | </td> | |
| 112 | </tr> | |
| 113 | 	<?php } elseif($type == 'select' OR $type = 'radio' OR $type = 'checkbox') { ?>
 | |
| 114 | <tr> | |
| 115 | <td valign="top"><?php echo 'List'; ?>:</td> | |
| 116 | <td> | |
| 117 | <?php | |
| 118 | $option_count = 0; | |
| 119 | 			$list = explode(',', $form['value']);
 | |
| 120 | 			foreach($list AS $option_value) {
 | |
| 121 | $option_count = $option_count+1; | |
| 122 | ?> | |
| 123 | <table cellpadding="3" cellspacing="0" width="100%" border="0"> | |
| 124 | <tr> | |
| 125 | <td width="70"><?php echo $TEXT['OPTION'].' '.$option_count; ?>:</td> | |
| 126 | <td> | |
| 127 | <input type="text" name="value<?php echo $option_count; ?>" value="<?php echo $option_value; ?>" style="width: 250px;" /> | |
| 128 | </td> | |
| 129 | </tr> | |
| 130 | </table> | |
| 131 | <?php | |
| 132 | } | |
| 133 | 			for($i = 0; $i < 2; $i++) {
 | |
| 134 | $option_count = $option_count+1; | |
| 135 | ?> | |
| 136 | <table cellpadding="3" cellspacing="0" width="100%" border="0"> | |
| 137 | <tr> | |
| 138 | <td width="70"><?php echo $TEXT['OPTION'].' '.$option_count; ?>:</td> | |
| 139 | <td> | |
| 140 | <input type="text" name="value<?php echo $option_count; ?>" value="" style="width: 250px;" /> | |
| 141 | </td> | |
| 142 | </tr> | |
| 143 | </table> | |
| 144 | <?php | |
| 145 | } | |
| 146 | ?> | |
| 147 | <input type="hidden" name="list_count" value="<?php echo $option_count; ?>" /> | |
| 148 | </td> | |
| 149 | </tr> | |
| 150 | <?php } ?> | |
| 151 | 	<?php if($type == 'select') { ?>
 | |
| 152 | <tr> | |
| 153 | <td><?php echo $TEXT['SIZE']; ?>:</td> | |
| 154 | <td> | |
| 155 | 			<?php $form['extra'] = explode(',',$form['extra']); ?>
 | |
| 156 | <input type="text" name="size" value="<?php echo trim($form['extra'][0]); ?>" style="width: 100%;" maxlength="3" /> | |
| 157 | </td> | |
| 158 | </tr> | |
| 159 | <tr> | |
| 160 | <td><?php echo $TEXT['ALLOW_MULTIPLE_SELECTIONS']; ?>:</td> | |
| 161 | <td> | |
| 162 | 			<input type="radio" name="multiselect" id="multiselect_true" value="multiple" <?php if($form['extra'][1] == 'multiple') { echo ' checked'; } ?> />
 | |
| 163 | 			<a href="#" onclick="javascript: document.getElementById('multiselect_true').checked = true;">
 | |
| 164 | <?php echo $TEXT['YES']; ?> | |
| 165 | </a> | |
| 166 |   | |
| 167 | 			<input type="radio" name="multiselect" id="multiselect_false" value="" <?php if($form['extra'][1] == '') { echo ' checked'; } ?> />
 | |
| 168 | 			<a href="#" onclick="javascript: document.getElementById('multiselect_false').checked = true;">
 | |
| 169 | <?php echo $TEXT['NO']; ?> | |
| 170 | </a> | |
| 171 | </td> | |
| 172 | </tr> | |
| 173 | 	<?php } elseif($type == 'checkbox' OR $type == 'radio') { ?>
 | |
| 174 | <tr> | |
| 175 | <td valign="top"><?php echo $TEXT['SEPERATOR']; ?>:</td> | |
| 176 | <td> | |
| 177 | <input type="text" name="seperator" value="<?php echo $form['extra']; ?>" style="width: 100%;" /> | |
| 178 | </td> | |
| 179 | </tr> | |
| 180 | <?php } ?> | |
| 181 | <?php } ?> | |
| 182 | <?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> | |
| 197 | <?php } ?> | |
| 198 | </table> | |
| 199 |  | |
| 200 | <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> | |
| 212 | </table> | |
| 213 |  | |
| 214 | <?php | |
| 215 |  | |
| 216 | // Print admin footer | |
| 217 | $admin->print_footer(); | |
| 218 |  | |
| 219 | ?> | |
| 0 | 220 | |
| tags/2.6.2/wb/modules/form/add_field.php | ||
|---|---|---|
| 1 | <?php | |
| 2 |  | |
| 3 | // $Id$ | |
| 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 | // Include the ordering class | |
| 37 | require(WB_PATH.'/framework/class.order.php'); | |
| 38 | // Get new order | |
| 39 | $order = new order(TABLE_PREFIX.'mod_form_fields', 'position', 'field_id', 'section_id'); | |
| 40 | $position = $order->get_new($section_id); | |
| 41 |  | |
| 42 | // Insert new row into database | |
| 43 | $database->query("INSERT INTO ".TABLE_PREFIX."mod_form_fields (section_id,page_id,position,required) VALUES ('$section_id','$page_id','$position','0')");
 | |
| 44 |  | |
| 45 | // Get the id | |
| 46 | $field_id = $database->get_one("SELECT LAST_INSERT_ID()");
 | |
| 47 |  | |
| 48 | // Say that a new record has been added, then redirect to modify page | |
| 49 | if($database->is_error()) {
 | |
| 50 | $admin->print_error($database->get_error(), WB_URL.'/modules/form/modify_field.php?page_id='.$page_id.'§ion_id='.$section_id.'&field_id='.$field_id); | |
| 51 | } else {
 | |
| 52 | $admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/form/modify_field.php?page_id='.$page_id.'§ion_id='.$section_id.'&field_id='.$field_id); | |
| 53 | } | |
| 54 |  | |
| 55 | // Print admin footer | |
| 56 | $admin->print_footer(); | |
| 57 |  | |
| 58 | ?> | |
| 0 | 59 | |
| tags/2.6.2/wb/modules/form/info.php | ||
|---|---|---|
| 1 | <?php | |
| 2 |  | |
| 3 | // $Id$ | |
| 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 | $module_directory = 'form'; | |
| 32 | $module_name = 'Form'; | |
| 33 | $module_function = 'page'; | |
| 34 | $module_version = '2.6'; | |
| 35 | $module_platform = '2.6.x'; | |
| 36 | $module_author = 'Ryan Djurovich & Rudolph Lartey'; | |
| 37 | $module_license = 'GNU General Public License'; | |
| 38 | $module_description = 'This module allows you to create customised online forms, such as a feedback form. '. | |
| 39 | 'Thank-you to Rudolph Lartey who help enhance this module, providing code for extra field types, etc.'; | |
| 40 |  | |
| 41 | ?> | |
| 0 | 42 | |
| tags/2.6.2/wb/modules/form/move_down.php | ||
|---|---|---|
| 1 | <?php | |
| 2 |  | |
| 3 | // $Id$ | |
| 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 | // Get id | |
| 34 | if(!isset($_GET['field_id']) OR !is_numeric($_GET['field_id'])) {
 | |
| 35 | 	header("Location: index.php");
 | |
| 36 | exit(0); | |
| 37 | } else {
 | |
| 38 | $field_id = $_GET['field_id']; | |
| 39 | } | |
| 40 |  | |
| 41 | // Include WB admin wrapper script | |
| 42 | require(WB_PATH.'/modules/admin.php'); | |
| 43 |  | |
| 44 | // Include the ordering class | |
| 45 | require(WB_PATH.'/framework/class.order.php'); | |
| 46 |  | |
| 47 | // Create new order object an reorder | |
| 48 | $order = new order(TABLE_PREFIX.'mod_form_fields', 'position', 'field_id', 'section_id'); | |
| 49 | if($order->move_down($field_id)) {
 | |
| 50 | $admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); | |
| 51 | } else {
 | |
| 52 | $admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); | |
| 53 | } | |
| 54 |  | |
| 55 | // Print admin footer | |
| 56 | $admin->print_footer(); | |
| 57 |  | |
| 58 | ?> | |
| 0 | 59 | |
| tags/2.6.2/wb/modules/form/save_field.php | ||
|---|---|---|
| 1 | <?php | |
| 2 |  | |
| 3 | // $Id$ | |
| 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 | // Get id | |
| 34 | if(!isset($_POST['field_id']) OR !is_numeric($_POST['field_id'])) {
 | |
| 35 | 	header("Location: ".ADMIN_URL."/pages/index.php");
 | |
| 36 | exit(0); | |
| 37 | } else {
 | |
| 38 | $field_id = $_POST['field_id']; | |
| 39 | $field_id = $field_id; | |
| 40 | } | |
| 41 |  | |
| 42 | // Include WB admin wrapper script | |
| 43 | $update_when_modified = true; // Tells script to update when this page was last updated | |
| 44 | require(WB_PATH.'/modules/admin.php'); | |
| 45 |  | |
| 46 | // Validate all fields | |
| 47 | if($admin->get_post('title') == '' OR $admin->get_post('type') == '') {
 | |
| 48 | $admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/form/modify_field.php?page_id='.$page_id.'§ion_id='.$section_id.'&field_id='.$field_id); | |
| 49 | } else {
 | |
| 50 | 	$title = $admin->add_slashes($admin->get_post('title'));
 | |
| 51 | 	$type = $admin->get_post('type');
 | |
| 52 | 	$required = $admin->get_post('required');
 | |
| 53 | } | |
| 54 |  | |
| 55 | // Update row | |
| 56 | $database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET title = '$title', type = '$type', required = '$required' WHERE field_id = '$field_id'");
 | |
| 57 |  | |
| 58 | // If field type has multiple options, get all values and implode them | |
| 59 | $list_count = $admin->get_post('list_count');
 | |
| 60 | if(is_numeric($list_count)) {
 | |
| 61 | $values = array(); | |
| 62 | 	for($i = 1; $i <= $list_count; $i++) {
 | |
| 63 | 		if($admin->get_post('value'.$i) != '') {
 | |
| 64 | 			$values[] = str_replace(",",",",$admin->get_post('value'.$i));
 | |
| 65 | } | |
| 66 | } | |
| 67 | 	$value = implode(',', $values);
 | |
| 68 | } | |
| 69 |  | |
| 70 | // Get extra fields for field-type-specific settings | |
| 71 | if($admin->get_post('type') == 'textfield') {
 | |
| 72 | 	$length = $admin->get_post('length');
 | |
| 73 | 	$value = $admin->get_post('value');
 | |
| 74 | 	$database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET value = '$value', extra = '$length' WHERE field_id = '$field_id'");
 | |
| 75 | } elseif($admin->get_post('type') == 'textarea') {
 | |
| 76 | 	$value = $admin->get_post('value');
 | |
| 77 | 	$database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET value = '$value', extra = '' WHERE field_id = '$field_id'");
 | |
| 78 | } elseif($admin->get_post('type') == 'heading') {
 | |
| 79 | 	$extra = $admin->get_post('template');
 | |
| 80 | 	if(trim($extra) == '') $extra = '<tr><td class="field_heading" colspan="2">{TITLE}{FIELD}</td></tr>';
 | |
| 81 | $extra = $admin->add_slashes($extra); | |
| 82 | 	$database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET value = '', extra = '$extra' WHERE field_id = '$field_id'");
 | |
| 83 | } elseif($admin->get_post('type') == 'select') {
 | |
| 84 | 	$extra = $admin->get_post('size').','.$admin->get_post('multiselect');
 | |
| 85 | 	$database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET value = '$value', extra = '$extra' WHERE field_id = '$field_id'");
 | |
| 86 | } elseif($admin->get_post('type') == 'checkbox') {
 | |
| 87 | 	$extra = $admin->get_post('seperator');
 | |
| 88 | 	$database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET value = '$value', extra = '$extra' WHERE field_id = '$field_id'");
 | |
| 89 | } elseif($admin->get_post('type') == 'radio') {
 | |
| 90 | 	$extra = $admin->get_post('seperator');
 | |
| 91 | 	$database->query("UPDATE ".TABLE_PREFIX."mod_form_fields SET value = '$value', extra = '$extra' WHERE field_id = '$field_id'");
 | |
| 92 | } | |
| 93 |  | |
| 94 | // Check if there is a db error, otherwise say successful | |
| 95 | if($database->is_error()) {
 | |
| 96 | $admin->print_error($database->get_error(), WB_URL.'/modules/form/modify_field.php?page_id='.$page_id.'§ion_id='.$section_id.'&field_id='.$field_id); | |
| 97 | } else {
 | |
| 98 | $admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/form/modify_field.php?page_id='.$page_id.'§ion_id='.$section_id.'&field_id='.$field_id); | |
| 99 | } | |
| 100 |  | |
| 101 | // Print admin footer | |
| 102 | $admin->print_footer(); | |
| 103 |  | |
| 104 | ?> | |
| 0 | 105 | |
| tags/2.6.2/wb/modules/form/delete.php | ||
|---|---|---|
| 1 | <?php | |
| 2 |  | |
| 3 | // $Id$ | |
| 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 | // Delete page from mod_wysiwyg | |
| 32 | $database->query("DELETE FROM ".TABLE_PREFIX."mod_form_fields WHERE page_id = '$page_id'");
 | |
| 33 | $database->query("DELETE FROM ".TABLE_PREFIX."mod_form_settings WHERE page_id = '$page_id'");
 | |
| 34 |  | |
| 35 | ?> | |
| 0 | 36 | |
| tags/2.6.2/wb/modules/form/delete_field.php | ||
|---|---|---|
| 1 | <?php | |
| 2 |  | |
| 3 | // $Id$ | |
| 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 | // Get id | |
| 34 | if(!isset($_GET['field_id']) OR !is_numeric($_GET['field_id'])) {
 | |
| 35 | 	header("Location: ".ADMIN_URL."/pages/index.php");
 | |
| 36 | exit(0); | |
| 37 | } else {
 | |
| 38 | $field_id = $_GET['field_id']; | |
| 39 | } | |
| 40 |  | |
| 41 | // Include WB admin wrapper script | |
| 42 | $update_when_modified = true; // Tells script to update when this page was last updated | |
| 43 | require(WB_PATH.'/modules/admin.php'); | |
| 44 |  | |
| 45 | // Delete row | |
| 46 | $database->query("DELETE FROM ".TABLE_PREFIX."mod_form_fields WHERE field_id = '$field_id'");
 | |
| 47 |  | |
| 48 | // Check if there is a db error, otherwise say successful | |
| 49 | if($database->is_error()) {
 | |
| 50 | $admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id); | |
| 51 | } else {
 | |
| 52 | $admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); | |
| 53 | } | |
| 54 |  | |
| 55 | // Print admin footer | |
| 56 | $admin->print_footer(); | |
| 57 |  | |
| 58 | ?> | |
| 0 | 59 | |
| tags/2.6.2/wb/modules/form/install.php | ||
|---|---|---|
| 1 | <?php | |
| 2 |  | |
| 3 | // $Id$ | |
| 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 | if(defined('WB_URL')) {
 | |
| 32 |  | |
| 33 | // Create tables | |
| 34 | 	$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_fields`");
 | |
| 35 | $mod_form = 'CREATE TABLE `'.TABLE_PREFIX.'mod_form_fields` ( `field_id` INT NOT NULL AUTO_INCREMENT,' | |
| 36 | . ' `section_id` INT NOT NULL ,' | |
| 37 | . ' `page_id` INT NOT NULL ,' | |
| 38 | . ' `position` INT NOT NULL ,' | |
| 39 | . ' `title` VARCHAR(255) NOT NULL DEFAULT \'\' ,' | |
| 40 | . ' `type` VARCHAR(255) NOT NULL DEFAULT \'\' ,' | |
| 41 | . ' `required` INT NOT NULL ,' | |
| 42 | . ' `value` TEXT NOT NULL DEFAULT \'\' ,' | |
| 43 | . ' `extra` TEXT NOT NULL DEFAULT \'\' ,' | |
| 44 | . ' PRIMARY KEY ( `field_id` ) )' | |
| 45 | . ' '; | |
| 46 | $database->query($mod_form); | |
| 47 | 	$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_settings`");
 | |
| 48 | 	$mod_form = 'CREATE TABLE `'.TABLE_PREFIX.'mod_form_settings` ('
 | |
| 49 | . ' `section_id` INT NOT NULL,' | |
| 50 | . ' `page_id` INT NOT NULL,' | |
| 51 | . ' `header` TEXT NOT NULL DEFAULT \'\' ,' | |
| 52 | . ' `field_loop` TEXT NOT NULL DEFAULT \'\' ,' | |
| 53 | . ' `footer` TEXT NOT NULL DEFAULT \'\' ,' | |
| 54 | . ' `email_to` TEXT NOT NULL DEFAULT \'\' ,' | |
| 55 | . ' `email_from` VARCHAR(255) NOT NULL DEFAULT \'\' ,' | |
| 56 | . ' `email_subject` VARCHAR(255) NOT NULL DEFAULT \'\' ,' | |
| 57 | . ' `success_message` TEXT NOT NULL DEFAULT \'\' ,' | |
| 58 | . ' `stored_submissions` INT NOT NULL,' | |
| 59 | . ' `max_submissions` INT NOT NULL,' | |
| 60 | . ' `use_captcha` INT NOT NULL,' | |
| 61 | . ' PRIMARY KEY ( `section_id` ) )' | |
| 62 | . ' '; | |
| 63 | $database->query($mod_form); | |
| 64 | 	$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_submissions`");
 | |
| 65 | $mod_form = 'CREATE TABLE `'.TABLE_PREFIX.'mod_form_submissions` ( `submission_id` INT NOT NULL AUTO_INCREMENT,' | |
| 66 | . ' `section_id` INT NOT NULL,' | |
| 67 | . ' `page_id` INT NOT NULL,' | |
| 68 | . ' `submitted_when` INT NOT NULL,' | |
| 69 | . ' `submitted_by` INT NOT NULL,' | |
| 70 | . ' `body` TEXT NOT NULL DEFAULT \'\' ,' | |
| 71 | . ' PRIMARY KEY ( `submission_id` ) )' | |
| 72 | . ' '; | |
| 73 | $database->query($mod_form); | |
| 74 |  | |
| 75 | // Insert info into the search table | |
| 76 | // Module query info | |
| 77 | $field_info = array(); | |
| 78 | $field_info['page_id'] = 'page_id'; | |
| 79 | $field_info['title'] = 'page_title'; | |
| 80 | $field_info['link'] = 'link'; | |
| 81 | $field_info['description'] = 'description'; | |
| 82 | $field_info['modified_when'] = 'modified_when'; | |
| 83 | $field_info['modified_by'] = 'modified_by'; | |
| 84 | $field_info = serialize($field_info); | |
| 85 | 	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'form', '$field_info')");
 | |
| 86 | // Query start | |
| 87 | $query_start_code = "SELECT [TP]pages.page_id, [TP]pages.page_title, [TP]pages.link, [TP]pages.description, [TP]pages.modified_when, [TP]pages.modified_by FROM [TP]mod_form_fields, [TP]mod_form_settings, [TP]pages WHERE "; | |
| 88 | 	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'form')");
 | |
| 89 | // Query body | |
| 90 | $query_body_code = " [TP]pages.page_id = [TP]mod_form_settings.page_id AND [TP]mod_form_settings.header [O] \'[W][STRING][W]\' AND [TP]pages.searching = \'1\' | |
| 91 | OR [TP]pages.page_id = [TP]mod_form_settings.page_id AND [TP]mod_form_settings.footer [O] \'[W][STRING][W]\' AND [TP]pages.searching = \'1\' | |
| 92 | OR [TP]pages.page_id = [TP]mod_form_fields.page_id AND [TP]mod_form_fields.title [O] \'[W][STRING][W]\' AND [TP]pages.searching = \'1\'"; | |
| 93 | 	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'form')");
 | |
| 94 | // Query end | |
| 95 | $query_end_code = ''; | |
| 96 | 	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'form')");
 | |
| 97 |  | |
| 98 | // Insert blank row (there needs to be at least on row for the search to work) | |
| 99 | 	$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_fields (page_id,section_id) VALUES ('0','0')");
 | |
| 100 | 	$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_settings (page_id,section_id) VALUES ('0','0')");
 | |
| 101 |  | |
| 102 | } | |
| 103 |  | |
| 104 | ?> | |
| 0 | 105 | |
| tags/2.6.2/wb/modules/form/index.php | ||
|---|---|---|
| 1 | <?php | |
| 2 |  | |
| 3 | // $Id$ | |
| 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 | header('Location: ../index.php');
 | |
| 32 |  | |
| 33 | ?> | |
| 0 | 34 | |
| tags/2.6.2/wb/modules/form/modify_settings.php | ||
|---|---|---|
| 1 | <?php | |
| 2 |  | |
| 3 | // $Id$ | |
| 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('<', '>');
 | |
| 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"> </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 | ?> | |
| 0 | 159 | |
| tags/2.6.2/wb/modules/form/move_up.php | ||
|---|---|---|
| 1 | <?php | |
| 2 |  | |
| 3 | // $Id$ | |
| 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 | // Get id | |
| 34 | if(!isset($_GET['field_id']) OR !is_numeric($_GET['field_id'])) {
 | |
| 35 | 	header("Location: index.php");
 | |
| 36 | exit(0); | |
| 37 | } else {
 | |
| 38 | $field_id = $_GET['field_id']; | |
| 39 | } | |
| 40 |  | |
| 41 | // Include WB admin wrapper script | |
| 42 | require(WB_PATH.'/modules/admin.php'); | |
| 43 |  | |
| 44 | // Include the ordering class | |
| 45 | require(WB_PATH.'/framework/class.order.php'); | |
| 46 |  | |
| 47 | // Create new order object an reorder | |
| 48 | $order = new order(TABLE_PREFIX.'mod_form_fields', 'position', 'field_id', 'section_id'); | |
| 49 | if($order->move_up($field_id)) {
 | |
| 50 | $admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); | |
| 51 | } else {
 | |
| 52 | $admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); | |
| 53 | } | |
| 54 |  | |
| 55 | // Print admin footer | |
| 56 | $admin->print_footer(); | |
| 57 |  | |
| 58 | ?> | |
| 0 | 59 | |
| tags/2.6.2/wb/modules/form/view.php | ||
|---|---|---|
| 1 | <?php | |
| 2 |  | |
| 3 | // $Id$ | |
| 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 | // Must include code to stop this file being access directly | |
| 32 | if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
 | |
| 33 |  | |
| 34 | // Function for generating an optionsfor a select field | |
| 35 | function make_option(&$n) {
 | |
| 36 | // start option group if it exists | |
| 37 | 	if (substr($n,0,2) == '[=') {
 | |
| 38 | $n = '<optgroup label="'.substr($n,2,strlen($n)).'">'; | |
| 39 | 	} elseif ($n == ']') {
 | |
| 40 | $n = '</optgroup>'; | |
| 41 | 	} else {
 | |
| 42 | $n = '<option value="'.$n.'">'.$n.'</option>'; | |
| 43 | } | |
| 44 | } | |
| 45 |  | |
| 46 | // Function for generating a checkbox | |
| 47 | function make_checkbox(&$n, $idx, $params) {
 | |
| 48 | $field_id = $params[0]; | |
| 49 | $seperator = $params[1]; | |
| 50 | //$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 | $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 | } | |
| 53 |  | |
| 54 | // Function for generating a radio button | |
| 55 | function make_radio(&$n, $idx, $params) {
 | |
| 56 | $field_id = $params[0]; | |
| 57 | $group = $params[1]; | |
| 58 | $seperator = $params[2]; | |
| 59 | $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 | } | |
| 61 |  | |
| 62 | // Work-out if the form has been submitted or not | |
| 63 | if($_POST == array()) {
 | |
| 64 |  | |
| 65 | ?> | |
| 66 | <style type="text/css"> | |
| 67 | .required {
 | |
| 68 | color: #FF0000; | |
| 69 | } | |
| 70 | .field_title {
 | |
| 71 | font-size: 12px; | |
| 72 | width: 100px; | |
| 73 | vertical-align: top; | |
| 74 | text-align:right; | |
| 75 | } | |
| 76 | .textfield {
 | |
| 77 | font-size: 12px; | |
| 78 | width: 200px; | |
| 79 | } | |
| 80 | .textarea {
 | |
| 81 | font-size: 12px; | |
| 82 | width: 90%; | |
| 83 | height: 100px; | |
| 84 | } | |
| 85 | .field_heading {
 | |
| 86 | font-size: 12px; | |
| 87 | font-weight: bold; | |
| 88 | border-bottom-width: 2px; | |
| 89 | border-bottom-style: solid; | |
| 90 | border-bottom-color: #666666; | |
| 91 | padding-top: 10px; | |
| 92 | color: #666666; | |
| 93 | } | |
| 94 | .select {
 | |
| 95 | font-size: 12px; | |
| 96 | } | |
| 97 | .checkbox_label {
 | |
| 98 | font-size: 11px; | |
| 99 | cursor: pointer; | |
| 100 | } | |
| 101 | .radio_label {
 | |
| 102 | font-size: 11px; | |
| 103 | cursor: pointer; | |
| 104 | } | |
| 105 | .email {
 | |
| 106 | font-size: 12px; | |
| 107 | width: 200px; | |
| 108 | } | |
| 109 | </style> | |
| 110 | <?php | |
| 111 |  | |
| 112 | // Get settings | |
| 113 | $query_settings = $database->query("SELECT header,field_loop,footer,use_captcha FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
 | |
| 114 | if($query_settings->numRows() > 0) {
 | |
| 115 | $fetch_settings = $query_settings->fetchRow(); | |
| 116 | 	$header = str_replace('{WB_URL}',WB_URL,$fetch_settings['header']);
 | |
| 117 | $field_loop = $fetch_settings['field_loop']; | |
| 118 | 	$footer = str_replace('{WB_URL}',WB_URL,$fetch_settings['footer']);
 | |
| 119 | $use_captcha = $fetch_settings['use_captcha']; | |
| 120 | } else {
 | |
| 121 | $header = ''; | |
| 122 | $field_loop = ''; | |
| 123 | $footer = ''; | |
| 124 | } | |
| 125 |  | |
| 126 | // Add form starter code | |
| 127 | ?> | |
| 128 | <form name="form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> | |
| 129 | <?php | |
| 130 |  | |
| 131 | // Print header | |
| 132 | echo $header; | |
| 133 |  | |
| 134 | // Get list of fields | |
| 135 | $query_fields = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_fields WHERE section_id = '$section_id' ORDER BY position ASC");
 | |
| 136 | if($query_fields->numRows() > 0) {
 | |
| 137 | 	while($field = $query_fields->fetchRow()) {
 | |
| 138 | // Set field values | |
| 139 | $field_id = $field['field_id']; | |
| 140 | $value = $field['value']; | |
| 141 | // Print field_loop after replacing vars with values | |
| 142 | 		$vars = array('{TITLE}', '{REQUIRED}');
 | |
| 143 | $values = array($field['title']); | |
| 144 | 		if($field['required'] == 1) {
 | |
| 145 | $values[] = '<font class="required">*</font>'; | |
| 146 | 		} else {
 | |
| 147 | $values[] = ''; | |
| 148 | } | |
| 149 | 		if($field['type'] == 'textfield') {
 | |
| 150 | 			$vars[] = '{FIELD}';
 | |
| 151 | $values[] = '<input type="text" name="field'.$field_id.'" id="field'.$field_id.'" maxlength="'.$field['extra'].'" value="'.$value.'" class="textfield" />'; | |
| 152 | 		} elseif($field['type'] == 'textarea') {
 | |
| 153 | 			$vars[] = '{FIELD}';
 | |
| 154 | $values[] = '<textarea name="field'.$field_id.'" id="field'.$field_id.'" class="textarea">'.$value.'</textarea>'; | |
| 155 | 		} elseif($field['type'] == 'select') {
 | |
| 156 | 			$vars[] = '{FIELD}';
 | |
| 157 | 			$options = explode(',', $value);
 | |
| 158 | array_walk($options, 'make_option'); | |
| 159 | 			$field['extra'] = explode(',',$field['extra']); 
 | |
| 160 | $values[] = '<select name="field'.$field_id.'[]" id="field'.$field_id.'" size="'.$field['extra'][0].'" '.$field['extra'][1].' class="select">'.implode($options).'</select>'; | |
| 161 | 		} elseif($field['type'] == 'heading') {
 | |
| 162 | 			$vars[] = '{FIELD}';
 | |
| 163 | $values[] = '<input type="hidden" name="field'.$field_id.'" id="field'.$field_id.'" value="===['.$field['title'].']===" />'; | |
| 164 | $tmp_field_loop = $field_loop; // temporarily modify the field loop template | |
| 165 | $field_loop = $field['extra']; | |
| 166 | 		} elseif($field['type'] == 'checkbox') {
 | |
| 167 | 			$vars[] = '{FIELD}';
 | |
| 168 | 			$options = explode(',', $value);
 | |
| 169 | array_walk($options, 'make_checkbox',array($field_id,$field['extra'])); | |
| 170 | $values[] = implode($options); | |
| 171 | 		} elseif($field['type'] == 'radio') {
 | |
| 172 | 			$vars[] = '{FIELD}';
 | |
| 173 | 			$options = explode(',', $value);
 | |
| 174 | array_walk($options, 'make_radio',array($field_id,$field['title'],$field['extra'])); | |
| 175 | $values[] = implode($options); | |
| 176 | 		} elseif($field['type'] == 'email') {
 | |
| 177 | 			$vars[] = '{FIELD}';
 | |
| 178 | $values[] = '<input type="text" name="field'.$field_id.'" id="field'.$field_id.'" maxlength="'.$field['extra'].'" class="email" />'; | |
| 179 | } | |
| 180 | 		if($field['type'] != '') {
 | |
| 181 | echo str_replace($vars, $values, $field_loop); | |
| 182 | } | |
| 183 | if (isset($tmp_field_loop)) $field_loop = $tmp_field_loop; | |
| 184 | } | |
| 185 | } | |
| 186 |  | |
| 187 | // Captcha | |
| 188 | if($use_captcha) {
 | |
| 189 | $_SESSION['captcha'] = ''; | |
| 190 | 	for($i = 0; $i < 5; $i++) {
 | |
| 191 | $_SESSION['captcha'] .= rand(0,9); | |
| 192 | } | |
| 193 | ?><tr><td class="field_title"><?php echo $TEXT['VERIFICATION']; ?>:</td><td> | |
| 194 | <table cellpadding="2" cellspacing="0" border="0"> | |
| 195 | <tr><td><img src="<?php echo WB_URL; ?>/include/captcha.php?t=<?php echo time(); ?>" alt="Captcha" /></td> | |
| 196 | <td><input type="text" name="captcha" maxlength="5" /></td> | |
| 197 | </tr></table> | |
| 198 | </td></tr> | |
| 199 | <?php | |
| 200 | } | |
| 201 |  | |
| 202 | // Print footer | |
| 203 | echo $footer; | |
| 204 |  | |
| 205 | // Add form end code | |
| 206 | ?> | |
| 207 | </form> | |
| 208 | <?php | |
| 209 |  | |
| 210 | } else {
 | |
| 211 |  | |
| 212 | // Submit form data | |
| 213 | // First start message settings | |
| 214 | 	$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'");
 | |
| 215 | 	if($query_settings->numRows() > 0) {
 | |
| 216 | $fetch_settings = $query_settings->fetchRow(); | |
| 217 | $email_to = $fetch_settings['email_to']; | |
| 218 | $email_from = $fetch_settings['email_from']; | |
| 219 | 		if(substr($email_from, 0, 5) == 'field') {
 | |
| 220 | // Set the email from field to what the user entered in the specified field | |
| 221 | $email_from = $wb->add_slashes($_POST[$email_from]); | |
| 222 | } | |
| 223 | $email_subject = $fetch_settings['email_subject']; | |
| 224 | $success_message = $fetch_settings['success_message']; | |
| 225 | $max_submissions = $fetch_settings['max_submissions']; | |
| 226 | $stored_submissions = $fetch_settings['stored_submissions']; | |
| 227 | $use_captcha = $fetch_settings['use_captcha']; | |
| 228 | 	} else {
 | |
| 229 | exit($TEXT['UNDER_CONSTRUCTION']); | |
| 230 | } | |
| 231 | $email_body = ''; | |
| 232 |  | |
| 233 | // Create blank "required" array | |
| 234 | $required = array(); | |
| 235 |  | |
| 236 | // Loop through fields and add to message body | |
| 237 | // Get list of fields | |
| 238 | 	$query_fields = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_fields WHERE section_id = '$section_id' ORDER BY position ASC");
 | |
| 239 | 	if($query_fields->numRows() > 0) {
 | |
| 240 | 		while($field = $query_fields->fetchRow()) {
 | |
| 241 | // Add to message body | |
| 242 | 			if($field['type'] != '') {
 | |
| 243 | 				if(!empty($_POST['field'.$field['field_id']])) {
 | |
| 244 | 					if($field['type'] == 'email' AND $admin->validate_email($_POST['field'.$field['field_id']]) == false) {
 | |
| 245 | $email_error = $MESSAGE['USERS']['INVALID_EMAIL']; | |
| 246 | } | |
| 247 | 					if($field['type'] == 'heading') {
 | |
| 248 | $email_body .= $_POST['field'.$field['field_id']]."\n\n"; | |
| 249 | 					} elseif (!is_array($_POST['field'.$field['field_id']])) {
 | |
| 250 | $email_body .= $field['title'].': '.$_POST['field'.$field['field_id']]."\n\n"; | |
| 251 | 					} else {
 | |
| 252 | $email_body .= $field['title'].": \n"; | |
| 253 | 						foreach ($_POST['field'.$field['field_id']] as $k=>$v) {
 | |
| 254 | $email_body .= $v."\n"; | |
| 255 | } | |
| 256 | $email_body .= "\n"; | |
| 257 | } | |
| 258 | 				} elseif($field['required'] == 1) {
 | |
| 259 | $required[] = $field['title']; | |
| 260 | } | |
| 261 | } | |
| 262 | } | |
| 263 | } | |
| 264 |  | |
| 265 | // Captcha | |
| 266 | 	if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
 | |
| 267 | 		if($use_captcha) {
 | |
| 268 | 			if(isset($_POST['captcha']) AND $_POST['captcha'] != ''){
 | |
| 269 | // Check for a mismatch | |
| 270 | 				if(!isset($_POST['captcha']) OR !isset($_SESSION['captcha']) OR $_POST['captcha'] != $_SESSION['captcha']) {
 | |
| 271 | $captcha_error = $MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA']; | |
| 272 | } | |
| 273 | 			} else {
 | |
| 274 | $captcha_error = $MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA']; | |
| 275 | } | |
| 276 | } | |
| 277 | } | |
| 278 | 	if(isset($_SESSION['captcha'])) { unset($_SESSION['captcha']); }
 | |
| 279 |  | |
| 280 | // Addslashes to email body - proposed by Icheb in topic=1170.0 | |
| 281 | // $email_body = $wb->add_slashes($email_body); | |
| 282 |  | |
| 283 | // Check if the user forgot to enter values into all the required fields | |
| 284 | 	if($required != array()) {
 | |
| 285 | 		if(!isset($MESSAGE['MOD_FORM']['REQUIRED_FIELDS'])) {
 | |
| 286 | echo 'You must enter details for the following fields'; | |
| 287 | 		} else {
 | |
| 288 | echo $MESSAGE['MOD_FORM']['REQUIRED_FIELDS']; | |
| 289 | } | |
| 290 | echo ':<br /><ul>'; | |
| 291 | 		foreach($required AS $field_title) {
 | |
| 292 | echo '<li>'.$field_title; | |
| 293 | } | |
| 294 | 		if(isset($email_error)) { echo '<li>'.$email_error.'</li>'; }
 | |
| 295 | 		if(isset($captcha_error)) { echo '<li>'.$captcha_error.'</li>'; }
 | |
| 296 | echo '</ul><a href="javascript: history.go(-1);">'.$TEXT['BACK'].'</a>'; | |
| 297 |  | |
| 298 | 	} else {
 | |
| 299 |  | |
| 300 | 		if(isset($email_error)) {
 | |
| 301 | echo '<br /><ul>'; | |
| 302 | echo '<li>'.$email_error.'</li>'; | |
| 303 | echo '</ul><a href="javascript: history.go(-1);">'.$TEXT['BACK'].'</a>'; | |
| 304 | 		} elseif(isset($captcha_error)) {
 | |
| 305 | echo '<br /><ul>'; | |
| 306 | echo '<li>'.$captcha_error.'</li>'; | |
| 307 | echo '</ul><a href="javascript: history.go(-1);">'.$TEXT['BACK'].'</a>'; | |
| 308 | 		} else {
 | |
| 309 |  | |
| 310 | // Check how many times form has been submitted in last hour | |
| 311 | $last_hour = time()-3600; | |
| 312 | 		$query_submissions = $database->query("SELECT submission_id FROM ".TABLE_PREFIX."mod_form_submissions WHERE submitted_when >= '$last_hour'");
 | |
| 313 | 		if($query_submissions->numRows() > $max_submissions) {
 | |
| 314 | // Too many submissions so far this hour | |
| 315 | echo $MESSAGE['MOD_FORM']['EXCESS_SUBMISSIONS']; | |
Also available in: Unified diff
Creating 2.6.2 tag