6950bcb4e2f1d2263c5c7a8f6517e6d4e9f89fd8
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');
389 * $message contains all information about the message
390 * including header and body
392 if (!isset($messages[$passed_id])) {
393 $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
394 $messages["$passed_id"] = $message;
395 $header = $message->header
;
397 echo "NOT SET $passed_id";
399 $message = $messages[$passed_id];
400 $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
401 if (isset($passed_ent_id)) {
402 $message = $message->getEntity($passed_ent_id);
403 $message->id
= $passed_id;
404 $message->mailbox
= $mailbox;
406 $header = $message->header
;
412 * The following code sets necesarry stuff for the MDN thing
414 if($default_use_mdn &&
415 ($mdn_user_support = getPref($data_dir, $username, 'mdn_user_support',
416 $default_use_mdn))) {
417 $supportMDN = ServerMDNSupport($mbx_response["PERMANENTFLAGS"]);
418 $FirstTimeSee = !$message->is_seen
;
421 displayPageHeader($color, $mailbox);
424 * The following code shows the header of the message and then exit
426 if (isset($view_hdr)) {
427 $template_vars = array();
428 parse_viewheader($imapConnection,$passed_id,&$template_vars);
429 $template_vars['return_address'] = set_url_var($PHP_SELF, 'view_hdr');
430 view_header($template_vars, '', '</body></html>');
435 $currentArrayIndex = $passed_id;
437 $currentArrayIndex = -1;
439 $msgs[$passed_id]['FLAG_SEEN'] = true;
443 * The following code sets necesarry stuff for the MDN thing
445 if($default_use_mdn &&
446 ($mdn_user_support = getPref($data_dir, $username, 'mdn_user_support',
447 $default_use_mdn))) {
448 $supportMDN = ServerMDNSupport($mbx_response["PERMANENTFLAGS"]);
449 $FirstTimeSee = !$message->is_seen
;
453 * The following code shows the header of the message and then exit
455 if (isset($view_hdr)) {
456 $template_vars = array();
457 parse_viewheader($imapConnection,$passed_id,&$template_vars);
458 $template_vars['return_address'] = set_url_var($PHP_SELF, 'view_hdr');
459 view_header($template_vars, '', '</body></html>');
464 $currentArrayIndex = $passed_id;
466 $currentArrayIndex = -1;
468 $msgs[$passed_id]['FLAG_SEEN'] = true;
470 /** translate the subject and mailbox into url-able text **/
471 $url_subj = urlencode(trim($header->subject
));
472 $urlMailbox = urlencode($mailbox);
474 if (isset($header->replyto
)) {
475 $addr_o = $header->replyto
;
476 $addr_s = $addr_o->getAddress();
477 $url_replyto = urlencode($addr_s);
480 $url_replytoall = $url_replyto;
483 * If we are replying to all, then find all other addresses and
484 * add them to the list. Remove duplicates.
490 * 1) Remove the addresses we'll be sending the message 'to'
492 $url_replytoall_avoid_addrs = '';
493 if (isset($header->replyto
)) {
494 $excl_ar = $header->getAddr_a('replyto');
499 * 2) Remove our identities from the CC list (they still can be in the
500 * TO list) only if $include_self_reply_all is turned off
502 if (!$include_self_reply_all) {
503 $email_address = trim(getPref($data_dir, $username, 'email_address'));
504 $excl_ar[$email_address] = '';
506 $idents = getPref($data_dir, $username, 'identities');
507 if ($idents != '' && $idents > 1) {
508 for ($i = 1; $i < $idents; $i ++
) {
509 $cur_email_address = getPref($data_dir, $username,
510 'email_address' . $i);
511 $cur_email_address = strtolower($cur_email_address);
512 $excl_ar[$cur_email_address] = '';
518 * 3) get the addresses.
520 $url_replytoall_ar = $header->getAddr_a(array('from','to','cc'), $excl_ar);
523 * 4) generate the string.
525 $url_replytoallcc = '';
526 foreach( $url_replytoall_ar as $email => $personal) {
528 $url_replytoallcc .= ", \"$personal\" <$email>";
530 $url_replytoallcc .= ', '. $email;
533 $url_replytoallcc = substr($url_replytoallcc,2);
538 $url_replytoallcc = urlencode($url_replytoallcc);
540 $dateString = getLongDateString($header->date
);
543 * What do we reply to -- text only, if possible
549 /* first step in displaying multiple entities */
551 $ent_ar = findDisplayEntity($message, false);
553 for ($i = 0; $i < count($ent_ar); $i++
) {
554 $body .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i]);
558 $ent_ar = findDisplayEntity($message,true);
560 $ent_num = $ent_ar[0];
561 for ($i = 1 ; $i < count($ent_ar); $i++
) {
562 $ent_num .= '_'.$ent_ar[$i];
564 /** TEXT STRINGS DEFINITIONS **/
565 $echo_more = _("more");
566 $echo_less = _("less");
568 if (!isset($show_more_cc)) {
569 $show_more_cc = FALSE;
572 if (!isset($show_more_bcc)) {
573 $show_more_bcc = FALSE;
576 /** FORMAT THE TO STRING **/
577 $to = formatRecipientString($message->header
->to
, "to");
578 $to_string = $to['str'];
579 $url_to_string = $to['url_str'];
582 /** FORMAT THE CC STRING **/
584 $cc = formatRecipientString($header->cc
, "cc");
585 $cc_string = $cc['str'];
586 $url_cc_string = $cc['url_str'];
588 /** FORMAT THE BCC STRING **/
590 $bcc = formatRecipientString($header->bcc
, "bcc");
591 $bcc_string = $bcc['str'];
592 $url_bcc_string = $bcc['url_str'];
594 if ($default_use_priority) {
595 $priority_level = substr($header->priority
,0,1);
597 switch($priority_level) {
598 /* check for a higher then normal priority. */
601 $priority_string = _("High");
604 /* check for a lower then normal priority. */
607 $priority_string = _("Low");
610 /* check for a normal priority. */
613 $priority_level = '3';
614 $priority_string = _("Normal");
620 /** make sure everything will display in HTML format **/
622 $from_o = $header->from
;
623 if (is_object($from_o)) {
624 $from_name = $from_o->getAddress();
626 $from_name = _("Unknown sender");
628 $from_name = decodeHeader(htmlspecialchars($from_name));
629 $subject = decodeHeader(htmlspecialchars($message->header
->subject
));
631 $idents = getPref($data_dir, $username, 'identities');
632 if (!empty($idents) && $idents > 1) {
633 for ($i = 1; $i < $idents; $i++
) {
634 $enc_from_name = '"'.
635 encodeHeader(getPref($data_dir,
638 '" <' . getPref($data_dir, $username,
639 'email_address' . $i) . '>';
640 if (htmlspecialchars($enc_from_name) == $from_name) {
647 do_hook('read_body_top');
650 html_tag( 'table', '', 'center', '', 'width="100%" cellpadding="0" cellspacing="0" border="0"' ) . "\n" .
652 html_tag( 'td', '', 'left', $color[9], 'width="100%"' ) .
653 html_tag( 'table', '', '', '', 'width="100%" cellpadding="3" cellspacing="0" border="0"' ) . "\n" .
655 html_tag( 'td', '', 'left', '', 'width="33%"' ) .
657 '<a href="' . $base_uri . 'src/';
659 if ($where && $what) {
663 echo "search.php?where=".urlencode($where)."&pos=$pos&what=".urlencode($what)."&mailbox=$urlMailbox\">";
665 echo "right_main.php?sort=$sort&startMessage=$startMessage&mailbox=$urlMailbox\">";
667 echo _("Message List") .
668 '</a> | ' .
669 '<a href="' . $base_uri . "src/delete_message.php?mailbox=$urlMailbox&message=$passed_id&";
670 if ($where && $what) {
671 echo 'where=' . urlencode($where) . '&what=' . urlencode($what) . '">';
673 echo "sort=$sort&startMessage=$startMessage\">";
675 echo _("Delete") . '</a> ';
676 if (($mailbox == $draft_folder) && ($save_as_draft)) {
677 $comp_uri = $base_uri . "src/compose.php?mailbox=$mailbox&".
678 "identity=$identity&send_to=$url_to_string&".
679 "send_to_cc=$url_cc_string&send_to_bcc=$url_bcc_string&".
680 "subject=$url_subj&mailprio=$priority_level&".
681 "draft_id=$passed_id&ent_num=$ent_num";
683 if ($compose_new_win == '1') {
684 echo "<a href=\"javascript:void(0)\" onclick=\"comp_in_new(false,'$comp_uri')\"";
686 echo '| <a href="' . $comp_uri .'"';
689 _("Resume Draft") . '</a>';
691 if ($mailbox == $sent_folder) {
692 $comp_uri = $base_uri . "src/compose.php?mailbox=$mailbox&".
693 "identity=$identity&send_to=$url_to_string&".
694 "send_to_cc=$url_cc_string&send_to_bcc=$url_bcc_string&".
695 "subject=$url_subj&mailprio=$priority_level&".
696 "ent_num=$ent_num&passed_id=$passed_id&edit_as_new=1";
698 if ($compose_new_win == '1') {
699 echo "<a href=\"javascript:void(0)\" onclick=\"comp_in_new(false,'$comp_uri')\"";
701 echo '| <a href="' . $comp_uri .'"';
704 _("Edit Message as New") . '</a>';
707 echo ' ' .
710 html_tag( 'td', '', 'center', '', 'width="33%"' ) .
713 if ( !($where && $what) ) {
714 if ($currentArrayIndex == -1) {
715 echo 'Previous | Next';
717 $prev = findPreviousMessage($mbx_response['EXISTS']);
718 $next = findNextMessage();
721 echo '<a href="' . $base_uri . "src/read_body.php?passed_id=$prev&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Previous") . "</a> | ";
723 echo _("Previous") . ' | ';
727 echo '<a href="' . $base_uri . "src/read_body.php?passed_id=$next&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Next") . "</a>";
736 html_tag( 'td', '', 'right', '', 'width="33%"' ) .
738 $comp_uri = $base_uri . "src/compose.php?forward_id=$passed_id&".
739 "forward_subj=$url_subj&".
740 ($default_use_priority?
"mailprio=$priority_level&":'').
741 "mailbox=$urlMailbox&ent_num=$ent_num";
743 if ($compose_new_win == '1') {
744 echo "<a href=\"javascript:void(0)\" onclick=\"comp_in_new(false,'$comp_uri')\"";
746 echo '| <a href="' . $comp_uri .'"';
753 $comp_uri = $base_uri . "src/compose.php?send_to=$url_replyto&".
754 "reply_subj=$url_subj&".
755 ($default_use_priority?
"mailprio=$priority_level&":'').
756 "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num";
758 if ($compose_new_win == '1') {
759 echo "<a href=\"javascript:void(0)\" onclick=\"comp_in_new(false,'$comp_uri')\"";
761 echo '| <a href="' . $comp_uri .'"';
768 $comp_uri = $base_uri . "src/compose.php?send_to=$url_replytoall&".
769 "send_to_cc=$url_replytoallcc&reply_subj=$url_subj&".
770 ($default_use_priority?
"mailprio=$priority_level&":'').
771 "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num";
773 if ($compose_new_win == '1') {
774 echo "<a href=\"javascript:void(0)\" onclick=\"comp_in_new(false,'$comp_uri')\"";
776 echo '| <a href="' . $comp_uri .'"';
788 html_tag( 'td', '', 'left', '', 'width="100%"' ) .
789 html_tag( 'table', '', '', '', 'width="100%" border="0" cellspacing="0" cellpadding="3"' ) .
790 html_tag( 'tr' ) . "\n";
793 echo html_tag( 'td', _("Subject:"), 'right', $color[0], 'width="10%" valign="top"' ) .
794 html_tag( 'td', '<b>' . $subject . '</b> ' . "\n", 'left', $color[0], 'width="80%" valign="top"' ) .
795 html_tag( 'td', '', 'right', $color[0], 'rowspan="4" width="10%" valign="top" nowrap' ) .
796 '<a href="' . $base_uri . "src/read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&";
798 /* From a search... */
799 if ($where && $what) {
800 echo 'where=' . urlencode($where) . '&what=' . urlencode($what) .
801 "&view_hdr=1\">" . _("View Full Header") . "</a>\n";
803 echo "startMessage=$startMessage&show_more=$show_more&view_hdr=1\">" .
804 _("View Full Header") . "</a>\n";
807 /* Output the printer friendly link if we are in subtle mode. */
808 if ($pf_subtle_link) {
809 echo printer_friendly_link(true);
812 do_hook("read_body_header_right");
813 echo '</small></td>' .
817 echo html_tag( 'tr', "\n" .
818 html_tag( 'td', _("From:"), 'right', $color[0], 'valign="top"' ) .
820 '<b>' . $from_name . '</b> ' . "\n" ,
823 do_hook("read_body_after_from");
825 echo html_tag( 'tr', "\n" .
826 html_tag( 'td', _("Date:"), 'right', $color[0], 'valign="top"' ) .
828 '<b>' . $dateString . '</b> ' . "\n" ,
832 echo html_tag( 'tr', "\n" .
833 html_tag( 'td', _("To:"), 'right', $color[0], 'valign="top"' ) .
835 '<b>' . $to_string . '</b> ' . "\n" ,
839 if (isset($cc_string) && $cc_string <> '') {
840 echo html_tag( 'tr', "\n" .
841 html_tag( 'td', _("Cc:"), 'right', $color[0], 'valign="top"' ) .
843 '<b>' . $cc_string . '</b> ' . "\n" ,
844 'left', $color[0], 'colspan="2" valign="top"' )
849 if (isset($bcc_string) && $bcc_string <> '') {
850 echo html_tag( 'tr', "\n" .
851 html_tag( 'td', _("Bcc:"), 'right', $color[0], 'valign="top"' ) .
853 '<b>' . $bcc_string . '</b> ' . "\n" ,
854 'left', $color[0], 'colspan="2" valign="top"' )
857 if ($default_use_priority && isset($priority_string) && $priority_string <> '' ) {
858 echo html_tag( 'tr', "\n" .
859 html_tag( 'td', _("Priority") . ':', 'right', $color[0], 'valign="top"' ) .
861 '<b>' . $priority_string . '</b> ' . "\n" ,
862 'left', $color[0], 'colspan="2" valign="top"' )
866 if ($show_xmailer_default) {
867 $mailer = $header->xmailer
;
869 echo html_tag( 'tr', "\n" .
870 html_tag( 'td', _("Mailer") . ':', 'right', $color[0], 'valign="top"' ) .
872 '<b>' . $mailer . '</b> ' ,
873 'left', $color[0], 'colspan="2" valign="top"' )
878 /* Output the printer friendly link if we are not in subtle mode. */
879 if (!$pf_subtle_link) {
880 echo printer_friendly_link(true);
883 if ($default_use_mdn) {
884 if ($mdn_user_support) {
886 // debug gives you the capability to remove mdn-flags
887 // $MDNDebug = false;
890 $MDN_to_o = $header->dnt
;
891 $MDN_to = $MDN_to_o->getAddress();
896 if ($MDN_to && (!isset( $sendreceipt ) ||
$sendreceipt == '' ) ) {
897 if ( $message->is_mdnsent
&& $supportMDN) {
898 $sendreceipt = 'removeMDN';
900 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
904 echo html_tag( 'tr', "\n" .
905 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
907 '<b>' . _("send") . '</b> <a href="' . $url . '">[' . _("Remove MDN flag") . '] </a> ' ,
908 'left', $color[9], 'colspan="2" valign="top"' )
912 echo html_tag( 'tr', "\n" .
913 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
915 '<b>' . _("send") . '</b> ' ,
916 'left', $color[9], 'colspan="2" valign="top"' )
922 } // when deleted or draft flag is set don't offer to send a MDN response
923 else if ( $message->is_draft ||
$message->is_deleted
) {
924 echo html_tag( 'tr', "\n" .
925 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
927 '<b>' . _("requested") . '</b> ' ,
928 'left', $color[9], 'colspan="2" valign="top"' )
931 // if no MDNsupport don't use the annoying popup messages
932 else if ( !$FirstTimeSee ) {
933 $sendreceipt = 'send';
934 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
935 echo html_tag( 'tr', "\n" .
936 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
938 '<b>' . _("requested") . '</b> <a href="' . $url . '">[' . _("Send read receipt now") . ']</a>',
939 'left', $color[9], 'colspan="2" valign="top"' )
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" .
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?") .
952 ' window.open('.$url.',"right");' . "\n" .
957 echo html_tag( 'tr', "\n" .
958 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
960 '<b>' . _("requested") . '</b>  <a href="' . $url . '">[' . _("Send read receipt now") . ']</a>',
961 'left', $color[9], 'colspan="2" valign="top"' )
967 if ( !isset( $sendreceipt ) ||
$sendreceipt == '' ) {
968 } else if ( $sendreceipt == 'send' ) {
969 if ( !$MDN_flag_present) {
970 if (isset($identity) ) {
971 $final_recipient = getPref($data_dir, $username, 'email_address' . '0', '' );
973 $final_recipient = getPref($data_dir, $username, 'email_address', '' );
977 $final_recipient = trim($final_recipient);
978 if ($final_recipient == '' ) {
979 $final_recipient = getPref($data_dir, $username, 'email_address', '' );
982 if ( SendMDN( $MDN_to, $final_recipient, $message ) > 0 && $supportMDN ) {
983 ToggleMDNflag( true);
987 $sendreceipt = 'removeMDN';
988 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
991 if ($MDNDebug && $supportMDN) {
992 echo html_tag( 'tr', "\n" .
993 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
995 '<b>' . _("send") . '</b>  <a href="' . $url . '">[' . _("Remove MDN flag") . ']</a>',
996 'left', $color[9], 'colspan="2" valign="top"' )
1000 echo html_tag( 'tr', "\n" .
1001 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
1003 '<b>' . _("send") . '</b> ',
1004 'left', $color[9], 'colspan="2" valign="top"' )
1010 elseif ($sendreceipt == 'removeMDN' ) {
1011 ToggleMDNflag ( false );
1013 $sendreceipt = 'send';
1014 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
1015 echo html_tag( 'tr', "\n" .
1016 html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
1018 '<b>' . _("requested") . '</b> <a href="' . $url . '">[' . _("Send read receipt now") . ']</a>',
1019 'left', $color[9], 'colspan="2" valign="top"' )
1027 do_hook('read_body_header');
1033 echo html_tag( 'table', "\n" .
1034 html_tag( 'tr', "\n" .
1035 html_tag( 'td', '<br>' . "\n" . $body . "\n", 'left', $color[4]
1038 'center', '', 'cellspacing=0 width="97%" border="0" cellpadding="0"') .
1040 html_tag( 'table', "\n" .
1041 html_tag( 'tr', "\n" .
1042 html_tag( 'td', ' ', 'left', $color[9]
1045 'center', '', 'cellspacing=0 width="100%" border="0" cellpadding="0"');
1047 /* show attached images inline -- if pref'fed so */
1048 if (($attachment_common_show_images) &&
1049 is_array($attachment_common_show_images_list)) {
1051 foreach ($attachment_common_show_images_list as $img) {
1052 $imgurl = '../src/download.php' .
1054 'passed_id=' . urlencode($img['passed_id']) .
1055 '&mailbox=' . urlencode($mailbox) .
1056 '&passed_ent_id=' . urlencode($img['ent_id']) .
1057 '&absolute_dl=true';
1059 echo html_tag( 'table', "\n" .
1060 html_tag( 'tr', "\n" .
1061 html_tag( 'td', '<img src="' . $imgurl . '">' ."\n", 'left'
1064 'center', '', 'cellspacing=0 border="0" cellpadding="2"');
1069 do_hook('read_body_bottom');
1070 do_hook('html_bottom');
1071 sqimap_logout($imapConnection);