summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2012-04-13 08:52:02 +0000
committeralecpl <alec@alec.pl>2012-04-13 08:52:02 +0000
commit0c259682f65eaaf23ea4ccb56a706d6baf3007e4 (patch)
treef1491f39189c8a970e7612b9dcc20f9409d7361e /program/steps/mail
parentce64332e7a9bf2468eabdb4b789270aebb3e7dc7 (diff)
- Merge devel-framework branch, resolved conflicts
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/compose.inc16
-rw-r--r--program/steps/mail/func.inc25
-rw-r--r--program/steps/mail/get.inc25
-rw-r--r--program/steps/mail/show.inc26
4 files changed, 70 insertions, 22 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index ebf79be4e..c0a5bf7bc 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -1162,10 +1162,22 @@ function rcmail_save_attachment(&$message, $pid)
$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,
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 8dcd37b20..319166c2d 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -230,7 +230,7 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null
// Make sure there are no duplicated columns (#1486999)
$a_show_cols = array_unique($a_show_cols);
- // Plugins may set header's list_cols/list_flags and other rcube_mail_header variables
+ // Plugins may set header's list_cols/list_flags and other rcube_message_header variables
// and list columns
$plugin = $RCMAIL->plugins->exec_hook('messages_list',
array('messages' => $a_headers, 'cols' => $a_show_cols));
@@ -1024,10 +1024,20 @@ function rcmail_message_body($attrib)
foreach ($MESSAGE->parts as $i => $part) {
if ($part->type == 'headers')
$out .= rcmail_message_headers(sizeof($header_attrib) ? $header_attrib : NULL, $part->headers);
- else if ($part->type == 'content' && $part->size) {
+ else if ($part->type == 'content') {
+ // unsapported
+ if ($part->realtype) {
+ if ($part->realtype == 'multipart/encrypted') {
+ $out .= html::span('part-notice', rcube_label('encryptedmessage'));
+ }
+ continue;
+ }
+ else if (!$part->size) {
+ continue;
+ }
// Check if we have enough memory to handle the message in it
// #1487424: we need up to 10x more memory than the body
- if (!rcmail_mem_check($part->size * 10)) {
+ else if (!rcmail_mem_check($part->size * 10)) {
$out .= html::span('part-notice', rcube_label('messagetoobig'). ' '
. html::a('?_task=mail&_action=get&_download=1&_uid='.$MESSAGE->uid.'&_part='.$part->mime_id
.'&_mbox='. urlencode($RCMAIL->storage->get_folder()), rcube_label('download')));
@@ -1438,9 +1448,14 @@ function rcmail_message_part_controls($attrib)
$part = $MESSAGE->mime_parts[$part];
$table = new html_table(array('cols' => 3));
- if (!empty($part->filename)) {
+ $filename = $part->filename;
+ if (empty($filename) && $attach_prop->mimetype == 'text/html') {
+ $filename = rcube_label('htmlmessage');
+ }
+
+ if (!empty($filename)) {
$table->add('title', Q(rcube_label('filename')));
- $table->add('header', Q($part->filename));
+ $table->add('header', Q($filename));
$table->add('download-link', html::a(array('href' => './?'.str_replace('_frame=', '_download=', $_SERVER['QUERY_STRING'])), Q(rcube_label('download'))));
}
diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc
index 924433df3..19be4bd07 100644
--- a/program/steps/mail/get.inc
+++ b/program/steps/mail/get.inc
@@ -69,8 +69,15 @@ if (!empty($_GET['_uid'])) {
// show part page
if (!empty($_GET['_frame'])) {
- if (($part_id = get_input_value('_part', RCUBE_INPUT_GPC)) && ($part = $MESSAGE->mime_parts[$part_id]) && $part->filename)
- $OUTPUT->set_pagetitle($part->filename);
+ if (($part_id = get_input_value('_part', RCUBE_INPUT_GPC)) && ($part = $MESSAGE->mime_parts[$part_id])) {
+ $filename = $part->filename;
+ if (empty($filename) && $part->mimetype == 'text/html') {
+ $filename = rcube_label('htmlmessage');
+ }
+ if (!empty($filename)) {
+ $OUTPUT->set_pagetitle($filename);
+ }
+ }
$OUTPUT->send('messagepart');
exit;
@@ -130,15 +137,25 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) {
$out = rcmail_print_body($part, array('safe' => $MESSAGE->is_safe, 'inline_html' => false));
}
- $OUTPUT = new rcube_html_page();
+ $OUTPUT = new rcube_output_html();
$OUTPUT->write($out);
}
else {
// don't kill the connection if download takes more than 30 sec.
@set_time_limit(0);
+ if ($part->filename) {
+ $filename = $part->filename;
+ }
+ else if ($part->mimetype == 'text/html') {
+ $filename = rcube_label('htmlmessage');
+ }
+ else {
+ $filename = ($MESSAGE->subject ? $MESSAGE->subject : 'roundcube');
+ }
+
$ext = '.' . ($mimetype == 'text/plain' ? 'txt' : $ctype_secondary);
- $filename = $part->filename ? $part->filename : ($MESSAGE->subject ? $MESSAGE->subject : 'roundcube') . $ext;
+ $filename .= $ext;
$filename = preg_replace('[\r\n]', '', $filename);
if ($browser->ie && $browser->ver < 7)
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index c6c6d9636..076098a56 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -126,20 +126,24 @@ function rcmail_message_attachments($attrib)
if (sizeof($MESSAGE->attachments)) {
foreach ($MESSAGE->attachments as $attach_prop) {
- if ($PRINT_MODE) {
- $ol .= html::tag('li', null, sprintf("%s (%s)", Q($attach_prop->filename), Q(show_bytes($attach_prop->size))));
+ $filename = $attach_prop->filename;
+ if (empty($filename) && $attach_prop->mimetype == 'text/html') {
+ $filename = rcube_label('htmlmessage');
}
- else {
- if (mb_strlen($attach_prop->filename) > 50) {
- $filename = abbreviate_string($attach_prop->filename, 50);
- $title = $attach_prop->filename;
+
+ if ($PRINT_MODE) {
+ $ol .= html::tag('li', null, sprintf("%s (%s)", Q($filename), Q(show_bytes($attach_prop->size))));
}
else {
- $filename = $attach_prop->filename;
- $title = '';
- }
-
- $ol .= html::tag('li', rcmail_filetype2classname($attach_prop->mimetype, $attach_prop->filename),
+ if (mb_strlen($filename) > 50) {
+ $filename = abbreviate_string($filename, 50);
+ $title = $filename;
+ }
+ else {
+ $title = '';
+ }
+
+ $ol .= html::tag('li', rcmail_filetype2classname($attach_prop->mimetype, $filename),
html::a(array(
'href' => $MESSAGE->get_part_url($attach_prop->mime_id, false),
'onclick' => sprintf(