Tweaks to phishing algorithm
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 12 Aug 2010 22:59:47 +0000 (16:59 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Sat, 14 Aug 2010 20:55:47 +0000 (14:55 -0600)
framework/Mime_Viewer/lib/Horde/Mime/Viewer/Html.php

index 6bf1b1e..b42051a 100644 (file)
@@ -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;
             }