From 6084d782f2e6e57248463bf10b99eeee543e0049 Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Sun, 14 Nov 2010 06:35:38 -0500 Subject: [PATCH] - Fix hanling of HTML entity strings in plai text messages --- program/steps/mail/compose.inc | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 2c29fc7..3f2b8c5 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -112,7 +112,8 @@ // add some labels to client $OUTPUT->add_label('nosubject', 'nosenderwarning', 'norecipientwarning', 'nosubjectwarning', 'cancel', 'nobodywarning', 'notsentwarning', 'notuploadedwarning', 'savingmessage', 'sendingmessage', - 'messagesaved', 'converting', 'editorwarning', 'searching', 'uploading', 'fileuploaderror'); + 'messagesaved', 'converting', 'editorwarning', 'searching', 'uploading', 'fileuploaderror', + 'autocompletechars'); // add config parameters to client script if (!empty($CONFIG['drafts_mbox'])) { @@ -123,6 +124,7 @@ $OUTPUT->set_env('mailbox', $IMAP->get_mailbox_name()); $OUTPUT->set_env('sig_above', $CONFIG['sig_above']); $OUTPUT->set_env('top_posting', $CONFIG['top_posting']); +$OUTPUT->set_env('autocomplete_min_length', $CONFIG['autocomplete_min_length']); // get reference message and set compose mode if ($msg_uid = $_SESSION['compose']['param']['reply_uid']) @@ -644,9 +646,20 @@ $out .= $msgtype->show(); // If desired, set this textarea to be editable by TinyMCE - if ($isHtml) $attrib['class'] = 'mce_editor'; - $textarea = new html_textarea($attrib); - $out .= $textarea->show($MESSAGE_BODY); + if ($isHtml) { + $attrib['class'] = 'mce_editor'; + $textarea = new html_textarea($attrib); + $out .= $textarea->show($MESSAGE_BODY); + } + else { + $textarea = new html_textarea($attrib); + $out .= $textarea->show(''); + // quote plain text, inject into textarea + $table = get_html_translation_table(HTML_SPECIALCHARS); + $MESSAGE_BODY = strtr($MESSAGE_BODY, $table); + $out = substr($out, 0, -11) . $MESSAGE_BODY . '</textarea>'; + } + $out .= $form_end ? "\n$form_end" : ''; $OUTPUT->set_env('composebody', $attrib['id']); -- Gitblit v1.9.1