From: x2003bruneau Date: Sat, 22 Jul 2006 20:00:56 +0000 (+0000) Subject: Improve email catcher X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=42a461571eff4c98a7fee13922af8710649c2348;p=banana.git 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 --- 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') {