From 5512e7787b1bf820811269a4f107efd5b7aedc2c Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Thu, 18 Nov 2010 08:41:17 +0000 Subject: [PATCH] rework of linkifying email adresses in displayed message bodys --- felamimail/inc/class.uidisplay.inc.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/felamimail/inc/class.uidisplay.inc.php b/felamimail/inc/class.uidisplay.inc.php index 93742624f7..a29c9af9dc 100644 --- a/felamimail/inc/class.uidisplay.inc.php +++ b/felamimail/inc/class.uidisplay.inc.php @@ -198,13 +198,17 @@ { if (!$email || $email == '' || $email == ' ') return ''; if (!$text) $text = $email; + //error_log( __METHOD__." email:".$email.'#
'); + //error_log( __METHOD__." text:".$text.'#
'); // create links for email addresses $linkData = array ( - 'menuaction' => 'felamimail.uicompose.compose' + 'menuaction' => 'felamimail.uicompose.compose', + 'send_to' => base64_encode($email) ); $link = $GLOBALS['egw']->link('/index.php',$linkData); - return ''.$text.''; + //error_log(__METHOD__." link:".$link.'#
'); + return "".$text.""; } function highlightQuotes($text, $level = 5) @@ -1296,9 +1300,9 @@ // removes stuff between http and ?http $Protocol = '(http:\/\/|(ftp:\/\/|https:\/\/))'; // only http:// gets removed, other protocolls are shown $newBody = preg_replace('~'.$Protocol.'[^>]*\?'.$Protocol.'~sim','$1',$newBody); // removes stuff between http:// and ?http:// - // spamsaver emailaddress, needed to be able to apply email compose links later + // TRANSFORM MAILTO LINKS TO EMAILADDRESS ONLY, WILL BE SUBSTITUTED BY parseEmail TO CLICKABLE LINK $newBody = preg_replace('/(?\\1 AT \\2 DOT \\3', + "\\1@\\2.\\3", $newBody); // redirect links for websites if you use no cookies @@ -1321,15 +1325,12 @@ } // create links for email addresses - $linkData = array - ( - 'menuaction' => 'felamimail.uicompose.compose' - ); - $link = $GLOBALS['egw']->link('/index.php',$linkData); + $link = $GLOBALS['egw']->link('/index.php',array('menuaction' => 'felamimail.uicompose.compose')); $newBody = preg_replace("/href=(\"|\')mailto:([\w,\-,\/,\?,\=,\.,&,!\n,\%,@,\*,#,:,~,\+]+)(\"|\')/ie", - "'href=\"$link&send_to='.base64_encode('$2').'\"'", $newBody); - #print "
".htmlentities($newBody)."

"; - + "'href=\"#\"'.' onclick=\"egw_openWindowCentered(\'$link&send_to='.base64_encode('$2').'\',\'compose\',700,egw_getWindowOuterHeight());\"'", $newBody); +// "'href=\"$link&send_to='.base64_encode('$2').'\"'", $newBody); + //print "
".htmlentities($newBody)."

"; + // replace emails within the text with clickable links. $this->parseEmail($newBody); }