[prev in list] [next in list] [prev in thread] [next in thread]
List: squirrelmail-cvs
Subject: [SM-CVS] SF.net SVN: squirrelmail: [12792]
From: pdontthink () users ! sourceforge ! net
Date: 2007-11-27 20:33:20
Message-ID: E1Ix77Q-0005w3-3Z () sc8-pr-svn2 ! sourceforge ! net
[Download RAW message or body]
Revision: 12792
http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=12792&view=rev
Author: pdontthink
Date: 2007-11-27 12:33:19 -0800 (Tue, 27 Nov 2007)
Log Message:
-----------
Add mailto: handling to url parser (backport from DEVEL)
Modified Paths:
--------------
branches/SM-1_4-STABLE/squirrelmail/ChangeLog
branches/SM-1_4-STABLE/squirrelmail/functions/url_parser.php
Modified: branches/SM-1_4-STABLE/squirrelmail/ChangeLog
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/ChangeLog 2007-11-27 13:02:59 UTC (rev 12791)
+++ branches/SM-1_4-STABLE/squirrelmail/ChangeLog 2007-11-27 20:33:19 UTC (rev 12792)
@@ -32,6 +32,7 @@
- Fix bug in sitewide SMTP settings still using authenticated user, rather
than configured settings (#1835942).
- Fixed mailto: functionality.
+ - Added mailto: link handling when viewing messages.
Version 1.4.11 - 29 September 2007
----------------------------------
Modified: branches/SM-1_4-STABLE/squirrelmail/functions/url_parser.php
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/functions/url_parser.php 2007-11-27 13:02:59 \
UTC (rev 12791)
+++ branches/SM-1_4-STABLE/squirrelmail/functions/url_parser.php 2007-11-27 20:33:19 \
UTC (rev 12792) @@ -76,6 +76,7 @@
'https://',
'ftp://',
'telnet:', // Special case -- doesn't need the slashes
+ 'mailto:', // Special case -- doesn't use the slashes
'gopher://',
'news://');
@@ -85,12 +86,18 @@
']', '[', '{', '}', "\240", ', ', '. ', ",\n", ",\r");
+/**
+ * Parses a body and converts all found URLs to clickable links.
+ *
+ * @param string body the body to process, by ref
+ * @return void
+ */
function parseUrl (&$body) {
global $url_parser_poss_ends, $url_parser_url_tokens;
$start = 0;
$blength = strlen($body);
- while ($start != $blength) {
+ while ($start < $blength) {
$target_token = '';
$target_pos = $blength;
@@ -112,6 +119,36 @@
$target_pos = strlen($check_str) + $start;
}
+ // rfc 2368 (mailto URL)
+ if ($target_token == 'mailto:') {
+ $target_pos += 7; //skip mailto:
+ $end = $blength;
+
+ $mailto = substr($body, $target_pos, $end-$target_pos);
+
+ global $MailTo_PReg_Match;
+ if ((preg_match($MailTo_PReg_Match, $mailto, $regs)) && ($regs[0] != \
'')) { + //sm_print_r($regs);
+ $mailto_before = $target_token . $regs[0];
+ $mailto_params = $regs[10];
+ if ($regs[1]) { //if there is an email addr before '?', we need \
to merge it with the params + $to = 'to=' . $regs[1];
+ if (strpos($mailto_params, 'to=') > -1) //already a 'to='
+ $mailto_params = str_replace('to=', $to . '%2C%20', \
$mailto_params); + else {
+ if ($mailto_params) //already some params, append to them
+ $mailto_params .= '&' . $to;
+ else
+ $mailto_params .= '?' . $to;
+ }
+ }
+ $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; + }
+ }
+ else
/* If there was a token to replace, replace it */
if ($target_token != '') {
/* Find the end of the URL */
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-----
squirrelmail-cvs mailing list
List address: squirrelmail-cvs@lists.sourceforge.net
List info (subscribe/unsubscribe/change options): \
https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
Repository: http://squirrelmail.org/svn
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic