** -> *
[squirrelmail.git] / functions / url_parser.php
index 3e20d76325ece638490bfa36c3519d21ac932575..c9ee48627853ec8ef5a68a920e200da3f6ff45db 100644 (file)
@@ -1,16 +1,16 @@
 <?php
 
    /**
-    **  url_parser.php
-    **
-    **  Copyright (c) 1999-2001 The Squirrelmail Development Team
-    **  Licensed under the GNU GPL. For full terms see the file COPYING.
-    **
-    **  This code provides various string manipulation functions that are
-    **  used by the rest of the Squirrelmail code.
-    **
-    **  $Id$
-    **/
+    *  url_parser.php
+    *
+    *  Copyright (c) 1999-2001 The Squirrelmail Development Team
+    *  Licensed under the GNU GPL. For full terms see the file COPYING.
+    *
+    *  This code provides various string manipulation functions that are
+    *  used by the rest of the Squirrelmail code.
+    *
+    *  $Id$
+    */
 
    function replaceBlock (&$in, $replace, $start, $end) {
       $begin = substr($in,0,$start);
@@ -77,7 +77,7 @@
    global $url_parser_poss_ends;
    $url_parser_poss_ends = array(' ', "\n", "\r", '<', '>', ".\r", ".\n", 
        '.&nbsp;', '&nbsp;', ')', '(', '&quot;', '&lt;', '&gt;', '.<', 
-       ']', '[', '{', '}', "\240");
+       ']', '[', '{', '}', "\240", ', ', '. ', ",\n", ",\r");
 
 
    function parseUrl (&$body)
           // Extract URL
           $url = substr($body, $target_pos, $end-$target_pos);
           
+          // Needed since lines are not passed with \n or \r
+          while ( ereg("[,\.]$", $url) ) {
+            $url = substr( $url, 0, -1 );
+            $end--;
+          }
+
           // Replace URL with HyperLinked Url, requires 1 char in link
           if ($url != '' && $url != $target_token) 
           {