dba24e804e3b8c2d368b3984f2c791b01728c608
6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This file is used for reading the msgs array and displaying
10 * the resulting emails in the right frame.
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 require_once('../functions/html.php');
22 require_once('../src/view_header.php');
26 * Given an IMAP message id number, this will look it up in the cached
27 * and sorted msgs array and return the index. Used for finding the next
28 * and previous messages.
30 * @return the index of the next valid message from the array
32 function findNextMessage() {
33 global $msort, $currentArrayIndex, $msgs, $sort,
34 $thread_sort_messages, $allow_server_sort,
36 if (!is_array($server_sort_array)) {
37 $thread_sort_messages = 0;
38 $allow_server_sort = FALSE;
41 if ($thread_sort_messages == 1 ||
$allow_server_sort == TRUE) {
42 reset($server_sort_array);
43 while(list($key, $value) = each ($server_sort_array)) {
44 if ($currentArrayIndex == $value) {
45 if ($key == (count($server_sort_array) - 1)) {
49 $result = $server_sort_array[$key +
1];
54 elseif ($sort == 6 && $allow_server_sort != TRUE &&
55 $thread_sort_messages != 1) {
56 if ($currentArrayIndex != 1) {
57 $result = $currentArrayIndex - 1;
60 elseif ($allow_server_sort != TRUE && $thread_sort_messages != 1 ) {
61 if (!is_array($msort)) {
64 for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) {
65 if ($currentArrayIndex == $msgs[$key]['ID']) {
69 $result = $msgs[$key]['ID'];
79 * Removes just one address from the list of addresses.
81 * @param &$addr_list a by-ref array of addresses
82 * @param $addr an address to remove
83 * @return void, since it operates on a by-ref param
85 function RemoveAddress(&$addr_list, $addr) {
87 foreach (array_keys($addr_list, $addr) as $key_to_delete) {
88 unset($addr_list[$key_to_delete]);
93 /** returns the index of the previous message from the array. */
94 function findPreviousMessage() {
95 global $msort, $currentArrayIndex, $sort, $msgs, $imapConnection,
96 $mailbox, $data_dir, $username, $thread_sort_messages,
97 $allow_server_sort, $server_sort_array;
99 if (!is_array($server_sort_array)) {
100 $thread_sort_messages = 0;
101 $allow_server_sort = FALSE;
103 if ($thread_sort_messages == 1 ||
$allow_server_sort == TRUE) {
104 reset($server_sort_array);
105 while(list($key, $value) = each ($server_sort_array)) {
106 if ($currentArrayIndex == $value) {
111 $result = $server_sort_array[$key -1];
116 elseif ($sort == 6 && $allow_server_sort != TRUE &&
117 $thread_sort_messages != 1) {
118 $numMessages = sqimap_get_num_messages($imapConnection, $mailbox);
119 if ($currentArrayIndex != $numMessages) {
120 $result = $currentArrayIndex +
1;
123 elseif ($thread_sort_messages != 1 && $allow_server_sort != TRUE) {
124 if (!is_array($msort)) {
127 for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) {
128 if ($currentArrayIndex == $msgs[$key]['ID']) {
132 $result = $msgs[$key]['ID'];
142 * Displays a link to a page where the message is displayed more
143 * "printer friendly".
145 function printer_friendly_link() {
146 global $passed_id, $mailbox, $ent_num, $color,
150 if (strlen(trim($mailbox)) < 1) {
154 $params = '?passed_ent_id=' . $ent_num .
155 '&mailbox=' . urlencode($mailbox) .
156 '&passed_id=' . $passed_id;
158 $print_text = _("View Printable Version");
160 if (!$pf_subtle_link) {
161 /* The link is large, on the bottom of the header panel. */
162 $result = html_tag( 'tr', '', '', $color[0] ) .
163 html_tag( 'td', ' ', 'right', '', 'class="medText" valign="top"' ) .
164 html_tag( 'td', '', 'left', '', 'class="medText" valign="top" colspan="2"' ) . "\n";
166 /* The link is subtle, below "view full header". */
170 /* Output the link. */
171 if ($javascript_on) {
172 $result .= '<script language="javascript" type="text/javascript">' . "\n" .
174 " function printFormat() {\n" .
175 ' window.open("../src/printer_friendly_main.php' .
176 $params . '","Print","width=800,height=600");' . "\n".
180 "<a href=\"javascript:printFormat();\">$print_text</a>\n";
182 $result .= '<A target="_blank" HREF="../src/printer_friendly_bottom.php' .
183 "$params\">$print_text</a>\n";
186 if (!$pf_subtle_link) {
187 /* The link is large, on the bottom of the header panel. */
188 $result .= '</td></tr>' . "\n";
194 function ServerMDNSupport( $read ) {
195 /* escaping $ doesn't work -> \x36 */
196 $ret = preg_match( '/(\x36MDNSent|\\\*)/i', $read );
200 function SendMDN ( $recipient , $sender) {
201 global $imapConnection, $mailbox, $username, $attachment_dir, $SERVER_NAME,
202 $version, $attachments, $identity, $data_dir, $passed_id;
204 $header = sqimap_get_message_header($imapConnection, $passed_id, $mailbox);
205 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
209 $senton = getLongDateString( $header->date
);
210 $to_array = $header->to
;
212 foreach ($to_array as $line) {
216 $subject = $header->subject
;
217 $now = getLongDateString( time() );
221 $body = _("Your message") . "\r\n\r\n" .
222 "\t" . _("To:") . ' ' . $to . "\r\n" .
223 "\t" . _("Subject:") . ' ' . $subject . "\r\n" .
224 "\t" . _("Sent:") . ' ' . $senton . "\r\n" .
226 sprintf( _("Was displayed on %s"), $now );
230 $original_recipient = $to;
231 $original_message_id = $header->message_id
;
233 $part2 = "Reporting-UA : $SERVER_NAME ; SquirrelMail (version $version) \r\n";
234 if ($original_recipient != '') {
235 $part2 .= "Original-Recipient : $original_recipient\r\n";
237 $final_recipient = $sender;
238 $part2 .= "Final-Recipient: rfc822; $final_recipient\r\n" .
239 "Original-Message-ID : $original_message_id\r\n" .
240 "Disposition: manual-action/MDN-sent-manually; displayed\r\n";
243 $localfilename = GenerateRandomString(32, 'FILE', 7);
244 $full_localfilename = "$hashed_attachment_dir/$localfilename";
246 $fp = fopen( $full_localfilename, 'w');
247 fwrite ($fp, $part2);
250 $newAttachment = array();
251 $newAttachment['localfilename'] = $localfilename;
252 $newAttachment['type'] = "message/disposition-notification";
253 $newAttachment['session']=-1;
254 $attachments[] = $newAttachment;
255 $MDN_to = trim($recipient);
258 return (SendMessage($MDN_to, '', '', _("Read:") . ' ' . $subject,
259 $body, $reply_id, True, 3, -1) );
263 function ToggleMDNflag ( $set ) {
264 global $imapConnection, $passed_id, $mailbox, $uid;
265 sqimap_mailbox_select($imapConnection, $mailbox);
267 $cmd = 'STORE ' . $passed_id . ' ' . $sg . 'FLAGS ($MDNSent)';
268 $read = sqimap_run_command ($imapConnection, $cmd, true, $response,
272 function ClearAttachments() {
273 global $username, $attachments, $attachment_dir;
275 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
277 $rem_attachments = array();
278 foreach ($attachments as $info) {
279 if ($info['session'] == -1) {
280 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
281 if (file_exists($attached_file)) {
282 unlink($attached_file);
285 $rem_attachments[] = $info;
288 $attachments = $rem_attachments;
291 function formatRecipientString($recipients, $item ) {
292 global $base_uri, $passed_id, $urlMailbox, $startMessage, $show_more_cc,
293 $echo_more, $echo_less, $show_more, $show_more_bcc, $sort, $passed_ent_id,
298 if ((is_array($recipients)) && (isset($recipients[0]))) {
306 $url = set_url_var($PHP_SELF, 'show_more',0);
308 $url = set_url_var($PHP_SELF, 'show_more',1);
310 } else if ($item == 'cc') {
312 $url = set_url_var($PHP_SELF, 'show_more_cc',0);
315 $url = set_url_var($PHP_SELF, 'show_more_cc',1);
317 } else if ($item == 'bcc') {
318 if ($show_more_bcc) {
319 $url = set_url_var($PHP_SELF, 'show_more_bcc',0);
322 $url = set_url_var($PHP_SELF, 'show_more_bcc',1);
329 $ary[$i] = $addr_o->getAddress();
330 $ary[$i] = decodeHeader(htmlspecialchars($ary[$i]));
331 $url_string .= $ary[$i];
333 $string .= '<BR>'.$ary[$i];
337 $string .= ' (<A HREF="'.$url;
339 $string .= '">'.$echo_less.'</A>)';
341 $string .= '">'.$echo_more.'</A>)';
352 $url_string = urlencode($url_string);
354 $result['str'] = $string;
355 $result['url_str'] = $url_string;
362 * Main of read_boby.php --------------------------------------------------
371 global $uid_support, $sqimap_capabilities;
373 if (isset($mailbox)){
374 $mailbox = urldecode( $mailbox );
377 $imapConnection = sqimap_login($username, $key, $imapServerAddress,
380 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox, false, false, true);
382 if (!isset($messages)) {
384 session_register('messages');
388 * $message contains all information about the message
389 * including header and body
392 $uidvalidity = $mbx_response['UIDVALIDITY'];
394 if (!isset($messages[$uidvalidity])) {
395 $messages[$uidvalidity] = array();
397 if (!isset($messages[$uidvalidity][$passed_id])) {
398 $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
399 $messages[$uidvalidity][$passed_id] = $message;
400 $header = $message->header
;
402 $message = $messages[$uidvalidity][$passed_id];
403 // $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
404 if (isset($passed_ent_id)) {
405 $message = $message->getEntity($passed_ent_id);
406 $message->id
= $passed_id;
407 $message->mailbox
= $mailbox;
409 $header = $message->header
;
415 * The following code sets necesarry stuff for the MDN thing
417 if($default_use_mdn &&
418 ($mdn_user_support = getPref($data_dir, $username, 'mdn_user_support',
419 $default_use_mdn))) {
420 $supportMDN = ServerMDNSupport($mbx_response["PERMANENTFLAGS"]);
421 $FirstTimeSee = !$message->is_seen
;
424 displayPageHeader($color, $mailbox);
427 * The following code shows the header of the message and then exit
429 if (isset($view_hdr)) {
430 $template_vars = array();
431 parse_viewheader($imapConnection,$passed_id,&$template_vars);
432 $template_vars['return_address'] = set_url_var($PHP_SELF, 'view_hdr');
433 view_header($template_vars, '', '</body></html>');
438 $currentArrayIndex = $passed_id;
440 $currentArrayIndex = -1;
442 $msgs[$passed_id]['FLAG_SEEN'] = true;
446 * The following code sets necesarry stuff for the MDN thing
448 if($default_use_mdn &&
449 ($mdn_user_support = getPref($data_dir, $username, 'mdn_user_support',
450 $default_use_mdn))) {
451 $supportMDN = ServerMDNSupport($mbx_response["PERMANENTFLAGS"]);
452 $FirstTimeSee = !$message->is_seen
;
456 * The following code shows the header of the message and then exit
458 if (isset($view_hdr)) {
459 $template_vars = array();
460 parse_viewheader($imapConnection,$passed_id,&$template_vars);
461 $template_vars['return_address'] = set_url_var($PHP_SELF, 'view_hdr');
462 view_header($template_vars, '', '</body></html>');
467 $currentArrayIndex = $passed_id;
469 $currentArrayIndex = -1;
471 $msgs[$passed_id]['FLAG_SEEN'] = true;
473 /** translate the subject and mailbox into url-able text **/
474 $url_subj = urlencode(trim($header->subject
));
475 $urlMailbox = urlencode($mailbox);
477 if (isset($header->replyto
)) {
478 $addr_o = $header->replyto
;
479 $addr_s = $addr_o->getAddress();
480 $url_replyto = urlencode($addr_s);
483 $url_replytoall = $url_replyto;
486 * If we are replying to all, then find all other addresses and
487 * add them to the list. Remove duplicates.
493 * 1) Remove the addresses we'll be sending the message 'to'
495 $url_replytoall_avoid_addrs = '';
496 if (isset($header->replyto
)) {
497 $excl_ar = $header->getAddr_a('replyto');
502 * 2) Remove our identities from the CC list (they still can be in the
503 * TO list) only if $include_self_reply_all is turned off
505 if (!$include_self_reply_all) {
506 $email_address = trim(getPref($data_dir, $username, 'email_address'));
507 $excl_ar[$email_address] = '';
509 $idents = getPref($data_dir, $username, 'identities');
510 if ($idents != '' && $idents > 1) {
511 for ($i = 1; $i < $idents; $i ++
) {
512 $cur_email_address = getPref($data_dir, $username,
513 'email_address' . $i);
514 $cur_email_address = strtolower($cur_email_address);
515 $excl_ar[$cur_email_address] = '';
521 * 3) get the addresses.
523 $url_replytoall_ar = $header->getAddr_a(array('from','to','cc'), $excl_ar);
526 * 4) generate the string.
528 $url_replytoallcc = '';
529 foreach( $url_replytoall_ar as $email => $personal) {
531 $url_replytoallcc .= ", \"$personal\" <$email>";
533 $url_replytoallcc .= ', '. $email;
536 $url_replytoallcc = substr($url_replytoallcc,2);
541 $url_replytoallcc = urlencode($url_replytoallcc);
543 $dateString = getLongDateString($header->date
);
546 * What do we reply to -- text only, if possible
552 /* first step in displaying multiple entities */
554 $ent_ar = findDisplayEntity($message, false);
556 for ($i = 0; $i < count($ent_ar); $i++
) {
557 $body .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i]);
561 $ent_ar = findDisplayEntity($message,true);
563 $ent_num = $ent_ar[0];
564 for ($i = 1 ; $i < count($ent_ar); $i++
) {
565 $ent_num .= '_'.$ent_ar[$i];
567 /** TEXT STRINGS DEFINITIONS **/
568 $echo_more = _("more");
569 $echo_less = _("less");
571 if (!isset($show_more_cc)) {
572 $show_more_cc = FALSE;
575 if (!isset($show_more_bcc)) {
576 $show_more_bcc = FALSE;
579 /** FORMAT THE TO STRING **/
580 $to = formatRecipientString($message->header
->to
, "to");
581 $to_string = $to['str'];
582 $url_to_string = $to['url_str'];
585 /** FORMAT THE CC STRING **/
587 $cc = formatRecipientString($header->cc
, "cc");
588 $cc_string = $cc['str'];
589 $url_cc_string = $cc['url_str'];
591 /** FORMAT THE BCC STRING **/
593 $bcc = formatRecipientString($header->bcc
, "bcc");
594 $bcc_string = $bcc['str'];
595 $url_bcc_string = $bcc['url_str'];
597 if ($default_use_priority) {
598 $priority_level = substr($header->priority
,0,1);
600 switch($priority_level) {
601 /* check for a higher then normal priority. */
604 $priority_string = _("High");
607 /* check for a lower then normal priority. */
610 $priority_string = _("Low");
613 /* check for a normal priority. */
616 $priority_level = '3';
617 $priority_string = _("Normal");
623 /** make sure everything will display in HTML format **/
625 $from_o = $header->from
;
626 if (is_object($from_o)) {
627 $from_name = $from_o->getAddress();
629 $from_name = _("Unknown sender");
631 $from_name = decodeHeader(htmlspecialchars($from_name));
632 $subject = decodeHeader(htmlspecialchars($message->header
->subject
));
634 $idents = getPref($data_dir, $username, 'identities');
635 if (!empty($idents) && $idents > 1) {
636 for ($i = 1; $i < $idents; $i++
) {
637 $enc_from_name = '"'.
638 encodeHeader(getPref($data_dir,
641 '" <' . getPref($data_dir, $username,
642 'email_address' . $i) . '>';
643 if (htmlspecialchars($enc_from_name) == $from_name) {
650 do_hook('read_body_top');
653 html_tag( 'table', '', 'center', '', 'width="100%" cellpadding="0" cellspacing="0" border="0"' ) . "\n" .
655 html_tag( 'td', '', 'left', $color[9], 'width="100%"' ) .
656 html_tag( 'table', '', '', '', 'width="100%" cellpadding="3" cellspacing="0" border="0"' ) . "\n" .
658 html_tag( 'td', '', 'left', '', 'width="33%"' ) .
660 '<a href="' . $base_uri . 'src/';
662 if ($where && $what) {
666 echo "search.php?where=".urlencode($where)."&pos=$pos&what=".urlencode($what)."&mailbox=$urlMailbox\">";
668 echo "right_main.php?sort=$sort&startMessage=$startMessage&mailbox=$urlMailbox\">";
670 echo _("Message List") .
671 '</a> | ' .
672 '<a href="' . $base_uri . "src/delete_message.php?mailbox=$urlMailbox&message=$passed_id&";
673 if ($where && $what) {
674 echo 'where=' . urlencode($where) . '&what=' . urlencode($what) . '">';
676 echo "sort=$sort&startMessage=$startMessage\">";
678 echo _("Delete") . '</a> ';
679 if (($mailbox == $draft_folder) && ($save_as_draft)) {
680 $comp_uri = $base_uri . "src/compose.php?mailbox=$mailbox&".
681 "identity=$identity&send_to=$url_to_string&".
682 "send_to_cc=$url_cc_string&send_to_bcc=$url_bcc_string&".
683 "subject=$url_subj&mailprio=$priority_level&".
684 "draft_id=$passed_id&ent_num=$ent_num";
686 if ($compose_new_win == '1') {
687 echo "<a href=\"javascript:void(0)\" onclick=\"comp_in_new(false,'$comp_uri')\"";
689 echo '| <a href="' . $comp_uri .'"';
692 _("Resume Draft") . '</a>';
694 if ($mailbox == $sent_folder) {
695 $comp_uri = $base_uri . "src/compose.php?mailbox=$mailbox&".
696 "identity=$identity&send_to=$url_to_string&".
697 "send_to_cc=$url_cc_string&send_to_bcc=$url_bcc_string&".
698 "subject=$url_subj&mailprio=$priority_level&".
699 "ent_num=$ent_num&passed_id=$passed_id&edit_as_new=1";
701 if ($compose_new_win == '1') {
702 echo "<a href=\"javascript:void(0)\" onclick=\"comp_in_new(false,'$comp_uri')\"";
704 echo '| <a href="' . $comp_uri .'"';
707 _("Edit Message as New") . '</a>';
710 echo ' ' .
713 html_tag( 'td', '', 'center', '', 'width="33%"' ) .
716 if ( !($where && $what) ) {
717 if ($currentArrayIndex == -1) {
718 echo 'Previous | Next';
720 $prev = findPreviousMessage($mbx_response['EXISTS']);
721 $next = findNextMessage();
724 echo '<a href="' . $base_uri . "src/read_body.php?passed_id=$prev&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Previous") . "</a> | ";
726 echo _("Previous") . ' | ';
730 echo '<a href="' . $base_uri . "src/read_body.php?passed_id=$next&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Next") . "</a>";
739 html_tag( 'td', '', 'right', '', 'width="33%"' ) .
741 $comp_uri = $base_uri . "src/compose.php?forward_id=$passed_id&".
742 "forward_subj=$url_subj&".
743 ($default_use_priority?
"mailprio=$priority_level&":'').
744 "mailbox=$urlMailbox&ent_num=$ent_num";
746 if ($compose_new_win == '1') {
747 echo "<a href=\"javascript:void(0)\" onclick=\"comp_in_new(false,'$comp_uri')\"";
749 echo '| <a href="' . $comp_uri .'"';
756 $comp_uri = $base_uri . "src/compose.php?send_to=$url_replyto&".
757 "reply_subj=$url_subj&".
758 ($default_use_priority?
"mailprio=$priority_level&":'').
759 "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num";
761 if ($compose_new_win == '1') {
762 echo "<a href=\"javascript:void(0)\" onclick=\"comp_in_new(false,'$comp_uri')\"";
764 echo '| <a href="' . $comp_uri .'"';
771 $comp_uri = $base_uri . "src/compose.php?send_to=$url_replytoall&".
772 "send_to_cc=$url_replytoallcc&reply_subj=$url_subj&".
773 ($default_use_priority?
"mailprio=$priority_level&":'').
774 "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num";
776 if ($compose_new_win == '1') {
777 echo "<a href=\"javascript:void(0)\" onclick=\"comp_in_new(false,'$comp_uri')\"";
779 echo '| <a href="' . $comp_uri .'"';
791 html_tag( 'td', '', 'left', '', 'width="100%"' ) .
792 html_tag( 'table', '', '', '', 'width="100%" border="0" cellspacing="0" cellpadding="3"' ) .
793 html_tag( 'tr' ) . "\n";
796 echo html_tag( 'td', _("Subject:"), 'right', $color[0], 'width="10%" valign="top"' ) .
797 html_tag( 'td', '<b>' . $subject . '</b> ' . "\n", 'left', $color[0], 'width="80%" valign="top"' ) .
798 html_tag( 'td', '', 'right', $color[0], 'rowspan="4" width="10%" valign="top" nowrap' ) .
799 '<a href="' . $base_uri . "src/read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&";
801 /* From a search... */
802 if ($where && $what) {
803 echo 'where=' . urlencode($where) . '&what=' . urlencode($what) .
804 "&view_hdr=1\">" . _("View Full Header") . "</a>\n";
806 echo "startMessage=$startMessage&show_more=$show_more&view_hdr=1\">" .
807 _("View Full Header") . "</a>\n";
810 /* Output the printer friendly link if we are in subtle mode. */
811 if ($pf_subtle_link) {
812 echo printer_friendly_link(true);
815 do_hook("read_body_header_right");
816 echo '</small></td>' .
820 echo html_tag( 'tr', "\n" .
821 html_tag( 'td', _("From:"), 'right', $color[0], 'valign="top"' ) .
823 '<b>' . $from_name . '</b> ' . "\n" ,
826 do_hook("read_body_after_from");
828 echo html_tag( 'tr', "\n" .
829 html_tag( 'td', _("Date:"), 'right', $color[0], 'valign="top"' ) .
831 '<b>' . $dateString . '</b> ' . "\n" ,
835 echo html_tag( 'tr', "\n" .
836 html_tag( 'td', _("To:"), 'right', $color[0], 'valign="top"' ) .
838 '<b>' . $to_string . '</b> ' . "\n" ,
842 if (isset($cc_string) && $cc_string <> '') {
843 echo html_tag( 'tr', "\n" .
844 html_tag( 'td', _("Cc:"), 'right', $color[0], 'valign="top"' ) .
846 '<b>' . $cc_string . '</b> ' . "\n" ,
847 'left', $color[0], 'colspan="2" valign="top"' )
852 if (isset($bcc_string) && $bcc_string <> '') {
853 echo html_tag( 'tr', "\n" .
854 html_tag( 'td', _("Bcc:"), 'right', $color[0], 'valign="top"' ) .
856 '<b>' . $bcc_string . '</b> ' . "\n" ,
857 'left', $color[0], 'colspan="2" valign="top"' )
860 if ($default_use_priority && isset($priority_string) && $priority_string <> '' ) {
861 echo html_tag( 'tr', "\n" .
862 html_tag( 'td', _("Priority") . ':', 'right', $color[0], 'valign="top"' ) .
864 '<b>' . $priority_string . '</b> ' . "\n" ,
865 'left', $color[0], 'colspan="2" valign="top"' )
869 if ($show_xmailer_default) {
870 $mailer = $header->xmailer
;
872 echo html_tag( 'tr', "\n" .
873 html_tag( 'td', _("Mailer") . ':', 'right', $color[0], 'valign="top"' ) .
875 '<b>' . $mailer . '</b> ' ,
876 'left', $color[0], 'colspan="2" valign="top"' )
881 /* Output the printer friendly link if we are not in subtle mode. */
882 if (!$pf_subtle_link) {
883 echo printer_friendly_link(true);
886 if ($default_use_mdn) {
887 if ($mdn_user_support) {
889 // debug gives you the capability to remove mdn-flags
890 // $MDNDebug = false;
893 $MDN_to_o = $header->dnt
;
894 $MDN_to = $MDN_to_o->getAddress();
899 if ($MDN_to && (!isset( $sendreceipt ) ||
$sendreceipt == '' ) ) {
900 if ( $message->is_mdnsent
&& $supportMDN) {
901 $sendreceipt = 'removeMDN';
903 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
907 echo html_tag( 'tr', "\n" .
908 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
910 '<b>' . _("send") . '</b> <a href="' . $url . '">[' . _("Remove MDN flag") . '] </a> ' ,
911 'left', $color[9], 'colspan="2" valign="top"' )
915 echo html_tag( 'tr', "\n" .
916 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
918 '<b>' . _("send") . '</b> ' ,
919 'left', $color[9], 'colspan="2" valign="top"' )
925 } // when deleted or draft flag is set don't offer to send a MDN response
926 else if ( $message->is_draft ||
$message->is_deleted
) {
927 echo html_tag( 'tr', "\n" .
928 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
930 '<b>' . _("requested") . '</b> ' ,
931 'left', $color[9], 'colspan="2" valign="top"' )
934 // if no MDNsupport don't use the annoying popup messages
935 else if ( !$FirstTimeSee ) {
936 $sendreceipt = 'send';
937 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
938 echo html_tag( 'tr', "\n" .
939 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
941 '<b>' . _("requested") . '</b> <a href="' . $url . '">[' . _("Send read receipt now") . ']</a>',
942 'left', $color[9], 'colspan="2" valign="top"' )
947 $sendreceipt = 'send';
948 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
949 if ($javascript_on) {
950 echo "<script language=\"javascript\" type=\"text/javascript\"> \n" .
952 " if (window.confirm(\"" .
953 _("The message sender has requested a response to indicate that you have read this message. Would you like to send a receipt?") .
955 ' window.open('.$url.',"right");' . "\n" .
960 echo html_tag( 'tr', "\n" .
961 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
963 '<b>' . _("requested") . '</b>  <a href="' . $url . '">[' . _("Send read receipt now") . ']</a>',
964 'left', $color[9], 'colspan="2" valign="top"' )
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', '' );
976 $final_recipient = getPref($data_dir, $username, 'email_address', '' );
980 $final_recipient = trim($final_recipient);
981 if ($final_recipient == '' ) {
982 $final_recipient = getPref($data_dir, $username, 'email_address', '' );
985 if ( SendMDN( $MDN_to, $final_recipient, $message ) > 0 && $supportMDN ) {
986 ToggleMDNflag( true);
990 $sendreceipt = 'removeMDN';
991 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
994 if ($MDNDebug && $supportMDN) {
995 echo html_tag( 'tr', "\n" .
996 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
998 '<b>' . _("send") . '</b>  <a href="' . $url . '">[' . _("Remove MDN flag") . ']</a>',
999 'left', $color[9], 'colspan="2" valign="top"' )
1003 echo html_tag( 'tr', "\n" .
1004 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
1006 '<b>' . _("send") . '</b> ',
1007 'left', $color[9], 'colspan="2" valign="top"' )
1013 elseif ($sendreceipt == 'removeMDN' ) {
1014 ToggleMDNflag ( false );
1016 $sendreceipt = 'send';
1017 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
1018 echo html_tag( 'tr', "\n" .
1019 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
1021 '<b>' . _("requested") . '</b> <a href="' . $url . '">[' . _("Send read receipt now") . ']</a>',
1022 'left', $color[9], 'colspan="2" valign="top"' )
1030 do_hook('read_body_header');
1036 echo html_tag( 'table', "\n" .
1037 html_tag( 'tr', "\n" .
1038 html_tag( 'td', '<br>' . "\n" . $body . "\n", 'left', $color[4]
1041 'center', '', 'cellspacing=0 width="97%" border="0" cellpadding="0"') .
1043 html_tag( 'table', "\n" .
1044 html_tag( 'tr', "\n" .
1045 html_tag( 'td', ' ', 'left', $color[9]
1048 'center', '', 'cellspacing=0 width="100%" border="0" cellpadding="0"');
1050 /* show attached images inline -- if pref'fed so */
1051 if (($attachment_common_show_images) &&
1052 is_array($attachment_common_show_images_list)) {
1054 foreach ($attachment_common_show_images_list as $img) {
1055 $imgurl = '../src/download.php' .
1057 'passed_id=' . urlencode($img['passed_id']) .
1058 '&mailbox=' . urlencode($mailbox) .
1059 '&passed_ent_id=' . urlencode($img['ent_id']) .
1060 '&absolute_dl=true';
1062 echo html_tag( 'table', "\n" .
1063 html_tag( 'tr', "\n" .
1064 html_tag( 'td', '<img src="' . $imgurl . '">' ."\n", 'left'
1067 'center', '', 'cellspacing=0 border="0" cellpadding="2"');
1072 do_hook('read_body_bottom');
1073 do_hook('html_bottom');
1074 sqimap_logout($imapConnection);