From 9cb2c070a64ec6db903cbe434a616b0fd1b3b28b Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 12 Aug 2010 16:59:47 -0600 Subject: [PATCH] Tweaks to phishing algorithm --- framework/Mime_Viewer/lib/Horde/Mime/Viewer/Html.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Html.php b/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Html.php index 6bf1b1eba..b42051adc 100644 --- a/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Html.php +++ b/framework/Mime_Viewer/lib/Horde/Mime/Viewer/Html.php @@ -256,8 +256,16 @@ class Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Base /* Check for case where text is just the domain name. */ if (!isset($text_url['host'])) { - if (!isset($text_url['path']) || - !preg_match("/^[^\.\s\/]+(?:\.[^\.\s]+)+$/", $text_url['path'])) { + if (!isset($text_url['path'])) { + return false; + } + + /* Path info may include path, so remove that. */ + if (($pos = strpos($text_url['path'], '/')) !== false) { + $text_url['path'] = substr($text_url['path'], 0, $pos); + } + + if (!preg_match("/^[^\.\s\/]+(?:\.[^\.\s]+)+$/", $text_url['path'])) { return false; } -- 2.11.0