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