Project

General

Profile

« Previous | Next » 

Revision 789

Added by doc about 16 years ago

fixed some layout issues with Form module (combination with Output-filter)

View differences:

view.php
41 41

  
42 42
require_once(WB_PATH.'/include/captcha/captcha.php');
43 43

  
44
// obtain the settings of the output filter module
45
if(file_exists(WB_PATH.'/modules/output_filter/filter-routines.php')) {
46
	include_once(WB_PATH.'/modules/output_filter/filter-routines.php');
47
	$filter_settings = get_output_filter_settings();
48
} else {
49
	// no output filter used, define default settings
50
	$filter_settings['email_filter'] = 0;
51
}
52

  
44 53
// Function for generating an optionsfor a select field
45 54
if (!function_exists('make_option')) {
46 55
function make_option(&$n, $k, $values) {
......
221 230
// Print footer
222 231
echo $footer;
223 232

  
233
/**
234
	NOTE: comment out the line ob_end_flush() if you indicate problems (e.g. when using ob_start in the index.php of your template)
235
	With ob_end_flush(): output filter will be disabled for this page (and all sections embedded on this page)
236
	Without ob_end_flush(): emails are rewritten (e.g. name@domain.com --> name(at)domain(dot)com) if output filter is enabled
237
	All replacements made by the Output-Filter module will be reverted before the email is send out
238
*/
239
if($filter_settings['email_filter'] && !($filter_settings['at_replacement']=='@' && $filter_settings['dot_replacement']=='.')) { 
240
	ob_end_flush();
241
}
242

  
224 243
// Add form end code
225 244
?>
226 245
</form>
......
305 324
						} else {
306 325
							$_SESSION['field'.$field['field_id']] = htmlspecialchars($_POST['field'.$field['field_id']]);
307 326
						}
327
						// if the output filter is active, we need to revert (dot) to . and (at) to @ (using current filter settings)
328
						// otherwise the entered mail will not be accepted and the recipient would see (dot), (at) etc.
329
						if ($filter_settings['email_filter']) {
330
							$field_value = $_POST['field'.$field['field_id']];
331
							$field_value = str_replace($filter_settings['at_replacement'], '@', $field_value);
332
							$field_value = str_replace($filter_settings['dot_replacement'], '.', $field_value);
333
							$_POST['field'.$field['field_id']] = $field_value;
334
						}
308 335
						if($field['type'] == 'email' AND $admin->validate_email($_POST['field'.$field['field_id']]) == false) {
309 336
							$email_error = $MESSAGE['USERS']['INVALID_EMAIL'];
310 337
						}

Also available in: Unified diff