X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fview_text.php;h=54ddf14217f278a8ecb0bd2983ce4e4af37e2e2f;hb=43a312983930fcca20ceb70047c162a2d359706d;hp=2b983cb940b82060b78d4d015cb397845230e675;hpb=460aef76de99c847de9449bb099caf040fec6776;p=squirrelmail.git diff --git a/src/view_text.php b/src/view_text.php index 2b983cb9..54ddf142 100644 --- a/src/view_text.php +++ b/src/view_text.php @@ -1,68 +1,97 @@ getEntity($passed_ent_id); - $header = $message->header; - $charset = $header->charset; - $type0 = $header->type0; - $type1 = $header->type1; - $encoding = strtolower($header->encoding); - $msg_url = 'read_body.php?' . $QUERY_STRING; +$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); +$mbx_response = sqimap_mailbox_select($imapConnection, $mailbox); - $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id); - $body = decodeBody($body, $encoding); +$message = &$messages[$mbx_response['UIDVALIDITY']]["$passed_id"]; +$message_ent = &$message->getEntity($ent_id); +if ($passed_ent_id) { + $message = &$message->getEntity($passed_ent_id); +} + +$header = $message_ent->header; +$charset = $header->getParameter('charset'); +$type0 = $header->type0; +$type1 = $header->type1; +$encoding = strtolower($header->encoding); - displayPageHeader($color, 'None'); +$msg_url = 'read_body.php?' . $QUERY_STRING; +$msg_url = set_url_var($msg_url, 'ent_id', 0); - echo "
". - "
". - _("Viewing a text attachment") . " - "; - echo ''. _("View message") . ''; +$body = mime_fetch_body($imapConnection, $passed_id, $ent_id); +$body = decodeBody($body, $encoding); - $dwnld_url = '../src/download.php?'. $QUERY_STRING.'&absolute_dl=1'; - echo '
'. - _("Download this as a file"). - "

". - "". - "
". - "
". - "
"; +displayPageHeader($color, 'None'); - if ($type1 == 'html') { - $msg = sqimap_get_message($imapConnection, $passed_id, $mailbox); - $msg = $msg->getEntity($passed_ent_id); - $body = MagicHTML( $body, $passed_id, $msg ); - } else { - translateText($body, $wrap_at, $charset); +echo "
". + "
". + _("Viewing a text attachment") . " - "; +echo ''. _("View message") . ''; + +$dwnld_url = '../src/download.php?'. $QUERY_STRING.'&absolute_dl=true'; +echo '
'. + _("Download this as a file"). + "

". + "". + "
". + "
". + "
"; + + if (isset($languages[$squirrelmail_language]['XTRA_CODE']) && + function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) { + if (mb_detect_encoding($body) != 'ASCII') { + $body = $languages[$squirrelmail_language]['XTRA_CODE']('decode', $body); + } } - echo $body . - "
"; - - sqimap_logout($imapConnection); + +if ($type1 == 'html' || (isset($override_type1) && $override_type1 == 'html')) { + $body = MagicHTML( $body, $passed_id, $message, $mailbox); +} else { + translateText($body, $wrap_at, $charset); +} +echo $body . "
"; + ?>