global $reply_citation_style, $reply_citation_start, $reply_citation_end;
// FIXME: why object is rewritten with string.
- $orig_from = decodeHeader($orig_from->getAddress(false),false,false,true);
+ if (!is_object($orig_from)) {
+ $orig_from = '';
+ } else {
+ $orig_from = decodeHeader($orig_from->getAddress(false),false,false,true);
+ }
+
// $from = decodeHeader($orig_header->getAddr_s('from',"\n$indent"),false,false);
/* First, return an empty string when no citation style selected. */
/**
* To translators: %s is for author's name
*/
- $full_reply_citation = sprintf(_("%s said:"),$orig_from);
+ $full_reply_citation = sprintf(_("%s wrote:"),$orig_from);
break;
case 'quote_who':
// FIXME: do we have to translate xml formating?
case 'date_time_author':
/**
* To translators:
- * first %s is for date string, second %s is for author's name. Date uses
+ * first %s is for date string, second %s is for author's name. Date uses
* formating from "D, F j, Y g:i a" and "D, F j, Y H:i" translations.
* Example string:
- * "On Sat, December 24, 2004 23:59, Santa said:"
+ * "On Sat, December 24, 2004 23:59, Santa wrote:"
* If you have to put author's name in front of date string, check comments about
* argument swapping at http://www.php.net/sprintf
*/
- $full_reply_citation = sprintf(_("On %s, %s said:"), getLongDateString($orig_date), $orig_from);
+ $full_reply_citation = sprintf(_("On %s, %s wrote:"), getLongDateString($orig_date), $orig_from);
break;
case 'user-defined':
$start = $reply_citation_start .
/**
* Creates header fields in forwarded email body
*
- * $default_charset global must be set correctly before you call this function.
+ * $default_charset global must be set correctly before you call this function.
* @param object $orig_header
- * @return $string
+ * @return $string
*/
function getforwardHeader($orig_header) {
global $editor_size, $default_charset;
if ($compose_new_win == '1') {
compose_Header($color, $mailbox);
} else {
- displayPageHeader($color, $mailbox);
+ $sHeaderJs = (isset($sHeaderJs)) ? $sHeaderJs : '';
+ if (strpos($action, 'reply') !== false && $reply_focus) {
+ $sBodyTagJs = 'onload="checkForm(\''.$replyfocus.'\');"';
+ } else {
+ $sBodyTagJs = 'onload="checkForm();"';
+ }
+ displayPageHeader($color, $mailbox,$sHeaderJs,$sBodyTagJs);
}
showInputForm($session, false);
exit();
if (!isset($compose_messages)) {
$compose_messages = array();
}
+
if (!isset($compose_messages[$session]) || ($compose_messages[$session] == NULL)) {
/* if (!array_key_exists($session, $compose_messages)) { /* We can only do this in PHP >= 4.1 */
$composeMessage = new Message();
$composeMessage->rfc822_header = $rfc822_header;
$composeMessage->reply_rfc822_header = '';
$compose_messages[$session] = $composeMessage;
+
sqsession_register($compose_messages,'compose_messages');
} else {
$composeMessage=$compose_messages[$session];
$draft_message = _("Draft Email Saved");
/* If this is a resumed draft, then delete the original */
if(isset($delete_draft)) {
- Header("Location: $location/delete_message.php?mailbox=" . urlencode($draft_folder) .
- "&message=$delete_draft&startMessage=1&saved_draft=yes");
- exit();
- }
- else {
- if ($compose_new_win == '1') {
- Header("Location: $location/compose.php?saved_draft=yes&session=$composesession");
- exit();
- }
- else {
- Header("Location: $location/right_main.php?mailbox=" . urlencode($draft_folder) .
- "&startMessage=1¬e=".urlencode($draft_message));
- exit();
+ $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, false);
+ sqimap_mailbox_select($imap_stream, $draft_folder);
+ // force bypass_trash=true because message should be saved when deliverMessage() returns true.
+ // in current implementation of sqimap_msgs_list_flag() single message id can
+ // be submitted as string. docs state that it should be array.
+ sqimap_msgs_list_delete($imap_stream, $draft_folder, $delete_draft, true);
+ if ($auto_expunge) {
+ sqimap_mailbox_expunge($imap_stream, $draft_folder, true);
}
+ sqimap_logout($imap_stream);
+ }
+ if ($compose_new_win == '1') {
+ Header("Location: $location/compose.php?saved_draft=yes&session=$composesession");
+ exit();
+ } else {
+ Header("Location: $location/right_main.php?mailbox=" . urlencode($draft_folder) .
+ "&startMessage=1¬e=".urlencode($draft_message));
+ exit();
}
}
}
if( $line <> '-- ' ) {
$line = rtrim($line);
}
- if (strlen($line) <= $editor_size + 1) {
+ if (sq_strlen($line,$default_charset) <= $editor_size + 1) {
$newBody .= $line . "\n";
} else {
- sqWordWrap($line, $editor_size);
+ sqWordWrap($line, $editor_size,$default_charset);
$newBody .= $line . "\n";
}
exit();
}
unset($compose_messages[$session]);
+ /* if it is resumed draft, delete draft message */
if ( isset($delete_draft)) {
- Header("Location: $location/delete_message.php?mailbox=" . urlencode( $draft_folder ).
- "&message=$delete_draft&startMessage=1&mail_sent=yes");
- exit();
+ $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, false);
+ sqimap_mailbox_select($imap_stream, $draft_folder);
+ // bypass_trash=true because message should be saved when deliverMessage() returns true.
+ // in current implementation of sqimap_msgs_list_flag() single message id can
+ // be submitted as string. docs state that it should be array.
+ sqimap_msgs_list_delete($imap_stream, $draft_folder, $delete_draft, true);
+ if ($auto_expunge) {
+ sqimap_mailbox_expunge($imap_stream, $draft_folder, true);
+ }
+ sqimap_logout($imap_stream);
}
if ($compose_new_win == '1') {
-
Header("Location: $location/compose.php?mail_sent=yes");
- }
- else {
+ }else {
Header("Location: $location/right_main.php?mailbox=$urlMailbox".
- "&startMessage=$startMessage&mail_sent=yes");
+ "&startMessage=$startMessage&mail_sent=yes");
}
} else {
if ($compose_new_win == '1') {
// forwarded message text should be as undisturbed as possible, so commenting out this call
// sqUnWordWrap($body);
$composeMessage = getAttachments($message, $composeMessage, $passed_id, $entities, $imapConnection);
+
//add a blank line after the forward headers
$body = "\n" . $body;
break;
* @param integer $passed_id
* @param mixed $entities
* @param mixed $imapConnection
- * @return object
+ * @return object
*/
function getAttachments($message, &$composeMessage, $passed_id, $entities, $imapConnection) {
global $attachment_dir, $username, $data_dir, $squirrelmail_language, $languages;
/* Write Attachment to file */
$fp = fopen ("$hashed_attachment_dir/$localfilename", 'wb');
- fputs($fp, decodeBody(mime_fetch_body($imapConnection,
- $passed_id, $message->entity_id),
- $message->header->encoding));
+ mime_print_body_lines ($imapConnection, $passed_id, $message->entity_id, $message->header->encoding, $fp);
fclose ($fp);
}
} else {
$mailprio, $compose_new_win, $saved_draft, $mail_sent, $sig_first,
$username, $compose_messages, $composesession, $default_charset;
+
$composeMessage = $compose_messages[$session];
if ($values) {
$send_to = $values['send_to'];
/*
* FIXME: test is specific to ja_JP translation implementation.
* This test might apply incorrect conversion to other translations, but
- * use of 7bit iso-2022-jp charset in other translations might have other
+ * use of 7bit iso-2022-jp charset in other translations might have other
* issues too.
*/
if ($default_charset == 'iso-2022-jp') {
function saveAttachedFiles($session) {
global $_FILES, $attachment_dir, $attachments, $username,
$data_dir, $compose_messages;
-
/* get out of here if no file was attached at all */
if (! is_uploaded_file($_FILES['attachfile']['tmp_name']) ) {
return true;
}
if (!$succes) {
$msg = $deliver->dlv_msg . '<br />' .
- _("Server replied: ") . $deliver->dlv_ret_nr . ' '.
+ _("Server replied:") . ' ' . $deliver->dlv_ret_nr . ' ' .
$deliver->dlv_server_msg;
plain_error_message($msg, $color);
} else {
ClearAttachments($composeMessage);
if ($action == 'reply' || $action == 'reply_all') {
sqimap_mailbox_select ($imap_stream, $mailbox);
- sqimap_messages_flag ($imap_stream, $passed_id, $passed_id, 'Answered', false);
+ sqimap_toggle_flag($imap_stream, array($passed_id), '\\Answered', true, false);
}
sqimap_logout($imap_stream);
}