diff options
Diffstat (limited to 'program/steps/mail')
-rw-r--r-- | program/steps/mail/func.inc | 20 | ||||
-rw-r--r-- | program/steps/mail/headers.inc | 43 | ||||
-rw-r--r-- | program/steps/mail/show.inc | 20 |
3 files changed, 48 insertions, 35 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index d1850d6cf..defb6f9cc 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -964,6 +964,11 @@ function rcmail_message_body($attrib) if (!isset($part->body)) $part->body = $MESSAGE->get_part_content($part->mime_id); + // message is cached but not exists (#1485443), or other error + if ($part->body === false) { + rcmail_message_error($MESSAGE->uid); + } + // re-format format=flowed content if ($part->ctype_secondary == "plain" && $part->ctype_parameters['format'] == "flowed") $part->body = rcube_message::unfold_flowed($part->body); @@ -1550,6 +1555,21 @@ function rcmail_search_filter($attrib) return $out; } +function rcmail_message_error($uid=null) +{ + global $RCMAIL; + + // Set env variables for messageerror.html template + if ($RCMAIL->action == 'show') { + $mbox_name = $RCMAIL->imap->get_mailbox_name(); + $RCMAIL->output->set_env('mailbox', $mbox_name); + $RCMAIL->output->set_env('uid', null); + } + // display error message + $RCMAIL->output->show_message('messageopenerror', 'error'); + // ... display message error page + $RCMAIL->output->send('messageerror'); +} // register UI objects $OUTPUT->add_handlers(array( diff --git a/program/steps/mail/headers.inc b/program/steps/mail/headers.inc index 946a688e9..aa1065531 100644 --- a/program/steps/mail/headers.inc +++ b/program/steps/mail/headers.inc @@ -20,28 +20,31 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_POST)) { - $source = $IMAP->get_raw_headers($uid); - - if ($source) - { - $source = htmlspecialchars(trim($source)); - $source = preg_replace( - array( - '/\n[\t\s]+/', - '/^([a-z0-9_:-]+)/im', - '/\r?\n/' - ), - array( - "\n ", - '<font class="bold">\1</font>', - '<br />' - ), $source); - - $OUTPUT->command('set_headers', $source); - $OUTPUT->send(); + $source = $IMAP->get_raw_headers($uid); + + if ($source !== false) { + $source = htmlspecialchars(trim($source)); + $source = preg_replace( + array( + '/\n[\t\s]+/', + '/^([a-z0-9_:-]+)/im', + '/\r?\n/' + ), + array( + "\n ", + '<font class="bold">\1</font>', + '<br />' + ), $source); + + $OUTPUT->command('set_headers', $source); + } + else { + $RCMAIL->output->show_message('messageopenerror', 'error'); } + + $OUTPUT->send(); } - + exit; ?> diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index 82af4780f..e130ecb76 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -22,28 +22,18 @@ $PRINT_MODE = $RCMAIL->action=='print' ? TRUE : FALSE; // similar code as in program/steps/mail/get.inc -if ($_GET['_uid']) { - $MESSAGE = new rcube_message(get_input_value('_uid', RCUBE_INPUT_GET)); +if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) { + $MESSAGE = new rcube_message($uid); // if message not found (wrong UID)... if (empty($MESSAGE->headers)) { - $OUTPUT->show_message('messageopenerror', 'error'); - // ... display error or preview page - if ($RCMAIL->action=='preview' && $OUTPUT->template_exists('messageerror')) - $OUTPUT->send('messageerror'); - else if ($RCMAIL->action=='preview' && $OUTPUT->template_exists('messagepreview')) - $OUTPUT->send('messagepreview'); - // ... go back to the list - else { - rcmail_overwrite_action(''); - return; - } + rcmail_message_error($uid); } send_nocacheing_headers(); $mbox_name = $IMAP->get_mailbox_name(); - + // show images? rcmail_check_safe($MESSAGE); @@ -52,7 +42,7 @@ if ($_GET['_uid']) { $IMAP->set_charset($MESSAGE->headers->charset); $OUTPUT->set_pagetitle($MESSAGE->subject); - + // give message uid to the client $OUTPUT->set_env('uid', $MESSAGE->uid); // set environement |