X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fread_body.php;h=f32330b1bd2993b404444390d510c3185124d574;hb=d8415ed878ea9a1a48879622d2ac674e9856d6bd;hp=069d3a7bfb7eb947542967f8d74fa23c84e8935a;hpb=1012f961058171a1e8f8402066f96276cf4034b1;p=squirrelmail.git diff --git a/src/read_body.php b/src/read_body.php index 069d3a7b..f32330b1 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -1,8 +1,9 @@ rfc822_header; - $hashed_attachment_dir = getHashedDir($username, $attachment_dir); $rfc822_header = new Rfc822Header(); $content_type = new ContentType('multipart/report'); @@ -184,16 +190,16 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) { $now = getLongDateString( time() ); set_my_charset(); $body = _("Your message") . "\r\n\r\n" . - "\t" . _("To:") . ' ' . decodeHeader($to,false,false) . "\r\n" . - "\t" . _("Subject:") . ' ' . decodeHeader($header->subject,false,false) . "\r\n" . - "\t" . _("Sent:") . ' ' . $senton . "\r\n" . + "\t" . _("To") . ': ' . decodeHeader($to,false,false) . "\r\n" . + "\t" . _("Subject") . ': ' . decodeHeader($header->subject,false,false) . "\r\n" . + "\t" . _("Sent") . ': ' . $senton . "\r\n" . "\r\n" . sprintf( _("Was displayed on %s"), $now ); $special_encoding = ''; if (isset($languages[$squirrelmail_language]['XTRA_CODE']) && - function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) { - $body = $languages[$squirrelmail_language]['XTRA_CODE']('encode', $body); + function_exists($languages[$squirrelmail_language]['XTRA_CODE'] . '_encode')) { + $body = call_user_func($languages[$squirrelmail_language]['XTRA_CODE'] . '_encode', $body); if (strtolower($default_charset) == 'iso-2022-jp') { if (mb_detect_encoding($body) == 'ASCII') { $special_encoding = '8bit'; @@ -202,6 +208,8 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) { $special_encoding = '7bit'; } } + } elseif (sq_is8bit($body)) { + $special_encoding = '8bit'; } $part1 = new Message(); $part1->setBody($body); @@ -253,7 +261,7 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) { } else { require_once(SM_PATH . 'class/deliver/Deliver_SMTP.class.php'); $deliver = new Deliver_SMTP(); - global $smtpServerAddress, $smtpPort, $smtp_auth_mech, $pop_before_smtp; + global $smtpServerAddress, $smtpPort, $pop_before_smtp; $authPop = (isset($pop_before_smtp) && $pop_before_smtp) ? true : false; get_smtp_user($user, $pass); $stream = $deliver->initStream($composeMessage,$domain,0, @@ -265,7 +273,7 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) { $success = $deliver->finalizeStream($stream); } if (!$success) { - $msg = $deliver->dlv_msg . '
' . + $msg = $deliver->dlv_msg . '
' . _("Server replied: ") . $deliver->dlv_ret_nr . ' '. $deliver->dlv_server_msg; require_once(SM_PATH . 'functions/display_messages.php'); @@ -302,7 +310,7 @@ function ClearAttachments() { if ($info['session'] == -1) { $attached_file = "$hashed_attachment_dir/$info[localfilename]"; if (file_exists($attached_file)) { - unlink($attached_file); + unlink($attached_file); } } else { $rem_attachments[] = $info; @@ -347,15 +355,15 @@ function formatRecipientString($recipients, $item ) { foreach($recipients as $r) { $add = decodeHeader($r->getAddress(true)); if ($string) { - $string .= '
' . $add; + $string .= '
' . $add; } else { $string = $add; if ($cnt > 1) { - $string .= ' ()'; + $string .= '">'._("less").')'; } else { - $string .= '">'._("more").')'; + $string .= '">'._("more").')'; break; } } @@ -367,11 +375,11 @@ function formatRecipientString($recipients, $item ) { function formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee) { - global $msn_user_support, $default_use_mdn, $default_use_priority, + global $default_use_mdn, $default_use_priority, $show_xmailer_default, $mdn_user_support, $PHP_SELF, $javascript_on, - $squirrelmail_language; + $squirrelmail_language; - $mailbox = $aMailbox['NAME'] ; + $mailbox = $aMailbox['NAME']; $header = $message->rfc822_header; $env = array(); @@ -425,26 +433,26 @@ function formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message, } } - $s = ''; + $s = '
'; foreach ($env as $key => $val) { if ($val) { - $s .= ''; - $s .= html_tag('TD', '' . $key . ':  ', 'RIGHT', '', 'VALIGN="TOP" WIDTH="20%"') . "\n"; - $s .= html_tag('TD', $val, 'left', '', 'VALIGN="TOP" WIDTH="80%"') . "\n"; - $s .= ''; + $s .= ''; + $s .= html_tag('td', '' . $key . ':  ', 'right', '', 'valign="top" width="20%"') . "\n"; + $s .= html_tag('td', $val, 'left', '', 'valign="top" width="80%"') . "\n"; + $s .= ''; } } - echo '
'."\n"; - echo ''."\n"; - echo '
'."\n"; + echo ''."\n"; + echo '
'."\n"; echo $s; do_hook('read_body_header'); formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color); - echo '
'; - echo '
'; + echo ''; + echo ''."\n"; + echo ''; } /** @@ -460,7 +468,7 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed global $base_uri, $draft_folder, $where, $what, $color, $sort, $startMessage, $PHP_SELF, $save_as_draft, $enable_forward_as_attachment, $imapConnection, $lastTargetMailbox, - $data_dir, $username, $delete_prev_next_display, + $username, $delete_prev_next_display, $compose_new_win, $javascript_on; //FIXME cleanup argument list, use $aMailbox where possible @@ -596,7 +604,7 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed // BEGIN MENU ROW - DELETE/REPLY/FORWARD/MOVE/etc. - $menu_row = ''; + $menu_row = ''; $comp_uri = $base_uri.'src/compose.php' . '?passed_id=' . $passed_id . '&mailbox=' . $urlMailbox . @@ -607,17 +615,20 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed $target = ''; $on_click=''; $method='method="post" '; + $onsubmit=''; if ($compose_new_win == '1') { if ( $javascript_on ) { $on_click=' onclick="comp_in_new_form(\''.$comp_uri.'\', this, this.form)"'; $comp_uri = 'javascript:void(0)'; $method='method="get" '; + $onsubmit = 'onsubmit="return false" '; } else { $target = 'target="_blank"'; } } - $menu_row .= "\n".'
'."\n"; + $menu_row .= "\n".''."\n"; // If Draft folder - create Resume link if (($mailbox == $draft_folder) && ($save_as_draft)) { @@ -630,28 +641,29 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed } // Show Alt URI for Draft/Sent if (isset($comp_alt_string)) - $menu_row .= getButton('SUBMIT', $new_button, $comp_alt_string, $on_click) . "\n"; + $menu_row .= getButton('submit', $new_button, $comp_alt_string, $on_click) . "\n"; - $menu_row .= getButton('SUBMIT', 'smaction_reply', _("Reply"), $on_click) . "\n"; - $menu_row .= getButton('SUBMIT', 'smaction_reply_all', _("Reply All"), $on_click) ."\n"; - $menu_row .= getButton('SUBMIT', 'smaction_forward', _("Forward"), $on_click); + $menu_row .= getButton('submit', 'smaction_reply', _("Reply"), $on_click) . "\n"; + $menu_row .= getButton('submit', 'smaction_reply_all', _("Reply All"), $on_click) ."\n"; + $menu_row .= getButton('submit', 'smaction_forward', _("Forward"), $on_click); if ($enable_forward_as_attachment) - $menu_row .= '' . _("As Attachment") .'  '."\n"; + $menu_row .= '' . _("As Attachment") .'  '."\n"; $menu_row .= '
 '; if ( in_array('\\deleted', $aMailbox['PERMANENTFLAGS'],true) ) { // Form for deletion. Form is handled by the originating display in $where. This is right_main.php or search.php $delete_url = $base_uri . "src/$where"; - $menu_row .= '
'; + $menu_row .= ''; if (!(isset($passed_ent_id) && $passed_ent_id)) { $menu_row .= addHidden('mailbox', $aMailbox['NAME']); $menu_row .= addHidden('msg[0]', $passed_id); - $menu_row .= getButton('SUBMIT', 'delete', _("Delete")); - $menu_row .= '' . _("Bypass Trash"); + $menu_row .= addHidden('startMessage', $startMessage); + $menu_row .= getButton('submit', 'delete', _("Delete")); + $menu_row .= '' . _("Bypass Trash"); } else { - $menu_row .= getButton('SUBMIT', 'delete', _("Delete"), '', FALSE) . "\n"; // delete button is disabled + $menu_row .= getButton('submit', 'delete', _("Delete"), '', FALSE) . "\n"; // delete button is disabled } $menu_row .= '
'; @@ -662,7 +674,7 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed if ( !(isset($passed_ent_id) && $passed_ent_id) && in_array('\\deleted', $aMailbox['PERMANENTFLAGS'],true) ) { - $menu_row .= '
'. + $menu_row .= ''. ''. addHidden('mailbox',$aMailbox['NAME']) . @@ -676,7 +688,7 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed } $menu_row .= ' '; - $menu_row .= getButton('SUBMIT', 'moveButton',_("Move")) . "\n" . ''; + $menu_row .= getButton('submit', 'moveButton',_("Move")) . "\n" . ''; } $menu_row .= ''; @@ -715,9 +727,9 @@ function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) { $url = $base_uri.'src/view_header.php?'.$query_string; - $s = "\n" . - html_tag( 'td', '', 'right', '', 'VALIGN="MIDDLE" WIDTH="20%"' ) . '' . _("Options") . ":  \n" . - html_tag( 'td', '', 'left', '', 'VALIGN="MIDDLE" WIDTH="80%"' ) . '' . + $s = "\n" . + html_tag( 'td', '', 'right', '', 'valign="middle" width="20%"' ) . '' . _("Options") . ":  \n" . + html_tag( 'td', '', 'left', '', 'valign="middle" width="80%"' ) . '' . ''._("View Full Header").''; /* Output the printer friendly link if we are in subtle mode. */ @@ -725,8 +737,8 @@ function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) { printer_friendly_link($mailbox, $passed_id, $passed_ent_id); echo $s; do_hook("read_body_header_right"); - $s = "\n" . - "\n"; + $s = "\n" . + "\n"; echo $s; } @@ -841,7 +853,6 @@ if (isset($passed_ent_id) && $passed_ent_id) { } $header = $message->header; -do_hook('html_top'); /****************************************/ /* Block for handling incoming url vars */ @@ -850,7 +861,7 @@ do_hook('html_top'); if (isset($sendreceipt)) { if ( !$message->is_mdnsent ) { $final_recipient = ''; - if ((isset($identity)) && ($identity != 0)) //Main identity + 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', '' )); @@ -880,7 +891,7 @@ $cnt = count($ent_ar); for ($i = 0; $i < $cnt; $i++) { $messagebody .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $passed_id, $mailbox); if ($i != $cnt-1) { - $messagebody .= '
'; + $messagebody .= '
'; } } @@ -895,7 +906,7 @@ echo ' '; @@ -903,8 +914,8 @@ echo '
'; // echo ' '; echo html_tag( 'table' ,'' , 'left', '', 'cellpadding="1" cellspacing="5" border="0"' ); -echo ' ' . html_tag( 'td', '
'. $messagebody."\n", 'left') +echo ' ' . html_tag( 'td', '
'. $messagebody."\n", 'left') . ''; echo '
'; echo '
'; echo ' '; echo ' '; -echo ''."\n"; +echo ''."\n"; $attachmentsdisplay = formatAttachments($message,$ent_ar,$mailbox, $passed_id); if ($attachmentsdisplay) { @@ -921,8 +932,8 @@ if ($attachmentsdisplay) { echo ' '; echo ' '; echo ' '; - echo ''; + echo ''; } echo ''; @@ -939,17 +950,16 @@ if (($attachment_common_show_images) && echo html_tag( 'table', "\n" . html_tag( 'tr', "\n" . - html_tag( 'td', '' ."\n", 'left' + html_tag( 'td', '' ."\n", 'left' ) ) , - 'center', '', 'cellspacing=0 border="0" cellpadding="2"'); + 'center', '', 'cellspacing="0" border="0" cellpadding="2"'); } } formatMenuBar($aMailbox, $passed_id, $passed_ent_id, $message, false, FALSE); do_hook('read_body_bottom'); -do_hook('html_bottom'); sqimap_logout($imapConnection); /* sessions are written at the end of the script. it's better to register them at the end so we avoid double session_register calls */ @@ -957,5 +967,4 @@ sqimap_logout($imapConnection); $mailbox_cache[$aMailbox['NAME']] = $aMailbox; sqsession_register($mailbox_cache,'mailbox_cache'); ?> - - + \ No newline at end of file