Merge branch 'dev-rfc822-preview'

Conflicts:
	CHANGELOG
	program/steps/mail/show.inc
pull/5241/head
Aleksander Machniak 8 years ago
commit 9796cd2063

@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
- Implemented message/rfc822 attachment preview
- Update to jsTimezoneDetect 1.0.6
- Enigma: Added enigma_debug option
- Fix message list multi-select/deselect issue (#5219)

@ -339,8 +339,15 @@ function rcube_webmail()
// init message compose form
this.init_messageform();
}
else if (this.env.action == 'get')
else if (this.env.action == 'get') {
this.enable_command('download', 'print', true);
if (this.env.is_message) {
this.enable_command('reply', 'reply-all', 'edit', 'viewsource',
'forward', 'forward-inline', 'forward-attachment', true);
if (this.env.list_post)
this.enable_command('reply-list', true);
}
}
// show printing dialog
else if (this.env.action == 'print' && this.env.uid
&& !this.env.is_pgp_content && !this.env.pgp_mime_part
@ -1211,13 +1218,13 @@ function rcube_webmail()
this.open_window(this.env.comm_path + url, true, true);
}
}
else if (this.env.action == 'get') {
else if (this.env.action == 'get' && !this.env.is_message) {
this.gui_objects.messagepartframe.contentWindow.print();
}
else if (uid = this.get_single_uid()) {
url = this.url('print', this.params_from_uid(uid, {_safe: this.env.safemode ? 1 : 0}));
if (this.open_window(url, true, true)) {
if (this.env.action != 'show')
if (this.env.action != 'show' && this.env.action != 'get')
this.mark_message('read', uid);
}
}

@ -54,6 +54,7 @@ class rcube_message
public $folder;
public $headers;
public $sender;
public $context;
public $parts = array();
public $mime_parts = array();
public $inline_parts = array();
@ -78,11 +79,17 @@ class rcube_message
function __construct($uid, $folder = null, $is_safe = false)
{
// decode combined UID-folder identifier
if (preg_match('/^\d+-.+/', $uid)) {
if (preg_match('/^[0-9.]+-.+/', $uid)) {
list($uid, $folder) = explode('-', $uid, 2);
}
if (preg_match('/^([0-9]+)\.([0-9.]+)$/', $uid, $matches)) {
$uid = $matches[1];
$context = $matches[2];
}
$this->uid = $uid;
$this->context = $context;
$this->app = rcube::get_instance();
$this->storage = $this->app->get_storage();
$this->folder = strlen($folder) ? $folder : $this->storage->get_folder();
@ -97,10 +104,6 @@ class rcube_message
return;
}
$this->mime = new rcube_mime($this->headers->charset);
$this->subject = $this->headers->get('subject');
list(, $this->sender) = each($this->mime->decode_address_list($this->headers->from, 1));
$this->set_safe($is_safe || $_SESSION['safe_messages'][$this->folder.':'.$uid]);
$this->opt = array(
'safe' => $this->is_safe,
@ -116,10 +119,14 @@ class rcube_message
$this->get_mime_numbers($this->headers->structure);
$this->parse_structure($this->headers->structure);
}
else {
else if ($this->context === null) {
$this->body = $this->storage->get_body($uid);
}
$this->mime = new rcube_mime($this->headers->charset);
$this->subject = $this->headers->get('subject');
list(, $this->sender) = each($this->mime->decode_address_list($this->headers->from, 1));
// notify plugins and let them analyze this structured message object
$this->app->plugins->exec_hook('message_load', array('object' => $this));
}
@ -169,7 +176,7 @@ class rcube_message
* Get content of a specific part of this message
*
* @param string $mime_id Part MIME-ID
* @param resource $fp File pointer to save the message part
* @param resource $fp File pointer to save the message part
* @param boolean $skip_charset_conv Disables charset conversion
* @param int $max_bytes Only read this number of bytes
* @param boolean $formatted Enables formatting of text/* parts bodies
@ -338,6 +345,14 @@ class rcube_message
continue;
}
if (!$part->size) {
continue;
}
if (!$this->check_context($part)) {
continue;
}
$level = explode('.', $part->mime_id);
$depth = count($level);
$last = '';
@ -350,19 +365,22 @@ class rcube_message
return true;
}
$parent = $this->mime_parts[join('.', $level)];
$parent = $this->mime_parts[join('.', $level)];
if (!$this->check_context($parent)) {
return true;
}
$max_delta = $depth - (1 + ($last == 'multipart/alternative' ? 1 : 0));
$last = $parent->mimetype;
$last = $parent->real_mimetype ?: $parent->mimetype;
if (!preg_match('/^multipart\/(alternative|related|signed|encrypted|mixed)$/', $parent->mimetype)
|| ($parent->mimetype == 'multipart/mixed' && $parent_depth < $max_delta)) {
if (!preg_match('/^multipart\/(alternative|related|signed|encrypted|mixed)$/', $last)
|| ($last == 'multipart/mixed' && $parent_depth < $max_delta)) {
continue 2;
}
}
if ($part->size) {
return true;
}
return true;
}
}
@ -389,6 +407,14 @@ class rcube_message
continue;
}
if (!$part->size) {
continue;
}
if (!$this->check_context($part)) {
continue;
}
$level = explode('.', $part->mime_id);
// Check if the part belongs to higher-level's alternative/related
@ -398,14 +424,17 @@ class rcube_message
}
$parent = $this->mime_parts[join('.', $level)];
if (!$this->check_context($parent)) {
return true;
}
if ($parent->mimetype != 'multipart/alternative' && $parent->mimetype != 'multipart/related') {
continue 2;
}
}
if ($part->size) {
return true;
}
return true;
}
}
@ -463,6 +492,26 @@ class rcube_message
}
}
/**
* Return message parts in current context
*/
public function mime_parts()
{
if ($this->context === null) {
return $this->mime_parts;
}
$parts = array();
foreach ($this->mime_parts as $part_id => $part) {
if ($this->check_context($part)) {
$parts[$part_id] = $part;
}
}
return $parts;
}
/**
* Checks if part of the message is an attachment (or part of it)
*
@ -527,6 +576,10 @@ class rcube_message
if (!isset($structure->headers['subject']) && !isset($structure->headers['from'])) {
list($headers, ) = explode("\r\n\r\n", $this->get_part_body($structure->mime_id, false, 32768));
$structure->headers = rcube_mime::parse_headers($headers);
if ($this->context == $structure->mime_id) {
$this->headers = rcube_message_header::from_array($structure->headers);
}
}
}
else {
@ -535,11 +588,12 @@ class rcube_message
// show message headers
if ($recursive && is_array($structure->headers) &&
(isset($structure->headers['subject']) || $structure->headers['from'] || $structure->headers['to'])) {
(isset($structure->headers['subject']) || $structure->headers['from'] || $structure->headers['to'])
) {
$c = new stdClass;
$c->type = 'headers';
$c->headers = $structure->headers;
$this->parts[] = $c;
$this->add_part($c);
}
// Allow plugins to handle message parts
@ -561,25 +615,25 @@ class rcube_message
if ($message_ctype_primary == 'text' && !$recursive) {
// parts with unsupported type add to attachments list
if (!in_array($message_ctype_secondary, array('plain', 'html', 'enriched'))) {
$this->attachments[] = $structure;
$this->add_part($structure, 'attachment');
return;
}
$structure->type = 'content';
$this->parts[] = $structure;
$this->add_part($structure);
// Parse simple (plain text) message body
if ($message_ctype_secondary == 'plain') {
foreach ((array)$this->uu_decode($structure) as $uupart) {
$this->mime_parts[$uupart->mime_id] = $uupart;
$this->attachments[] = $uupart;
$this->add_part($uupart, 'attachment');
}
}
}
// the same for pgp signed messages
else if ($mimetype == 'application/pgp' && !$recursive) {
$structure->type = 'content';
$this->parts[] = $structure;
$this->add_part($structure);
}
// message contains (more than one!) alternative parts
else if ($mimetype == 'multipart/alternative'
@ -613,7 +667,7 @@ class rcube_message
$enriched_part = $p;
else {
// add unsupported/unrecognized parts to attachments list
$this->attachments[] = $sub_part;
$this->add_part($sub_part, 'attachment');
}
}
@ -642,7 +696,7 @@ class rcube_message
// add the right message body
if (is_object($print_part)) {
$print_part->type = 'content';
$this->parts[] = $print_part;
$this->add_part($print_part);
}
// show plaintext warning
else if ($html_part !== null && empty($this->parts)) {
@ -653,7 +707,7 @@ class rcube_message
$c->mimetype = 'text/plain';
$c->realtype = 'text/html';
$this->parts[] = $c;
$this->add_part($c);
}
}
// this is an ecrypted message -> create a plaintext body with the according message
@ -666,14 +720,14 @@ class rcube_message
$p->realtype = 'multipart/encrypted';
$p->mime_id = $structure->mime_id;
$this->parts[] = $p;
$this->add_part($p);
// add encrypted payload part as attachment
if (is_array($structure->parts)) {
for ($i=0; $i < count($structure->parts); $i++) {
$subpart = $structure->parts[$i];
if ($subpart->mimetype == 'application/octet-stream' || !empty($subpart->filename)) {
$this->attachments[] = $subpart;
$this->add_part($subpart, 'attachment');
}
}
}
@ -688,10 +742,10 @@ class rcube_message
$p->realtype = 'application/pkcs7-mime';
$p->mime_id = $structure->mime_id;
$this->parts[] = $p;
$this->add_part($p);
if (!empty($structure->filename)) {
$this->attachments[] = $structure;
$this->add_part($structure, 'attachment');
}
}
// message contains multiple parts
@ -709,7 +763,7 @@ class rcube_message
// list message/rfc822 as attachment as well (mostly .eml)
if ($primary_type == 'message' && !empty($mail_part->filename)) {
$this->attachments[] = $mail_part;
$this->add_part($mail_part, 'attachment');
}
}
// part text/[plain|html] or delivery status
@ -738,12 +792,12 @@ class rcube_message
($secondary_type == 'plain' && !$this->opt['prefer_html'])
) {
$mail_part->type = 'content';
$this->parts[] = $mail_part;
$this->add_part($mail_part);
}
// list as attachment as well
if (!empty($mail_part->filename)) {
$this->attachments[] = $mail_part;
$this->add_part($mail_part, 'attachment');
}
}
// ignore "virtual" protocol parts
@ -755,13 +809,13 @@ class rcube_message
$tnef_parts = (array) $this->tnef_decode($mail_part);
foreach ($tnef_parts as $tpart) {
$this->mime_parts[$tpart->mime_id] = $tpart;
$this->attachments[] = $tpart;
$this->add_part($tpart, 'attachment');
}
// add winmail.dat to the list if it's content is unknown
if (empty($tnef_parts) && !empty($mail_part->filename)) {
$this->mime_parts[$mail_part->mime_id] = $mail_part;
$this->attachments[] = $mail_part;
$this->add_part($mail_part, 'attachment');
}
}
// part is a file/attachment
@ -783,12 +837,12 @@ class rcube_message
if ($mail_part->headers['content-location'])
$mail_part->content_location = $mail_part->headers['content-base'] . $mail_part->headers['content-location'];
$this->inline_parts[] = $mail_part;
$this->add_part($mail_part, 'inline');
}
// regular attachment with valid content type
// (content-type name regexp according to RFC4288.4.2)
else if (preg_match('/^[a-z0-9!#$&.+^_-]+\/[a-z0-9!#$&.+^_-]+$/i', $part_mimetype)) {
$this->attachments[] = $mail_part;
$this->add_part($mail_part, 'attachment');
}
// attachment with invalid content type
// replace malformed content type with application/octet-stream (#1487767)
@ -797,7 +851,7 @@ class rcube_message
$mail_part->ctype_secondary = 'octet-stream';
$mail_part->mimetype = 'application/octet-stream';
$this->attachments[] = $mail_part;
$this->add_part($mail_part, 'attachment');
}
}
// calendar part not marked as attachment (#1490325)
@ -806,7 +860,7 @@ class rcube_message
$mail_part->filename = 'calendar.ics';
}
$this->attachments[] = $mail_part;
$this->add_part($mail_part, 'attachment');
}
}
@ -828,13 +882,13 @@ class rcube_message
// In this case multipart/related message has only one text part
// We'll add all such attachments to the attachments list
if (!isset($this->got_html_part)) {
$this->attachments[] = $inline_object;
$this->add_part($inline_object, 'attachment');
}
// MS Outlook sometimes also adds non-image attachments as related
// We'll add all such attachments to the attachments list
// Warning: some browsers support pdf in <img/>
else if (!preg_match($img_regexp, $inline_object->mimetype)) {
$this->attachments[] = $inline_object;
$this->add_part($inline_object, 'attachment');
}
// @TODO: we should fetch HTML body and find attachment's content-id
// to handle also image attachments without reference in the body
@ -852,16 +906,16 @@ class rcube_message
}
// message is a single part non-text
else if ($structure->filename) {
$this->attachments[] = $structure;
$this->add_part($structure, $attachment);
}
// message is a single part non-text (without filename)
else if (preg_match('/application\//i', $mimetype)) {
$this->attachments[] = $structure;
$this->add_part($structure, 'attachment');
}
}
/**
* Fill aflat array with references to all parts, indexed by part numbers
* Fill a flat array with references to all parts, indexed by part numbers
*
* @param rcube_message_part $part Message body structure
*/
@ -875,6 +929,28 @@ class rcube_message
$this->get_mime_numbers($part->parts[$i]);
}
/**
* Add a part to object parts array(s) (with context check)
*/
private function add_part($part, $type = null)
{
if ($this->check_context($part)) {
switch ($type) {
case 'inline': $this->inline_parts[] = $part; break;
case 'attachment': $this->attachments[] = $part; break;
default: $this->parts[] = $part; break;
}
}
}
/**
* Check if specified part belongs to the current context
*/
private function check_context($part)
{
return $this->context === null || strpos($part->mime_id, $this->context . '.') === 0;
}
/**
* Decode a Microsoft Outlook TNEF part (winmail.dat)
*

@ -5,7 +5,7 @@
| program/steps/mail/compose.inc |
| |
| This file is part of the Roundcube Webmail client |
| Copyright (C) 2005-2013, The Roundcube Dev Team |
| Copyright (C) 2005-2016, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@ -179,7 +179,7 @@ if (!empty($msg_uid) && empty($COMPOSE['as_attachment'])) {
$MESSAGE = new rcube_message($msg_uid);
// make sure message is marked as read
if ($MESSAGE->headers && empty($MESSAGE->headers->flags['SEEN'])) {
if ($MESSAGE->headers && $MESSAGE->context === null && empty($MESSAGE->headers->flags['SEEN'])) {
$RCMAIL->storage->set_flag($msg_uid, 'SEEN');
}
@ -192,7 +192,7 @@ if (!empty($msg_uid) && empty($COMPOSE['as_attachment'])) {
}
else if ($compose_mode == RCUBE_COMPOSE_FORWARD || $compose_mode == RCUBE_COMPOSE_REPLY) {
if ($compose_mode == RCUBE_COMPOSE_REPLY) {
$COMPOSE['reply_uid'] = $msg_uid;
$COMPOSE['reply_uid'] = $MESSAGE->context === null ? $msg_uid : null;
if (!empty($COMPOSE['param']['all'])) {
$MESSAGE->reply_all = $COMPOSE['param']['all'];
@ -780,7 +780,7 @@ function rcmail_prepare_message_body()
if (!empty($MESSAGE->parts)) {
// collect IDs of message/rfc822 parts
foreach ($MESSAGE->mime_parts as $part) {
foreach ($MESSAGE->mime_parts() as $part) {
if ($part->mimetype == 'message/rfc822') {
$messages[] = $part->mime_id;
}
@ -1255,7 +1255,7 @@ function rcmail_write_compose_attachments(&$message, $bodyIsHtml)
return $cid_map;
}
foreach ((array)$message->mime_parts as $pid => $part) {
foreach ((array) $message->mime_parts() as $pid => $part) {
if ($part->mimetype == 'message/rfc822') {
$messages[] = $part->mime_id;
}
@ -1321,7 +1321,7 @@ function rcmail_write_inline_attachments(&$message)
return $cid_map;
}
foreach ((array)$message->mime_parts as $pid => $part) {
foreach ((array) $message->mime_parts() as $pid => $part) {
if ($part->mimetype == 'message/rfc822') {
$messages[] = $part->mime_id;
}

@ -1987,7 +1987,9 @@ function rcmail_fix_mimetype($name)
'image/x-ms-bmp' => 'image/bmp', // #1490282
);
if ($alias = $map[strtolower($name)]) {
$name = strtolower($name);
if ($alias = $map[$name]) {
$name = $alias;
}
// Some versions of Outlook create garbage Content-Type:

@ -62,10 +62,22 @@ if (!empty($_GET['_frame'])) {
'messagepartcontrols' => 'rcmail_message_part_controls',
));
$mimetype = $part ? rcmail_fix_mimetype($part->mimetype) : '';
// message/rfc822 preview (Note: handle also multipart/ parts, they can
// come from Enigma, which replaces message/rfc822 with real mimetype)
if ($part_id && ($mimetype == 'message/rfc822' || strpos($mimetype, 'multipart/') === 0)) {
$uid = preg_replace('/\.[0-9.]+/', '', $uid);
$uid .= '.' . $part_id;
$OUTPUT->set_env('is_message', true);
}
$OUTPUT->set_env('mailbox', $RCMAIL->storage->get_folder());
$OUTPUT->set_env('uid', $uid);
$OUTPUT->set_env('part', $part_id);
$OUTPUT->set_env('filename', $filename);
$OUTPUT->set_env('mimetype', $mimetype);
$OUTPUT->send('messagepart');
exit;
@ -449,12 +461,23 @@ function rcmail_message_part_controls($attrib)
*/
function rcmail_message_part_frame($attrib)
{
global $MESSAGE, $RCMAIL;
global $RCMAIL;
$part = $MESSAGE->mime_parts[asciiwords(rcube_utils::get_input_value('_part', rcube_utils::INPUT_GPC))];
$ctype_primary = strtolower($part->ctype_primary);
$attrib['src'] = './?' . str_replace('_frame=', ($ctype_primary=='text' ? '_embed=' : '_preload='), $_SERVER['QUERY_STRING']);
if ($RCMAIL->output->get_env('is_message')) {
$attrib['src'] = $RCMAIL->url(array(
'task' => 'mail',
'action' => 'preview',
'uid' => $RCMAIL->output->get_env('uid'),
'mbox' => $RCMAIL->output->get_env('mailbox'),
'framed' => 1,
));
}
else {
$mimetype = $RCMAIL->output->get_env('mimetype');
$frame_replace = strpos($mimetype, 'text/') === 0 ? '_embed=' : '_preload=';
$attrib['src'] = './?' . str_replace('_frame=', $frame_replace, $_SERVER['QUERY_STRING']);
}
$RCMAIL->output->add_gui_object('messagepartframe', $attrib['id']);

@ -5,7 +5,7 @@
| program/steps/mail/headers.inc |
| |
| This file is part of the Roundcube Webmail client |
| Copyright (C) 2005-2007, The Roundcube Dev Team |
| Copyright (C) 2005-2016, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@ -20,7 +20,14 @@
*/
if ($uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST)) {
$source = $RCMAIL->storage->get_raw_headers($uid);
if ($pos = strpos($uid, '.')) {
$message = new rcube_message($uid);
$source = $message->get_part_body(substr($uid, $pos + 1));
$source = substr($source, 0, strpos($source, "\r\n\r\n"));
}
else {
$source = $RCMAIL->storage->get_raw_headers($uid);
}
if ($source !== false) {
$source = trim(rcube_charset::clean($source));

@ -189,11 +189,17 @@ if ($hdr = rcube_utils::get_input_value('_followupto', rcube_utils::INPUT_POST,
}
// remember reply/forward UIDs in special headers
if (!empty($COMPOSE['reply_uid']) && $savedraft) {
$headers['X-Draft-Info'] = array('type' => 'reply', 'uid' => $COMPOSE['reply_uid']);
}
else if (!empty($COMPOSE['forward_uid']) && $savedraft) {
$headers['X-Draft-Info'] = array('type' => 'forward', 'uid' => rcube_imap_generic::compressMessageSet($COMPOSE['forward_uid']));
if ($savedraft) {
// Note: We ignore <UID>.<PART> forwards/replies here
if (($uid = $COMPOSE['reply_uid']) && !preg_match('/^\d+[0-9.]+$/', $uid)) {
$headers['X-Draft-Info'] = array('type' => 'reply', 'uid' => $uid);
}
else if (!empty($COMPOSE['forward_uid'])
&& ($uid = rcube_imap_generic::compressMessageSet($COMPOSE['forward_uid']))
&& !preg_match('/^\d+[0-9.]+$/', $uid)
) {
$headers['X-Draft-Info'] = array('type' => 'forward', 'uid' => $uid);
}
}
if (!empty($COMPOSE['reply_msgid'])) {
@ -550,12 +556,18 @@ if (!$savedraft && !$saveonly) {
// set replied/forwarded flag
if ($COMPOSE['reply_uid']) {
foreach (rcmail::get_uids($COMPOSE['reply_uid'], $COMPOSE['mailbox']) as $mbox => $uids) {
$RCMAIL->storage->set_flag($uids, 'ANSWERED', $mbox);
// skip <UID>.<PART> replies
if (!preg_match('/^\d+[0-9.]+$/', implode(',', (array) $uids))) {
$RCMAIL->storage->set_flag($uids, 'ANSWERED', $mbox);
}
}
}
else if ($COMPOSE['forward_uid']) {
foreach (rcmail::get_uids($COMPOSE['forward_uid'], $COMPOSE['mailbox']) as $mbox => $uids) {
$RCMAIL->storage->set_flag($uids, 'FORWARDED', $mbox);
// skip <UID>.<PART> forwards
if (!preg_match('/^\d+[0-9.]+$/', implode(',', (array) $uids))) {
$RCMAIL->storage->set_flag($uids, 'FORWARDED', $mbox);
}
}
}
}

@ -31,7 +31,8 @@ if ($caps = rcube_utils::get_input_value('_caps', rcube_utils::INPUT_GET)) {
$_SESSION['browser_caps'] = $browser_caps;
}
$uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GET);
$msg_id = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GET);
$uid = preg_replace('/\.[0-9.]+$/', '', $msg_id);
$mbox_name = $RCMAIL->storage->get_folder();
// similar code as in program/steps/mail/get.inc
@ -46,7 +47,7 @@ if ($uid) {
$RCMAIL->config->set('prefer_html', $_SESSION['msg_formats'][$mbox_name.':'.$uid]);
}
$MESSAGE = new rcube_message($uid, $mbox_name, intval($_GET['_safe']));
$MESSAGE = new rcube_message($msg_id, $mbox_name, intval($_GET['_safe']));
// if message not found (wrong UID)...
if (empty($MESSAGE->headers)) {
@ -64,12 +65,13 @@ if ($uid) {
$OUTPUT->set_pagetitle(abbreviate_string($MESSAGE->subject, 128, '...', true));
// set message environment
$OUTPUT->set_env('uid', $MESSAGE->uid);
$OUTPUT->set_env('uid', $msg_id);
$OUTPUT->set_env('safemode', $MESSAGE->is_safe);
$OUTPUT->set_env('message_context', $MESSAGE->context);
$OUTPUT->set_env('sender', $MESSAGE->sender['string']);
$OUTPUT->set_env('mailbox', $mbox_name);
$OUTPUT->set_env('username', $RCMAIL->get_user_name());
$OUTPUT->set_env('permaurl', $RCMAIL->url(array('_action' => 'show', '_uid' => $MESSAGE->uid, '_mbox' => $mbox_name)));
$OUTPUT->set_env('permaurl', $RCMAIL->url(array('_action' => 'show', '_uid' => $msg_id, '_mbox' => $mbox_name)));
if ($MESSAGE->headers->get('list-post', false)) {
$OUTPUT->set_env('list_post', true);
@ -106,6 +108,9 @@ if ($uid) {
unset($mimetypes[$key]);
}
}
if (!in_array('message/rfc822', $mimetypes)) {
$mimetypes[] = 'message/rfc822';
}
$OUTPUT->set_env('mimetypes', array_values($mimetypes));
@ -121,6 +126,7 @@ if ($uid) {
// check for unset disposition notification
if ($MESSAGE->headers->mdn_to
&& $MESSAGE->context === null
&& empty($MESSAGE->headers->flags['MDNSENT'])
&& empty($MESSAGE->headers->flags['SEEN'])
&& ($RCMAIL->storage->check_permflag('MDNSENT') || $RCMAIL->storage->check_permflag('*'))
@ -146,6 +152,7 @@ if ($uid) {
}
if (empty($MESSAGE->headers->flags['SEEN'])
&& $MESSAGE->context === null
&& ($RCMAIL->action == 'show' || ($RCMAIL->action == 'preview' && intval($RCMAIL->config->get('preview_pane_mark_read')) == 0))
) {
$RCMAIL->output->command('set_unread_message', $MESSAGE->uid, $mbox_name);

@ -5,7 +5,7 @@
| program/steps/mail/viewsource.inc |
| |
| This file is part of the Roundcube Webmail client |
| Copyright (C) 2005-2013, The Roundcube Dev Team |
| Copyright (C) 2005-2016, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@ -27,7 +27,15 @@ ob_end_clean();
// similar code as in program/steps/mail/get.inc
if ($uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GET)) {
$headers = $RCMAIL->storage->get_message_headers($uid);
if ($pos = strpos($uid, '.')) {
$message = new rcube_message($uid);
$headers = $message->headers;
$part_id = substr($uid, $pos + 1);
}
else {
$headers = $RCMAIL->storage->get_message_headers($uid);
}
$charset = $headers->charset ?: $RCMAIL->config->get('default_charset');
header("Content-Type: text/plain; charset={$charset}");
@ -46,7 +54,12 @@ if ($uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GET)) {
header("Content-Disposition: attachment; filename=\"$filename\"");
}
$RCMAIL->storage->print_raw_body($uid, empty($_GET['_save']));
if (isset($message)) {
$message->get_part_body($part_id, empty($_GET['_save']), 0, -1);
}
else {
$RCMAIL->storage->print_raw_body($uid, empty($_GET['_save']));
}
}
else {
rcube::raise_error(array(

@ -14,8 +14,7 @@
}
#abooktoolbar a.button,
#abooktoolbar a.buttonPas,
#abooktoolbar span.separator {
#abooktoolbar a.buttonPas {
display: block;
float: left;
width: 32px;
@ -85,11 +84,6 @@
background-position: -128px -32px;
}
#abooktoolbar span.separator {
width: 5px;
background-position: -162px 0;
}
#abooktoolbar a.search {
background-position: -170px 0;
}

@ -507,6 +507,18 @@ body.iframe .boxtitle
font-size: 10px;
}
.toolbarseparator {
display: block;
float: left;
width: 5px;
height: 32px;
padding: 0;
margin: 0 5px;
overflow: hidden;
background: url(images/abook_toolbar.png) -162px 0 no-repeat transparent;
opacity: 0.99; /* this is needed to make buttons appear correctly in Chrome */
}
.splitter
{
user-select: none;

@ -23,7 +23,7 @@
<roundcube:button command="compose" type="link" class="buttonPas compose" classAct="button compose" classSel="button composeSel" title="composeto" content=" " />
<roundcube:button command="print" type="link" class="buttonPas print" classAct="button print" classSel="button printSel" label="print" title="printcontact" content=" " />
<roundcube:button command="delete" type="link" class="buttonPas delete" classAct="button delete" classSel="button deleteSel" title="deletecontact" content=" " />
<span class="separator">&nbsp;</span>
<span class="toolbarseparator">&nbsp;</span>
<roundcube:button command="import" type="link" class="buttonPas import" classAct="button import" classSel="button importSel" title="importcontacts" content=" " />
<span class="dropbutton">
<roundcube:button command="export" type="link" class="buttonPas export" classAct="button export" classSel="button exportSel" title="exportvcards" content=" " />

@ -17,6 +17,19 @@
<roundcube:button command="download" type="link" class="button download" classAct="button download" classSel="button downloadSel" title="download" content=" " />
<roundcube:button command="print" type="link" class="button print" classAct="button print" classSel="button printSel" title="print" content=" " />
<roundcube:container name="toolbar" id="messagetoolbar" />
<roundcube:if condition="env:is_message" />
<span class="toolbarseparator">&nbsp;</span>
<roundcube:button command="reply" type="link" class="buttonPas reply" classAct="button reply" classSel="button replySel" title="replytomessage" content=" " />
<span class="dropbutton">
<roundcube:button command="reply-all" type="link" class="buttonPas replyAll" classAct="button replyAll" classSel="button replyAllSel" title="replytoallmessage" content=" " />
<span id="replyallmenulink" onclick="rcmail_ui.show_popup('replyallmenu');return false"></span>
</span>
<span class="dropbutton">
<roundcube:button command="forward" type="link" class="buttonPas forward" classAct="button forward" classSel="button forwardSel" title="forwardmessage" content=" " />
<span id="forwardmenulink" onclick="rcmail_ui.show_popup('forwardmenu');return false"></span>
</span>
<roundcube:button name="messagemenulink" id="messagemenulink" type="link" class="button messagemenu" title="moreactions" onclick="rcmail_ui.show_popup('messagemenu');return false" content=" " />
<roundcube:endif />
</div>
<div id="mainscreen">
@ -30,9 +43,37 @@
<roundcube:object name="messagePartFrame" id="messagepartframe" width="100%" height="100%" />
</div>
</div>
<roundcube:if condition="env:is_message" />
<div id="forwardmenu" class="popupmenu">
<ul id="forwardmenumenu">
<roundcube:button type="link-menuitem" command="forward-inline" label="forwardinline" prop="sub" classAct="forwardlink active" class="forwardlink" />
<roundcube:button type="link-menuitem" command="forward-attachment" label="forwardattachment" prop="sub" classAct="forwardattachmentlink active" class="forwardattachmentlink" />
<roundcube:container name="forwardmenu" id="forwardmenumenu" />
</ul>
</div>
<div id="replyallmenu" class="popupmenu">
<ul id="replyallmenumenu">
<roundcube:button type="link-menuitem" command="reply-all" label="replyall" prop="sub" classAct="replyalllink active" class="replyalllink" />
<roundcube:button type="link-menuitem" command="reply-list" label="replylist" prop="sub" classAct="replylistlink active" class="replylistlink" />
<roundcube:container name="replyallmenu" id="replyallmenumenu" />
</ul>
</div>
<div id="messagemenu" class="popupmenu">
<ul class="toolbarmenu" id="messagemenumenu">
<roundcube:button type="link-menuitem" class="editlink" command="edit" prop="new" label="editasnew" classAct="editlink active" />
<roundcube:button type="link-menuitem" class="sourcelink" command="viewsource" label="viewsource" classAct="sourcelink active" />
<roundcube:container name="messagemenu" id="messagemenumenu" />
</ul>
</div>
<roundcube:endif />
<script type="text/javascript">
var mailpartsplit = new rcube_splitter({id:'mailpartsplitter', p1: 'messagepartheader', p2: 'messagepartcontainer', orientation: 'v', relative: true, start: 165});
rcmail.add_onload('mailpartsplit.init()');
rcube_init_mail_ui();
</script>
</body>

@ -16,7 +16,9 @@
<roundcube:if condition="env:optional_format=='html'" />
<roundcube:button command="change-format" prop="html" image="/images/icons/html.png" width="15" height="15" title="changeformathtml" id="changeformathtml" />
<roundcube:endif />
<roundcube:button command="extwin" image="/images/icons/extwin.png" width="15" height="15" title="openinextwin" id="openextwinlink" />
<roundcube:if condition="!env:message_context">
<roundcube:button command="extwin" image="/images/icons/extwin.png" width="15" height="15" title="openinextwin" id="openextwinlink" />
<roundcube:endif />
</div>
<roundcube:object name="messageHeaders" class="headers-table" cellspacing="0" cellpadding="2" addicon="/images/icons/silhouette.png" summary="Message headers" />
<roundcube:object name="messageFullHeaders" id="full-headers" />

@ -17,6 +17,19 @@
<roundcube:button command="download" type="link" class="button download disabled" classAct="button download" classSel="button download pressed" label="download" title="download" />
<roundcube:button command="print" type="link" class="button print disabled" classAct="button print" classSel="button print pressed" label="print" title="print" />
<roundcube:container name="toolbar" id="messagetoolbar" />
<roundcube:if condition="env:is_message" />
<span class="spacer"></span>
<roundcube:button command="reply" type="link" class="button reply disabled" classAct="button reply" classSel="button reply pressed" label="reply" title="replytomessage" />
<span class="dropbutton">
<roundcube:button command="reply-all" type="link" class="button reply-all disabled" classAct="button reply-all" classSel="button reply-all pressed" label="replyall" title="replytoallmessage" />
<a href="#reply-all" class="dropbuttontip" id="replyallmenulink" onclick="UI.toggle_popup('replyallmenu',event);return false" aria-haspopup="true" aria-expanded="false" aria-owns="replyallmenu-menu" tabindex="0">Reply-all options</a>
</span>
<span class="dropbutton">
<roundcube:button command="forward" type="link" class="button forward disabled" classAct="button forward" classSel="button forward pressed" label="forward" title="forwardmessage" />
<a href="#forward" class="dropbuttontip" id="forwardmenulink" onclick="UI.toggle_popup('forwardmenu',event);return false" aria-haspopup="true" aria-expanded="false" aria-owns="forwardmenu-menu" tabindex="0">Forwarding options</a>
</span>
<roundcube:button name="messagemenulink" id="messagemenulink" type="link" class="button more" label="more" title="moreactions" onclick="UI.toggle_popup('messagemenu',event);return false" aria-haspopup="true" aria-expanded="false" aria-owns="messagemenu-menu" />
<roundcube:endif />
</div>
<div id="mainscreencontent">
@ -38,6 +51,35 @@
</div>
</div>
<roundcube:if condition="env:is_message" />
<div id="forwardmenu" class="popupmenu" aria-hidden="true">
<h3 id="aria-label-forwardmenu" class="voice"><roundcube:label name="arialabelforwardingoptions" /></h3>
<ul id="forwardmenu-menu" class="toolbarmenu" role="menu" aria-labelledby="aria-label-forwardmenu">
<roundcube:button type="link-menuitem" command="forward-inline" label="forwardinline" prop="sub" classAct="forwardlink active" class="forwardlink" />
<roundcube:button type="link-menuitem" command="forward-attachment" label="forwardattachment" prop="sub" classAct="forwardattachmentlink active" class="forwardattachmentlink" />
<roundcube:container name="forwardmenu" id="forwardmenu-menu" />
</ul>
</div>
<div id="replyallmenu" class="popupmenu" aria-hidden="true">
<h3 id="aria-label-replyallmenu" class="voice"><roundcube:label name="arialabelreplyalloptions" /></h3>
<ul id="replyallmenu-menu" class="toolbarmenu" role="menu" aria-labelledby="aria-label-replyallmenu">
<roundcube:button type="link-menuitem" command="reply-all" label="replyall" prop="sub" class="replyalllink" classAct="replyalllink active" />
<roundcube:button type="link-menuitem" command="reply-list" label="replylist" prop="sub" class="replylistlink" classAct="replylistlink active" />
<roundcube:container name="replyallmenu" id="replyallmenu-menu" />
</ul>
</div>
<div id="messagemenu" class="popupmenu" aria-hidden="true">
<h3 id="aria-label-messagemenu" class="voice"><roundcube:label name="arialabelmoremessageactions" /></h3>
<ul id="messagemenu-menu" class="toolbarmenu iconized" role="menu" aria-labelledby="aria-label-messagemenu">
<roundcube:button type="link-menuitem" command="edit" prop="new" label="editasnew" class="icon" classAct="icon active" innerclass="icon edit" />
<roundcube:button type="link-menuitem" command="viewsource" label="viewsource" class="icon" classAct="icon active" innerclass="icon viewsource" />
<roundcube:container name="messagemenu" id="messagemenu-menu" />
</ul>
</div>
<roundcube:endif />
<roundcube:include file="/includes/footer.html" />
</body>

@ -15,20 +15,22 @@
<span class="buttongroup">
<roundcube:button command="change-format" prop="html" type="link" class="button first changeformat html selected" innerClass="icon" title="changeformathtml" content="HTML" /><roundcube:button command="change-format" prop="text" type="link" class="button last changeformat text" classSel="button changeformat text pressed" innerClass="icon" title="changeformattext" content="Text" />
</span>
&nbsp;
<roundcube:elseif condition="env:optional_format=='html'" />
&nbsp;
<span class="buttongroup">
<roundcube:button command="change-format" prop="html" type="link" class="button first changeformat html" classSel="button changeformat html pressed" innerClass="icon" title="changeformathtml" content="HTML" /><roundcube:button command="change-format" prop="text" type="link" class="button last changeformat text selected" innerClass="icon" title="changeformattext" content="Text" />
</span>
&nbsp;
<roundcube:endif />
<roundcube:if condition="env:mailbox != config:drafts_mbox">
<roundcube:if condition="env:mailbox != config:drafts_mbox || env:message_context">
&nbsp;
<roundcube:button command="reply" type="link" class="button reply" classSel="button reply pressed" innerClass="icon" title="replytomessage" label="replytomessage" />
<roundcube:button command="reply-all" type="link" class="button replyall" classSel="button replyall pressed" innerClass="icon" title="replytoallmessage" label="replytoallmessage" />
<roundcube:button command="forward" type="link" class="button forward" classSel="button forward pressed" innerClass="icon" title="forwardmessage" label="forwardmessage" />
&nbsp;
<roundcube:endif />
<roundcube:if condition="!env:message_context">
&nbsp;
<roundcube:button command="extwin" type="link" class="button extwin" classSel="button extwin pressed" innerClass="icon" title="openinextwin" label="openinextwin" />
<roundcube:endif />
</div>
<h3 class="subject"><span class="voice"><roundcube:label name="subject" />: </span><roundcube:object name="messageHeaders" valueOf="subject" /></h3>

Loading…
Cancel
Save