fix for bug #538641. Also fixes a few problems with sort types and the prev/next
[squirrelmail.git] / src / read_body.php
CommitLineData
59177427 1<?php
895905c0 2
35586184 3/**
4 * read_body.php
5 *
15e6162e 6 * Copyright (c) 1999-2002 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 *
12 * $Id$
a07cd1a4 13 */
35586184 14
15require_once('../src/validate.php');
16require_once('../functions/imap.php');
17require_once('../functions/mime.php');
18require_once('../functions/date.php');
19require_once('../functions/url_parser.php');
57257333 20require_once('../functions/smtp.php');
5be9f195 21
a07cd1a4 22/**
1fca12b5 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.
26 *
27 * @return the index of the next valid message from the array
28 */
a07cd1a4 29function findNextMessage() {
92592f0e 30 global $msort, $currentArrayIndex, $msgs, $sort,
cf710efe 31 $thread_sort_messages, $allow_server_sort,
60a3e687 32 $server_sort_array;
a07cd1a4 33 $result = -1;
cf710efe 34 if ($thread_sort_messages == 1 || $allow_server_sort == 'true') {
60a3e687 35 reset($server_sort_array);
36 while(list($key, $value) = each ($server_sort_array)) {
37 if ($currentArrayIndex == $value) {
1fca12b5 38 if ($key == (count($server_sort_array) - 1)) {
60a3e687 39 $result = -1;
40 break;
41 }
1fca12b5 42 $result = $server_sort_array[$key + 1];
60a3e687 43 break;
789b4d79 44 }
60a3e687 45 }
1fca12b5 46 }
cf710efe 47 elseif ($sort == 6 && $allow_server_sort != 'true' &&
48 $thread_sort_messages != 1) {
a07cd1a4 49 if ($currentArrayIndex != 1) {
50 $result = $currentArrayIndex - 1;
51 }
1fca12b5 52 }
cf710efe 53 elseif ($allow_server_sort != 'true' && $thread_sort_messages != 1 ) {
75ef78d8 54 if (!is_array($msort)) {
55 return -1;
56 }
a07cd1a4 57 for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) {
58 if ($currentArrayIndex == $msgs[$key]['ID']) {
59 next($msort);
60 $key = key($msort);
1fca12b5 61 if (isset($key)){
a07cd1a4 62 $result = $msgs[$key]['ID'];
63 break;
1fca12b5 64 }
10f0ce72 65 }
66 }
10f0ce72 67 }
a07cd1a4 68 return ($result);
69}
70
1fca12b5 71/**
72 * Removes just one address from the list of addresses.
73 *
74 * @param &$addr_list a by-ref array of addresses
75 * @param $addr an address to remove
76 * @return void, since it operates on a by-ref param
77 */
a07cd1a4 78function RemoveAddress(&$addr_list, $addr) {
79 if ($addr != '') {
80 foreach (array_keys($addr_list, $addr) as $key_to_delete) {
81 unset($addr_list[$key_to_delete]);
10f0ce72 82 }
a07cd1a4 83 }
84}
85
86/** returns the index of the previous message from the array. */
87function findPreviousMessage() {
57257333 88 global $msort, $currentArrayIndex, $sort, $msgs, $imapConnection,
cf710efe 89 $mailbox, $data_dir, $username, $thread_sort_messages,
60a3e687 90 $allow_server_sort, $server_sort_array;
a07cd1a4 91 $result = -1;
cf710efe 92 if ($thread_sort_messages == 1 || $allow_server_sort == 'true') {
60a3e687 93 reset($server_sort_array);
94 while(list($key, $value) = each ($server_sort_array)) {
95 if ($currentArrayIndex == $value) {
96 if ($key == 0) {
97 $result = -1;
98 break;
99 }
100 $result = $server_sort_array[$key -1];
101 break;
789b4d79 102 }
60a3e687 103 }
789b4d79 104 }
cf710efe 105 elseif ($sort == 6 && $allow_server_sort != 'true' &&
106 $thread_sort_messages != 1) {
a07cd1a4 107 $numMessages = sqimap_get_num_messages($imapConnection, $mailbox);
108 if ($currentArrayIndex != $numMessages) {
109 $result = $currentArrayIndex + 1;
110 }
60a3e687 111 }
cf710efe 112 elseif ($thread_sort_messages != 1 && $allow_server_sort != 'true') {
1fca12b5 113 if (!is_array($msort)) {
75ef78d8 114 return -1;
1fca12b5 115 }
a07cd1a4 116 for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) {
117 if ($currentArrayIndex == $msgs[$key]['ID']) {
118 prev($msort);
119 $key = key($msort);
120 if (isset($key)) {
121 $result = $msgs[$key]['ID'];
122 break;
10f0ce72 123 }
124 }
10f0ce72 125 }
a07cd1a4 126 }
127 return ($result);
128}
10f0ce72 129
a07cd1a4 130/**
1fca12b5 131 * Displays a link to a page where the message is displayed more
132 * "printer friendly".
133 */
a07cd1a4 134function printer_friendly_link() {
57257333 135 global $passed_id, $mailbox, $ent_num, $color,
136 $pf_subtle_link,
137 $javascript_on;
a07cd1a4 138
139 if (strlen(trim($mailbox)) < 1) {
140 $mailbox = 'INBOX';
141 }
10f0ce72 142
57257333 143 $params = '?passed_ent_id=' . $ent_num .
1fca12b5 144 '&mailbox=' . urlencode($mailbox) .
145 '&passed_id=' . $passed_id;
10f0ce72 146
a07cd1a4 147 $print_text = _("View Printable Version");
10f0ce72 148
a07cd1a4 149 if (!$pf_subtle_link) {
150 /* The link is large, on the bottom of the header panel. */
1fca12b5 151 $result = '<tr bgcolor="' . $color[0] . '">' .
152 '<td class="medText" align="right" valign="top">' .
153 '&nbsp;' .
154 '</td><td class="medText" valign="top" colspan="2">'."\n";
a07cd1a4 155 } else {
156 /* The link is subtle, below "view full header". */
157 $result = "<BR>\n";
158 }
10f0ce72 159
a07cd1a4 160 /* Output the link. */
161 if ($javascript_on) {
3d570ba0 162 $result .= '<script language="javascript" type="text/javascript">' . "\n" .
a07cd1a4 163 '<!--' . "\n" .
164 " function printFormat() {\n" .
165 ' window.open("../src/printer_friendly_main.php' .
166 $params . '","Print","width=800,height=600");' . "\n".
167 " }\n" .
168 "// -->\n" .
169 "</script>\n" .
170 "<A HREF=\"javascript:printFormat();\">$print_text</A>\n";
171 } else {
172 $result .= '<A TARGET="_blank" HREF="../src/printer_friendly_bottom.php' .
173 "$params\">$print_text</A>\n";
174 }
10f0ce72 175
a07cd1a4 176 if (!$pf_subtle_link) {
177 /* The link is large, on the bottom of the header panel. */
57257333 178 $result .= '</td></tr>' . "\n";
10f0ce72 179 }
180
a07cd1a4 181 return ($result);
182}
183
57257333 184function ServerMDNSupport( $read ) {
f69feefe 185 /* escaping $ doesn't work -> \x36 */
186 $ret = preg_match( '/(\x36MDNSent|\\\*)/i', $read );
57257333 187 return ( $ret );
188}
189
190function SendMDN ( $recipient , $sender) {
191 global $imapConnection, $mailbox, $username, $attachment_dir, $SERVER_NAME,
192 $version, $attachments, $identity, $data_dir, $passed_id;
193
99fbb343 194 $header = sqimap_get_message_header($imapConnection, $passed_id, $mailbox);
57257333 195 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
196
197 // part 1 (RFC2298)
198
199 $senton = getLongDateString( $header->date );
200 $to_array = $header->to;
201 $to = '';
202 foreach ($to_array as $line) {
203 $to .= " $line ";
204 }
205
206 $subject = $header->subject;
207 $now = getLongDateString( time() );
46bb8da8 208
78db1583 209 set_my_charset();
210
46bb8da8 211 $body = _("Your message") . "\r\n\r\n" .
212 "\t" . _("To:") . ' ' . $to . "\r\n" .
213 "\t" . _("Subject:") . ' ' . $subject . "\r\n" .
214 "\t" . _("Sent:") . ' ' . $senton . "\r\n" .
215 "\r\n" .
216 sprintf( _("Was displayed on %s"), $now );
f69feefe 217
57257333 218 // part2 (RFC2298)
219
220 $original_recipient = $to;
221 $original_message_id = $header->message_id;
222
223 $part2 = "Reporting-UA : $SERVER_NAME ; SquirrelMail (version $version) \r\n";
224 if ($original_recipient != '') {
225 $part2 .= "Original-Recipient : $original_recipient\r\n";
226 }
227 $final_recipient = $sender;
228 $part2 .= "Final-Recipient: rfc822; $final_recipient\r\n" .
229 "Original-Message-ID : $original_message_id\r\n" .
230 "Disposition: manual-action/MDN-sent-manually; displayed\r\n";
231
232
233 $localfilename = GenerateRandomString(32, 'FILE', 7);
234 $full_localfilename = "$hashed_attachment_dir/$localfilename";
235
236 $fp = fopen( $full_localfilename, 'w');
237 fwrite ($fp, $part2);
238 fclose($fp);
239
240 $newAttachment = array();
241 $newAttachment['localfilename'] = $localfilename;
242 $newAttachment['type'] = "message/disposition-notification";
aa866a40 243 $newAttachment['session']=-1;
57257333 244 $attachments[] = $newAttachment;
245 $MDN_to = trim($recipient);
246 $reply_id = 0;
247
1fca12b5 248 return (SendMessage($MDN_to, '', '', _("Read:") . ' ' . $subject,
249 $body, $reply_id, True, 3, -1) );
57257333 250}
251
252
253function ToggleMDNflag ( $set ) {
77b88425 254 global $imapConnection, $passed_id, $mailbox;
f69feefe 255 sqimap_mailbox_select($imapConnection, $mailbox);
0892e427 256
257 $sg = $set?'+':'-';
258 $cmd = 'STORE ' . $passed_id . ' ' . $sg . 'FLAGS ($MDNSent)';
0892e427 259 $read = sqimap_run_command ($imapConnection, $cmd, true, $response,
260 $readmessage);
57257333 261}
262
263function ClearAttachments() {
264 global $username, $attachments, $attachment_dir;
265
266 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
267
aa866a40 268 $rem_attachments = array();
57257333 269 foreach ($attachments as $info) {
aa866a40 270 if ($info->session == -1) {
271 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
272 if (file_exists($attached_file)) {
273 unlink($attached_file);
274 }
275 } else {
276 $rem_attachments[] = $info;
277 }
278 }
279 $attachments = rem_attachments;
57257333 280}
281
4d0cd98b 282function formatRecipientString($recipients, $item ) {
1fca12b5 283 global $base_uri, $passed_id, $urlMailbox, $startMessage, $show_more_cc,
284 $echo_more, $echo_less, $show_more, $show_more_bcc, $sort;
4d0cd98b 285
286 $i = 0;
287 $url_string = '';
288
289 if (isset ($recipients[0]) && trim($recipients[0])) {
1fca12b5 290 $string = '';
4d0cd98b 291 $ary = $recipients;
292
1fca12b5 293 switch ($item) {
4d0cd98b 294 case 'to':
1fca12b5 295 $show = "&amp;show_more=1&amp;show_more_cc=$show_more_cc&amp;".
296 "show_more_bcc=$show_more_bcc";
297 $show_n = "&amp;show_more=0&amp;show_more_cc=$show_more_cc&amp;".
298 "show_more_bcc=$show_more_bcc";
299 break;
4d0cd98b 300 case 'cc':
1fca12b5 301 $show = "&amp;show_more=$show_more&amp;show_more_cc=1&amp;".
302 "show_more_bcc=$show_more_bcc";
303 $show_n = "&amp;show_more=$show_more&amp;show_more_cc=0&amp;".
304 "show_more_bcc=$show_more_bcc";
305 $show_more = $show_more_cc;
306 break;
4d0cd98b 307 case 'bcc':
1fca12b5 308 $show = "&amp;show_more=$show_more&amp;show_more_cc=$show_more_cc".
309 "&amp;show_more_bcc=1";
310 $show_n = "&amp;show_more=$show_more&amp;show_more_cc=".
311 "$show_more_cc&amp;show_more_bcc=0";
312 $show_more = $show_more_bcc;
313 break;
4d0cd98b 314 default:
1fca12b5 315 $break;
316 }
317
318 while ($i < count($ary)) {
319 $ary[$i] = decodeHeader(htmlspecialchars($ary[$i]));
4d0cd98b 320 $url_string .= $ary[$i];
321 if ($string) {
1fca12b5 322 $string = "$string<BR>$ary[$i]";
4d0cd98b 323 } else {
1fca12b5 324 $string = "$ary[$i]";
4d0cd98b 325 }
326
327 $i++;
328 if (count($ary) > 1) {
1fca12b5 329 if ($show_more == false) {
4d0cd98b 330 if ($i == 1) {
1fca12b5 331 /* From a search... */
332 $string .= '&nbsp;(<A HREF="' . $base_uri .
333 "src/read_body.php?mailbox=$urlMailbox&amp;".
334 "passed_id=$passed_id&amp;";
335 if (isset($where) && isset($what)) {
336 $string .= 'what=' . urlencode($what).
337 "&amp;where=".urlencode($where).
338 "$show\">$echo_more</A>)";
339 } else {
340 $string .= "sort=$sort&amp;startMessage=".
341 "$startMessage"."$show\">$echo_more</A>)";
342 }
343 $i = count($ary);
4d0cd98b 344 }
1fca12b5 345 } else if ($i == 1) {
4d0cd98b 346 /* From a search... */
347 $string .= '&nbsp;(<A HREF="' . $base_uri .
1fca12b5 348 "src/read_body.php?mailbox=$urlMailbox&amp;".
349 "passed_id=$passed_id&amp;";
4d0cd98b 350 if (isset($where) && isset($what)) {
1fca12b5 351 $string .= 'what=' . urlencode($what).
352 "&amp;where=".urlencode($where).
353 "$show_n\">$echo_less</A>)";
4d0cd98b 354 } else {
1fca12b5 355 $string .= "sort=$sort&amp;startMessage=$startMessage".
356 "$show_n\">$echo_less</A>)";
4d0cd98b 357 }
1fca12b5 358 }
4d0cd98b 359 }
1fca12b5 360 }
4d0cd98b 361 }
362 else {
1fca12b5 363 $string = '';
4d0cd98b 364 }
365 $url_string = urlencode($url_string);
366 $result = array();
367 $result['str'] = $string;
368 $result['url_str'] = $url_string;
369 return $result;
370}
371
372
57257333 373
374/*
375 * Main of read_boby.php --------------------------------------------------
376 */
377
378/*
379 Urled vars
380 ----------
381 $passed_id
382*/
a07cd1a4 383
1fca12b5 384if (isset($mailbox)){
4366bea4 385 $mailbox = urldecode( $mailbox );
386}
1fca12b5 387$imapConnection = sqimap_login($username, $key, $imapServerAddress,
388 $imapPort, 0);
650be221 389$read = sqimap_mailbox_select($imapConnection, $mailbox, false, false, true);
57257333 390
a07cd1a4 391do_hook('html_top');
57257333 392
393/*
394 * The following code sets necesarry stuff for the MDN thing
395 */
1fca12b5 396if($default_use_mdn &&
397 ($mdn_user_support = getPref($data_dir, $username, 'mdn_user_support',
398 $default_use_mdn))) {
399
f69feefe 400 $supportMDN = ServerMDNSupport($read["PERMANENTFLAGS"]);
57257333 401 $flags = sqimap_get_flags ($imapConnection, $passed_id);
650be221 402 $FirstTimeSee = !(in_array( 'Seen', $flags ));
57257333 403}
404
a07cd1a4 405displayPageHeader($color, $mailbox);
406
57257333 407
408/*
409 * The following code shows the header of the message and then exit
410 */
a07cd1a4 411if (isset($view_hdr)) {
1fca12b5 412 $read=sqimap_run_command ($imapConnection, "FETCH $passed_id BODY[HEADER]",
413 true, $a, $b);
414
a07cd1a4 415 echo '<BR>' .
1fca12b5 416 '<TABLE WIDTH="100%" CELLPADDING="2" CELLSPACING="0" BORDER="0"'.
417 ' ALIGN="CENTER">' . "\n" .
418 " <TR><TD BGCOLOR=\"$color[9]\" WIDTH=\"100%\" ALIGN=\"CENTER\"><B>".
419 _("Viewing Full Header") . '</B> - '.
420 '<a href="' . $base_uri . 'src/read_body.php?mailbox='.
421 urlencode($mailbox);
a07cd1a4 422 if (isset($where) && isset($what)) {
423 // Got here from a search
1fca12b5 424 echo "&amp;passed_id=$passed_id&amp;where=".urlencode($where).
425 "&amp;what=".urlencode($what).'">';
a07cd1a4 426 } else {
1fca12b5 427 echo "&amp;passed_id=$passed_id&amp;startMessage=$startMessage".
428 "&amp;show_more=$show_more\">";
a07cd1a4 429 }
1fca12b5 430 echo _("View message") . "</a></b></td></tr></table>\n".
431 "<table width='99%' cellpadding='2' cellspacing='0' border='0'".
432 "align=center>\n".
433 '<tr><td>';
434
a07cd1a4 435 $cnum = 0;
436 for ($i=1; $i < count($read); $i++) {
437 $line = htmlspecialchars($read[$i]);
438 if (eregi("^&gt;", $line)) {
439 $second[$i] = $line;
440 $first[$i] = '&nbsp;';
441 $cnum++;
442 } else if (eregi("^[ |\t]", $line)) {
443 $second[$i] = $line;
444 $first[$i] = '';
445 } else if (eregi("^([^:]+):(.+)", $line, $regs)) {
446 $first[$i] = $regs[1] . ':';
447 $second[$i] = $regs[2];
448 $cnum++;
0606ca1f 449 } else {
a07cd1a4 450 $second[$i] = trim($line);
451 $first[$i] = '';
10f0ce72 452 }
a07cd1a4 453 }
454 for ($i=0; $i < count($second); $i = $j) {
455 if (isset($first[$i])) {
456 $f = $first[$i];
0606ca1f 457 }
a07cd1a4 458 if (isset($second[$i])) {
459 $s = nl2br($second[$i]);
460 }
461 $j = $i + 1;
462 while (($first[$j] == '') && ($j < count($first))) {
463 $s .= '&nbsp;&nbsp;&nbsp;&nbsp;' . nl2br($second[$j]);
464 $j++;
0606ca1f 465 }
a07cd1a4 466 parseEmail($s);
1190197c 467 if (isset($f)) {
7e235a1a 468 echo "<nobr><tt><b>$f</b>$s</tt></nobr>";
1190197c 469 }
10f0ce72 470 }
57257333 471 echo "</td></tr></table>\n" .
1fca12b5 472 '</body></html>';
a07cd1a4 473 sqimap_logout($imapConnection);
474 exit;
475}
476
477if (isset($msgs)) {
478 $currentArrayIndex = $passed_id;
479} else {
480 $currentArrayIndex = -1;
481}
482
483for ($i = 0; $i < count($msgs); $i++) {
484 if ($msgs[$i]['ID'] == $passed_id) {
485 $msgs[$i]['FLAG_SEEN'] = true;
10f0ce72 486 }
a07cd1a4 487}
488
1fca12b5 489/**
490 * $message contains all information about the message
491 * including header and body
492 */
a07cd1a4 493$message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
494
495/** translate the subject and mailbox into url-able text **/
496$url_subj = urlencode(trim($message->header->subject));
497$urlMailbox = urlencode($mailbox);
498$url_replyto = '';
499if (isset($message->header->replyto)) {
500 $url_replyto = urlencode($message->header->replyto);
501}
502
1fca12b5 503$url_replytoall = $url_replyto;
a07cd1a4 504
1fca12b5 505/**
506 * If we are replying to all, then find all other addresses and
507 * add them to the list. Remove duplicates.
508 * This is somewhat messy, so I'll explain:
509 * 1) Take all addresses (from, to, cc) (avoid nasty join errors here)
510 */
a07cd1a4 511$url_replytoall_extra_addrs = array_merge(
1fca12b5 512 array($message->header->from),
513 $message->header->to,
514 $message->header->cc
515 );
a07cd1a4 516
1fca12b5 517/**
518 * 2) Make one big string out of them
519 */
a07cd1a4 520$url_replytoall_extra_addrs = join(';', $url_replytoall_extra_addrs);
521
1fca12b5 522/**
523 * 3) Parse that into an array of addresses
524 */
a07cd1a4 525$url_replytoall_extra_addrs = parseAddrs($url_replytoall_extra_addrs);
526
1fca12b5 527/**
528 * 4) Make them unique -- weed out duplicates
529 * (Coded for PHP 4.0.0)
530 */
a07cd1a4 531$url_replytoall_extra_addrs =
532 array_keys(array_flip($url_replytoall_extra_addrs));
533
1fca12b5 534/**
535 * 5) Remove the addresses we'll be sending the message 'to'
536 */
a07cd1a4 537$url_replytoall_avoid_addrs = '';
538if (isset($message->header->replyto)) {
539 $url_replytoall_avoid_addrs = $message->header->replyto;
540}
541
542$url_replytoall_avoid_addrs = parseAddrs($url_replytoall_avoid_addrs);
543foreach ($url_replytoall_avoid_addrs as $addr) {
544 RemoveAddress($url_replytoall_extra_addrs, $addr);
545}
546
1fca12b5 547/**
548 * 6) Remove our identities from the CC list (they still can be in the
549 * TO list) only if $include_self_reply_all is turned off
550 */
a07cd1a4 551if (!$include_self_reply_all) {
552 RemoveAddress($url_replytoall_extra_addrs,
1fca12b5 553 getPref($data_dir, $username, 'email_address'));
a07cd1a4 554 $idents = getPref($data_dir, $username, 'identities');
555 if ($idents != '' && $idents > 1) {
556 for ($i = 1; $i < $idents; $i ++) {
1fca12b5 557 $cur_email_address = getPref($data_dir, $username,
558 'email_address' . $i);
a07cd1a4 559 RemoveAddress($url_replytoall_extra_addrs, $cur_email_address);
10f0ce72 560 }
692155b7 561 }
a07cd1a4 562}
1108e8bb 563
1fca12b5 564/**
565 * 7) Smoosh back into one nice line
566 */
a07cd1a4 567$url_replytoallcc = getLineOfAddrs($url_replytoall_extra_addrs);
692155b7 568
1fca12b5 569/**
570 * 8) urlencode() it
571 */
a07cd1a4 572$url_replytoallcc = urlencode($url_replytoallcc);
be69e508 573
a07cd1a4 574$dateString = getLongDateString($message->header->date);
5bc39e3f 575
1fca12b5 576/**
577 * What do we reply to -- text only, if possible
578 */
a07cd1a4 579$ent_num = findDisplayEntity($message);
5bc39e3f 580
a07cd1a4 581/** TEXT STRINGS DEFINITIONS **/
582$echo_more = _("more");
583$echo_less = _("less");
584
57257333 585if (!isset($show_more_cc)) {
586 $show_more_cc = FALSE;
587}
10f0ce72 588
4d0cd98b 589if (!isset($show_more_bcc)) {
590 $show_more_bcc = FALSE;
a07cd1a4 591}
4d0cd98b 592
593/** FORMAT THE TO STRING **/
594$to = formatRecipientString($message->header->to, "to");
595$to_string = $to['str'];
596$url_to_string = $to['url_str'];
dfd93ee7 597
a07cd1a4 598
599/** FORMAT THE CC STRING **/
10f0ce72 600
4d0cd98b 601$cc = formatRecipientString($message->header->cc, "cc");
602$cc_string = $cc['str'];
603$url_cc_string = $cc['url_str'];
a07cd1a4 604
605/** FORMAT THE BCC STRING **/
10f0ce72 606
4d0cd98b 607$bcc = formatRecipientString($message->header->bcc, "bcc");
608$bcc_string = $bcc['str'];
609$url_bcc_string = $bcc['url_str'];
10f0ce72 610
a07cd1a4 611if ($default_use_priority) {
a7818e8e 612 $priority_level = substr($message->header->priority,0,1);
613
614 switch($priority_level) {
09278ebf 615 /* check for a higher then normal priority. */
616 case '1':
5be9f195 617 case '2':
618 $priority_string = _("High");
09278ebf 619 break;
620
621 /* check for a lower then normal priority. */
622 case '4':
5be9f195 623 case '5':
624 $priority_string = _("Low");
09278ebf 625 break;
5be9f195 626
09278ebf 627 /* check for a normal priority. */
5be9f195 628 case '3':
09278ebf 629 default:
630 $priority_level = '3';
5be9f195 631 $priority_string = _("Normal");
09278ebf 632 break;
5be9f195 633
10f0ce72 634 }
a07cd1a4 635}
636
637/** make sure everything will display in HTML format **/
638$from_name = decodeHeader(htmlspecialchars($message->header->from));
639$subject = decodeHeader(htmlspecialchars($message->header->subject));
fa77d354 640$identity = '';
641$idents = getPref($data_dir, $username, 'identities');
642if (!empty($idents) && $idents > 1) {
643 for ($i = 1; $i < $idents; $i++) {
1fca12b5 644 $enc_from_name = '"'.
645 encodeHeader(getPref($data_dir,
646 $username,
647 'full_name' . $i)) .
648 '" <' . getPref($data_dir, $username,
649 'email_address' . $i) . '>';
650 if (htmlspecialchars($enc_from_name) == $from_name) {
fa77d354 651 $identity = $i;
652 break;
653 }
654 }
655}
a07cd1a4 656
657do_hook('read_body_top');
658echo '<BR>' .
57257333 659 '<TABLE CELLSPACING="0" WIDTH="100%" BORDER="0" ALIGN="CENTER" CELLPADDING="0">' .
660 '<TR><TD BGCOLOR="' . $color[9] . '" WIDTH="100%">' .
661 '<TABLE WIDTH="100%" CELLSPACING="0" BORDER="0" CELLPADDING="3">' .
662 '<TR>' .
663 '<TD ALIGN="LEFT" WIDTH="33%">' .
664 '<SMALL>' .
665 '<A HREF="' . $base_uri . 'src/';
a07cd1a4 666
667if ($where && $what) {
c52c873e 668 if ($pos == '') {
669 $pos=0;
10f0ce72 670 }
c52c873e 671 echo "search.php?where=".urlencode($where)."&amp;pos=$pos&amp;what=".urlencode($what)."&amp;mailbox=$urlMailbox\">";
a07cd1a4 672} else {
3d570ba0 673 echo "right_main.php?sort=$sort&amp;startMessage=$startMessage&amp;mailbox=$urlMailbox\">";
a07cd1a4 674}
675echo _("Message List") .
676 '</A>&nbsp;|&nbsp;' .
3d570ba0 677 '<A HREF="' . $base_uri . "src/delete_message.php?mailbox=$urlMailbox&amp;message=$passed_id&amp;";
a07cd1a4 678if ($where && $what) {
3d570ba0 679 echo 'where=' . urlencode($where) . '&amp;what=' . urlencode($what) . '">';
a07cd1a4 680} else {
3d570ba0 681 echo "sort=$sort&amp;startMessage=$startMessage\">";
a07cd1a4 682}
683echo _("Delete") . '</A>&nbsp;';
684if (($mailbox == $draft_folder) && ($save_as_draft)) {
685 echo '|&nbsp;<A HREF="' . $base_uri .
fa77d354 686 "src/compose.php?mailbox=$mailbox&amp;identity=$identity&amp;send_to=$url_to_string&amp;send_to_cc=$url_cc_string&amp;send_to_bcc=$url_bcc_string&amp;subject=$url_subj&amp;mailprio=$priority_level&amp;draft_id=$passed_id&amp;ent_num=$ent_num" . '"';
9c3e6cd4 687 if ($compose_new_win == '1') {
fa77d354 688 echo ' TARGET="compose_window" onClick="comp_in_new()"';
9c3e6cd4 689 }
690 echo '>'.
a07cd1a4 691 _("Resume Draft") . '</a>';
692}
fa77d354 693if ($mailbox == $sent_folder) {
694 echo '|&nbsp;<A HREF="' . $base_uri .
695 "src/compose.php?mailbox=$mailbox&amp;identity=$identity&amp;send_to=$url_to_string&amp;send_to_cc=$url_cc_string&amp;send_to_bcc=$url_bcc_string&amp;subject=$url_subj&amp;mailprio=$priority_level&amp;draft_id=$passed_id&amp;ent_num=$ent_num" . '"';
696 if ($compose_new_win == '1') {
697 echo ' TARGET="compose_window" onClick="comp_in_new()"';
698 }
699 echo '>'.
700 _("Edit Message as New") . '</a>';
701}
a07cd1a4 702
703echo '&nbsp;&nbsp;' .
57257333 704 '</SMALL>' .
705 '</TD>' .
706 '<TD WIDTH="33%" ALIGN="CENTER">' .
707 '<SMALL>';
a07cd1a4 708
709if ( !($where && $what) ) {
a07cd1a4 710 if ($currentArrayIndex == -1) {
711 echo 'Previous&nbsp;|&nbsp;Next';
10f0ce72 712 } else {
a07cd1a4 713 $prev = findPreviousMessage();
714 $next = findNextMessage();
10f0ce72 715
a07cd1a4 716 if ($prev != -1) {
3d570ba0 717 echo '<a href="' . $base_uri . "src/read_body.php?passed_id=$prev&amp;mailbox=$urlMailbox&amp;sort=$sort&amp;startMessage=$startMessage&amp;show_more=0\">" . _("Previous") . "</A>&nbsp;|&nbsp;";
10f0ce72 718 } else {
a07cd1a4 719 echo _("Previous") . '&nbsp;|&nbsp;';
10f0ce72 720 }
7baf86a9 721
a07cd1a4 722 if ($next != -1) {
3d570ba0 723 echo '<a href="' . $base_uri . "src/read_body.php?passed_id=$next&amp;mailbox=$urlMailbox&amp;sort=$sort&amp;startMessage=$startMessage&amp;show_more=0\">" . _("Next") . "</A>";
a07cd1a4 724 } else {
725 echo _("Next");
726 }
10f0ce72 727 }
a07cd1a4 728}
729
57257333 730echo '</SMALL>' .
731 '</TD><TD WIDTH="33%" ALIGN="RIGHT">' .
732 '<SMALL>' .
3d570ba0 733 '<A HREF="' . $base_uri . "src/compose.php?forward_id=$passed_id&amp;forward_subj=$url_subj&amp;".
1190197c 734 ($default_use_priority?"mailprio=$priority_level&amp;":'')
3d570ba0 735 ."mailbox=$urlMailbox&amp;ent_num=$ent_num\"";
9c3e6cd4 736 if ($compose_new_win == '1') {
737 echo 'TARGET="compose_window" onClick="comp_in_new()"';
738 }
739 echo '>'.
a07cd1a4 740 _("Forward") .
741 '</A>&nbsp;|&nbsp;' .
3d570ba0 742 '<A HREF="' . $base_uri . "src/compose.php?send_to=$url_replyto&amp;reply_subj=$url_subj&amp;".
1190197c 743 ($default_use_priority?"mailprio=$priority_level&amp;":'').
3d570ba0 744 "reply_id=$passed_id&amp;mailbox=$urlMailbox&amp;ent_num=$ent_num\"";
9c3e6cd4 745 if ($compose_new_win == '1') {
746 echo 'TARGET="compose_window" onClick="comp_in_new()"';
747 }
748 echo '>'.
a07cd1a4 749 _("Reply") .
750 '</A>&nbsp;|&nbsp;' .
3d570ba0 751 '<A HREF="' . $base_uri . "src/compose.php?send_to=$url_replytoall&amp;send_to_cc=$url_replytoallcc&amp;reply_subj=$url_subj&amp;".
1190197c 752 ($default_use_priority?"mailprio=$priority_level&amp;":'').
3d570ba0 753 "reply_id=$passed_id&amp;mailbox=$urlMailbox&amp;ent_num=$ent_num\"";
9c3e6cd4 754 if ($compose_new_win == '1') {
755 echo 'TARGET="compose_window" onClick="comp_in_new()"';
756 }
757 echo '>'.
a07cd1a4 758 _("Reply All") .
759 '</A>&nbsp;&nbsp;' .
57257333 760 '</SMALL>' .
761 '</TD>' .
762 '</TR>' .
763 '</TABLE>' .
764 '</TD></TR>' .
3d570ba0 765 '<TR><TD WIDTH="100%">' .
57257333 766 '<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="3">' . "\n" .
767 '<TR>' . "\n";
a07cd1a4 768
769/** subject **/
57257333 770echo "<TD BGCOLOR=\"$color[0]\" WIDTH=\"10%\" ALIGN=\"right\" VALIGN=\"top\">\n" .
a07cd1a4 771 _("Subject:") .
57257333 772 "</TD><TD BGCOLOR=\"$color[0]\" WIDTH=\"80%\" VALIGN=\"top\">\n" .
773 "<B>$subject</B>&nbsp;\n" .
774 "</TD>\n" .
775 '<TD ROWSPAN="4" width="10%" BGCOLOR="' . $color[0] .
a07cd1a4 776 '" ALIGN=right VALIGN=top NOWRAP><small>'.
3d570ba0 777 '<A HREF="' . $base_uri . "src/read_body.php?mailbox=$urlMailbox&amp;passed_id=$passed_id&amp;";
a07cd1a4 778
779/* From a search... */
780if ($where && $what) {
3d570ba0 781 echo 'where=' . urlencode($where) . '&amp;what=' . urlencode($what) .
782 "&amp;view_hdr=1\">" . _("View Full Header") . "</A>\n";
a07cd1a4 783} else {
3d570ba0 784 echo "startMessage=$startMessage&amp;show_more=$show_more&amp;view_hdr=1\">" .
a07cd1a4 785 _("View Full Header") . "</A>\n";
786}
787
788/* Output the printer friendly link if we are in subtle mode. */
789if ($pf_subtle_link) {
790 echo printer_friendly_link(true);
791}
792
793do_hook("read_body_header_right");
57257333 794echo '</small></TD>' .
795 ' </TR>';
a07cd1a4 796
797/** from **/
57257333 798echo '<TR>' .
799 '<TD BGCOLOR="' . $color[0] . '" ALIGN="RIGHT">' .
a07cd1a4 800 _("From:") .
57257333 801 '</TD><TD BGCOLOR="' . $color[0] . '">' .
802 "<B>$from_name</B>&nbsp;\n" .
803 '</TD>' .
804 '</TR>';
a07cd1a4 805/** date **/
57257333 806echo '<TR>' . "\n" .
807 '<TD BGCOLOR="' . $color[0] . '" ALIGN="RIGHT">' . "\n" .
a07cd1a4 808 _("Date:") .
57257333 809 "</TD><TD BGCOLOR=\"$color[0]\">\n" .
810 "<B>$dateString</B>&nbsp;\n" .
811 '</TD>' . "\n" .
812 '</TR>' . "\n";
a07cd1a4 813
814/** to **/
57257333 815echo "<TR>\n" .
816 "<TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>\n" .
a07cd1a4 817 _("To:") .
57257333 818 '</TD><TD BGCOLOR="' . $color[0] . '" VALIGN="TOP">' . "\n" .
819 "<B>$to_string</B>&nbsp;\n" .
820 '</TD>' . "\n" .
821 '</TR>' . "\n";
a07cd1a4 822/** cc **/
9e9ad58b 823if (isset($cc_string) && $cc_string <> '') {
57257333 824 echo '<TR>' .
825 "<TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>" .
826 'Cc:' .
827 "</TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>" .
828 "<B>$cc_string</B>&nbsp;" .
829 '</TD>' .
830 '</TR>' . "\n";
a07cd1a4 831}
832
833/** bcc **/
9e9ad58b 834if (isset($bcc_string) && $bcc_string <> '') {
57257333 835 echo '<TR>'.
836 "<TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>" .
837 'Bcc:' .
838 "</TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>" .
839 "<B>$bcc_string</B>&nbsp;" .
840 '</TD>' .
841 '</TR>' . "\n";
a07cd1a4 842}
9e9ad58b 843if ($default_use_priority && isset($priority_string) && $priority_string <> '' ) {
844 echo '<TR>' .
845 "<TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>" .
846 _("Priority") . ': '.
847 "</TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>" .
848 "<B>$priority_string</B>&nbsp;" .
849 '</TD>' .
850 "</TR>" . "\n";
a07cd1a4 851}
852
853if ($show_xmailer_default) {
451a5790 854 $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY.PEEK[HEADER.FIELDS (X-Mailer User-Agent)]", true,
a07cd1a4 855 $response, $readmessage);
856 $mailer = substr($read[1], strpos($read[1], " "));
857 if (trim($mailer)) {
57257333 858 echo '<TR>' .
859 "<TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>" .
860 _("Mailer") . ': '.
861 "</TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>" .
862 "<B>$mailer</B>&nbsp;" .
863 '</TD>' .
864 "</TR>" . "\n";
10f0ce72 865 }
a07cd1a4 866}
867
868/* Output the printer friendly link if we are not in subtle mode. */
869if (!$pf_subtle_link) {
870 echo printer_friendly_link(true);
871}
872
57257333 873if ($default_use_mdn) {
874 if ($mdn_user_support) {
875
876 // debug gives you the capability to remove mdn-flags
1190197c 877 // $MDNDebug = false;
57257333 878 $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY.PEEK[HEADER.FIELDS (Disposition-Notification-To)]", true,
879 $response, $readmessage);
880 $MDN_to = substr($read[1], strpos($read[1], ' '));
881 $MDN_flag_present = false;
882
883 $read = sqimap_run_command ($imapConnection, "FETCH $passed_id FLAGS", true,
884 $response, $readmessage);
77b88425 885
886 $MDN_flag_present = preg_match( '/.*\$MDNSent/i', $read[0]);
887
57257333 888 if (trim($MDN_to) &&
889 (!isset( $sendreceipt ) || $sendreceipt == '' ) ) {
890
891 if ( $MDN_flag_present && $supportMDN) {
77b88425 892 $sendreceipt = 'removeMDN';
3d570ba0 893 $url = "\"read_body.php?mailbox=$mailbox&amp;passed_id=$passed_id&amp;startMessage=$startMessage&amp;show_more=$show_more&amp;sendreceipt=$sendreceipt\"";
1190197c 894 $sendreceipt='';
895 /*
650be221 896 if ($MDNDebug ) {
57257333 897 echo '<TR>' .
898 "<TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>" .
899 _("Read receipt") . ': ' .
900 "</TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>" .
901 '<B>' .
902 _("send") .
903 "</B> <a href=$url>[" . _("Remove MDN flag") . '] </a>' .
904 '</TD>' .
905 '</TR>' . "\n";
906 } else {
1190197c 907 */
908 echo '<TR>' .
909 "<TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>" .
910 _("Read receipt") . ': ' .
911 "</TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>" .
912 '<B>'._("send").'</B>'.
913 '</TD>' .
914 '</TR>' . "\n";
915 /*
57257333 916 }
1190197c 917 */
57257333 918
919 } // when deleted or draft flag is set don't offer to send a MDN response
f69feefe 920 else if ( ereg('\\Draft',$read[0] || ereg('\\Deleted',$read[0])) ) {
57257333 921 echo '<TR>' .
922 "<TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>" .
923 _("Read receipt") . ': '.
924 "</TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>" .
925 '<B>' . _("requested") . "</B>" .
926 '</TD>' .
927 '</TR>' . "\n";
928 }
929 // if no MDNsupport don't use the annoying popup messages
930 else if ( !$FirstTimeSee ) {
931 $sendreceipt = 'send';
3b1410d9 932 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
57257333 933 echo '<TR>' .
934 "<TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>" .
935 _("Read receipt") . ': ' .
936 "</TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>" .
937 '<B>' . _("requested") .
938 "</B> &nbsp; <a href=$url>[" . _("Send read receipt now") . "]</a>" .
939 '</TD>' .
940 '</TR>' . "\n";
941 $sendreceipt='';
942 }
943 else {
944 $sendreceipt = 'send';
3b1410d9 945 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
57257333 946 if ($javascript_on) {
3d570ba0 947 echo "<script language=\"javascript\" type=\"text/javascript\"> \n" .
57257333 948 '<!-- ' . "\n" .
949 " if (window.confirm(\"" .
950 _("The message sender has requested a response to indicate that you have read this message. Would you like to send a receipt?") .
951 "\")) { \n" .
952 " window.location=($url); \n" .
953 ' window.reload()' . "\n" .
954 ' }' . "\n" .
955 '// -->' . "\n" .
956 '</script>' . "\n";
957 }
958 echo '<TR>' .
959 "<TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>" .
960 _("Read receipt") . ': ' .
961 "</TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>" .
962 '<B>' . _("requested") . "&nbsp&nbsp</B><a href=$url>" . '[' .
963 _("Send read receipt now") . '] </a>' ." \n" .
964 '</TD>' .
965 '</TR>' . "\n";
966 $sendreceipt = '';
967 }
968 }
969
77b88425 970 if ( !isset( $sendreceipt ) || $sendreceipt == '' ) {
57257333 971 } else if ( $sendreceipt == 'send' ) {
972 if ( !$MDN_flag_present) {
973 if (isset($identity) ) {
77b88425 974 $final_recipient = getPref($data_dir, $username, 'email_address' . '0', '' );
975 } else {
976 $final_recipient = getPref($data_dir, $username, 'email_address', '' );
977 }
57257333 978
979 $final_recipient = trim($final_recipient);
980 if ($final_recipient == '' ) {
77b88425 981 $final_recipient = getPref($data_dir, $username, 'email_address', '' );
57257333 982 }
983
77b88425 984 if ( SendMDN( $MDN_to, $final_recipient ) > 0 && $supportMDN ) {
985 ToggleMDNflag( true);
57257333 986 }
987 }
988 $sendreceipt = 'removeMDN';
3d570ba0 989 $url = "\"read_body.php?mailbox=$mailbox&amp;passed_id=$passed_id&amp;startMessage=$startMessage&amp;show_more=$show_more&amp;sendreceipt=$sendreceipt\"";
1190197c 990 $sendreceipt='';
7e235a1a 991 /*
650be221 992 if ($MDNDebug && $supportMDN) {
57257333 993 echo " <TR>\n" .
994 " <TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>\n" .
995 " "._("Read receipt").": \n".
996 " </TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>\n" .
997 ' <B>'._("send").'</B>'." <a href=$url>" . '[' . _("Remove MDN flag") . '] </a>' . "\n" .
998 ' </TD>' . "\n" .
999 ' </TR>' . "\n";
1000 } else {
1190197c 1001 */
57257333 1002 echo " <TR>\n" .
1003 " <TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>\n" .
1004 " "._("Read receipt").": \n".
1005 " </TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>\n" .
1006 ' <B>'._("send").'</B>'. "\n" .
1007 ' </TD>' . "\n" .
1008 ' </TR>' . "\n";
1190197c 1009 /*
57257333 1010 }
1190197c 1011 */
57257333 1012 }
1013 elseif ($sendreceipt == 'removeMDN' ) {
1014 ToggleMDNflag ( false );
1015
1016 $sendreceipt = 'send';
3d570ba0 1017 $url = "\"read_body.php?mailbox=$mailbox&amp;passed_id=$passed_id&amp;startMessage=$startMessage&amp;show_more=$show_more&amp;sendreceipt=$sendreceipt\"";
57257333 1018 echo '<TR>'.
1019 "<TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>" .
1020 _("Read receipt") . ': ' .
1021 "</TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>" .
1022 '<B>' . _("requested") .
1023 "</B> &nbsp; <a href=$url>[" . _("Send read receipt now") . "]</a>" .
1024 '</TD>' .
1025 '</TR>' . "\n";
1026 $sendreceipt = '';
1027
1028 }
1029 }
1030}
1031
5be9f195 1032do_hook('read_body_header');
57257333 1033
a07cd1a4 1034echo '</TABLE>' .
1035 ' </TD></TR>' .
1036 '</TABLE>';
1037flush();
5be9f195 1038
a07cd1a4 1039echo "<TABLE CELLSPACING=0 WIDTH=\"97%\" BORDER=0 ALIGN=CENTER CELLPADDING=0>\n" .
1040 " <TR><TD BGCOLOR=\"$color[4]\" WIDTH=\"100%\">\n" .
1041 '<BR>'.
1042 formatBody($imapConnection, $message, $color, $wrap_at).
3d570ba0 1043 '</TD></TR></TABLE>' .
a07cd1a4 1044 '<TABLE CELLSPACING="0" WIDTH="100%" BORDER="0" ALIGN="CENTER" CELLPADDING="0">' . "\n" .
1045 " <TR><TD BGCOLOR=\"$color[9]\">&nbsp;</TD></TR>" .
1046 '</TABLE>' . "\n";
1047
1048/* show attached images inline -- if pref'fed so */
5be9f195 1049if (($attachment_common_show_images) &&
a07cd1a4 1050 is_array($attachment_common_show_images_list)) {
5be9f195 1051
a07cd1a4 1052 foreach ($attachment_common_show_images_list as $img) {
5be9f195 1053 $imgurl = '../src/download.php' .
57257333 1054 '?' .
cd7b8833 1055 'passed_id=' . urlencode($img['passed_id']) .
3d570ba0 1056 '&amp;mailbox=' . urlencode($mailbox) .
1057 '&amp;passed_ent_id=' . urlencode($img['ent_id']) .
1058 '&amp;absolute_dl=true';
5be9f195 1059
a07cd1a4 1060 echo "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER>\n" .
57257333 1061 '<TR>' .
1062 '<TD>' .
1063 "<img src=\"$imgurl\">\n" .
1064 "</TD>\n" .
1065 "</TR>\n" .
a07cd1a4 1066 "</TABLE>\n";
5be9f195 1067
10f0ce72 1068 }
a07cd1a4 1069}
1070
5be9f195 1071
a07cd1a4 1072do_hook('read_body_bottom');
1073do_hook('html_bottom');
1074sqimap_logout($imapConnection);
1075?>
1076</body>
a7818e8e 1077</html>