summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/compose.inc16
-rw-r--r--program/steps/mail/func.inc4
-rw-r--r--program/steps/mail/get.inc23
-rw-r--r--program/steps/mail/sendmail.inc1
4 files changed, 29 insertions, 15 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 646d2bcd1..f75b219ff 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -110,9 +110,10 @@ $OUTPUT->add_label('nosubject', 'nosenderwarning', 'norecipientwarning', 'nosubj
'nobodywarning', 'notsentwarning', 'notuploadedwarning', 'savingmessage', 'sendingmessage',
'messagesaved', 'converting', 'editorwarning', 'searching', 'uploading', 'uploadingmany',
'fileuploaderror', 'sendmessage', 'savenewresponse', 'responsename', 'responsetext', 'save',
- 'savingresponse');
+ 'savingresponse', 'restoresavedcomposedata', 'restoremessage', 'delete', 'restore', 'ignore');
$OUTPUT->set_env('compose_id', $COMPOSE['id']);
+$OUTPUT->set_env('session_id', session_id());
$OUTPUT->set_pagetitle(rcube_label('compose'));
// add config parameters to client script
@@ -239,6 +240,9 @@ if (!empty($msg_uid) && empty($COMPOSE['as_attachment']))
$COMPOSE['reply_msgid'] = '<' . $in_reply_to . '>';
$COMPOSE['references'] = $MESSAGE->headers->references;
+
+ // use message-ID as draft_id, same as in sendmail.inc
+ $OUTPUT->set_env('draft_id', trim($MESSAGE->headers->get('message-id'), '<>'));
}
}
else {
@@ -442,6 +446,11 @@ function rcmail_process_compose_params(&$COMPOSE)
}
}
+ // clean HTML message body which can be submitted by URL
+ if ($COMPOSE['param']['body']) {
+ $COMPOSE['param']['body'] = rcmail_wash_html($COMPOSE['param']['body'], array('safe' => false, 'inline_html' => true), array());
+ }
+
$RCMAIL = rcmail::get_instance();
// select folder where to save the sent message
@@ -642,7 +651,7 @@ function rcmail_prepare_message_body()
}
else if ($COMPOSE['param']['body']) {
$body = $COMPOSE['param']['body'];
- $isHtml = false;
+ $isHtml = (bool) $COMPOSE['param']['html'];
}
// forward as attachment
else if ($compose_mode == RCUBE_COMPOSE_FORWARD && $COMPOSE['as_attachment']) {
@@ -827,6 +836,9 @@ function rcmail_compose_body($attrib)
$msgtype = new html_hiddenfield(array('name' => '_is_html', 'value' => ($isHtml?"1":"0")));
$out .= $msgtype->show();
+ $framed = new html_hiddenfield(array('name' => '_framed', 'value' => '1'));
+ $out .= $framed->show();
+
// If desired, set this textarea to be editable by TinyMCE
if ($isHtml) {
$MESSAGE_BODY = htmlentities($MESSAGE_BODY, ENT_NOQUOTES, RCMAIL_CHARSET);
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 78a977b82..8164592dd 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1342,9 +1342,9 @@ function rcmail_html4inline($body, $container_id, $body_id='', &$attributes=null
if (preg_match($regexp, $body, $m)) {
$attrs = $m[0];
// Get bgcolor, we'll set it as background-color of the message container
- if ($m[1] && preg_match('/bgcolor=["\']*([a-z0-9#]+)["\']*/', $attrs, $mb)) {
+ if ($m[1] && preg_match('/bgcolor=["\']*([a-z0-9#]+)["\']*/i', $attrs, $mb)) {
$attributes['background-color'] = $mb[1];
- $attrs = preg_replace('/bgcolor=["\']*([a-z0-9#]+)["\']*/', '', $attrs);
+ $attrs = preg_replace('/bgcolor=["\']*[a-z0-9#]+["\']*/i', '', $attrs);
}
// Get background, we'll set it as background-image of the message container
if ($m[1] && preg_match('/background=["\']*([^"\'>\s]+)["\']*/', $attrs, $mb)) {
diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc
index e0c4e2911..ae48307e3 100644
--- a/program/steps/mail/get.inc
+++ b/program/steps/mail/get.inc
@@ -84,17 +84,18 @@ else if ($_GET['_thumb']) {
// render thumbnail image if not done yet
if (!is_file($cache_file)) {
- $fp = fopen(($orig_name = $cache_basename . '.orig.' . $ext), 'w');
- $MESSAGE->get_part_content($part->mime_id, $fp);
- fclose($fp);
-
- $image = new rcube_image($orig_name);
- if ($imgtype = $image->resize($thumbnail_size, $cache_file, true)) {
- $mimetype = 'image/' . $imgtype;
- unlink($orig_name);
- }
- else {
- rename($orig_name, $cache_file);
+ if ($fp = fopen(($orig_name = $cache_basename . '.orig.' . $ext), 'w')) {
+ $MESSAGE->get_part_content($part->mime_id, $fp);
+ fclose($fp);
+
+ $image = new rcube_image($orig_name);
+ if ($imgtype = $image->resize($thumbnail_size, $cache_file, true)) {
+ $mimetype = 'image/' . $imgtype;
+ unlink($orig_name);
+ }
+ else {
+ rename($orig_name, $cache_file);
+ }
}
}
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 52b02ecff..ea5eaaed1 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -855,6 +855,7 @@ else {
$folders[] = $COMPOSE['mailbox'];
rcmail_compose_cleanup($COMPOSE_ID);
+ $OUTPUT->command('remove_compose_data', $COMPOSE_ID);
if ($store_folder && !$saved)
$OUTPUT->command('sent_successfully', 'error', rcube_label('errorsavingsent'), $folders);