X-Git-Url: https://git.p6c8.net/form-email.git/blobdiff_plain/e727168305eaf781e5640690a0369eaa4614ffc6..d1446fd17368b3db10988069662a18386fe587a8:/form-email/functions.php diff --git a/form-email/functions.php b/form-email/functions.php index d8d6f71..d9f3482 100644 --- a/form-email/functions.php +++ b/form-email/functions.php @@ -7,9 +7,9 @@ # geschrieben wurde. # # Autor: Patrick Canterino -# Letzte Aenderung: 3.12.2011 +# Letzte Aenderung: 17.12.2011 # -# Copyright (C) 2002-2011 Patrick Canterino +# Copyright (C) 2002-2012 Patrick Canterino # # Diese Datei kann unter den Bedingungen der "Artistic License 2.0" # weitergegeben und / oder veraendert werden. @@ -66,7 +66,7 @@ function formdata($param) { # # Rueckgabe: Bearbeiteter Text (String) -function &plain(&$text,$linebreak='
') { +function plain($text,$linebreak='
') { $htmltext = htmlspecialchars($text); $htmltext = preg_replace("/\015\012|\012|\015/",$linebreak,$htmltext); @@ -103,13 +103,21 @@ function semicolon_split($string) { # # Parameter: Fehlermeldung -function show_fatal(&$errmsg) { +function show_fatal($errmsg,$vars=array()) { global $tpl_fatal; $tpl = new Template; $tpl->read_file($tpl_fatal); - $tpl->fillin('ERROR',$errmsg); + if(sizeof($vars) > 0) { + while(list($var,$content) = each($vars)) { + $errmsg = str_replace('{'.$var.'}',htmlspecialchars($content),$errmsg); + } + } + + $tpl->set_var('ERROR',$errmsg); + + $tpl->parse(); print $tpl->get_template(); exit; @@ -122,7 +130,7 @@ function show_fatal(&$errmsg) { # # Parameter: Fehlermeldung -function show_user_error(&$errmsg) { +function show_user_error($errmsg) { global $captcha_enable, $email, $name, $subject, $text, $user_fields, $tpl_user_error; $tpl = new Template; @@ -139,7 +147,14 @@ function show_user_error(&$errmsg) { reset($user_fields); while(list($user_field,$user_field_data) = each($user_fields)) { - $tpl->set_var($user_field_data['tpl_var'],htmlspecialchars(formdata($user_field))); + 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; + } + + $tpl->set_var($tpl_var,htmlspecialchars(formdata($user_field))); } $tpl->parse();