X-Git-Url: https://git.p6c8.net/form-email.git/blobdiff_plain/48d0c07a90a64c489199182f3c0757153f12d363..e52c5cdbe5a29aa2f1d2f77597119f2bd1d474c8:/form-email/mailer.php?ds=inline diff --git a/form-email/mailer.php b/form-email/mailer.php index 3c1d3ce..32f1caa 100644 --- a/form-email/mailer.php +++ b/form-email/mailer.php @@ -7,7 +7,7 @@ # geschrieben wurde. # # Autor: Patrick Canterino -# Letzte Aenderung: 15.12.2011 +# Letzte Aenderung: 17.12.2011 # # Copyright (C) 2002-2011 Patrick Canterino # @@ -93,22 +93,22 @@ $prepared_user_fields = array(); while(list($user_field,$user_field_data) = each($user_fields)) { $user_field_content = formdata($user_field); - + # Pruefung, ob das Feld gesetzt wurde und ob es optional ist - + if((!$user_field_data['optional']) && (!$user_field_content)) { show_user_error($user_field_data['errors']['not_set']); } elseif($user_field_data['optional'] && (!$user_field_content)) { # Wenn das Feld optional ist und nicht gesetzt wurde, brechen wir hier ab # und machen mit dem naechsten Feld weiter - + $prepared_user_fields[$user_field_data['tpl_var']] = ''; 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'])) { @@ -119,7 +119,7 @@ while(list($user_field,$user_field_data) = each($user_fields)) { } } } - + 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'])) { @@ -130,7 +130,7 @@ while(list($user_field,$user_field_data) = each($user_fields)) { } } } - + # Pruefung gegen frei definierbare Pruef-Funktion if(isset($user_field_data['check']) && $user_field_data['check'] != '') { @@ -143,7 +143,7 @@ while(list($user_field,$user_field_data) = each($user_fields)) { } } } - + # Pruefung gegen frei definierbaren regulaeren Ausdruck if(isset($user_field_data['regex']) && $user_field_data['regex'] != '') { @@ -156,7 +156,7 @@ while(list($user_field,$user_field_data) = each($user_fields)) { } } } - + # Formularfeld durch frei definierbare Funktion bearbeiten if(isset($user_field_data['prepare']) && $user_field_data['prepare'] != '') { @@ -164,7 +164,7 @@ while(list($user_field,$user_field_data) = each($user_fields)) { $user_field_content = call_user_func($user_field_data['prepare'],$user_field_content); } } - + # Name der Template-Variable ermitteln if(isset($user_field_data['tpl_var']) && $user_field_data['tpl_var'] != '') { @@ -173,7 +173,7 @@ while(list($user_field,$user_field_data) = each($user_fields)) { else { $tpl_var = 'USER_'.$user_field; } - + # Fertige Formulardaten wegkopieren und fuer spaeter zur Verfuegung stellen $prepared_user_fields[$tpl_var] = $user_field_content; @@ -192,7 +192,7 @@ if($captcha_enable) { else { if(!$captcha_input || empty($captcha_input) || strtolower($captcha_input) != strtolower($_SESSION['captcha'])) $captcha_incorrect = true; } - + if($captcha_incorrect) { if($captcha_max) { if(isset($_SESSION['captcha_failed']) && $_SESSION['captcha_failed']) { @@ -206,7 +206,7 @@ if($captcha_enable) { if($captcha_max && isset($_SESSION['captcha_failed']) && $_SESSION['captcha_failed'] >= $captcha_max) { show_fatal($err_captcha_max); } - else { + else { show_user_error($err_captcha_incorrect); } } @@ -348,14 +348,15 @@ if($captcha_enable) session_destroy(); if($return_url) { # Per Redirect auf Seite umleiten - if(!preg_match('!://!',$return_url)) { + if(strpos($return_url,'://') === false) { # URL vervollstaendigen $http_host = ($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; $protocol = ''; $port = ''; + $path = ''; - if($_SERVER['HTTPS']) { + if(isset($_SERVER['HTTPS'])) { # SSL-verschluesseltes HTTP $protocol = 'https://'; @@ -368,13 +369,19 @@ if($return_url) { if($_SERVER['SERVER_PORT'] != 80) $port = ':'.$_SERVER['SERVER_PORT']; } - if(preg_match('!^/!',$return_url)) { + if(substr($return_url,0,1) == '/') { $return_url = $protocol.$http_host.$port.$return_url; } else { - if(preg_match('!/$!',$_SERVER['SCRIPT_NAME'])) $path = substr($_SERVER['SCRIPT_NAME'],0,-1); + if(substr($_SERVER['SCRIPT_NAME'],-1,1) == '/') { + $path = substr($_SERVER['SCRIPT_NAME'],0,-1); + } + else { + $path = $_SERVER['SCRIPT_NAME']; + } + $path = substr($path,0,strrpos($path,'/')+1); - if(!preg_match('!^/!',$path)) $path = '/'.$path; + if(substr($path,0,1) != '/') $path = '/'.$path; $return_url = $protocol.$http_host.$port.$path.$return_url; }