From 2b057170eba08ec01d3662f2e365c4cafb20320d Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Sat, 22 Jul 2006 20:00:56 +0000 Subject: [PATCH] Improve email catcher Do not catch message-id as email anymore git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@122 9869982d-c50d-0410-be91-f2a2ec7c7c7b --- Changelog | 4 ++++ banana/misc.inc.php | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 1b2c924..6aa6a12 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,7 @@ +Sat, 22 Jul 2006 Florent Bruneau + * Impove url and email catcher + * Bugfix: quotes formating + Sat, 15 Jul 2006 Florent Bruneau * New tabbed structure * Support of Content-ID references (multipart/related) diff --git a/banana/misc.inc.php b/banana/misc.inc.php index f717c00..d3eeb2d 100644 --- a/banana/misc.inc.php +++ b/banana/misc.inc.php @@ -571,6 +571,14 @@ function cleanurl($url) return ''.cutlink($url).''; } +function catchMailLink($email) +{ + if (strpos($email, '$') !== false) { + return $email; + } + return '' . $email . ''; +} + /** Remove quotation marks */ function replaceQuotes($text) @@ -594,7 +602,9 @@ function formatbody($_text, $format='plain', $flowed=false) $url = $banana->url_regexp; $res = preg_replace("/(<|>|")/", " \\1 ", $res); $res = preg_replace("!$url!ie", "'\\1'.cleanurl('\\2').'\\3'", $res); - $res = preg_replace('/(["\[])?(?:mailto:)?([a-z0-9.\-+_]+@[a-z0-9.\-+_]+)(["\]])?/i', '\1\2\3', $res); + $res = preg_replace('/(["\[])?(?:mailto:)?([a-z0-9.\-+_\$]+@[a-z0-9.\-+_]+)(["\]])?/ie', + "'\\1' . catchMailLink('\\2') . '\\3'", + $res); $res = preg_replace("/ (<|>|") /", "\\1", $res); if ($format == 'richtext') { -- 2.1.4