This commit adds the possibility to specify system-defined css in order to
[squirrelmail.git] / src / read_body.php
1 <?php
2
3 /**
4 * read_body.php
5 *
6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
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$
13 */
14
15 require_once('../src/validate.php');
16 require_once('../functions/imap.php');
17 require_once('../functions/mime.php');
18 require_once('../functions/date.php');
19 require_once('../functions/url_parser.php');
20
21 /**
22 * Given an IMAP message id number, this will look it up in the cached
23 * and sorted msgs array and return the index. Used for finding the next
24 * and previous messages.
25 *
26 * returns the index of the next valid message from the array
27 */
28 function findNextMessage() {
29 global $msort, $currentArrayIndex, $msgs, $sort;
30 $result = -1;
31
32 if ($sort == 6) {
33 if ($currentArrayIndex != 1) {
34 $result = $currentArrayIndex - 1;
35 }
36 } else {
37 for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) {
38 if ($currentArrayIndex == $msgs[$key]['ID']) {
39 next($msort);
40 $key = key($msort);
41 if (isset($key))
42 $result = $msgs[$key]['ID'];
43 break;
44 }
45 }
46 }
47 return ($result);
48 }
49
50 /** Removes just one address from the list of addresses. */
51 function RemoveAddress(&$addr_list, $addr) {
52 if ($addr != '') {
53 foreach (array_keys($addr_list, $addr) as $key_to_delete) {
54 unset($addr_list[$key_to_delete]);
55 }
56 }
57 }
58
59 /** returns the index of the previous message from the array. */
60 function findPreviousMessage() {
61 global $msort, $currentArrayIndex, $sort, $msgs, $imapConnection;
62 global $mailbox, $data_dir, $username;
63 $result = -1;
64
65 if ($sort == 6) {
66 $numMessages = sqimap_get_num_messages($imapConnection, $mailbox);
67 if ($currentArrayIndex != $numMessages) {
68 $result = $currentArrayIndex + 1;
69 }
70 } else {
71 for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) {
72 if ($currentArrayIndex == $msgs[$key]['ID']) {
73 prev($msort);
74 $key = key($msort);
75 if (isset($key)) {
76 $result = $msgs[$key]['ID'];
77 break;
78 }
79 }
80 }
81 }
82 return ($result);
83 }
84
85 /**
86 * Displays a link to a page where the message is displayed more
87 * "printer friendly".
88 */
89 function printer_friendly_link() {
90 global $passed_id, $mailbox, $ent_num, $color;
91 global $pf_subtle_link;
92 global $javascript_on;
93
94 if (strlen(trim($mailbox)) < 1) {
95 $mailbox = 'INBOX';
96 }
97
98 $params = '?passed_ent_id=' . $ent_num;
99 $params .= '&mailbox=' . urlencode($mailbox);
100 $params .= '&passed_id=' . $passed_id;
101
102 $print_text = _("View Printable Version");
103
104 if (!$pf_subtle_link) {
105 /* The link is large, on the bottom of the header panel. */
106 $result = ' <tr bgcolor="' . $color[0] . '">' . "\n" .
107 ' <td class="medText" align="right" valign="top">' . "\n" .
108 ' &nbsp;' . "\n" .
109 ' </td><td class="medText" valign="top" colspan="2">'."\n";
110 } else {
111 /* The link is subtle, below "view full header". */
112 $result = "<BR>\n";
113 }
114
115 /* Output the link. */
116 if ($javascript_on) {
117 $result .= '<script language="javascript">' . "\n" .
118 '<!--' . "\n" .
119 " function printFormat() {\n" .
120 ' window.open("../src/printer_friendly_main.php' .
121 $params . '","Print","width=800,height=600");' . "\n".
122 " }\n" .
123 "// -->\n" .
124 "</script>\n" .
125 "<A HREF=\"javascript:printFormat();\">$print_text</A>\n";
126 } else {
127 $result .= '<A TARGET="_blank" HREF="../src/printer_friendly_bottom.php' .
128 "$params\">$print_text</A>\n";
129 }
130
131 if (!$pf_subtle_link) {
132 /* The link is large, on the bottom of the header panel. */
133 $result .= ' </td>' . "\n" .
134 ' </tr>' . "\n";
135 }
136
137 return ($result);
138 }
139
140 /*****************************/
141 /*** Main of read_boby.php ***/
142 /*****************************/
143
144 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
145 sqimap_mailbox_select($imapConnection, $mailbox);
146 do_hook('html_top');
147 displayPageHeader($color, $mailbox);
148
149 if (isset($view_hdr)) {
150 fputs ($imapConnection, sqimap_session_id() . " FETCH $passed_id BODY[HEADER]\r\n");
151 $read = sqimap_read_data ($imapConnection, sqimap_session_id(), true, $a, $b);
152
153 echo '<BR>' .
154 '<TABLE WIDTH="100%" CELLPADDING="2" CELLSPACING="0" BORDER="0" ALIGN="CENTER">' . "\n" .
155 " <TR><TD BGCOLOR=\"$color[9]\" WIDTH=\"100%\"><CENTER><B>" . _("Viewing Full Header") . '</B> - '.
156 '<a href="' . $base_uri . "src/read_body.php?mailbox=".urlencode($mailbox);
157 if (isset($where) && isset($what)) {
158 // Got here from a search
159 echo "&passed_id=$passed_id&where=".urlencode($where)."&what=".urlencode($what).'">';
160 } else {
161 echo "&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more\">";
162 }
163 echo ''._("View message") . "</a></b></center></td></tr></table>\n" .
164 "<table width=\"99%\" cellpadding=2 cellspacing=0 border=0 align=center>\n" .
165 '<tr><td>';
166
167 $cnum = 0;
168 for ($i=1; $i < count($read); $i++) {
169 $line = htmlspecialchars($read[$i]);
170 if (eregi("^&gt;", $line)) {
171 $second[$i] = $line;
172 $first[$i] = '&nbsp;';
173 $cnum++;
174 } else if (eregi("^[ |\t]", $line)) {
175 $second[$i] = $line;
176 $first[$i] = '';
177 } else if (eregi("^([^:]+):(.+)", $line, $regs)) {
178 $first[$i] = $regs[1] . ':';
179 $second[$i] = $regs[2];
180 $cnum++;
181 } else {
182 $second[$i] = trim($line);
183 $first[$i] = '';
184 }
185 }
186 for ($i=0; $i < count($second); $i = $j) {
187 if (isset($first[$i])) {
188 $f = $first[$i];
189 }
190 if (isset($second[$i])) {
191 $s = nl2br($second[$i]);
192 }
193 $j = $i + 1;
194 while (($first[$j] == '') && ($j < count($first))) {
195 $s .= '&nbsp;&nbsp;&nbsp;&nbsp;' . nl2br($second[$j]);
196 $j++;
197 }
198 parseEmail($s);
199 if (isset($f)) echo "<nobr><tt><b>$f</b>$s</tt></nobr>";
200 }
201 echo "</td></tr></table>\n";
202 echo '</body></html>';
203 sqimap_logout($imapConnection);
204 exit;
205 }
206
207 if (isset($msgs)) {
208 $currentArrayIndex = $passed_id;
209 } else {
210 $currentArrayIndex = -1;
211 }
212
213 for ($i = 0; $i < count($msgs); $i++) {
214 if ($msgs[$i]['ID'] == $passed_id) {
215 $msgs[$i]['FLAG_SEEN'] = true;
216 }
217 }
218
219 // $message contains all information about the message
220 // including header and body
221 $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
222
223 /** translate the subject and mailbox into url-able text **/
224 $url_subj = urlencode(trim($message->header->subject));
225 $urlMailbox = urlencode($mailbox);
226 $url_replyto = '';
227 if (isset($message->header->replyto)) {
228 $url_replyto = urlencode($message->header->replyto);
229 }
230
231 $url_replytoall = $url_replyto;
232
233 // If we are replying to all, then find all other addresses and
234 // add them to the list. Remove duplicates.
235 // This is somewhat messy, so I'll explain:
236 // 1) Take all addresses (from, to, cc) (avoid nasty join errors here)
237 $url_replytoall_extra_addrs = array_merge(
238 array($message->header->from),
239 $message->header->to,
240 $message->header->cc
241 );
242
243 // 2) Make one big string out of them
244 $url_replytoall_extra_addrs = join(';', $url_replytoall_extra_addrs);
245
246 // 3) Parse that into an array of addresses
247 $url_replytoall_extra_addrs = parseAddrs($url_replytoall_extra_addrs);
248
249 // 4) Make them unique -- weed out duplicates
250 // (Coded for PHP 4.0.0)
251 $url_replytoall_extra_addrs =
252 array_keys(array_flip($url_replytoall_extra_addrs));
253
254 // 5) Remove the addresses we'll be sending the message 'to'
255 $url_replytoall_avoid_addrs = '';
256 if (isset($message->header->replyto)) {
257 $url_replytoall_avoid_addrs = $message->header->replyto;
258 }
259
260 $url_replytoall_avoid_addrs = parseAddrs($url_replytoall_avoid_addrs);
261 foreach ($url_replytoall_avoid_addrs as $addr) {
262 RemoveAddress($url_replytoall_extra_addrs, $addr);
263 }
264
265 // 6) Remove our identities from the CC list (they still can be in the
266 // TO list) only if $include_self_reply_all is turned off
267 if (!$include_self_reply_all) {
268 RemoveAddress($url_replytoall_extra_addrs,
269 getPref($data_dir, $username, 'email_address'));
270 $idents = getPref($data_dir, $username, 'identities');
271 if ($idents != '' && $idents > 1) {
272 for ($i = 1; $i < $idents; $i ++) {
273 $cur_email_address = getPref($data_dir, $username, 'email_address' . $i);
274 RemoveAddress($url_replytoall_extra_addrs, $cur_email_address);
275 }
276 }
277 }
278
279 // 7) Smoosh back into one nice line
280 $url_replytoallcc = getLineOfAddrs($url_replytoall_extra_addrs);
281
282 // 8) urlencode() it
283 $url_replytoallcc = urlencode($url_replytoallcc);
284
285 $dateString = getLongDateString($message->header->date);
286
287 // What do we reply to -- text only, if possible
288 $ent_num = findDisplayEntity($message);
289
290 /** TEXT STRINGS DEFINITIONS **/
291 $echo_more = _("more");
292 $echo_less = _("less");
293
294 if (!isset($show_more_cc)) $show_more_cc = false;
295
296 /** FORMAT THE TO STRING **/
297 $i = 0;
298 $to_string = '';
299 $to_ary = $message->header->to;
300 while ($i < count($to_ary)) {
301 $to_ary[$i] = htmlspecialchars(decodeHeader($to_ary[$i]));
302
303 if ($to_string) {
304 $to_string = "$to_string<BR>$to_ary[$i]";
305 } else {
306 $to_string = "$to_ary[$i]";
307 }
308
309 $i++;
310 if (count($to_ary) > 1) {
311 if ($show_more == false) {
312 if ($i == 1) {
313 /* From a search... */
314 $to_string .= '&nbsp;(<A HREF="' . $base_uri .
315 "src/read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&";
316 if (isset($where) && isset($what)) {
317 $to_string .= 'where='.urlencode($where)."&what=".urlencode($what)."&show_more=1&show_more_cc=$show_more_cc\">$echo_more</A>)";
318 } else {
319 $to_string .= "sort=$sort&startMessage=$startMessage&show_more=1&show_more_cc=$show_more_cc\">$echo_more</A>)";
320 }
321 $i = count($to_ary);
322 }
323 } else if ($i == 1) {
324 /* From a search... */
325 $to_string .= '&nbsp;(<A HREF="' . $base_uri .
326 "src/read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&";
327 if (isset($where) && isset($what)) {
328 $to_string .= 'where='.urlencode($where)."&what=".urlencode($what)."&show_more=0&show_more_cc=$show_more_cc\">$echo_less</A>)";
329 } else {
330 $to_string .= "sort=$sort&startMessage=$startMessage&show_more=0&show_more_cc=$show_more_cc\">$echo_less</A>)";
331 }
332 }
333 }
334 }
335
336 /** FORMAT THE CC STRING **/
337 $i = 0;
338 if (isset ($message->header->cc[0]) && trim($message->header->cc[0])) {
339 $cc_string = "";
340 $cc_ary = $message->header->cc;
341 while ($i < count(decodeHeader($cc_ary))) {
342 $cc_ary[$i] = htmlspecialchars($cc_ary[$i]);
343 if ($cc_string) {
344 $cc_string = "$cc_string<BR>$cc_ary[$i]";
345 } else {
346 $cc_string = "$cc_ary[$i]";
347 }
348
349 $i++;
350 if (count($cc_ary) > 1) {
351 if ($show_more_cc == false) {
352 if ($i == 1) {
353 /* From a search... */
354 $cc_string .= '&nbsp;(<A HREF="' . $base_uri .
355 "src/read_body.php?mailbox=$urlMailbox&passed_id=$passed_id";
356 if (isset($where) && isset($what)) {
357 $cc_string .= '&what='.urlencode($what)."&where=".urlencode($where)."&show_more_cc=1&show_more=$show_more\">$echo_more</A>)";
358 } else {
359 $cc_string .= "&sort=$sort&startMessage=$startMessage&show_more_cc=1&show_more=$show_more\">$echo_more</A>)";
360 }
361 $i = count($cc_ary);
362 }
363 } else if ($i == 1) {
364 /* From a search... */
365 $cc_string .= '&nbsp;(<A HREF="' . $base_uri .
366 "src/read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&";
367 if (isset($where) && isset($what)) {
368 $cc_string .= 'what=' . urlencode($what)."&where=".urlencode($where)."&show_more_cc=0&show_more=$show_more\">$echo_less</A>)";
369 } else {
370 $cc_string .= "sort=$sort&startMessage=$startMessage&show_more_cc=0&show_more=$show_more\">$echo_less</A>)";
371 }
372 }
373 }
374 }
375 }
376
377 /** FORMAT THE BCC STRING **/
378 $i = 0;
379 if (isset ($message->header->bcc[0]) && trim($message->header->bcc[0])){
380 $bcc_string = "";
381 $bcc_ary = $message->header->bcc;
382 while ($i < count(decodeHeader($bcc_ary))) {
383 $bcc_ary[$i] = htmlspecialchars($bcc_ary[$i]);
384 if ($bcc_string) {
385 $bcc_string = "$bcc_string<BR>$bcc_ary[$i]";
386 } else {
387 $bcc_string = "$bcc_ary[$i]";
388 }
389
390 $i++;
391 if (count($bcc_ary) > 1) {
392 if ($show_more_cc == false) {
393 if ($i == 1) {
394 /* From a search... */
395 $bcc_string .= '&nbsp;(<A HREF="' . $base_uri .
396 "src/read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&";
397 if (isset($where) && isset($what)) {
398 $bcc_string .= 'what=' . urlencode($what)."&where=".urlencode($where)."&show_more_cc=1&show_more=$show_more\">$echo_more</A>)";
399 } else {
400 $bcc_string .= "sort=$sort&startMessage=$startMessage&show_more_cc=1&show_more=$show_more\">$echo_more</A>)";
401 }
402 $i = count($bcc_ary);
403 }
404 } else if ($i == 1) {
405 /* From a search... */
406 $bcc_string .= '&nbsp;(<A HREF="' . $base_uri .
407 "src/read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&";
408 if (isset($where) && isset($what)) {
409 $bcc_string .= 'what=' . urlencode($what)."&where=".urlencode($where)."&show_more_cc=0&show_more=$show_more\">$echo_less</A>)";
410 } else {
411 $bcc_string .= "sort=$sort&startMessage=$startMessage&show_more_cc=0&show_more=$show_more\">$echo_less</A>)";
412 }
413 }
414 }
415 }
416 }
417
418 if ($default_use_priority) {
419 $priority_level = substr($message->header->priority,0,1);
420
421 switch($priority_level) {
422 /* check for a higher then normal priority. */
423 case '1':
424 case '2':
425 $priority_string = _("High");
426 break;
427
428 /* check for a lower then normal priority. */
429 case '4':
430 case '5':
431 $priority_string = _("Low");
432 break;
433
434 /* check for a normal priority. */
435 case '3':
436 default:
437 $priority_level = '3';
438 $priority_string = _("Normal");
439 break;
440
441 }
442 }
443
444 /** make sure everything will display in HTML format **/
445 $from_name = decodeHeader(htmlspecialchars($message->header->from));
446 $subject = decodeHeader(htmlspecialchars($message->header->subject));
447
448 do_hook('read_body_top');
449 echo '<BR>' .
450 '<TABLE CELLSPACING="0" WIDTH="100%" BORDER="0" ALIGN="CENTER" CELLPADDING="0">' . "\n" .
451 ' <TR><TD BGCOLOR="' . $color[9] . '" WIDTH="100%">' . "\n" .
452 ' <TABLE WIDTH="100%" CELLSPACING="0" BORDER="0" CELLPADDING="3">' . "\n" .
453 ' <TR>' . "\n" .
454 ' <TD ALIGN="LEFT" WIDTH="33%">' . "\n" .
455 ' <SMALL>' . "\n" .
456 '<A HREF="' . $base_uri . 'src/';
457
458 if ($where && $what) {
459 if( $pos == '' ) {
460 $pos = 0;
461 }
462 echo "search.php?where$pos=".urlencode($where)."&pos=$pos&what$pos=".urlencode($what)."&mailbox=$urlMailbox\">";
463 } else {
464 echo "right_main.php?use_mailbox_cache=1&sort=$sort&startMessage=$startMessage&mailbox=$urlMailbox\">";
465 }
466 echo _("Message List") .
467 '</A>&nbsp;|&nbsp;' .
468 '<A HREF="' . $base_uri . "src/delete_message.php?mailbox=$urlMailbox&message=$passed_id&";
469 if ($where && $what) {
470 echo 'where=' . urlencode($where) . '&what=' . urlencode($what) . '">';
471 } else {
472 echo "sort=$sort&startMessage=$startMessage\">";
473 }
474 echo _("Delete") . '</A>&nbsp;';
475 if (($mailbox == $draft_folder) && ($save_as_draft)) {
476 echo '|&nbsp;<A HREF="' . $base_uri .
477 "src/compose.php?mailbox=$mailbox&send_to=$to_string&send_to_cc=$cc_string&send_to_bcc=$bcc_string&subject=$url_subj&draft_id=$passed_id&ent_num=$ent_num\">".
478 _("Resume Draft") . '</a>';
479 }
480
481 echo '&nbsp;&nbsp;' .
482 ' </SMALL>' . "\n" .
483 ' </TD>' . "\n" .
484 ' <TD WIDTH="33%" ALIGN="CENTER">' . "\n" .
485 ' <SMALL>' . "\n";
486
487 if ( !($where && $what) ) {
488
489 if ($currentArrayIndex == -1) {
490 echo 'Previous&nbsp;|&nbsp;Next';
491 } else {
492 $prev = findPreviousMessage();
493 $next = findNextMessage();
494
495 if ($prev != -1) {
496 echo '<a href="' . $base_uri . "src/read_body.php?passed_id=$prev&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Previous") . "</A>&nbsp;|&nbsp;";
497 } else {
498 echo _("Previous") . '&nbsp;|&nbsp;';
499 }
500
501 if ($next != -1) {
502 echo '<a href="' . $base_uri . "src/read_body.php?passed_id=$next&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Next") . "</A>";
503 } else {
504 echo _("Next");
505 }
506 }
507 }
508
509 echo ' </SMALL>' . "\n" .
510 ' </TD><TD WIDTH="33%" ALIGN="RIGHT">' .
511 ' <SMALL>' .
512 ' <A HREF="' . $base_uri . "src/compose.php?forward_id=$passed_id&forward_subj=$url_subj&".
513 (isset($default_use_priority)?"mailprio=$priority_level&":"")
514 ."mailbox=$urlMailbox&ent_num=$ent_num\">" .
515 _("Forward") .
516 '</A>&nbsp;|&nbsp;' .
517 ' <A HREF="' . $base_uri . "src/compose.php?send_to=$url_replyto&reply_subj=$url_subj&".
518 (isset($default_use_priority)?"mailprio=$priority_level&":"").
519 "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\">" .
520 _("Reply") .
521 '</A>&nbsp;|&nbsp;' .
522 ' <A HREF="' . $base_uri . "src/compose.php?send_to=$url_replytoall&send_to_cc=$url_replytoallcc&reply_subj=$url_subj&".
523 (isset($default_use_priority)?"mailprio=$priority_level&":"").
524 "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\">" .
525 _("Reply All") .
526 '</A>&nbsp;&nbsp;' .
527 ' </SMALL>' .
528 ' </TD>' .
529 ' </TR>' .
530 ' </TABLE>' .
531 ' </TD></TR>' .
532 ' <TR><TD CELLSPACING="0" WIDTH="100%">' .
533 ' <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="3">' . "\n" .
534 ' <TR>' . "\n";
535
536 /** subject **/
537 echo " <TD BGCOLOR=\"$color[0]\" WIDTH=\"10%\" ALIGN=\"right\" VALIGN=\"top\">\n" .
538 _("Subject:") .
539 " </TD><TD BGCOLOR=\"$color[0]\" WIDTH=\"80%\" VALIGN=\"top\">\n" .
540 " <B>$subject</B>&nbsp;\n" .
541 " </TD>\n" .
542 ' <TD ROWSPAN="4" width="10%" BGCOLOR="' . $color[0] .
543 '" ALIGN=right VALIGN=top NOWRAP><small>'.
544 '<A HREF="' . $base_uri . "src/read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&";
545
546 /* From a search... */
547 if ($where && $what) {
548 echo 'where=' . urlencode($where) . '&what=' . urlencode($what) .
549 "&view_hdr=1\">" . _("View Full Header") . "</A>\n";
550 } else {
551 echo "startMessage=$startMessage&show_more=$show_more&view_hdr=1\">" .
552 _("View Full Header") . "</A>\n";
553 }
554
555 /* Output the printer friendly link if we are in subtle mode. */
556 if ($pf_subtle_link) {
557 echo printer_friendly_link(true);
558 }
559
560 do_hook("read_body_header_right");
561 echo '</small></TD>' . "\n" .
562 ' </TR>' ."\n";
563
564 /** from **/
565 echo ' <TR>' . "\n" .
566 ' <TD BGCOLOR="' . $color[0] . '" ALIGN="RIGHT">' . "\n" .
567 _("From:") .
568 ' </TD><TD BGCOLOR="' . $color[0] . '">' . "\n" .
569 " <B>$from_name</B>&nbsp;\n" .
570 ' </TD>' . "\n" .
571 ' </TR>' . "\n";
572 /** date **/
573 echo ' <TR>' . "\n" .
574 ' <TD BGCOLOR="' . $color[0] . '" ALIGN="RIGHT">' . "\n" .
575 _("Date:") .
576 " </TD><TD BGCOLOR=\"$color[0]\">\n" .
577 " <B>$dateString</B>&nbsp;\n" .
578 ' </TD>' . "\n" .
579 ' </TR>' . "\n";
580
581 /** to **/
582 echo " <TR>\n" .
583 " <TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>\n" .
584 _("To:") .
585 ' </TD><TD BGCOLOR="' . $color[0] . '" VALIGN="TOP">' . "\n" .
586 " <B>$to_string</B>&nbsp;\n" .
587 ' </TD>' . "\n" .
588 ' </TR>' . "\n";
589 /** cc **/
590 if (isset($cc_string)) {
591 echo " <TR>\n" .
592 " <TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>\n" .
593 ' Cc:' . "\n" .
594 " </TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>\n" .
595 " <B>$cc_string</B>&nbsp;\n" .
596 ' </TD>' . "\n" .
597 ' </TR>' . "\n";
598 }
599
600 /** bcc **/
601 if (isset($bcc_string)) {
602 echo " <TR>\n" .
603 " <TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>\n" .
604 ' Bcc:' . "\n" .
605 " </TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>\n" .
606 " <B>$bcc_string</B>&nbsp;\n" .
607 ' </TD>' . "\n" .
608 ' </TR>' . "\n";
609 }
610 if ($default_use_priority) {
611 if (isset($priority_string)) {
612 echo " <TR>\n" .
613 " <TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>\n" .
614 " "._("Priority").": \n".
615 " </TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>\n" .
616 " <B>$priority_string</B>&nbsp;\n" .
617 " </TD>" . "\n" .
618 " </TR>" . "\n";
619 }
620 }
621
622 if ($show_xmailer_default) {
623 fputs ($imapConnection, sqimap_session_id() .
624 " FETCH $passed_id BODY.PEEK[HEADER.FIELDS (X-Mailer User-Agent)]\r\n");
625 $read = sqimap_read_data ($imapConnection, sqimap_session_id(), true,
626 $response, $readmessage);
627 $mailer = substr($read[1], strpos($read[1], " "));
628 if (trim($mailer)) {
629 echo " <TR>\n" .
630 " <TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>\n" .
631 " "._("Mailer").": \n".
632 " </TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>\n" .
633 " <B>$mailer</B>&nbsp;\n" .
634 " </TD>" . "\n" .
635 " </TR>" . "\n";
636 }
637 }
638
639 /* Output the printer friendly link if we are not in subtle mode. */
640 if (!$pf_subtle_link) {
641 echo printer_friendly_link(true);
642 }
643
644 do_hook("read_body_header");
645 echo '</TABLE>' .
646 ' </TD></TR>' .
647 '</TABLE>';
648 flush();
649 echo "<TABLE CELLSPACING=0 WIDTH=\"97%\" BORDER=0 ALIGN=CENTER CELLPADDING=0>\n" .
650 " <TR><TD BGCOLOR=\"$color[4]\" WIDTH=\"100%\">\n" .
651 '<BR>'.
652 formatBody($imapConnection, $message, $color, $wrap_at).
653 '</TABLE>' .
654 '<TABLE CELLSPACING="0" WIDTH="100%" BORDER="0" ALIGN="CENTER" CELLPADDING="0">' . "\n" .
655 " <TR><TD BGCOLOR=\"$color[9]\">&nbsp;</TD></TR>" .
656 '</TABLE>' . "\n";
657
658 /* show attached images inline -- if pref'fed so */
659 if (($attachment_common_show_images) and
660 is_array($attachment_common_show_images_list)) {
661 foreach ($attachment_common_show_images_list as $img) {
662 echo "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER>\n" .
663 " <TR>\n" .
664 " <TD>\n" .
665 ' <img src="../src/download.php' .
666 '?passed_id=' . urlencode($img['passed_id']) .
667 '&mailbox=' . urlencode($img['mailbox']) .
668 '&passed_ent_id=' . urlencode($img['ent_id']) .
669 '&absolute_dl=true">' . "\n" .
670 " </TD>\n" .
671 " </TR>\n" .
672 "</TABLE>\n";
673 }
674 }
675
676 do_hook('read_body_bottom');
677 do_hook('html_bottom');
678 sqimap_logout($imapConnection);
679 ?>
680 </body>
681 </html>