- Fix plaintext versions of HTML messages don't contain placeholders for emotions (#1485206)

release-0.6
alecpl 14 years ago
parent 9e81b55616
commit 7472893512

@ -14,6 +14,7 @@ CHANGELOG Roundcube Webmail
- Add possibility to move a subfolder into root folder (#1486791) - Add possibility to move a subfolder into root folder (#1486791)
- Fix copying all messages in a folder copies only messages from current page - Fix copying all messages in a folder copies only messages from current page
- Improve performance of moving or copying of all messages in a folder - Improve performance of moving or copying of all messages in a folder
- Fix plaintext versions of HTML messages don't contain placeholders for emotions (#1485206)
RELEASE 0.5-BETA RELEASE 0.5-BETA
---------------- ----------------

@ -1646,6 +1646,43 @@ function rcube_html_editor($mode='')
} }
/**
* Replaces TinyMCE's emoticon images with plain-text representation
*
* @param string HTML content
* @return string HTML content
*/
function rcmail_replace_emoticons($html)
{
$emoticons = array(
'8-)' => 'smiley-cool',
':-#' => 'smiley-foot-in-mouth',
':-*' => 'smiley-kiss',
':-X' => 'smiley-sealed',
':-P' => 'smiley-tongue-out',
':-@' => 'smiley-yell',
":'(" => 'smiley-cry',
':-(' => 'smiley-frown',
':-D' => 'smiley-laughing',
':-)' => 'smiley-smile',
':-/' => 'smiley-undecided',
':-X' => 'smiley-embarassed',
'0:-)' => 'smiley-innocent',
':-|' => 'smiley-money-mouth',
':-0' => 'smiley-surprised',
';-)' => 'smiley-wink',
);
foreach ($emoticons as $idx => $file) {
// <img title="Cry" src="http://.../program/js/tiny_mce/plugins/emotions/img/smiley-cry.gif" border="0" alt="Cry" />
$search[] = '/<img title="[a-z ]+" src="https?:\/\/[a-z0-9_.\/-]+\/tiny_mce\/plugins\/emotions\/img\/'.$file.'.gif"[^>]+\/>/i';
$replace[] = $idx;
}
return preg_replace($search, $replace, $html);
}
/** /**
* Check if working in SSL mode * Check if working in SSL mode
* *
@ -1881,3 +1918,4 @@ function log_bug($arg_arr)
flush(); flush();
} }
} }

@ -193,6 +193,7 @@ function rcmail_email_input_format($mailto, $count=false, $check=true)
return implode(', ', $result); return implode(', ', $result);
} }
/****** compose message ********/ /****** compose message ********/
if (strlen($_POST['_draft_saveid']) > 3) if (strlen($_POST['_draft_saveid']) > 3)
@ -441,6 +442,9 @@ if ($isHtml) {
$MAIL_MIME->setHTMLBody($plugin['body']); $MAIL_MIME->setHTMLBody($plugin['body']);
// replace emoticons
$plugin['body'] = rcmail_replace_emoticons($plugin['body']);
// add a plain text version of the e-mail as an alternative part. // add a plain text version of the e-mail as an alternative part.
$h2t = new html2text($plugin['body'], false, true, 0); $h2t = new html2text($plugin['body'], false, true, 0);
$plainTextPart = rc_wordwrap($h2t->get_text(), $LINE_LENGTH, "\r\n"); $plainTextPart = rc_wordwrap($h2t->get_text(), $LINE_LENGTH, "\r\n");

@ -19,7 +19,12 @@
*/ */
$converter = new html2text($HTTP_RAW_POST_DATA); $html = $HTTP_RAW_POST_DATA;
// Replace emoticon images with its text representation
$html = rcmail_replace_emoticons($html);
$converter = new html2text($html);
header('Content-Type: text/plain; charset=UTF-8'); header('Content-Type: text/plain; charset=UTF-8');
print rtrim($converter->get_text()); print rtrim($converter->get_text());

Loading…
Cancel
Save