| | |
| | | |
| | | */ |
| | | |
| | | require_once('Mail/mimeDecode.php'); |
| | | require_once('lib/rc_mail_mime.inc'); |
| | | |
| | | $PRINT_MODE = $_action=='print' ? TRUE : FALSE; |
| | | $PRINT_MODE = $RCMAIL->action=='print' ? TRUE : FALSE; |
| | | |
| | | // similar code as in program/steps/mail/get.inc |
| | | if ($_GET['_uid']) |
| | |
| | | $MESSAGE = array('UID' => get_input_value('_uid', RCUBE_INPUT_GET)); |
| | | $MESSAGE['headers'] = $IMAP->get_headers($MESSAGE['UID']); |
| | | |
| | | // set message charset as default |
| | | if (!empty($MESSAGE['headers']->charset)) |
| | | $IMAP->set_charset($MESSAGE['headers']->charset); |
| | | |
| | | // go back to list if message not found (wrong UID) |
| | | if (!$MESSAGE['headers']) |
| | | { |
| | | $OUTPUT->show_message('messageopenerror', 'error'); |
| | | if ($_action=='preview' && template_exists('messagepreview')) |
| | | parse_template('messagepreview'); |
| | | if ($RCMAIL->action=='preview' && template_exists('messagepreview')) |
| | | $OUTPUT->send('messagepreview'); |
| | | else |
| | | { |
| | | $_action = 'list'; |
| | | $RCMAIL->action = 'list'; |
| | | return; |
| | | } |
| | | } |
| | |
| | | else if ($_SESSION['safe_messages'][$MESSAGE['UID']]) |
| | | $MESSAGE['is_safe'] = 1; |
| | | |
| | | $mbox_name = $IMAP->get_mailbox_name(); |
| | | |
| | | // calculate Etag for this request |
| | | $etag = md5($MESSAGE['UID'].$IMAP->get_mailbox_name().session_id().intval($MESSAGE['headers']->mdn_sent).intval($PRINT_MODE)); |
| | | $etag = md5($MESSAGE['UID'].$mbox_name.session_id().intval($MESSAGE['headers']->mdn_sent).intval($MESSAGE['is_safe']).intval($PRINT_MODE)); |
| | | |
| | | // allow caching, unless remote images are present |
| | | if ((bool)get_input_value('_safe', RCUBE_INPUT_GET)) |
| | | if ((bool)$MESSAGE['is_safe']) |
| | | send_nocacheing_headers(); |
| | | else if (empty($CONFIG['devel_mode'])) |
| | | send_modified_header($_SESSION['login_time'], $etag); |
| | | send_modified_header($_SESSION['login_time'], $etag, !$MESSAGE['headers']->seen); |
| | | |
| | | $MESSAGE['subject'] = rcube_imap::decode_mime_string($MESSAGE['headers']->subject, $MESSAGE['headers']->charset); |
| | | $MESSAGE['subject'] = $IMAP->decode_header($MESSAGE['headers']->subject); |
| | | $OUTPUT->set_pagetitle($MESSAGE['subject']); |
| | | |
| | | if ($MESSAGE['structure'] = $IMAP->get_structure($MESSAGE['UID'])) |
| | |
| | | else |
| | | $MESSAGE['body'] = $IMAP->get_body($MESSAGE['UID']); |
| | | |
| | | |
| | | // mark message as read |
| | | if (!$MESSAGE['headers']->seen && $_action != 'preview') |
| | | $IMAP->set_flag($MESSAGE['UID'], 'SEEN'); |
| | | if (!$MESSAGE['headers']->seen) |
| | | { |
| | | $marked = $IMAP->set_flag($MESSAGE['UID'], 'SEEN'); |
| | | if($RCMAIL->action == 'preview' && $marked != -1) |
| | | { |
| | | $OUTPUT->command('set_unread_count_from_preview', $mbox_name, $IMAP->messagecount($mbox_name, 'UNSEEN'), ($mbox_name == 'INBOX')); |
| | | $OUTPUT->command('mark_as_read_from_preview', $MESSAGE['UID']); |
| | | } |
| | | } |
| | | |
| | | // give message uid to the client |
| | | $OUTPUT->set_env('uid', $MESSAGE['UID']); |
| | | $OUTPUT->set_env('safemode', $MESSAGE['is_safe']); |
| | | |
| | | // check for unset disposition notification |
| | | if ($MESSAGE['headers']->mdn_to && !$MESSAGE['headers']->mdn_sent && $IMAP->get_mailbox_name() != $CONFIG['drafts_mbox']) |
| | | if ($MESSAGE['headers']->mdn_to && !$MESSAGE['headers']->mdn_sent && $mbox_name != $CONFIG['drafts_mbox']) |
| | | { |
| | | if (intval($CONFIG['mdn_requests']) === 1) |
| | | { |
| | |
| | | 'blockedobjects' => 'rcmail_remote_objects_msg')); |
| | | |
| | | |
| | | if ($_action=='print' && template_exists('printmessage')) |
| | | parse_template('printmessage'); |
| | | else if ($_action=='preview' && template_exists('messagepreview')) |
| | | parse_template('messagepreview'); |
| | | if ($RCMAIL->action=='print' && template_exists('printmessage')) |
| | | $OUTPUT->send('printmessage'); |
| | | else if ($RCMAIL->action=='preview' && template_exists('messagepreview')) |
| | | $OUTPUT->send('messagepreview'); |
| | | else |
| | | parse_template('message'); |
| | | $OUTPUT->send('message'); |
| | | ?> |