From 2456ea61eabd3791d810516c615afa0ad967b86c Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Fri, 24 Nov 2006 17:43:08 +0000 Subject: [PATCH] Fixes on email filter git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1152 839d8a87-29fc-0310-9880-83ba4fa771e5 --- classes/platalpage.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/classes/platalpage.php b/classes/platalpage.php index 833fdc7..ab83066 100644 --- a/classes/platalpage.php +++ b/classes/platalpage.php @@ -280,19 +280,19 @@ function hide_emails($source, &$smarty) } //catch all emails in - preg_match_all("!]+href=[\"']mailto:[^>]+>.*?!is", $source, $ahref); - $source = preg_replace("!]+href=[\"']mailto:[^>]+>.*?!is", '&&&ahref&&&', $source); + preg_match_all("!]+href=[\"'][^\"']*[-a-z0-9_.]+@[-a-z0-9_.]+[^\"']*[\"'][^>]*>.*?!is", $source, $ahref); + $source = preg_replace("!]+href=[\"'][^\"']*[-a-z0-9_.]+@[-a-z0-9_.]+[^\"']*[\"'][^>]*>.*?!is", '&&&ahref&&&', $source); //prevant replacement in tag attributes - preg_match_all("!<[^>]+[-a-z0-9_.]+@[-a-z0-9_.]+[^>]+>!is", $source, $misc); - $source = preg_replace("!<[^>]+[-a-z0-9_.]+@[-a-z0-9_.]+[^>]+>!is", '&&&misc&&&', $source); + preg_match_all("!<[^>]+[\"'][^\"']*[-a-z0-9_.]+@[-a-z0-9_.]+[^\"']*[\"'][^>]*>!is", $source, $misc); + $source = preg_replace("!<[^>]+[\"'][^\"']*[-a-z0-9_.]+@[-a-z0-9_.]+[^\"']*[\"'][^>]*>!is", '&&&misc&&&', $source); //catch ! $source = preg_replace('!([-a-z0-9_.]+@[-a-z0-9_.]+)!ie', '_hide_email("\1")', $source); $source = preg_replace('!&&&ahref&&&!e', '_hide_email(array_shift($ahref[0]))', $source); - $source = preg_replace('!&&&misc&&&!e', '_hide_email(array_shift($misc[0]))', $source); // restore data + $source = preg_replace('!&&&misc&&&!e', 'array_shift($misc[0])', $source); foreach ($tags as $tag) { $source = preg_replace("!&&&{$tag}&&&!e", 'array_shift(${$tag}[0])', $source); } -- 2.1.4