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