From: Patrick Canterino Date: Sat, 3 Dec 2011 13:06:47 +0000 (+0000) Subject: Programmierstil von functions.php angepasst X-Git-Tag: 3.5~56 X-Git-Url: https://git.p6c8.net/form-email.git/commitdiff_plain/f77ec4e3fb74940eeabdf816a99664ec5e532f64?hp=542aadbfb3e19f62899f4513424da7774e2b80af Programmierstil von functions.php angepasst --- diff --git a/form-email/functions.php b/form-email/functions.php index f470011..e353da8 100644 --- a/form-email/functions.php +++ b/form-email/functions.php @@ -7,7 +7,7 @@ # geschrieben wurde. # # Autor: Patrick Canterino -# Letzte Aenderung: 7.11.2011 +# Letzte Aenderung: 3.12.2011 # # Copyright (C) 2002-2011 Patrick Canterino # @@ -29,36 +29,31 @@ # wird nichts zurueckgegeben. # - Codierende Backslashes werden automatisch entfernt -function formdata($param) -{ - switch($_SERVER['REQUEST_METHOD']) - { - case 'GET': - if(isset($_GET[$param])) - { - $value = $_GET[$param]; - break; - } - else return null; - - case 'POST': - if(isset($_POST[$param])) - { - $value = $_POST[$param]; - break; - } - else return null; - - default: - return null; - } - - if(get_magic_quotes_gpc()) - { - if(is_array($value)) return array_map('stripslashes',$value); - else return stripslashes($value); - } - else return $value; +function formdata($param) { + switch($_SERVER['REQUEST_METHOD']) { + case 'GET': + if(isset($_GET[$param])) { + $value = $_GET[$param]; + break; + } + else return null; + + case 'POST': + if(isset($_POST[$param])) { + $value = $_POST[$param]; + break; + } + else return null; + + default: + return null; + } + + if(get_magic_quotes_gpc()) { + if(is_array($value)) return array_map('stripslashes',$value); + else return stripslashes($value); + } + else return $value; } # plain() @@ -71,20 +66,18 @@ function formdata($param) # # Rueckgabe: Bearbeiteter Text (String) -function &plain(&$text,$linebreak='
') -{ - $htmltext = htmlentities($text); - $htmltext = preg_replace("/\015\012|\012|\015/",$linebreak,$htmltext); +function &plain(&$text,$linebreak='
') { + $htmltext = htmlentities($text); + $htmltext = preg_replace("/\015\012|\012|\015/",$linebreak,$htmltext); - for($x=0;$xread_file($tpl_fatal); + $tpl = new Template; + $tpl->read_file($tpl_fatal); - $tpl->fillin('ERROR',$errmsg); + $tpl->fillin('ERROR',$errmsg); - print $tpl->get_template(); - exit; + print $tpl->get_template(); + exit; } # show_user_error() @@ -131,25 +122,24 @@ function show_fatal(&$errmsg) # # Parameter: Fehlermeldung -function show_user_error(&$errmsg) -{ - global $captcha_enable, $email, $name, $subject, $text, $tpl_user_error; +function show_user_error(&$errmsg) { + global $captcha_enable, $email, $name, $subject, $text, $tpl_user_error; - $tpl = new Template; - $tpl->read_file($tpl_user_error); + $tpl = new Template; + $tpl->read_file($tpl_user_error); - $tpl->parse_if_block('CAPTCHA',$captcha_enable); - - $tpl->set_var('EMAIL', htmlentities($email)); - $tpl->set_var('ERROR', $errmsg); - $tpl->set_var('NAME', htmlentities($name)); - $tpl->set_var('SUBJECT',htmlentities($subject)); - $tpl->set_var('TEXT', htmlentities($text)); + $tpl->parse_if_block('CAPTCHA',$captcha_enable); - $tpl->parse(); + $tpl->set_var('EMAIL', htmlentities($email)); + $tpl->set_var('ERROR', $errmsg); + $tpl->set_var('NAME', htmlentities($name)); + $tpl->set_var('SUBJECT',htmlentities($subject)); + $tpl->set_var('TEXT', htmlentities($text)); - print $tpl->get_template(); - exit; + $tpl->parse(); + + print $tpl->get_template(); + exit; } #