X-Git-Url: https://git.p6c8.net/form-email.git/blobdiff_plain/1920f0f5bae14e21fcd25f63aab273da0bda0fd3..486e87a00a9d88a8001077f3f8bb06aa602551c5:/form-email/mailer.php diff --git a/form-email/mailer.php b/form-email/mailer.php index bed4207..3adbaad 100644 --- a/form-email/mailer.php +++ b/form-email/mailer.php @@ -7,7 +7,7 @@ # geschrieben wurde. # # Autor: Patrick Canterino -# Letzte Aenderung: 3.12.2011 +# Letzte Aenderung: 12.12.2011 # # Copyright (C) 2002-2011 Patrick Canterino # @@ -21,11 +21,13 @@ # Hauptteil # =========== +$VERSION = '3.5-dev'; + require('config.php'); require('functions.php'); require('class.Template.php'); -if($only_post && $_SERVER['REQUEST_METHOD'] != 'POST') show_fatal($err_only_post); +if($_SERVER['REQUEST_METHOD'] != 'POST') show_fatal($err_only_post); # Wenn Captchas aktiviert sind, Session starten @@ -110,11 +112,40 @@ while(list($user_field,$user_field_data) = each($user_fields)) { continue; } + # Laengen-Pruefung + + if(isset($user_field_data['min']) && $user_field_data['min']) { + if(strlen($user_field_content) < $user_field_data['min']) { + if(isset($user_field_data['errors']['too_short'])) { + show_user_error($user_field_data['errors']['too_short']); + } + else { + show_fatal($err_indiv_errmsg_miss,array('ERRMSG' => 'too_short', 'INDIVIDUAL' => $user_field)); + } + } + } + + if(isset($user_field_data['min']) && $user_field_data['max']) { + if(strlen($user_field_content) > $user_field_data['max']) { + if(isset($user_field_data['errors']['too_long'])) { + show_user_error($user_field_data['errors']['too_long']); + } + else { + show_fatal($err_indiv_errmsg_miss,array('ERRMSG' => 'too_long', 'INDIVIDUAL' => $user_field)); + } + } + } + # Pruefung gegen frei definierbare Pruef-Funktion if(isset($user_field_data['check']) && $user_field_data['check'] != '') { if(function_exists($user_field_data['check']) && call_user_func($user_field_data['check'],$user_field_content) === false) { - show_user_error($user_field_data['errors']['check_fail']); + if(isset($user_field_data['errors']['check_fail'])) { + show_user_error($user_field_data['errors']['check_fail']); + } + else { + show_fatal($err_indiv_errmsg_miss,array('ERRMSG' => 'check_fail', 'INDIVIDUAL' => $user_field)); + } } } @@ -122,7 +153,12 @@ while(list($user_field,$user_field_data) = each($user_fields)) { if(isset($user_field_data['regex']) && $user_field_data['regex'] != '') { if(!preg_match($user_field_data['regex'],$user_field_content)) { - show_user_error($user_field_data['errors']['match_fail']); + if(isset($user_field_data['errors']['match_fail'])) { + show_user_error($user_field_data['errors']['match_fail']); + } + else { + show_fatal($err_indiv_errmsg_miss,array('ERRMSG' => 'match_fail', 'INDIVIDUAL' => $user_field)); + } } } @@ -134,9 +170,18 @@ while(list($user_field,$user_field_data) = each($user_fields)) { } } + # Name der Template-Variable ermitteln + + if(isset($user_field_data['tpl_var']) && $user_field_data['tpl_var'] != '') { + $tpl_var = $user_field_data['tpl_var']; + } + else { + $tpl_var = 'USER_'.$user_field; + } + # Fertige Formulardaten wegkopieren und fuer spaeter zur Verfuegung stellen - $prepared_user_fields[$user_field_data['tpl_var']] = $user_field_content; + $prepared_user_fields[$tpl_var] = $user_field_content; } # Captcha ueberpruefen @@ -230,7 +275,7 @@ if($add_header) { $header .= 'Content-Type: text/plain; charset="'.$charset.'"'."\n"; $header .= 'Content-Transfer-Encoding: 8bit'."\n"; $header .= 'MIME-Version: 1.0'."\n"; - $header .= 'X-Mailer: Form E-Mail 3.4.1'."\n"; + $header .= 'X-Mailer: Form E-Mail '.$VERSION."\n"; $header .= 'X-Sender-IP: ['.$_SERVER['REMOTE_ADDR'].']'; } else $header .= "Reply-To: $email";