[geeklog-cvs] geeklog: trim() name and email address in COM_formatEmailAddress

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Sep 19 08:17:33 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/fe52314f43eb
changeset: 7323:fe52314f43eb
user:      Dirk Haun <dirk at haun-online.de>
date:      Sat Sep 19 13:03:44 2009 +0200
description:
trim() name and email address in COM_formatEmailAddress

diffstat:

 public_html/lib-common.php |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (30 lines):

diff -r 6bfe0553c0e3 -r fe52314f43eb public_html/lib-common.php
--- a/public_html/lib-common.php	Sat Sep 19 11:50:37 2009 +0200
+++ b/public_html/lib-common.php	Sat Sep 19 13:03:44 2009 +0200
@@ -3196,18 +3196,20 @@
 * @return   string              formatted email address
 *
 */
-function COM_formatEmailAddress( $name, $address )
-{
+function COM_formatEmailAddress($name, $address)
+{
+    $name = trim($name);
+    $address = trim($address);
+
     if (function_exists('CUSTOM_formatEmailAddress')) {
         return CUSTOM_formatEmailAddress($name, $address);
     }
 
-    $formatted_name = COM_emailEscape( $name );
+    $formatted_name = COM_emailEscape($name);
 
     // if the name comes back unchanged, it's not UTF-8, so preg_match is fine
-    if(( $formatted_name == $name ) && preg_match( '/[^0-9a-z ]/i', $name ))
-    {
-        $formatted_name = str_replace( '"', '\\"', $formatted_name );
+    if (($formatted_name == $name) && preg_match('/[^0-9a-z ]/i', $name)) {
+        $formatted_name = str_replace('"', '\\"', $formatted_name);
         $formatted_name = '"' . $formatted_name . '"';
     }
 



More information about the geeklog-cvs mailing list