From 041c93ce0bc00cb6417ce2e4bdce2ed84d37f50a Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 22 May 2012 06:31:37 -0400
Subject: [PATCH] Removed $Id$

---
 program/steps/mail/compose.inc |   35 ++++++++++++++++++++++++++---------
 1 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 56abd24..306de36 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -17,9 +17,6 @@
  +-----------------------------------------------------------------------+
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
  +-----------------------------------------------------------------------+
-
- $Id$
-
 */
 
 // define constants for message compose mode
@@ -29,7 +26,6 @@
 define('RCUBE_COMPOSE_EDIT', 0x0109);
 
 $MESSAGE_FORM = null;
-$MESSAGE      = null;
 $COMPOSE_ID   = get_input_value('_id', RCUBE_INPUT_GET);
 $COMPOSE      = null;
 
@@ -119,7 +115,11 @@
   }
 
   // redirect to a unique URL with all parameters stored in session
-  $OUTPUT->redirect(array('_action' => 'compose', '_id' => $COMPOSE['id']));
+  $OUTPUT->redirect(array(
+    '_action' => 'compose',
+    '_id'     => $COMPOSE['id'],
+    '_search' => $_REQUEST['_search'],
+  ));
 }
 
 
@@ -181,7 +181,7 @@
   $MESSAGE = new rcube_message($msg_uid);
 
   // make sure message is marked as read
-  if ($MESSAGE && $MESSAGE->headers && empty($MESSAGE->headers->flags['SEEN']))
+  if ($MESSAGE->headers && empty($MESSAGE->headers->flags['SEEN']))
     $RCMAIL->storage->set_flag($msg_uid, 'SEEN');
 
   if (!empty($MESSAGE->headers->charset))
@@ -240,6 +240,9 @@
     if (!empty($COMPOSE['param']['attachment']))
       $MESSAGE->forward_attachment = true;
   }
+}
+else {
+  $MESSAGE = new stdClass();
 }
 
 $MESSAGE->compose = array();
@@ -764,7 +767,9 @@
 
   // If desired, set this textarea to be editable by TinyMCE
   if ($isHtml) {
+    $MESSAGE_BODY = htmlentities($MESSAGE_BODY, ENT_NOQUOTES, RCMAIL_CHARSET);
     $attrib['class'] = 'mce_editor';
+    $attrib['is_escaped'] = true;
     $textarea = new html_textarea($attrib);
     $out .= $textarea->show($MESSAGE_BODY);
   }
@@ -1156,10 +1161,22 @@
     $data = $message->get_part_content($pid);
   }
 
+  $mimetype = $part->ctype_primary . '/' . $part->ctype_secondary;
+  $filename = $part->filename;
+  if (!strlen($filename)) {
+    if ($mimetype == 'text/html') {
+      $filename = rcube_label('htmlmessage');
+    }
+    else {
+      $filename = 'Part_'.$pid;
+    }
+    $filename .= '.' . $part->ctype_secondary;
+  }
+
   $attachment = array(
     'group' => $COMPOSE['id'],
-    'name' => $part->filename ? $part->filename : 'Part_'.$pid.'.'.$part->ctype_secondary,
-    'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary,
+    'name' => $filename,
+    'mimetype' => $mimetype,
     'content_id' => $part->content_id,
     'data' => $data,
     'path' => $path,
@@ -1396,7 +1413,7 @@
   $attrib['value'] = '1';
   $checkbox = new html_checkbox($attrib);
 
-  if ($MESSAGE && in_array($compose_mode, array(RCUBE_COMPOSE_DRAFT, RCUBE_COMPOSE_EDIT)))
+  if (in_array($compose_mode, array(RCUBE_COMPOSE_DRAFT, RCUBE_COMPOSE_EDIT)))
     $mdn_default = (bool) $MESSAGE->headers->mdn_to;
   else
     $mdn_default = $RCMAIL->config->get('mdn_default');

--
Gitblit v1.9.1