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