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