/**
* url_parser.php
*
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2003 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.
*
* $Id$
+ * @package squirrelmail
*/
+/**
+ * Undocumented - complain, then patch.
+ */
function replaceBlock (&$in, $replace, $start, $end) {
$begin = substr($in,0,$start);
$end = substr($in,$end,strlen($in)-$end);
$Email_RegExp_Match = '[0-9a-z]([-_.+]?[0-9a-z])*(%' . $Host_RegExp_Match .
')?@' . $Host_RegExp_Match;
+/**
+ * Parses a body and converts all found email addresses to clickable links.
+ *
+ * @param string body the body to process, by ref
+ * @return int the number of unique addresses found
+ */
function parseEmail (&$body) {
- global $color, $Email_RegExp_Match, $compose_new_win;
+ global $color, $Email_RegExp_Match;
$sbody = $body;
$addresses = array();
}
/* Replace each email address with a compose URL */
foreach ($addresses as $email) {
- $comp_uri = '../src/compose.php?send_to='.urlencode($email);
- if ($compose_new_win == '1') {
- $comp_uri = 'javascript:void(0)" onClick="comp_in_new('
- . "'$comp_uri'" . ')';
- }
- $comp_uri = '<a href="'.$comp_uri.'">'.$email.'</a>';
+ $comp_uri = makeComposeLink('src/compose.php?send_to='.urlencode($email), $email);
$body = str_replace($email, $comp_uri, $body);
}
/* Return number of unique addresses found */
']', '[', '{', '}', "\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;