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