Templates
[squirrelmail.git] / src / read_body.php
CommitLineData
59177427 1<?php
134e4174 2
35586184 3/**
4 * read_body.php
5 *
6c84ba1e 6 * Copyright (c) 1999-2005 The SquirrelMail Project Team
35586184 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * This file is used for reading the msgs array and displaying
10 * the resulting emails in the right frame.
11 *
30967a1e 12 * @version $Id$
8f6f9ba5 13 * @package squirrelmail
a07cd1a4 14 */
35586184 15
30967a1e 16/**
17 * Path for SquirrelMail required files.
18 * @ignore
19 */
86725763 20define('SM_PATH','../');
21
22/* SquirrelMail required files. */
08185f2a 23require_once(SM_PATH . 'include/validate.php');
8650e9e1 24require_once(SM_PATH . 'functions/global.php');
86725763 25require_once(SM_PATH . 'functions/imap.php');
26require_once(SM_PATH . 'functions/mime.php');
27require_once(SM_PATH . 'functions/date.php');
28require_once(SM_PATH . 'functions/url_parser.php');
29require_once(SM_PATH . 'functions/html.php');
e95c04ec 30require_once(SM_PATH . 'functions/global.php');
6d021521 31require_once(SM_PATH . 'functions/identity.php');
91c27aee 32include_once(SM_PATH . 'functions/arrays.php');
d6b6d221 33require_once(SM_PATH . 'functions/mailbox_display.php');
38c944cc 34
a07cd1a4 35/**
1fca12b5 36 * Given an IMAP message id number, this will look it up in the cached
1e150c97 37 * and sorted msgs array and return the index of the next message
1fca12b5 38 *
1e150c97 39 * @param int $passed_id The current message UID
1fca12b5 40 * @return the index of the next valid message from the array
41 */
e0e30169 42function findNextMessage($uidset,$passed_id='backwards') {
324ac3c5 43 if (!is_array($uidset)) {
44 return -1;
45 }
e0e30169 46 if ($passed_id=='backwards' || !is_array($uidset)) { // check for backwards compattibilty gpg plugin
47 $passed_id = $uidset;
e0e30169 48 }
91c27aee 49 $result = sqm_array_get_value_by_offset($uidset,$passed_id,1);
50 if ($result === false) {
51 return -1;
52 } else {
53 return $result;
10f0ce72 54 }
a07cd1a4 55}
56
1e150c97 57/**
58 * Given an IMAP message id number, this will look it up in the cached
59 * and sorted msgs array and return the index of the previous message
60 *
61 * @param int $passed_id The current message UID
62 * @return the index of the next valid message from the array
63 */
e0e30169 64
65function findPreviousMessage($uidset, $passed_id) {
324ac3c5 66 if (!is_array($uidset)) {
67 return -1;
e0e30169 68 }
91c27aee 69 $result = sqm_array_get_value_by_offset($uidset,$passed_id,-1);
70 if ($result === false) {
71 return -1;
72 } else {
73 return $result;
a07cd1a4 74 }
a07cd1a4 75}
10f0ce72 76
a07cd1a4 77/**
1fca12b5 78 * Displays a link to a page where the message is displayed more
79 * "printer friendly".
1e150c97 80 * @param string $mailbox Name of current mailbox
4669e892 81 * @param int $passed_id
1fca12b5 82 */
1e150c97 83function printer_friendly_link($mailbox, $passed_id, $passed_ent_id) {
ce68b76b 84 global $javascript_on;
a07cd1a4 85
e2da1d80 86 /* hackydiehack */
87 if( !sqgetGlobalVar('view_unsafe_images', $view_unsafe_images, SQ_GET) ) {
88 $view_unsafe_images = false;
89 } else {
90 $view_unsafe_images = true;
91 }
164584f0 92 $params = '?passed_ent_id=' . urlencode($passed_ent_id) .
c2324b26 93 '&mailbox=' . urlencode($mailbox) .
e2da1d80 94 '&passed_id=' . urlencode($passed_id).
95 '&view_unsafe_images='. (bool) $view_unsafe_images;
10f0ce72 96
a07cd1a4 97 $print_text = _("View Printable Version");
10f0ce72 98
c615b1da 99 $result = '';
a07cd1a4 100 /* Output the link. */
101 if ($javascript_on) {
9f42bfc8 102 $result = '<script language="javascript" type="text/javascript">' . "\n" .
103 '<!--' . "\n" .
104 " function printFormat() {\n" .
105 ' window.open("../src/printer_friendly_main.php' .
106 $params . '","Print","width=800,height=600");' . "\n".
107 " }\n" .
108 "// -->\n" .
109 "</script>\n" .
110 "<a href=\"javascript:printFormat();\">$print_text</a>\n";
a07cd1a4 111 } else {
c2324b26 112 $result = '<a target="_blank" href="../src/printer_friendly_bottom.php' .
9f42bfc8 113 "$params\">$print_text</a>\n";
a07cd1a4 114 }
d9c1dccc 115 return $result;
a07cd1a4 116}
117
4669e892 118function ServerMDNSupport($aFlags) {
119 /* escaping $ doesn't work -> \x36 */
c075fcfe 120 return ( in_array('$mdnsent',$aFlags,true) ||
121 in_array('\\*',$aFlags,true) ) ;
57257333 122}
123
fc224f68 124function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) {
8d8da447 125 global $username, $attachment_dir, $popuser, $username, $color,
ce68b76b 126 $version, $squirrelmail_language, $default_charset,
127 $languages, $useSendmail, $domain, $sent_folder;
57257333 128
e95c04ec 129 sqgetGlobalVar('SERVER_NAME', $SERVER_NAME, SQ_SERVER);
0b97a708 130
38bca81c 131 $header = $message->rfc822_header;
57257333 132
fc224f68 133 $rfc822_header = new Rfc822Header();
d9c1dccc 134 $content_type = new ContentType('multipart/report');
fc224f68 135 $content_type->properties['report-type']='disposition-notification';
d9c1dccc 136
fc224f68 137 set_my_charset();
138 if ($default_charset) {
d9c1dccc 139 $content_type->properties['charset']=$default_charset;
fc224f68 140 }
141 $rfc822_header->content_type = $content_type;
142 $rfc822_header->to[] = $header->dnt;
a20855e4 143 $rfc822_header->subject = _("Read:") . ' ' . encodeHeader($header->subject);
fc224f68 144
27a1d10a 145 // Patch #793504 Return Receipt Failing with <@> from Tim Craig (burny_md)
146 // This merely comes from compose.php and only happens when there is no
147 // email_addr specified in user's identity (which is the startup config)
148 if (ereg("^([^@%/]+)[@%/](.+)$", $username, $usernamedata)) {
149 $popuser = $usernamedata[1];
150 $domain = $usernamedata[2];
151 unset($usernamedata);
152 } else {
153 $popuser = $username;
154 }
fc224f68 155
156 $reply_to = '';
6d021521 157 $ident = get_identities();
158 if(!isset($identity)) $identity = 0;
159 $full_name = $ident[$identity]['full_name'];
160 $from_mail = $ident[$identity]['email_address'];
161 $from_addr = '"'.$full_name.'" <'.$from_mail.'>';
162 $reply_to = $ident[$identity]['reply_to'];
163
27a1d10a 164 if (!$from_mail) {
165 $from_mail = "$popuser@$domain";
166 $from_addr = $from_mail;
fc224f68 167 }
168 $rfc822_header->from = $rfc822_header->parseAddress($from_addr,true);
169 if ($reply_to) {
170 $rfc822_header->reply_to = $rfc822_header->parseAddress($reply_to,true);
171 }
d9c1dccc 172
57257333 173 // part 1 (RFC2298)
57257333 174 $senton = getLongDateString( $header->date );
175 $to_array = $header->to;
176 $to = '';
177 foreach ($to_array as $line) {
af568a82 178 $to .= ' '.$line->getAddress();
57257333 179 }
57257333 180 $now = getLongDateString( time() );
78db1583 181 set_my_charset();
46bb8da8 182 $body = _("Your message") . "\r\n\r\n" .
48027e89 183 "\t" . _("To") . ': ' . decodeHeader($to,false,false) . "\r\n" .
184 "\t" . _("Subject") . ': ' . decodeHeader($header->subject,false,false) . "\r\n" .
185 "\t" . _("Sent") . ': ' . $senton . "\r\n" .
46bb8da8 186 "\r\n" .
187 sprintf( _("Was displayed on %s"), $now );
f69feefe 188
fc224f68 189 $special_encoding = '';
4669e892 190 if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
f4bb5d22 191 function_exists($languages[$squirrelmail_language]['XTRA_CODE'] . '_encode')) {
192 $body = call_user_func($languages[$squirrelmail_language]['XTRA_CODE'] . '_encode', $body);
d9c1dccc 193 if (strtolower($default_charset) == 'iso-2022-jp') {
194 if (mb_detect_encoding($body) == 'ASCII') {
195 $special_encoding = '8bit';
196 } else {
197 $body = mb_convert_encoding($body, 'JIS');
198 $special_encoding = '7bit';
199 }
200 }
21461ca4 201 } elseif (sq_is8bit($body)) {
202 $special_encoding = '8bit';
6fbd125b 203 }
fc224f68 204 $part1 = new Message();
205 $part1->setBody($body);
206 $mime_header = new MessageHeader;
207 $mime_header->type0 = 'text';
208 $mime_header->type1 = 'plain';
209 if ($special_encoding) {
210 $mime_header->encoding = $special_encoding;
d9c1dccc 211 } else {
fc224f68 212 $mime_header->encoding = 'us-ascii';
213 }
214 if ($default_charset) {
215 $mime_header->parameters['charset'] = $default_charset;
216 }
217 $part1->mime_header = $mime_header;
218
57257333 219 // part2 (RFC2298)
d9c1dccc 220 $original_recipient = $to;
57257333 221 $original_message_id = $header->message_id;
222
fc224f68 223 $report = "Reporting-UA : $SERVER_NAME ; SquirrelMail (version $version) \r\n";
57257333 224 if ($original_recipient != '') {
fc224f68 225 $report .= "Original-Recipient : $original_recipient\r\n";
57257333 226 }
227 $final_recipient = $sender;
fc224f68 228 $report .= "Final-Recipient: rfc822; $final_recipient\r\n" .
57257333 229 "Original-Message-ID : $original_message_id\r\n" .
230 "Disposition: manual-action/MDN-sent-manually; displayed\r\n";
231
fc224f68 232 $part2 = new Message();
233 $part2->setBody($report);
234 $mime_header = new MessageHeader;
235 $mime_header->type0 = 'message';
236 $mime_header->type1 = 'disposition-notification';
237 $mime_header->encoding = 'us-ascii';
238 $part2->mime_header = $mime_header;
239
240 $composeMessage = new Message();
241 $composeMessage->rfc822_header = $rfc822_header;
242 $composeMessage->addEntity($part1);
243 $composeMessage->addEntity($part2);
244
245
d9c1dccc 246 if ($useSendmail) {
247 require_once(SM_PATH . 'class/deliver/Deliver_SendMail.class.php');
248 global $sendmail_path;
249 $deliver = new Deliver_SendMail();
250 $stream = $deliver->initStream($composeMessage,$sendmail_path);
fc224f68 251 } else {
d9c1dccc 252 require_once(SM_PATH . 'class/deliver/Deliver_SMTP.class.php');
253 $deliver = new Deliver_SMTP();
ce68b76b 254 global $smtpServerAddress, $smtpPort, $pop_before_smtp;
d9c1dccc 255 $authPop = (isset($pop_before_smtp) && $pop_before_smtp) ? true : false;
9bd3b1e6 256 get_smtp_user($user, $pass);
d9c1dccc 257 $stream = $deliver->initStream($composeMessage,$domain,0,
70ce2218 258 $smtpServerAddress, $smtpPort, $user, $pass, $authPop);
d9c1dccc 259 }
260 $success = false;
fc224f68 261 if ($stream) {
d9c1dccc 262 $length = $deliver->mail($composeMessage, $stream);
263 $success = $deliver->finalizeStream($stream);
fc224f68 264 }
d9c1dccc 265 if (!$success) {
ff0969a0 266 $msg = $deliver->dlv_msg . '<br />' .
00ac2f42 267 _("Server replied: ") . $deliver->dlv_ret_nr . ' '.
268 $deliver->dlv_server_msg;
d9c1dccc 269 require_once(SM_PATH . 'functions/display_messages.php');
fc224f68 270 plain_error_message($msg, $color);
271 } else {
272 unset ($deliver);
d9c1dccc 273 if (sqimap_mailbox_exists ($imapConnection, $sent_folder)) {
274 sqimap_append ($imapConnection, $sent_folder, $length);
275 require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
276 $imap_deliver = new Deliver_IMAP();
277 $imap_deliver->mail($composeMessage, $imapConnection);
278 sqimap_append_done ($imapConnection);
279 unset ($imap_deliver);
280 }
281 }
282 return $success;
57257333 283}
284
6201339c 285function ToggleMDNflag ($set ,$imapConnection, $mailbox, $passed_id) {
d9c1dccc 286 $sg = $set?'+':'-';
287 $cmd = 'STORE ' . $passed_id . ' ' . $sg . 'FLAGS ($MDNSent)';
4669e892 288 $read = sqimap_run_command ($imapConnection, $cmd, true, $response,
6201339c 289 $readmessage, TRUE);
57257333 290}
291
292function ClearAttachments() {
d9c1dccc 293 global $username, $attachments, $attachment_dir;
294
295 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
296
297 $rem_attachments = array();
6191bcb1 298 if (isset($attachments)) {
324ac3c5 299 foreach ($attachments as $info) {
300 if ($info['session'] == -1) {
301 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
302 if (file_exists($attached_file)) {
134e4174 303 unlink($attached_file);
324ac3c5 304 }
305 } else {
306 $rem_attachments[] = $info;
307 }
308 }
d9c1dccc 309 }
310 $attachments = $rem_attachments;
57257333 311}
312
4d0cd98b 313function formatRecipientString($recipients, $item ) {
d9c1dccc 314 global $show_more_cc, $show_more, $show_more_bcc,
315 $PHP_SELF;
4d0cd98b 316
d9c1dccc 317 $string = '';
38c944cc 318 if ((is_array($recipients)) && (isset($recipients[0]))) {
d9c1dccc 319 $show = false;
38c944cc 320
321 if ($item == 'to') {
d9c1dccc 322 if ($show_more) {
323 $show = true;
324 $url = set_url_var($PHP_SELF, 'show_more',0);
325 } else {
326 $url = set_url_var($PHP_SELF, 'show_more',1);
327 }
328 } else if ($item == 'cc') {
329 if ($show_more_cc) {
330 $show = true;
331 $url = set_url_var($PHP_SELF, 'show_more_cc',0);
332 } else {
333 $url = set_url_var($PHP_SELF, 'show_more_cc',1);
334 }
335 } else if ($item == 'bcc') {
336 if ($show_more_bcc) {
337 $show = true;
338 $url = set_url_var($PHP_SELF, 'show_more_bcc',0);
339 } else {
340 $url = set_url_var($PHP_SELF, 'show_more_bcc',1);
341 }
342 }
343
344 $cnt = count($recipients);
345 foreach($recipients as $r) {
a91189d6 346 $add = decodeHeader($r->getAddress(true));
d9c1dccc 347 if ($string) {
3c621ba1 348 $string .= '<br />' . $add;
d9c1dccc 349 } else {
350 $string = $add;
351 if ($cnt > 1) {
3c621ba1 352 $string .= '&nbsp;(<a href="'.$url;
d9c1dccc 353 if ($show) {
3c621ba1 354 $string .= '">'._("less").'</a>)';
d9c1dccc 355 } else {
3c621ba1 356 $string .= '">'._("more").'</a>)';
d9c1dccc 357 break;
358 }
359 }
360 }
1fca12b5 361 }
4d0cd98b 362 }
c615b1da 363 return $string;
364}
365
e0e30169 366function formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message,
af568a82 367 $color, $FirstTimeSee) {
ce68b76b 368 global $default_use_mdn, $default_use_priority,
77836429 369 $show_xmailer_default, $mdn_user_support, $PHP_SELF, $javascript_on,
134e4174 370 $squirrelmail_language;
38bca81c 371
134e4174 372 $mailbox = $aMailbox['NAME'];
e0e30169 373
d9c1dccc 374 $header = $message->rfc822_header;
375 $env = array();
bdb9ce72 376 $env[_("Subject")] = str_replace("&nbsp;"," ",decodeHeader($header->subject));
7893c8a5 377
d9c1dccc 378 $from_name = $header->getAddr_s('from');
d6b6d221 379 if (!$from_name)
d9c1dccc 380 $from_name = $header->getAddr_s('sender');
d6b6d221 381 if (!$from_name)
382 $env[_("From")] = _("Unknown sender");
383 else
384 $env[_("From")] = decodeHeader($from_name);
d9c1dccc 385 $env[_("Date")] = getLongDateString($header->date);
386 $env[_("To")] = formatRecipientString($header->to, "to");
387 $env[_("Cc")] = formatRecipientString($header->cc, "cc");
388 $env[_("Bcc")] = formatRecipientString($header->bcc, "bcc");
389 if ($default_use_priority) {
0e8006dc 390 $env[_("Priority")] = htmlspecialchars(getPriorityStr($header->priority));
d9c1dccc 391 }
392 if ($show_xmailer_default) {
a91189d6 393 $env[_("Mailer")] = decodeHeader($header->xmailer);
d9c1dccc 394 }
395 if ($default_use_mdn) {
396 if ($mdn_user_support) {
397 if ($header->dnt) {
398 if ($message->is_mdnsent) {
509ce88e 399 $env[_("Read receipt")] = _("sent");
d9c1dccc 400 } else {
4669e892 401 $env[_("Read receipt")] = _("requested");
402 if (!(handleAsSent($mailbox) ||
d9c1dccc 403 $message->is_deleted ||
404 $passed_ent_id)) {
405 $mdn_url = $PHP_SELF . '&sendreceipt=1';
406 if ($FirstTimeSee && $javascript_on) {
407 $script = '<script language="JavaScript" type="text/javascript">' . "\n";
408 $script .= '<!--'. "\n";
409 $script .= 'if(window.confirm("' .
410 _("The message sender has requested a response to indicate that you have read this message. Would you like to send a receipt?") .
411 '")) { '."\n" .
412 ' sendMDN()'.
413 '}' . "\n";
414 $script .= '// -->'. "\n";
415 $script .= '</script>'. "\n";
416 echo $script;
417 }
418 $env[_("Read receipt")] .= '&nbsp;<a href="' . $mdn_url . '">[' .
419 _("Send read receipt now") . ']</a>';
420 }
421 }
422 }
423 }
424 }
c615b1da 425
3c621ba1 426 $s = '<table width="100%" cellpadding="0" cellspacing="2" border="0"';
427 $s .= ' align="center" bgcolor="'.$color[0].'">';
d9c1dccc 428 foreach ($env as $key => $val) {
429 if ($val) {
3c621ba1 430 $s .= '<tr>';
431 $s .= html_tag('td', '<b>' . $key . ':&nbsp;&nbsp;</b>', 'right', '', 'valign="top" width="20%"') . "\n";
432 $s .= html_tag('td', $val, 'left', '', 'valign="top" width="80%"') . "\n";
433 $s .= '</tr>';
d9c1dccc 434 }
435 }
3c621ba1 436 echo '<table bgcolor="'.$color[9].'" width="100%" cellpadding="1"'.
437 ' cellspacing="0" border="0" align="center">'."\n";
438 echo '<tr><td height="5" colspan="2" bgcolor="'.
439 $color[4].'"></td></tr><tr><td align="center">'."\n";
d9c1dccc 440 echo $s;
00ac2f42 441 do_hook('read_body_header');
d9c1dccc 442 formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color);
3c621ba1 443 echo '</table>';
444 echo '</td></tr><tr><td height="5" colspan="2" bgcolor="'.$color[4].'"></td></tr>'."\n";
445 echo '</table>';
d9c1dccc 446}
c615b1da 447
1e150c97 448/**
4669e892 449 * Format message toolbar
450 *
1e150c97 451 * @param string $mailbox Name of current mailbox
452 * @param int $passed_id UID of current message
453 * @param int $passed_ent_id Id of entity within message
454 * @param object $message Current message object
455 * @param object $mbx_response
456 */
324ac3c5 457function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removedVar, $nav_on_top = TRUE) {
a94c1db1 458 global $base_uri, $draft_folder, $where, $what, $color, $sort,
4669e892 459 $startMessage, $PHP_SELF, $save_as_draft,
1e150c97 460 $enable_forward_as_attachment, $imapConnection, $lastTargetMailbox,
ce68b76b 461 $username, $delete_prev_next_display,
91c27aee 462 $compose_new_win, $javascript_on, $compose_width, $compose_height;
c615b1da 463
e0e30169 464 //FIXME cleanup argument list, use $aMailbox where possible
465 $mailbox = $aMailbox['NAME'];
466
d9c1dccc 467 $topbar_delimiter = '&nbsp;|&nbsp;';
1e150c97 468 $double_delimiter = '&nbsp;&nbsp;&nbsp;&nbsp;';
d9c1dccc 469 $urlMailbox = urlencode($mailbox);
c615b1da 470
1e150c97 471 $msgs_url = $base_uri . 'src/';
2ffa3f57 472
1e150c97 473 // BEGIN NAV ROW - PREV/NEXT, DEL PREV/NEXT, LINKS TO INDEX, etc.
45c1ed84 474 $nav_row = '<tr><td align="left" colspan="2" style="border: 1px solid '.$color[9].';"><small>';
e55c441a 475
1e150c97 476 // Create Prev & Next links
477 // Handle nested entities first (i.e. Mime Attach parts)
478 if (isset($passed_ent_id) && $passed_ent_id) {
479 // code for navigating through attached message/rfc822 messages
d9c1dccc 480 $url = set_url_var($PHP_SELF, 'passed_ent_id',0);
70bdc740 481 $entities = array();
482 $entity_count = array();
483 $c = 0;
f2f03410 484
70bdc740 485 foreach($message->parent->entities as $ent) {
9f42bfc8 486 if ($ent->type0 == 'message' && $ent->type1 == 'rfc822') {
487 $c++;
488 $entity_count[$c] = $ent->entity_id;
489 $entities[$ent->entity_id] = $c;
490 }
70bdc740 491 }
1e150c97 492
70bdc740 493 $prev_link = _("Previous");
91c27aee 494 if(isset($entities[$passed_ent_id]) && $entities[$passed_ent_id] > 1) {
70bdc740 495 $prev_ent_id = $entity_count[$entities[$passed_ent_id] - 1];
496 $prev_link = '<a href="'
497 . set_url_var($PHP_SELF, 'passed_ent_id', $prev_ent_id)
498 . '">' . $prev_link . '</a>';
499 }
1e150c97 500
501 $next_link = _("Next");
91c27aee 502 if(isset($entities[$passed_ent_id]) && $entities[$passed_ent_id] < $c) {
70bdc740 503 $next_ent_id = $entity_count[$entities[$passed_ent_id] + 1];
504 $next_link = '<a href="'
505 . set_url_var($PHP_SELF, 'passed_ent_id', $next_ent_id)
506 . '">' . $next_link . '</a>';
507 }
1e150c97 508
d9c1dccc 509 $par_ent_id = $message->parent->entity_id;
1e150c97 510 $up_link = '';
d9c1dccc 511 if ($par_ent_id) {
512 $par_ent_id = substr($par_ent_id,0,-2);
1e150c97 513 if ( $par_ent_id != 0 ) {
514 $up_link = $topbar_delimiter;
515 $url = set_url_var($PHP_SELF, 'passed_ent_id',$par_ent_id);
516 $up_link .= '<a href="'.$url.'">'._("Up").'</a>';
517 }
518 }
519
520 $nav_row .= $prev_link . $up_link . $topbar_delimiter . $next_link;
abafb676 521 $nav_row .= $double_delimiter . '[<a href="'.$url.'">'._("View Message").'</a>]';
1e150c97 522
523 // Prev/Next links for regular messages
324ac3c5 524 } else if ( true ) { //!(isset($where) && isset($what)) ) {
525 /**
526 * Check if cache is still valid
527 */
528 if (!is_array($aMailbox['UIDSET'][$what])) {
529 fetchMessageHeaders($imapConnection, $aMailbox);
530 }
531 $prev = findPreviousMessage($aMailbox['UIDSET'][$what], $passed_id);
532 $next = findNextMessage($aMailbox['UIDSET'][$what],$passed_id);
1e150c97 533
534 $prev_link = _("Previous");
535 if ($prev >= 0) {
536 $uri = $base_uri . 'src/read_body.php?passed_id='.$prev.
537 '&amp;mailbox='.$urlMailbox.'&amp;sort='.$sort.
324ac3c5 538 "&amp;where=$where&amp;what=$what" .
1e150c97 539 '&amp;startMessage='.$startMessage.'&amp;show_more=0';
540 $prev_link = '<a href="'.$uri.'">'.$prev_link.'</a>';
d9c1dccc 541 }
1e150c97 542
543 $next_link = _("Next");
544 if ($next >= 0) {
545 $uri = $base_uri . 'src/read_body.php?passed_id='.$next.
546 '&amp;mailbox='.$urlMailbox.'&amp;sort='.$sort.
324ac3c5 547 "&amp;where=$where&amp;what=$what" .
1e150c97 548 '&amp;startMessage='.$startMessage.'&amp;show_more=0';
549 $next_link = '<a href="'.$uri.'">'.$next_link.'</a>';
550 }
551
1e150c97 552 // Only bother with Delete & Prev and Delete & Next IF
6201339c 553 // top display is enabled.
4669e892 554 if ( $delete_prev_next_display == 1 &&
324ac3c5 555 in_array('\\deleted', $aMailbox['PERMANENTFLAGS'],true) ) {
45c1ed84 556 $del_prev_link = _("Delete & Prev");
1e150c97 557 if ($prev >= 0) {
558 $uri = $base_uri . 'src/read_body.php?passed_id='.$prev.
559 '&amp;mailbox='.$urlMailbox.'&amp;sort='.$sort.
560 '&amp;startMessage='.$startMessage.'&amp;show_more=0'.
324ac3c5 561 "&amp;where=$where&amp;what=$what" .
1e150c97 562 '&amp;delete_id='.$passed_id;
4669e892 563 $del_prev_link = '<a href="'.$uri.'">'.$del_prev_link.'</a>';
1e150c97 564 }
565
45c1ed84 566 $del_next_link = _("Delete & Next");
1e150c97 567 if ($next >= 0) {
568 $uri = $base_uri . 'src/read_body.php?passed_id='.$next.
569 '&amp;mailbox='.$urlMailbox.'&amp;sort='.$sort.
570 '&amp;startMessage='.$startMessage.'&amp;show_more=0'.
324ac3c5 571 "&amp;where=$where&amp;what=$what" .
1e150c97 572 '&amp;delete_id='.$passed_id;
45c1ed84 573 $del_next_link = '<a href="'.$uri.'">'.$del_next_link.'</a>';
1e150c97 574 }
1e150c97 575 }
45c1ed84 576
abafb676 577 $nav_row .= '['.$prev_link.$topbar_delimiter.$next_link.']';
578 if ( isset($del_prev_link) && isset($del_next_link) )
579 $nav_row .= $double_delimiter.'['.$del_prev_link.$topbar_delimiter.$del_next_link.']';
1e150c97 580 }
581
582 // Start with Search Results or Message List link.
324ac3c5 583 $msgs_url .= "$where?where=read_body.php&amp;what=$what&amp;mailbox=" . $urlMailbox.
584 "&amp;startMessage=$startMessage";
585 if ($where == 'search.php') {
1e150c97 586 $msgs_str = _("Search Results");
587 } else {
1e150c97 588 $msgs_str = _("Message List");
589 }
590 $nav_row .= $double_delimiter .
abafb676 591 '[<a href="' . $msgs_url . '">' . $msgs_str . '</a>]';
1e150c97 592
593 $nav_row .= '</small></td></tr>';
594
595
596 // BEGIN MENU ROW - DELETE/REPLY/FORWARD/MOVE/etc.
ad2ee09d 597 $menu_row = '<tr bgcolor="'.$color[0].'"><td><small>';
98a9cc03 598 $comp_uri = $base_uri.'src/compose.php' .
599 '?passed_id=' . $passed_id .
600 '&amp;mailbox=' . $urlMailbox .
601 '&amp;startMessage=' . $startMessage .
602 (isset($passed_ent_id) ? '&amp;passed_ent_id='.$passed_ent_id : '');
4669e892 603
604 // Start form for reply/reply all/forward..
1a531551 605 $target = '';
606 $on_click='';
ee66175d 607 $method='method="post" ';
6190378c 608 $onsubmit='';
1a531551 609 if ($compose_new_win == '1') {
91c27aee 610 if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
611 $compose_width = '640';
612 }
613 if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
614 $compose_height = '550';
615 }
1a531551 616 if ( $javascript_on ) {
91c27aee 617 $on_click=' onclick="comp_in_new_form(\''.$comp_uri.'\', this, this.form,'. $compose_width .',' . $compose_height .')"';
1a531551 618 $comp_uri = 'javascript:void(0)';
ee66175d 619 $method='method="get" ';
6190378c 620 $onsubmit = 'onsubmit="return false" ';
1a531551 621 } else {
622 $target = 'target="_blank"';
1a531551 623 }
624 }
625
6190378c 626 $menu_row .= "\n".'<form name="composeForm" action="'.$comp_uri.'" '
627 . $method.$target.$onsubmit.' style="display: inline">'."\n";
98a9cc03 628
1e150c97 629 // If Draft folder - create Resume link
630 if (($mailbox == $draft_folder) && ($save_as_draft)) {
1a531551 631 $new_button = 'smaction_draft';
1e150c97 632 $comp_alt_string = _("Resume Draft");
633 } else if (handleAsSent($mailbox)) {
634 // If in Sent folder, edit as new
1a531551 635 $new_button = 'smaction_edit_new';
1e150c97 636 $comp_alt_string = _("Edit Message as New");
637 }
1e150c97 638 // Show Alt URI for Draft/Sent
98a9cc03 639 if (isset($comp_alt_string))
e1728a7a 640 $menu_row .= getButton('submit', $new_button, $comp_alt_string, $on_click) . "\n";
1e150c97 641
e1728a7a 642 $menu_row .= getButton('submit', 'smaction_reply', _("Reply"), $on_click) . "\n";
643 $menu_row .= getButton('submit', 'smaction_reply_all', _("Reply All"), $on_click) ."\n";
644 $menu_row .= getButton('submit', 'smaction_forward', _("Forward"), $on_click);
98a9cc03 645 if ($enable_forward_as_attachment)
ff0969a0 646 $menu_row .= '<input type="checkbox" name="smaction_attache" />' . _("As Attachment") .'&nbsp;&nbsp;'."\n";
1e150c97 647
51eb014b 648 $menu_row .= '</form>&nbsp;';
c615b1da 649
324ac3c5 650 if ( in_array('\\deleted', $aMailbox['PERMANENTFLAGS'],true) ) {
651 // Form for deletion. Form is handled by the originating display in $where. This is right_main.php or search.php
652 $delete_url = $base_uri . "src/$where";
25e57ed2 653 $menu_row .= '<form name="deleteMessageForm" action="'.$delete_url.'" method="post" style="display: inline">';
a128c967 654
4669e892 655 if (!(isset($passed_ent_id) && $passed_ent_id)) {
324ac3c5 656 $menu_row .= addHidden('mailbox', $aMailbox['NAME']);
657 $menu_row .= addHidden('msg[0]', $passed_id);
7fcab811 658 $menu_row .= addHidden('startMessage', $startMessage);
e1728a7a 659 $menu_row .= getButton('submit', 'delete', _("Delete"));
ff0969a0 660 $menu_row .= '<input type="checkbox" name="bypass_trash" />' . _("Bypass Trash");
324ac3c5 661 } else {
e1728a7a 662 $menu_row .= getButton('submit', 'delete', _("Delete"), '', FALSE) . "\n"; // delete button is disabled
abafb676 663 }
abafb676 664
4669e892 665 $menu_row .= '</form>';
666 }
abafb676 667
1e150c97 668 // Add top move link
669 $menu_row .= '</small></td><td align="right">';
4669e892 670 if ( !(isset($passed_ent_id) && $passed_ent_id) &&
324ac3c5 671 in_array('\\deleted', $aMailbox['PERMANENTFLAGS'],true) ) {
b2811304 672
25e57ed2 673 $menu_row .= '<form name="moveMessageForm" action="'.$base_uri.'src/'.$where.'?'.'" method="post" style="display: inline">'.
64c9e87e 674 '<small>'.
324ac3c5 675
676 addHidden('mailbox',$aMailbox['NAME']) .
677 addHidden('msg[0]', $passed_id) . _("Move to:") .
1e150c97 678 '<select name="targetMailbox" style="padding: 0px; margin: 0px">';
b2811304 679
1e150c97 680 if (isset($lastTargetMailbox) && !empty($lastTargetMailbox)) {
681 $menu_row .= sqimap_mailbox_option_list($imapConnection, array(strtolower($lastTargetMailbox)));
682 } else {
683 $menu_row .= sqimap_mailbox_option_list($imapConnection);
684 }
b2811304 685 $menu_row .= '</select> ';
686
e1728a7a 687 $menu_row .= getButton('submit', 'moveButton',_("Move")) . "\n" . '</form>';
1e150c97 688 }
689 $menu_row .= '</td></tr>';
d9c1dccc 690
1e150c97 691 // echo rows, with hooks
764971df 692 $ret = do_hook_function('read_body_menu_top', array($nav_row, $menu_row));
988e24f6 693 if (is_array($ret)) {
694 if (isset($ret[0]) && !empty($ret[0])) {
695 $nav_row = $ret[0];
696 }
697 if (isset($ret[1]) && !empty($ret[1])) {
698 $menu_row = $ret[1];
699 }
764971df 700 }
1e150c97 701 echo '<table width="100%" cellpadding="3" cellspacing="0" align="center" border="0">';
702 echo $nav_on_top ? $nav_row . $menu_row : $menu_row . $nav_row;
703 echo '</table>'."\n";
d62c4938 704 do_hook('read_body_menu_bottom');
c615b1da 705}
706
707function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) {
78909469 708 global $base_uri, $where, $what;
4669e892 709
d9c1dccc 710 $urlMailbox = urlencode($mailbox);
78909469 711 $urlPassed_id = urlencode($passed_id);
712 $urlPassed_ent_id = urlencode($passed_ent_id);
4669e892 713
78909469 714 $query_string = 'mailbox=' . $urlMailbox . '&amp;passed_id=' . $urlPassed_id . '&amp;passed_ent_id=' . $urlPassed_ent_id;
4669e892 715
78909469 716 if (!empty($where)) {
717 $query_string .= '&amp;where=' . urlencode($where);
718 }
719
720 if (!empty($what)) {
721 $query_string .= '&amp;what=' . urlencode($what);
722 }
723
e95c04ec 724 $url = $base_uri.'src/view_header.php?'.$query_string;
d9c1dccc 725
3c621ba1 726 $s = "<tr>\n" .
727 html_tag( 'td', '', 'right', '', 'valign="middle" width="20%"' ) . '<b>' . _("Options") . ":&nbsp;&nbsp;</b></td>\n" .
728 html_tag( 'td', '', 'left', '', 'valign="middle" width="80%"' ) . '<small>' .
d9c1dccc 729 '<a href="'.$url.'">'._("View Full Header").'</a>';
730
731 /* Output the printer friendly link if we are in subtle mode. */
732 $s .= '&nbsp;|&nbsp;' .
1e150c97 733 printer_friendly_link($mailbox, $passed_id, $passed_ent_id);
d9c1dccc 734 echo $s;
735 do_hook("read_body_header_right");
3c621ba1 736 $s = "</small></td>\n" .
737 "</tr>\n";
d9c1dccc 738 echo $s;
a128c967 739
4d0cd98b 740}
741
91c27aee 742/**
743 * Creates button
744 *
745 * @deprecated see form functions available in 1.5.1 and 1.4.3.
746 * @param string $type
747 * @param string $name
748 * @param string $value
749 * @param string $js
750 * @param bool $enabled
751 */
752function getButton($type, $name, $value, $js = '', $enabled = TRUE) {
753 $disabled = ( $enabled ? '' : 'disabled ' );
754 $js = ( $js ? $js.' ' : '' );
755 return '<input '.$disabled.$js.
756 'type="'.$type.
757 '" name="'.$name.
758 '" value="'.$value .
759 '" style="padding: 0px; margin: 0px" />';
760}
761
762
6206f6c4 763/***************************/
2ffa3f57 764/* Main of read_body.php */
6206f6c4 765/***************************/
57257333 766
0b97a708 767/* get the globals we may need */
768
1e12d1ff 769sqgetGlobalVar('key', $key, SQ_COOKIE);
e95c04ec 770sqgetGlobalVar('username', $username, SQ_SESSION);
771sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION);
e95c04ec 772sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
1e12d1ff 773sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
e95c04ec 774sqgetGlobalVar('lastTargetMailbox', $lastTargetMailbox, SQ_SESSION);
e95c04ec 775if (!sqgetGlobalVar('messages', $messages, SQ_SESSION) ) {
776 $messages = array();
ce274df9 777}
778
e95c04ec 779/** GET VARS */
780sqgetGlobalVar('sendreceipt', $sendreceipt, SQ_GET);
324ac3c5 781if (!sqgetGlobalVar('where', $where, SQ_GET) ) {
782 $where = 'right_main.php';
783}
784if (!sqgetGlobalVar('what', $what, SQ_GET) ){
785 $what = 0;
786}
e95c04ec 787if ( sqgetGlobalVar('show_more', $temp, SQ_GET) ) {
788 $show_more = (int) $temp;
1b9f3c04 789}
e95c04ec 790if ( sqgetGlobalVar('show_more_cc', $temp, SQ_GET) ) {
791 $show_more_cc = (int) $temp;
0b97a708 792}
e95c04ec 793if ( sqgetGlobalVar('show_more_bcc', $temp, SQ_GET) ) {
794 $show_more_bcc = (int) $temp;
0b97a708 795}
e95c04ec 796if ( sqgetGlobalVar('view_hdr', $temp, SQ_GET) ) {
797 $view_hdr = (int) $temp;
0b97a708 798}
e95c04ec 799
91c27aee 800if ( sqgetGlobalVar('account', $temp, SQ_GET) ) {
801 $iAccount = (int) $temp;
802} else {
803 $iAccount = 0;
804}
805
e95c04ec 806/** GET/POST VARS */
807sqgetGlobalVar('passed_ent_id', $passed_ent_id);
808sqgetGlobalVar('mailbox', $mailbox);
809
810if ( sqgetGlobalVar('passed_id', $temp) ) {
811 $passed_id = (int) $temp;
0b97a708 812}
e95c04ec 813if ( sqgetGlobalVar('sort', $temp) ) {
814 $sort = (int) $temp;
0b97a708 815}
e95c04ec 816if ( sqgetGlobalVar('startMessage', $temp) ) {
817 $startMessage = (int) $temp;
324ac3c5 818} else {
819 $startMessage = 1;
ce274df9 820}
324ac3c5 821/**
822 * Retrieve mailbox cache
823 */
824sqgetGlobalVar('mailbox_cache',$mailbox_cache,SQ_SESSION);
0b97a708 825
ce274df9 826/* end of get globals */
6201339c 827global $sqimap_capabilities, $lastTargetMailbox;
38c944cc 828
6206f6c4 829$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
91c27aee 830$aMailbox = sqm_api_mailbox_select($imapConnection, $iAccount, $mailbox,array('setindex' => $what, 'offset' => $startMessage),array());
831
832/**
833 * Check if cache is still valid
834 */
835$iSetIndex = $aMailbox['SETINDEX'];
836$aMailbox['CURRENT_MSG'][$iSetIndex] = $passed_id;
837//$aMailbox['OFFSET'] = $startMessage -1;
838
839sqgetGlobalVar('aFetchColumns',$aFetchColumns,SQ_SESSION);
840if (!is_array($aMailbox['UIDSET'][$what])) {
841 fetchMessageHeaders($imapConnection, $aMailbox, $aFetchColumns);
842}
38c944cc 843
324ac3c5 844/**
845 * Update the seen state
846 * and ignore in_array('\\seen',$aMailbox['PERMANENTFLAGS'],true)
847 */
848if (isset($aMailbox['MSG_HEADERS'][$passed_id]['FLAGS'])) {
849 $aMailbox['MSG_HEADERS'][$passed_id]['FLAGS']['\\seen'] = true;
e0e30169 850}
e0e30169 851
1e150c97 852/**
853 * Process Delete from delete-move-next
854 * but only if delete_id was set
855 */
856if ( sqgetGlobalVar('delete_id', $delete_id, SQ_GET) ) {
324ac3c5 857 handleMessageListForm($imapConnection,$aMailbox,$sButton='setDeleted', array($delete_id));
1e150c97 858}
859
38c944cc 860/**
861 * $message contains all information about the message
862 * including header and body
863 */
37d2a6ee 864
324ac3c5 865if (isset($aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT'])) {
866 $message = $aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT'];
867 $FirstTimeSee = !$message->is_seen;
38c944cc 868} else {
324ac3c5 869 $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
870 $FirstTimeSee = !$message->is_seen;
871 $message->is_seen = true;
872 $aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT'] = $message;
5200c026 873}
af568a82 874
dd628162 875if (isset($passed_ent_id) && $passed_ent_id) {
324ac3c5 876 $message = $message->getEntity($passed_ent_id);
877 if ($message->type0 != 'message' && $message->type1 != 'rfc822') {
878 $message = $message->parent;
879 }
880 $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY[$passed_ent_id.HEADER]", true, $response, $msg, TRUE);
881 $rfc822_header = new Rfc822Header();
882 $rfc822_header->parseHeader($read);
883 $message->rfc822_header = $rfc822_header;
91c27aee 884} else if ($message->type0 == 'message' && $message->type1 == 'rfc822' && isset($message->entities[0])) {
885 $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY[1.HEADER]", true, $response, $msg, TRUE);
886 $rfc822_header = new Rfc822Header();
887 $rfc822_header->parseHeader($read);
888 $message->rfc822_header = $rfc822_header;
c615b1da 889} else {
324ac3c5 890 $passed_ent_id = 0;
38c944cc 891}
5200c026 892$header = $message->header;
57257333 893
91c27aee 894$header = $message->header;
895
57257333 896
6206f6c4 897/****************************************/
898/* Block for handling incoming url vars */
899/****************************************/
5200c026 900
5200c026 901if (isset($sendreceipt)) {
902 if ( !$message->is_mdnsent ) {
27a1d10a 903 $final_recipient = '';
134e4174 904 if ((isset($identity)) && ($identity != 0)) //Main identity
27a1d10a 905 $final_recipient = trim(getPref($data_dir, $username, 'email_address' . $identity, '' ));
906 if ($final_recipient == '' )
907 $final_recipient = trim(getPref($data_dir, $username, 'email_address', '' ));
324ac3c5 908 $supportMDN = ServerMDNSupport($aMailbox["PERMANENTFLAGS"]);
fc224f68 909 if ( SendMDN( $mailbox, $passed_id, $final_recipient, $message, $imapConnection ) > 0 && $supportMDN ) {
6201339c 910 ToggleMDNflag( true, $imapConnection, $mailbox, $passed_id);
5200c026 911 $message->is_mdnsent = true;
1012f961 912 $aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT'] = $message;
5200c026 913 }
914 ClearAttachments();
915 }
916}
6206f6c4 917/***********************************************/
918/* End of block for handling incoming url vars */
919/***********************************************/
920
324ac3c5 921
9f42bfc8 922
923$messagebody = '';
c4ad259b 924do_hook('read_body_top');
925if ($show_html_default == 1) {
926 $ent_ar = $message->findDisplayEntity(array());
927} else {
928 $ent_ar = $message->findDisplayEntity(array(), array('text/plain'));
929}
a128c967 930$cnt = count($ent_ar);
931for ($i = 0; $i < $cnt; $i++) {
6a108031 932 $messagebody .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $passed_id, $mailbox);
a128c967 933 if ($i != $cnt-1) {
83ae18bc 934 $messagebody .= '<hr style="height: 1px;" />';
a128c967 935 }
38c944cc 936}
e55c441a 937
c615b1da 938displayPageHeader($color, $mailbox);
324ac3c5 939formatMenuBar($aMailbox, $passed_id, $passed_ent_id, $message,false);
e0e30169 940formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee);
a94c1db1 941echo '<table width="100%" cellpadding="0" cellspacing="0" align="center" border="0">';
6206f6c4 942echo ' <tr><td>';
a94c1db1 943echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="'.$color[9].'">';
a128c967 944echo ' <tr><td>';
a94c1db1 945echo ' <table width="100%" cellpadding="3" cellspacing="0" align="center" border="0">';
6206f6c4 946echo ' <tr bgcolor="'.$color[4].'"><td>';
98fb28fd 947// echo ' <table cellpadding="1" cellspacing="5" align="left" border="0">';
948echo html_tag( 'table' ,'' , 'left', '', 'cellpadding="1" cellspacing="5" border="0"' );
3c621ba1 949echo ' <tr>' . html_tag( 'td', '<br />'. $messagebody."\n", 'left')
6c7b5d8c 950 . '</tr>';
6206f6c4 951echo ' </table>';
4669e892 952echo ' </td></tr>';
6206f6c4 953echo ' </table></td></tr>';
2ffa3f57 954echo ' </table>';
955echo ' </td></tr>';
a128c967 956
3c621ba1 957echo '<tr><td height="5" colspan="2" bgcolor="'.
958 $color[4].'"></td></tr>'."\n";
d0a2476a 959
a128c967 960$attachmentsdisplay = formatAttachments($message,$ent_ar,$mailbox, $passed_id);
961if ($attachmentsdisplay) {
8acd2fb5 962 echo ' </table>';
6206f6c4 963 echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center"'.' border="0" bgcolor="'.$color[9].'">';
2ffa3f57 964 echo ' <tr><td>';
d0a2476a 965 echo ' <table width="100%" cellpadding="0" cellspacing="0" align="center" border="0" bgcolor="'.$color[4].'">';
4669e892 966 echo ' <tr>' . html_tag( 'td', '', 'left', $color[9] );
6206f6c4 967 echo ' <b>' . _("Attachments") . ':</b>';
968 echo ' </td></tr>';
969 echo ' <tr><td>';
970 echo ' <table width="100%" cellpadding="2" cellspacing="2" align="center"'.' border="0" bgcolor="'.$color[0].'"><tr><td>';
971 echo $attachmentsdisplay;
972 echo ' </td></tr></table>';
6c7b5d8c 973 echo ' </td></tr></table>';
6206f6c4 974 echo ' </td></tr>';
3c621ba1 975 echo '<tr><td height="5" colspan="2" bgcolor="'.
976 $color[4].'"></td></tr>';
a128c967 977}
c615b1da 978echo '</table>';
a07cd1a4 979
980/* show attached images inline -- if pref'fed so */
5be9f195 981if (($attachment_common_show_images) &&
a07cd1a4 982 is_array($attachment_common_show_images_list)) {
983 foreach ($attachment_common_show_images_list as $img) {
ce274df9 984 $imgurl = SM_PATH . 'src/download.php' .
57257333 985 '?' .
cd7b8833 986 'passed_id=' . urlencode($img['passed_id']) .
3d570ba0 987 '&amp;mailbox=' . urlencode($mailbox) .
ff9d4297 988 '&amp;ent_id=' . urlencode($img['ent_id']) .
3d570ba0 989 '&amp;absolute_dl=true';
5be9f195 990
b5058e9e 991 echo html_tag( 'table', "\n" .
d9c1dccc 992 html_tag( 'tr', "\n" .
3c621ba1 993 html_tag( 'td', '<img src="' . $imgurl . '" />' ."\n", 'left'
d9c1dccc 994 )
995 ) ,
3c621ba1 996 'center', '', 'cellspacing="0" border="0" cellpadding="2"');
10f0ce72 997 }
a07cd1a4 998}
999
324ac3c5 1000formatMenuBar($aMailbox, $passed_id, $passed_ent_id, $message, false, FALSE);
1e150c97 1001
c615b1da 1002do_hook('read_body_bottom');
a07cd1a4 1003sqimap_logout($imapConnection);
91c27aee 1004
1005/**
1006 * Write mailbox with updated seen flag information back to cache.
1007 */
1008$mailbox_cache[$iAccount.'_'.$aMailbox['NAME']] = $aMailbox;
324ac3c5 1009sqsession_register($mailbox_cache,'mailbox_cache');
dcc1cc82 1010?>
83ae18bc 1011</body></html>