6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This file is used for reading the msgs array and displaying
10 * the resulting emails in the right frame.
15 require_once('../src/validate.php');
16 require_once('../functions/imap.php');
17 require_once('../functions/mime.php');
18 require_once('../functions/date.php');
19 require_once('../functions/url_parser.php');
20 require_once('../functions/html.php');
23 * Given an IMAP message id number, this will look it up in the cached
24 * and sorted msgs array and return the index. Used for finding the next
25 * and previous messages.
27 * @return the index of the next valid message from the array
29 function findNextMessage($passed_id) {
30 global $msort, $msgs, $sort,
31 $thread_sort_messages, $allow_server_sort,
33 if (!is_array($server_sort_array)) {
34 $thread_sort_messages = 0;
35 $allow_server_sort = FALSE;
38 if ($thread_sort_messages ||
$allow_server_sort) {
39 reset($server_sort_array);
40 while(list($key, $value) = each ($server_sort_array)) {
41 if ($passed_id == $value) {
42 if ($key == (count($server_sort_array) - 1)) {
46 $result = $server_sort_array[$key +
1];
50 } else if ($sort == 6 && !$allow_server_sort &&
51 !$thread_sort_messages ) {
52 if ($passed_id != 1) {
53 $result = $passed_id - 1;
55 } else if (!$allow_server_sort && !$thread_sort_messages ) {
56 if (!is_array($msort)) {
59 for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) {
60 if ($passed_id == $msgs[$key]['ID']) {
64 $result = $msgs[$key]['ID'];
73 /** returns the index of the previous message from the array. */
74 function findPreviousMessage($numMessages, $passed_id) {
75 global $msort, $sort, $msgs,
76 $thread_sort_messages,
77 $allow_server_sort, $server_sort_array;
79 if (!is_array($server_sort_array)) {
80 $thread_sort_messages = 0;
81 $allow_server_sort = FALSE;
83 if ($thread_sort_messages ||
$allow_server_sort ) {
84 reset($server_sort_array);
85 while(list($key, $value) = each ($server_sort_array)) {
86 if ($passed_id == $value) {
91 $result = $server_sort_array[$key -1];
95 } else if ($sort == 6 && !$allow_server_sort &&
96 !$thread_sort_messages) {
97 if ($passed_id != $numMessages) {
98 $result = $passed_id +
1;
100 } else if (!$thread_sort_messages && !$allow_server_sort) {
101 if (!is_array($msort)) {
104 for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) {
105 if ($passed_id == $msgs[$key]['ID']) {
109 //echo $msort[$key]; /* Why again were we echoing here? */
110 $result = $msgs[$key]['ID'];
120 * Displays a link to a page where the message is displayed more
121 * "printer friendly".
123 function printer_friendly_link($mailbox, $passed_id, $passed_ent_id, $color) {
124 global $javascript_on;
126 $params = '?passed_ent_id=' . $passed_ent_id .
127 '&mailbox=' . urlencode($mailbox) .
128 '&passed_id=' . $passed_id;
130 $print_text = _("View Printable Version");
133 /* Output the link. */
134 if ($javascript_on) {
135 $result .= '<script language="javascript" type="text/javascript">' . "\n" .
137 " function printFormat() {\n" .
138 ' window.open("../src/printer_friendly_main.php' .
139 $params . '","Print","width=800,height=600");' . "\n".
143 "<a href=\"javascript:printFormat();\">$print_text</a>\n";
145 $result .= '<A target="_blank" HREF="../src/printer_friendly_bottom.php' .
146 "$params\">$print_text</a>\n";
151 function ServerMDNSupport( $read ) {
152 /* escaping $ doesn't work -> \x36 */
153 $ret = preg_match( '/(\x36MDNSent|\\\*)/i', $read );
157 function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) {
158 global $username, $attachment_dir, $SERVER_NAME,
159 $version, $attachments, $squirrelmail_language, $default_charset,
160 $languages, $useSendmail, $domain, $sent_folder,
161 $popuser, $data_dir, $username;
163 $header = $message->rfc822_header
;
164 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
166 $rfc822_header = new Rfc822Header();
167 $content_type = new ContentType('multipart/report');
168 $content_type->properties
['report-type']='disposition-notification';
171 if ($default_charset) {
172 $content_type->properties
['charset']=$default_charset;
174 $rfc822_header->content_type
= $content_type;
175 $rfc822_header->to
[] = $header->dnt
;
176 $rfc822_header->subject
= _("Read:") . ' ' . $header->subject
;
180 if (isset($identity) && $identity != 'default') {
181 $from_mail = getPref($data_dir, $username,
182 'email_address' . $identity);
183 $full_name = getPref($data_dir, $username,
184 'full_name' . $identity);
185 $from_addr = '"'.$full_name.'" <'.$from_mail.'>';
186 $reply_to = getPref($data_dir, $username,
187 'reply_to' . $identity);
189 $from_mail = getPref($data_dir, $username, 'email_address');
190 $full_name = getPref($data_dir, $username, 'full_name');
191 $from_addr = '"'.$full_name.'" <'.$from_mail.'>';
192 $reply_to = getPref($data_dir, $username,'reply_to');
195 $from_addr = "$popuser@$domain";
196 $from_mail = $from_addr;
198 $rfc822_header->from
= $rfc822_header->parseAddress($from_addr,true);
200 $rfc822_header->reply_to
= $rfc822_header->parseAddress($reply_to,true);
204 $senton = getLongDateString( $header->date
);
205 $to_array = $header->to
;
207 foreach ($to_array as $line) {
208 $to .= ' '.$line->getAddress();
210 $now = getLongDateString( time() );
212 $body = _("Your message") . "\r\n\r\n" .
213 "\t" . _("To:") . ' ' . $to . "\r\n" .
214 "\t" . _("Subject:") . ' ' . $header->subject
. "\r\n" .
215 "\t" . _("Sent:") . ' ' . $senton . "\r\n" .
217 sprintf( _("Was displayed on %s"), $now );
219 $special_encoding = '';
220 if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
221 function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
222 $body = $languages[$squirrelmail_language]['XTRA_CODE']('encode', $body);
223 if (strtolower($default_charset) == 'iso-2022-jp') {
224 if (mb_detect_encoding($body) == 'ASCII') {
225 $special_encoding = '8bit';
227 $body = mb_convert_encoding($body, 'JIS');
228 $special_encoding = '7bit';
232 $part1 = new Message();
233 $part1->setBody($body);
234 $mime_header = new MessageHeader
;
235 $mime_header->type0
= 'text';
236 $mime_header->type1
= 'plain';
237 if ($special_encoding) {
238 $mime_header->encoding
= $special_encoding;
240 $mime_header->encoding
= 'us-ascii';
242 if ($default_charset) {
243 $mime_header->parameters
['charset'] = $default_charset;
245 $part1->mime_header
= $mime_header;
248 $original_recipient = $to;
249 $original_message_id = $header->message_id
;
251 $report = "Reporting-UA : $SERVER_NAME ; SquirrelMail (version $version) \r\n";
252 if ($original_recipient != '') {
253 $report .= "Original-Recipient : $original_recipient\r\n";
255 $final_recipient = $sender;
256 $report .= "Final-Recipient: rfc822; $final_recipient\r\n" .
257 "Original-Message-ID : $original_message_id\r\n" .
258 "Disposition: manual-action/MDN-sent-manually; displayed\r\n";
260 $part2 = new Message();
261 $part2->setBody($report);
262 $mime_header = new MessageHeader
;
263 $mime_header->type0
= 'message';
264 $mime_header->type1
= 'disposition-notification';
265 $mime_header->encoding
= 'us-ascii';
266 $part2->mime_header
= $mime_header;
268 $composeMessage = new Message();
269 $composeMessage->rfc822_header
= $rfc822_header;
270 $composeMessage->addEntity($part1);
271 $composeMessage->addEntity($part2);
275 require_once('../class/deliver/Deliver_SMTP.class.php');
276 $deliver = new Deliver_SMTP();
277 global $smtpServerAddress, $smtpPort, $use_authenticated_smtp, $pop_before_smtp;
278 if ($use_authenticated_smtp) {
279 global $key, $onetimepad;
281 $pass = OneTimePadDecrypt($key, $onetimepad);
286 $authPop = (isset($pop_before_smtp) && $pop_before_smtp) ?
true : false;
287 $stream = $deliver->initStream($composeMessage,$domain,0,
288 $smtpServerAddress, $smtpPort, $authPop);
290 require_once('../class/deliver/Deliver_SendMail.class.php');
291 global $sendmail_path;
292 $deliver = new Deliver_SendMail();
293 $stream = $deliver->initStream($composeMessage,$sendmail_path);
297 $length = $deliver->mail($composeMessage, $stream);
298 $succes = $deliver->finalizeStream($stream);
301 $msg = $deliver->dlv_msg
. '<br>Server replied: '.$deliver->dlv_ret_nr
;
302 require_once('../functions/display_messages.php');
303 plain_error_message($msg, $color);
306 if (sqimap_mailbox_exists ($imapConnection, $sent_folder)) {
307 sqimap_append ($imapConnection, $sent_folder, $length);
308 require_once('../class/deliver/Deliver_IMAP.class.php');
309 $imap_deliver = new Deliver_IMAP();
310 $imap_deliver->mail($composeMessage, $imapConnection);
311 sqimap_append_done ($imapConnection);
312 unset ($imap_deliver);
319 function ToggleMDNflag ( $set ,$imapConnection, $mailbox, $passed_id, $uid_support) {
321 $cmd = 'STORE ' . $passed_id . ' ' . $sg . 'FLAGS ($MDNSent)';
322 $read = sqimap_run_command ($imapConnection, $cmd, true, $response,
323 $readmessage, $uid_support);
326 function ClearAttachments() {
327 global $username, $attachments, $attachment_dir;
329 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
331 $rem_attachments = array();
332 foreach ($attachments as $info) {
333 if ($info['session'] == -1) {
334 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
335 if (file_exists($attached_file)) {
336 unlink($attached_file);
339 $rem_attachments[] = $info;
342 $attachments = $rem_attachments;
345 function formatRecipientString($recipients, $item ) {
346 global $show_more_cc, $show_more, $show_more_bcc,
349 if ((is_array($recipients)) && (isset($recipients[0]))) {
357 $url = set_url_var($PHP_SELF, 'show_more',0);
359 $url = set_url_var($PHP_SELF, 'show_more',1);
361 } else if ($item == 'cc') {
363 $url = set_url_var($PHP_SELF, 'show_more_cc',0);
366 $url = set_url_var($PHP_SELF, 'show_more_cc',1);
368 } else if ($item == 'bcc') {
369 if ($show_more_bcc) {
370 $url = set_url_var($PHP_SELF, 'show_more_bcc',0);
373 $url = set_url_var($PHP_SELF, 'show_more_bcc',1);
380 $ary[$i] = htmlspecialchars($ary[$i]->getAddress());
382 $string .= '<BR>'.$ary[$i];
386 $string .= ' (<A HREF="'.$url;
388 $string .= '">'._("less").'</A>)';
390 $string .= '">'._("more").'</A>)';
404 function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message,
405 $color, $FirstTimeSee) {
406 global $msn_user_support, $default_use_mdn, $draft_folder, $sent_folder,
407 $default_use_priority, $show_xmailer_default,
408 $mdn_user_support, $PHP_SELF, $javascript_on;
410 $header = $message->rfc822_header
;
412 $env[_("Subject")] = htmlspecialchars(decodeHeader($header->subject
));
413 $from_name = $header->getAddr_s('from');
415 $from_name = $header->getAddr_s('sender');
417 $from_name = _("Unknown sender");
420 $env[_("From")] = htmlspecialchars(decodeHeader($from_name));
421 $env[_("Date")] = getLongDateString($header->date
);
422 $env[_("To")] = formatRecipientString($header->to
, "to");
423 $env[_("Cc")] = formatRecipientString($header->cc
, "cc");
424 $env[_("Bcc")] = formatRecipientString($header->bcc
, "bcc");
425 if ($default_use_priority) {
426 $env[_("Priority")] = getPriorityStr($header->priority
);
428 if ($show_xmailer_default) {
429 $env[_("Mailer")] = decodeHeader($header->xmailer
);
431 if ($default_use_mdn) {
432 if ($mdn_user_support) {
434 if ($message->is_mdnsent
) {
435 $env[_("Read receipt")] = _("send");
437 if ( !($mailbox == $draft_folder ||
438 $mailbox == $sent_folder ||
439 $message->is_deleted ||
441 $mdn_url = $PHP_SELF . '&sendreceipt=1';
442 if ($FirstTimeSee && $javascript_on) {
443 $script = '<script language="JavaScript" type="text/javascript">' ."\n";
444 $script .= '<!--'. "\n";
445 $script .= 'if(window.confirm("' .
446 _("The message sender has requested a response to indicate that you have read this message. Would you like to send a receipt?") .
450 $script .= '// -->'. "\n";
451 $script .= '</script>'. "\n";
454 $env[_("Read receipt")] = _("requested") .
455 ' <a href="'.$mdn_url.'">['. _("Send read receipt now") .']</a>';
457 $env[_("Read receipt")] = _("requested");
464 $s = '<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"';
465 $s .= ' ALIGN="center" BGCOLOR="' . $color[0] . '">';
466 foreach ($env as $key => $val) {
469 $s .= html_tag('TD', '<B>' . $key . ': </B>', 'RIGHT', '', 'VALIGN="TOP" WIDTH="20%"') . "\n";
470 $s .= html_tag('TD', $val, 'left', '', 'VALIGN="TOP" WIDTH="80%"') . "\n";
475 do_hook("read_body_header");
476 formatToolbar($mailbox,$passed_id,$passed_ent_id,$message, $color);
480 function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response) {
481 global $base_uri, $sent_folder, $draft_folder, $where, $what, $color, $sort,
482 $startMessage, $compose_new_win, $PHP_SELF, $save_as_draft,
483 $enable_forward_as_attachment;
485 $topbar_delimiter = ' | ';
486 $urlMailbox = urlencode($mailbox);
487 $s = '<table width="100%" cellpadding="3" cellspacing="0" align="center"'.
488 ' border="0" bgcolor="'.$color[9].'"><tr><td align="left" width="33%"><small>';
490 $msgs_url = $base_uri . 'src/';
491 if (isset($where) && isset($what)) {
492 $msgs_url .= 'search.php?where='.urlencode($where).
493 '&what='.urlencode($what).'&mailbox='.$urlMailbox;
494 $msgs_str = _("Search results");
496 $msgs_url .= 'right_main.php?sort='.$sort.'&startMessage='.
497 $startMessage.'&mailbox='.$urlMailbox;
498 $msgs_str = _("Message List");
500 $s .= '<a href="'. $msgs_url.'">'.$msgs_str.'</a>';
501 $s .= $topbar_delimiter;
503 $delete_url = $base_uri . 'src/delete_message.php?mailbox='.$urlMailbox.
504 '&message='.$passed_id.'&';
505 if (!(isset($passed_ent_id) && $passed_ent_id)) {
506 if ($where && $what) {
507 $delete_url .= 'where=' . urlencode($where) . '&what=' . urlencode($what);
509 $delete_url .= 'sort='. $sort . '&startMessage='. $startMessage;
511 $s .= '<a href="'. $delete_url.'">'._("Delete").'</a>';
514 $comp_uri = $base_uri . 'src/compose.php'.
515 '?passed_id='.$passed_id.
516 '&mailbox='.$urlMailbox.
517 (isset($passed_ent_id)?
'&passed_ent_id='.$passed_ent_id:'');
519 if (($mailbox == $draft_folder) && ($save_as_draft)) {
520 $comp_alt_uri = $comp_uri . '&action=draft';
521 $comp_alt_string = _("Resume Draft");
522 } else if ($mailbox == $sent_folder) {
523 $comp_alt_uri = $comp_uri . '&action=edit_as_new';
524 $comp_alt_string = _("Edit Message as New");
526 if (isset($comp_alt_uri)) {
527 $s .= $topbar_delimiter;
528 if ($compose_new_win == '1') {
529 $s .= '<a href="javascript:void(0)" '.
530 'onclick="comp_in_new(\''.$comp_alt_uri.'\')">'.$comp_alt_string.'</a>';
532 $s .= '<a href="'.$comp_alt_uri.'">'.$comp_alt_string.'</a>';
536 $s .= '</small></td><td align="center" width="33%"><small>';
538 if (!(isset($where) && isset($what)) && !$passed_ent_id) {
539 $prev = findPreviousMessage($mbx_response['EXISTS'], $passed_id);
540 $next = findNextMessage($passed_id);
542 $uri = $base_uri . 'src/read_body.php?passed_id='.$prev.
543 '&mailbox='.$urlMailbox.'&sort='.$sort.
544 '&startMessage='.$startMessage.'&show_more=0';
545 $s .= '<a href="'.$uri.'">'._("Previous").'</a>';
549 $s .= $topbar_delimiter;
551 $uri = $base_uri . 'src/read_body.php?passed_id='.$next.
552 '&mailbox='.$urlMailbox.'&sort='.$sort.
553 '&startMessage='.$startMessage.'&show_more=0';
554 $s .= '<a href="'.$uri.'">'._("Next").'</a>';
558 } else if (isset($passed_ent_id) && $passed_ent_id) {
559 /* code for navigating through attached message/rfc822 messages */
560 $url = set_url_var($PHP_SELF, 'passed_ent_id',0);
561 $s .= '<a href="'.$url.'">'._("View Message").'</a>';
562 $par_ent_id = $message->parent
->entity_id
;
564 $par_ent_id = substr($par_ent_id,0,-2);
565 $s .= $topbar_delimiter;
566 $url = set_url_var($PHP_SELF, 'passed_ent_id',$par_ent_id);
567 $s .= '<a href="'.$url.'">'._("Up").'</a>';
571 $s .= '</small></td><td align="right" width="33%" nowrap><small>';
572 $comp_action_uri = $comp_uri . '&action=forward';
573 if ($compose_new_win == '1') {
574 $s .= '<a href="javascript:void(0)" '.
575 'onclick="comp_in_new(\''.$comp_action_uri.'\')">'._("Forward").'</a>';
577 $s .= '<a href="'.$comp_action_uri.'">'._("Forward").'</a>';
579 $s .= $topbar_delimiter;
581 if ($enable_forward_as_attachment) {
582 $comp_action_uri = $comp_uri . '&action=forward_as_attachment';
583 if ($compose_new_win == '1') {
584 $s .= '<a href="javascript:void(0)" '.
585 'onclick="comp_in_new(\''.$comp_action_uri.'\')">'._("Forward as Attachment").'</a>';
587 $s .= '<a href="'.$comp_action_uri.'">'._("Forward as Attachment").'</a>';
589 $s .= $topbar_delimiter;
592 $comp_action_uri = decodeHeader($comp_uri . '&action=reply');
593 if ($compose_new_win == '1') {
594 $s .= '<a href="javascript:void(0)" '.
595 'onclick="comp_in_new(\''.$comp_action_uri.'\')">'._("Reply").'</a>';
597 $s .= '<a href="'.$comp_action_uri.'">'._("Reply").'</a>';
599 $s .= $topbar_delimiter;
601 $comp_action_uri = $comp_uri . '&action=reply_all';
602 if ($compose_new_win == '1') {
603 $s .= '<a href="javascript:void(0)" '.
604 'onclick="comp_in_new(\''.$comp_action_uri.'\')">'._("Reply All").'</a>';
606 $s .= '<a href="'.$comp_action_uri.'">'._("Reply All").'</a>';
608 $s .= '</small></td></tr></table>';
609 do_hook("read_body_menu_top");
611 do_hook("read_body_menu_bottom");
614 function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) {
615 global $QUERY_STRING, $base_uri;
617 $urlMailbox = urlencode($mailbox);
618 $url = $base_uri.'src/view_header.php?'.$QUERY_STRING;
621 '<TD VALIGN="MIDDLE" ALIGN="RIGHT" WIDTH="20%"><B>' . _("Options") . ": </B></TD>\n" .
622 '<TD VALIGN="MIDDLE" ALIGN="LEFT" WIDTH="80%"><SMALL>' .
623 '<a href="'.$url.'">'._("View Full Header").'</a>';
625 /* Output the printer friendly link if we are in subtle mode. */
626 $s .= ' | ' .
627 printer_friendly_link($mailbox, $passed_id, $passed_ent_id, $color);
629 do_hook("read_body_header_right");
630 $s = "</SMALL></TD>\n" .
636 /***************************/
637 /* Main of read_body.php */
638 /***************************/
646 global $uid_support, $sqimap_capabilities;
648 if (isset($mailbox)) {
649 $mailbox = urldecode( $mailbox );
652 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
653 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox, false, false, true);
655 if (!isset($messages)) {
657 sqsession_register($messages,'messages');
661 * $message contains all information about the message
662 * including header and body
665 $uidvalidity = $mbx_response['UIDVALIDITY'];
667 if (!isset($messages[$uidvalidity])) {
668 $messages[$uidvalidity] = array();
670 if (!isset($messages[$uidvalidity][$passed_id]) ||
!$uid_support) {
671 $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
672 $FirstTimeSee = !$message->is_seen
;
673 $message->is_seen
= true;
674 $messages[$uidvalidity][$passed_id] = $message;
675 sqsession_register($messages, 'messages');
677 // $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
678 $message = $messages[$uidvalidity][$passed_id];
679 $FirstTimeSee = !$message->is_seen
;
681 //$FirstTimeSee = !$message->is_seen;
682 //$message->is_seen = true;
683 //$messages[$uidvalidity][$passed_id] = $message;
685 if (isset($passed_ent_id) && $passed_ent_id) {
686 $message = $message->getEntity($passed_ent_id);
687 if ($message->type0
!= 'message' && $message->type1
!= 'rfc822') {
688 $message = $message->parent
;
690 $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY[$passed_ent_id.HEADER]", true, $response, $msg, $uid_support);
691 $rfc822_header = new Rfc822Header();
692 $rfc822_header->parseHeader($read);
693 $message->rfc822_header
= $rfc822_header;
697 $header = $message->header
;
701 /****************************************/
702 /* Block for handling incoming url vars */
703 /****************************************/
705 if (isset($sendreceipt)) {
706 if ( !$message->is_mdnsent
) {
707 if (isset($identity) ) {
708 $final_recipient = getPref($data_dir, $username, 'email_address' . '0', '' );
710 $final_recipient = getPref($data_dir, $username, 'email_address', '' );
713 $final_recipient = trim($final_recipient);
714 if ($final_recipient == '' ) {
715 $final_recipient = getPref($data_dir, $username, 'email_address', '' );
717 $supportMDN = ServerMDNSupport($mbx_response["PERMANENTFLAGS"]);
718 if ( SendMDN( $mailbox, $passed_id, $final_recipient, $message, $imapConnection ) > 0 && $supportMDN ) {
719 ToggleMDNflag( true, $imapConnection, $mailbox, $passed_id, $uid_support);
720 $message->is_mdnsent
= true;
721 $messages[$uidvalidity][$passed_id]=$message;
726 /***********************************************/
727 /* End of block for handling incoming url vars */
728 /***********************************************/
730 $msgs[$passed_id]['FLAG_SEEN'] = true;
733 do_hook('read_body_top');
734 if ($show_html_default == 1) {
735 $ent_ar = $message->findDisplayEntity(array());
737 $ent_ar = $message->findDisplayEntity(array(), array('text/plain'));
739 $cnt = count($ent_ar);
740 for ($i = 0; $i < $cnt; $i++
) {
741 $messagebody .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $passed_id, $mailbox);
743 $messagebody .= '<hr noshade size=1>';
747 displayPageHeader($color, $mailbox);
748 formatMenuBar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response);
749 formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee);
750 echo '<table width="100%" cellpadding="0" cellspacing="0" align="center" border="0">';
752 echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="'.$color[9].'">';
754 echo ' <table width="100%" cellpadding="3" cellspacing="0" align="center" border="0">';
755 echo ' <tr bgcolor="'.$color[4].'"><td>';
756 echo ' <table cellpadding="0" cellspacing="0" align="center" border="0">';
757 echo ' <tr><td><br>' . $messagebody . '</td></td>';
760 echo ' </table></td></tr>';
764 $attachmentsdisplay = formatAttachments($message,$ent_ar,$mailbox, $passed_id);
765 if ($attachmentsdisplay) {
767 echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center"'.' border="0" bgcolor="'.$color[9].'">';
769 echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="'.$color[4].'">';
770 echo ' <tr><td ALIGN="left" bgcolor="'.$color[9].'">';
771 echo ' <b>' . _("Attachments") . ':</b>';
774 echo ' <table width="100%" cellpadding="2" cellspacing="2" align="center"'.' border="0" bgcolor="'.$color[0].'"><tr><td>';
775 echo $attachmentsdisplay;
776 echo ' </td></tr></table>';
777 echo ' </table></td></tr>';
778 echo ' </table></td></tr>';
785 /* show attached images inline -- if pref'fed so */
786 if (($attachment_common_show_images) &&
787 is_array($attachment_common_show_images_list)) {
788 foreach ($attachment_common_show_images_list as $img) {
789 $imgurl = '../src/download.php' .
791 'passed_id=' . urlencode($img['passed_id']) .
792 '&mailbox=' . urlencode($mailbox) .
793 '&ent_id=' . urlencode($img['ent_id']) .
794 '&absolute_dl=true';
796 echo html_tag( 'table', "\n" .
797 html_tag( 'tr', "\n" .
798 html_tag( 'td', '<img src="' . $imgurl . '">' ."\n", 'left'
801 'center', '', 'cellspacing=0 border="0" cellpadding="2"');
805 do_hook('read_body_bottom');
806 do_hook('html_bottom');
807 //$message->clean_up();
808 sqimap_logout($imapConnection);