Re: Patch for mailto: link urlencoding
"Michael A. Puls II" <[email protected]>
| Newsgroups | gmane.mail.squirrelmail.devel |
|---|---|
| Message-ID | <op.u6g9iiui1ejg13@sandra-svwliu01> |
On Wed, 13 Jan 2010 10:10:58 -0500, Michael A. Puls II <[email protected]> wrote: > On Wed, 13 Jan 2010 09:36:02 -0500, Michael A. Puls II > <[email protected]> wrote: > >> On Wed, 13 Jan 2010 08:26:32 -0500, Michael A. Puls II >> <[email protected]> wrote: >> >>> On Wed, 13 Jan 2010 08:00:18 -0500, Michael A. Puls II >>> <[email protected]> wrote: >>> >>>> On Wed, 13 Jan 2010 07:48:13 -0500, Michael A. Puls II >>>> <[email protected]> wrote: >>>> >>>>> On Tue, 12 Jan 2010 13:58:59 -0500, Jon Nathan >>>>> <[email protected]> wrote: >>>>> >>>>>> Thanks for your feedback. What do you think the appropriate way >>>>>> to adress this is? I'd hate to only urlencode specific characters. >>>>> >>>>> I think the relevant code is actually in parseUrl() in >>>>> functions/url_parser.php. >>>>> >>>> In url_parser.php, in parseUrl, after: >>>> $mailto = substr($body, $target_pos, $end-$target_pos); >>>> add this line: >>>> $mailto = preg_replace("/\\+/", "%2B", $mailto); >>>> for example. >>>> >>>> That will fix things. >>> >>> That does fix things, but it breaks some other things. The replacement >>> of the '+' characters causes the length to be longer, which messes up >>> other calculations down the code a bit. Will investigate. >> >> O.K. disregard the previous fix and try this: >> Change the following line: >> $mailto_params = $regs[10]; >> to: >> $mailto_params = preg_replace("/\\+/", "%2B", $regs[10]); >> >> and see if that works. > > That does work, but it doesn't do the replacement before '?'. > > So, *also* change: > $to = 'to=' .$regs[1]; > to: > $to = 'to=' . preg_replace("/\\+/", "%2B", $regs[1]); > Attached is the full patch. Hope that helps. -- Michael ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev ----- squirrelmail-devel mailing list Posting guidelines: http://squirrelmail.org/postingguidelines List address: [email protected] List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel
url_parser.php.patch
(application/octet-stream, 958 B)
Index: functions/url_parser.php
===================================================================
--- functions/url_parser.php (revision 13883)
+++ functions/url_parser.php (working copy)
@@ -130,9 +130,9 @@
if ((preg_match($MailTo_PReg_Match, $mailto, $regs)) && ($regs[0] != '')) {
//sm_print_r($regs);
$mailto_before = $target_token . $regs[0];
- $mailto_params = $regs[10];
+ $mailto_params = preg_replace("/\\+/", "%2B", $regs[10]);
if ($regs[1]) { //if there is an email addr before '?', we need to merge it with the params
- $to = 'to=' . $regs[1];
+ $to = 'to=' . preg_replace("/\\+/", "%2B", $regs[1]);
if (strpos($mailto_params, 'to=') > -1) //already a 'to='
$mailto_params = str_replace('to=', $to . '%2C%20', $mailto_params);
else {