X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fcompose.php;h=078c7ee92203d5d152d2611e28ad8350273c74ee;hb=a46ecf666765455b3030130111a6156ea582fd63;hp=bbf93738a4f6a7bc017d109aa042e3c46d8854ed;hpb=14bdd9e6a752daa1ffb9172d97fb518dcfa22c84;p=squirrelmail.git diff --git a/src/compose.php b/src/compose.php index bbf93738..078c7ee9 100644 --- a/src/compose.php +++ b/src/compose.php @@ -14,11 +14,14 @@ * - Send mail * - Save As Draft * - * $Id$ + * @version $Id$ * @package squirrelmail */ -/** Path for SquirrelMail required files. */ +/** + * Path for SquirrelMail required files. + * @ignore + */ define('SM_PATH','../'); /* SquirrelMail required files. */ @@ -98,6 +101,8 @@ if ( !sqgetGlobalVar('smaction',$action) ) if ( sqgetGlobalVar('smaction_reply_all',$tmp) ) $action = 'reply_all'; if ( sqgetGlobalVar('smaction_forward',$tmp) ) $action = 'forward'; if ( sqgetGlobalVar('smaction_attache',$tmp) ) $action = 'forward_as_attachment'; + if ( sqgetGlobalVar('smaction_draft',$tmp) ) $action = 'draft'; + if ( sqgetGlobalVar('smaction_edit_new',$tmp) ) $action = 'edit_as_new'; } /* Location (For HTTP 1.1 Header("Location: ...") redirects) */ @@ -575,9 +580,16 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se global $editor_size, $default_use_priority, $body, $idents, $use_signature, $composesession, $data_dir, $username, $username, $key, $imapServerAddress, $imapPort, $compose_messages, - $composeMessage; + $composeMessage, $body_quote; global $languages, $squirrelmail_language, $default_charset; + /* + * Set $default_charset to correspond with the user's selection + * of language interface. $default_charset global is not correct, + * if message is composed in new window. + */ + set_my_charset(); + $send_to = $send_to_cc = $send_to_bcc = $subject = $identity = ''; $mailprio = 3; @@ -644,7 +656,7 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se } if ( $actual && is_conversion_safe($actual) && $actual != $default_charset){ - $bodypart = charset_decode($actual,$bodypart); + $bodypart = charset_convert($actual,$bodypart,$default_charset); } $body .= $bodypart; @@ -661,6 +673,11 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se $identity = ''; $from_o = $orig_header->from; + if (is_array($from_o)) { + if (isset($from_o[0])) { + $from_o = $from_o[0]; + } + } if (is_object($from_o)) { $orig_from = $from_o->getAddress(); } else { @@ -682,8 +699,6 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se if ($identity_match) { $identity = $identity_match; } - // we need identiy here fore draft case #845290 - // echo $identity."leer"; } switch ($action) { @@ -785,9 +800,9 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se sqWordWrap($line, ($editor_size)); if (preg_match("/^(>+)/", $line, $matches)) { $gt = $matches[1]; - $body .= '>' . str_replace("\n", "\n>$gt ", rtrim($line)) ."\n"; + $body .= $body_quote . str_replace("\n", "\n$body_quote$gt ", rtrim($line)) ."\n"; } else { - $body .= '> ' . str_replace("\n", "\n> ", rtrim($line)) . "\n"; + $body .= $body_quote . (!empty($body_quote) ? ' ' : '') . str_replace("\n", "\n$body_quote" . (!empty($body_quote) ? ' ' : ''), rtrim($line)) . "\n"; } } $body = getReplyCitation($from , $orig_header->date) . $body; @@ -978,21 +993,22 @@ function showInputForm ($session, $values=false) { /* display select list for identities */ if (count($idents) > 1) { - $ident_list = array(); - foreach($idents as $id => $data) { - $ident_list[$id] = - $data['full_name'].' <'.$data['email_address'].'>'; - } + $ident_list = array(); + foreach($idents as $id => $data) { + $ident_list[$id] = + $data['full_name'].' <'.$data['email_address'].'>'; + } echo ' ' . "\n" . html_tag( 'td', '', 'right', $color[4], 'width="10%"' ) . _("From:") . '' . "\n" . html_tag( 'td', '', 'left', $color[4], 'width="90%"' ) . - ' '. - addSelect('identitiy', $ident_list, $identity, TRUE); + ' '. + addSelect('identity', $ident_list, $identity, TRUE); echo ' ' . "\n" . ' ' . "\n"; } + echo ' ' . "\n" . html_tag( 'td', '', 'right', $color[4], 'width="10%"' ) . _("To:") . '' . "\n" . @@ -1004,14 +1020,14 @@ function showInputForm ($session, $values=false) { html_tag( 'td', '', 'right', $color[4] ) . _("CC:") . '' . "\n" . html_tag( 'td', '', 'left', $color[4] ) . - addInput('send_to_cc', $send_to_cc, 60). '
' . "\n" . + addInput('send_to_cc', $send_to_cc, 60). '
' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . html_tag( 'td', '', 'right', $color[4] ) . _("BCC:") . '' . "\n" . html_tag( 'td', '', 'left', $color[4] ) . - addInput('send_to_bcc', $send_to_bcc, 60).'
' . "\n" . + addInput('send_to_bcc', $send_to_bcc, 60).'
' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . @@ -1132,8 +1148,8 @@ function showInputForm ($session, $values=false) { $s_a[] = '
'. - addCheckBox('delete[]', FALSE, $key). - "\n" . $attached_filename . + addCheckBox('delete[]', FALSE, $key). + "\n" . $attached_filename . '- ' . $type . '('. show_readable_size( filesize( $attached_file ) ) . ')
'."\n"; } @@ -1160,18 +1176,18 @@ function showInputForm ($session, $values=false) { } echo '' . "\n" . - addHidden('username', $username). - addHidden('smaction', $action). - addHidden('mailbox', $mailbox); + addHidden('username', $username). + addHidden('smaction', $action). + addHidden('mailbox', $mailbox); /* store the complete ComposeMessages array in a hidden input value so we can restore them in case of a session timeout. */ sqgetGlobalVar('QUERY_STRING', $queryString, SQ_SERVER); echo addHidden('restoremessages', serialize($compose_messages)). - addHidden('composesession', $composesession). - addHidden('querystring', $queryString). - "\n"; + addHidden('composesession', $composesession). + addHidden('querystring', $queryString). + "\n"; if (!(bool) ini_get('file_uploads')) { /* File uploads are off, so we didn't show that part of the form. To avoid bogus bug reports, tell the user why. */ @@ -1199,16 +1215,16 @@ function showComposeButtonRow() { } echo ' ' . _("Priority") . addSelect('mailprio', array( - '1' => _("High"), - '3' => _("Normal"), - '5' => _("Low") ), $mailprio, TRUE); + '1' => _("High"), + '3' => _("Normal"), + '5' => _("Low") ), $mailprio, TRUE); } $mdn_user_support=getPref($data_dir, $username, 'mdn_user_support',$default_use_mdn); if ($default_use_mdn) { if ($mdn_user_support) { echo ' ' . _("Receipt") .': '. - addCheckBox('request_mdn', $request_mdn == '1', '1'). _("On Read"). - addCheckBox('request_dr', $request_dr == '1', '1'). _("On Delivery"); + addCheckBox('request_mdn', $request_mdn == '1', '1'). _("On Read"). + addCheckBox('request_dr', $request_dr == '1', '1'). _("On Delivery"); } } @@ -1350,18 +1366,6 @@ function deliverMessage($composeMessage, $draft=false) { $domain, $action, $default_move_to_sent, $move_to_sent; global $imapServerAddress, $imapPort, $sent_folder, $key; - /* some browsers replace by nonbreaking spaces   - by replacing them back to spaces addressparsing works */ - /* FIXME: How to handle in case of other charsets where "\240" - is not a non breaking space ??? */ - /* THEFIX: browsers don't replace space with nbsp. SM replaces - space with nbsp when decodes headers. If problem still happens, - use cleanup_nbsp() */ - -// $send_to = str_replace("\240",' ',$send_to); -// $send_to_cc = str_replace("\240",' ',$send_to_cc); -// $send_to_bcc = str_replace("\240",' ',$send_to_bcc); - $rfc822_header = $composeMessage->rfc822_header; $abook = addressbook_init(false, true); @@ -1490,7 +1494,7 @@ function deliverMessage($composeMessage, $draft=false) { unset ($imap_deliver); return $length; } else { - $msg = '
Error: '._("Draft folder")." $draft_folder" . ' does not exist.'; + $msg = '
'.sprintf(_("Error: Draft folder %s does not exist."), $draft_folder); plain_error_message($msg, $color); return false; } @@ -1501,7 +1505,7 @@ function deliverMessage($composeMessage, $draft=false) { $succes = $deliver->finalizeStream($stream); } if (!$succes) { - $msg = $deliver->dlv_msg . '
' . + $msg = $deliver->dlv_msg . '
' . _("Server replied: ") . $deliver->dlv_ret_nr . ' '. $deliver->dlv_server_msg; plain_error_message($msg, $color);