More accurate mailto replacements
[squirrelmail.git] / functions / url_parser.php
index 23eb8c9acdeb806013bd77cf6fcd81d25800835a..2a6da6670a431306baef4f3ef36cba60abbd322b 100644 (file)
@@ -3,11 +3,11 @@
 /**
  * url_parser.php
  *
- * Copyright (c) 1999-2004 The SquirrelMail Project Team
+ * Copyright (c) 1999-2005 The SquirrelMail Project 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.
+ * used by the rest of the SquirrelMail code.
  *
  * @version $Id$
  * @package squirrelmail
@@ -157,7 +157,7 @@ function parseUrl (&$body) {
                             $mailto_params .= '?' . $to;
                     }
                 }
-                $url_str = str_replace(array('to=', 'cc=', 'bcc='), array('send_to=', 'send_to_cc=', 'send_to_bcc='), $mailto_params);
+                $url_str = preg_replace(array('/to=/i', '/(?<!b)cc=/i', '/bcc=/i'), array('send_to=', 'send_to_cc=', 'send_to_bcc='), $mailto_params);
                 $comp_uri = makeComposeLink('src/compose.php' . $url_str, $mailto_before);
                 replaceBlock($body, $comp_uri, $target_pos - 7, $target_pos + strlen($regs[0]));
                 $target_pos += strlen($comp_uri) - 7;
@@ -223,4 +223,4 @@ function getEmail($string) {
     return (array_key_exists(0, $addresses) ? $addresses[0] : '');
 }
 
-?>
\ No newline at end of file
+?>