From: Patrick Canterino Date: Fri, 16 Dec 2011 14:30:03 +0000 (+0000) Subject: Unnoetige regulaere Ausdruecke entfernt (String-Funktionen sind schneller) X-Git-Tag: 3.5~42 X-Git-Url: https://git.p6c8.net/form-email.git/commitdiff_plain/de80757b425abdbc86c2f6837a5485c0e89878b8?ds=sidebyside Unnoetige regulaere Ausdruecke entfernt (String-Funktionen sind schneller) --- diff --git a/form-email/mailer.php b/form-email/mailer.php index 3c1d3ce..5330f1c 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: 16.12.2011 # # Copyright (C) 2002-2011 Patrick Canterino # @@ -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,13 @@ 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); $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; }