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