X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fread_body.php;h=b2f8266207d8b4b4ef2bc68beb8f6183ae406124;hb=40e071367219a08de46bf1ed3993180030adc9c9;hp=7078c95ef0035cedf731a965e6540234bbcfde93;hpb=628bce99c404e37bbebc40555b591ed101400671;p=squirrelmail.git diff --git a/src/read_body.php b/src/read_body.php index 7078c95e..b2f82662 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -6,7 +6,7 @@ * This file is used for reading the msgs array and displaying * the resulting emails in the right frame. * - * @copyright © 1999-2006 The SquirrelMail Project Team + * @copyright © 1999-2007 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail @@ -124,9 +124,9 @@ function ServerMDNSupport($aFlags) { in_array('\\*',$aFlags,true) ) ; } -function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) { - global $username, $attachment_dir, $popuser, $username, $color, - $version, $squirrelmail_language, $default_charset, +function SendMDN ( $mailbox, $passed_id, $message, $imapConnection) { + global $username, $attachment_dir, $color, + $squirrelmail_language, $default_charset, $languages, $useSendmail, $domain, $sent_folder; sqgetGlobalVar('SERVER_NAME', $SERVER_NAME, SQ_SERVER); @@ -145,36 +145,27 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) { $rfc822_header->to[] = $header->dnt; $rfc822_header->subject = _("Read:") . ' ' . encodeHeader($header->subject); - // Patch #793504 Return Receipt Failing with <@> from Tim Craig (burny_md) - // This merely comes from compose.php and only happens when there is no - // email_addr specified in user's identity (which is the startup config) - if (ereg("^([^@%/]+)[@%/](.+)$", $username, $usernamedata)) { - $popuser = $usernamedata[1]; - $domain = $usernamedata[2]; - unset($usernamedata); - } else { - $popuser = $username; + $idents = get_identities(); + $needles = array(); + if ($header->to) { + foreach ($header->to as $message_to) { + $needles[] = $message_to->mailbox.'@'.$message_to->host; + } } + $identity = find_identity($needles); + $from_addr = build_from_header($identity); + $reply_to = isset($idents[$identity]['reply_to']) ? $idents[$identity]['reply_to'] : ''; + // FIXME: this must actually be the envelope address of the orginal message, + // but do we have that information? For now the first identity is our best guess. + $final_recipient = $idents[0]['email_address']; - $reply_to = ''; - $ident = get_identities(); - if(!isset($identity)) $identity = 0; - $full_name = $ident[$identity]['full_name']; - $from_mail = $ident[$identity]['email_address']; - $from_addr = '"'.$full_name.'" <'.$from_mail.'>'; - $reply_to = $ident[$identity]['reply_to']; - - if (!$from_mail) { - $from_mail = "$popuser@$domain"; - $from_addr = $from_mail; - } $rfc822_header->from = $rfc822_header->parseAddress($from_addr,true); if ($reply_to) { $rfc822_header->reply_to = $rfc822_header->parseAddress($reply_to,true); } // part 1 (RFC2298) - $senton = getLongDateString( $header->date ); + $senton = getLongDateString( $header->date, $header->date_unparsed ); $to_array = $header->to; $to = ''; foreach ($to_array as $line) { @@ -223,11 +214,10 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) { $original_recipient = $to; $original_message_id = $header->message_id; - $report = "Reporting-UA : $SERVER_NAME ; SquirrelMail (version $version) \r\n"; + $report = "Reporting-UA : $SERVER_NAME ; SquirrelMail (version " . SM_VERSION . ") \r\n"; if ($original_recipient != '') { $report .= "Original-Recipient : $original_recipient\r\n"; } - $final_recipient = $sender; $report .= "Final-Recipient: rfc822; $final_recipient\r\n" . "Original-Message-ID : $original_message_id\r\n" . "Disposition: manual-action/MDN-sent-manually; displayed\r\n"; @@ -372,7 +362,7 @@ function formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message, $env[_("From")] = _("Unknown sender"); else $env[_("From")] = decodeHeader($from_name); - $env[_("Date")] = getLongDateString($header->date); + $env[_("Date")] = getLongDateString($header->date, $header->date_unparsed); $env[_("To")] = formatRecipientString($header->to, "to"); $env[_("Cc")] = formatRecipientString($header->cc, "cc"); $env[_("Bcc")] = formatRecipientString($header->bcc, "bcc"); @@ -388,10 +378,10 @@ function formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message, if ($mdn_user_support) { if ($header->dnt) { $mdn_url = $PHP_SELF; - $mdn_url = set_url_var($PHP_SELF, 'mailbox', urlencode($mailbox)); - $mdn_url = set_url_var($PHP_SELF, 'passed_id', $passed_id); - $mdn_url = set_url_var($PHP_SELF, 'passed_ent_id', $passed_ent_id); - $mdn_url = set_url_var($PHP_SELF, 'sendreceipt', 1); + $mdn_url = set_url_var($mdn_url, 'mailbox', urlencode($mailbox)); + $mdn_url = set_url_var($mdn_url, 'passed_id', $passed_id); + $mdn_url = set_url_var($mdn_url, 'passed_ent_id', $passed_ent_id); + $mdn_url = set_url_var($mdn_url, 'sendreceipt', 1); $oTemplate->assign('read_receipt_sent', $message->is_mdnsent); $oTemplate->assign('first_time_reading', $FirstTimeSee); @@ -553,7 +543,7 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed // Start form for reply/reply all/forward.. $target = ''; $on_click=''; - $method='method="post" '; + $method='post'; $onsubmit=''; if ($compose_new_win == '1') { if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) { @@ -563,12 +553,12 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed $compose_height = '550'; } if ( checkForJavascript() ) { - $on_click=' onclick="comp_in_new_form(\''.$comp_uri.'\', this, this.form,'. $compose_width .',' . $compose_height .')"'; + $on_click='comp_in_new_form(\''.$comp_uri.'\', this, this.form,'. $compose_width .',' . $compose_height .')'; $comp_uri = 'javascript:void(0)'; - $method='method="get" '; - $onsubmit = 'onsubmit="return false" '; + $method='get'; + $onsubmit = 'return false'; } else { - $target = 'target="_blank"'; + $target = '_blank'; } } @@ -584,7 +574,10 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed $oTemplate->assign('message_list_href', $msg_list_href); $oTemplate->assign('search_href', $search_href); - $oTemplate->assign('form_extra', $method . $target . $onsubmit); + $oTemplate->assign('form_extra', ''); + $oTemplate->assign('form_method', $method); + $oTemplate->assign('form_target', $target); + $oTemplate->assign('form_onsubmit', $onsubmit); $oTemplate->assign('compose_href', $comp_uri); $oTemplate->assign('button_onclick', $on_click); $oTemplate->assign('forward_as_attachment_enabled', $enable_forward_as_attachment==1); @@ -634,6 +627,9 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed $oTemplate->assign('can_be_copied', false); } + global $null; + do_hook('read_body_menu', $null); + if ($nav_on_top) { $oTemplate->display('read_menubar_nav.tpl'); $oTemplate->display('read_menubar_buttons.tpl'); @@ -642,8 +638,6 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed $oTemplate->display('read_menubar_nav.tpl'); } - global $null; - do_hook('read_body_menu_bottom', $null); } function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) { @@ -912,13 +906,8 @@ $header = $message->header; if (isset($sendreceipt)) { if ( !$message->is_mdnsent ) { - $final_recipient = ''; - if ((isset($identity)) && ($identity != 0)) //Main identity - $final_recipient = trim(getPref($data_dir, $username, 'email_address' . $identity, '' )); - if ($final_recipient == '' ) - $final_recipient = trim(getPref($data_dir, $username, 'email_address', '' )); $supportMDN = ServerMDNSupport($aMailbox["PERMANENTFLAGS"]); - if ( SendMDN( $mailbox, $passed_id, $final_recipient, $message, $imapConnection ) > 0 && $supportMDN ) { + if ( SendMDN( $mailbox, $passed_id, $message, $imapConnection ) > 0 && $supportMDN ) { ToggleMDNflag( true, $imapConnection, $mailbox, $passed_id); $message->is_mdnsent = true; $aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT'] = $message;