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