}
function getforwardHeader($orig_header) {
+ global $editor_size;
+
$display = array(
_("Subject") => strlen(_("Subject")),
_("From") => strlen(_("From")),
foreach($display as $key => $val) {
$display[$key] = $key .': '. str_pad('', $maxsize - $val);
}
- $bodyTop = str_pad(' '._("Original Message").' ',78, '-',STR_PAD_BOTH);
- $bodyTop .= "\n". $display[_("Subject")] . $orig_header->subject . "\n" .
- $display[_("From")] . $orig_header->getAddr_s('from',"\n$indent") . "\n" .
+ $bodyTop = str_pad(' '._("Original Message").' ',$editor_size -2,'-',STR_PAD_BOTH);
+ $bodyTop .= "\n". $display[_("Subject")] . decodeHeader($orig_header->subject) . "\n" .
+ $display[_("From")] . decodeHeader($orig_header->getAddr_s('from',"\n$indent")) . "\n" .
$display[_("Date")] . getLongDateString( $orig_header->date ). "\n" .
- $display[_("To")] . $orig_header->getAddr_s('to',"\n$indent") ."\n";
+ $display[_("To")] . decodeHeader($orig_header->getAddr_s('to',"\n$indent")) ."\n";
if ($orig_header->cc != array() && $orig_header->cc !='') {
- $bodyTop .= $display[_("Cc")] . $orig_header->getAddr_s('cc',"\n$indent") . "\n";
+ $bodyTop .= $display[_("Cc")] . decodeHeader($orig_header->getAddr_s('cc',"\n$indent")) . "\n";
}
- $bodyTop .= str_pad('',78, '-');
+ $bodyTop .= str_pad('', $editor_size -2 , '-');
$bodyTop .= "\n";
return $bodyTop;
}
$encoding = $message->header->encoding;
$type0 = $message->type0;
$type1 = $message->type1;
-
foreach ($entities as $ent) {
- $bodypart = decodeBody(
- mime_fetch_body($imapConnection, $passed_id, $ent),
- $encoding);
+ $unencoded_bodypart = mime_fetch_body($imapConnection, $passed_id, $ent);
+ $body_part_entity = $message->getEntity($ent);
+ $bodypart = decodeBody($unencoded_bodypart,
+ $body_part_entity->header->encoding);
if ($type1 == 'html') {
$bodypart = strip_tags($bodypart);
}
}
$body = getforwardHeader($orig_header) . $body;
sqUnWordWrap($body);
- getAttachments($message, $session, $passed_id, $entities, $imapConnection);
+ getAttachments($message, $session, $passed_id, $entities, $imapConnection);
+ break;
+ case ('forward_as_attachment'):
+ getMessage_RFC822_Attachment($message, $session, $passed_id, $imapConnection);
+ $body = '';
break;
case ('reply_all'):
$send_to_cc = replyAllString($orig_header);
}
} else {
$filename = decodeHeader($message->header->getParameter('filename'));
- if ($filename == "") {
- $filename = "untitled-".$message->entity_id;
+ if ($filename == '') {
+ $name = decodeHeader($message->header->getParameter('name'));
+ if ($name == '') {
+ $filename = "untitled-".$message->entity_id;
+ } else {
+ $filename = $name;
+ }
}
}
$localfilename = GenerateRandomString(32, '', 7);
return;
}
+function getMessage_RFC822_Attachment($message, $session, $passed_id, $imapConnection) {
+ global $attachments, $attachment_dir, $username, $data_dir, $uid_support;
+ $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
+ $body_a = sqimap_run_command($imapConnection, "FETCH $passed_id RFC822",true, $response, $readmessage, $uid_support);
+ if ($response = 'OK') {
+ $subject = encodeHeader($message->rfc822_header->subject);
+ array_shift($body_a);
+ $body = implode('', $body_a);
+ $body .= "\r\n";
+
+ $localfilename = GenerateRandomString(32, 'FILE', 7);
+ $full_localfilename = "$hashed_attachment_dir/$localfilename";
+
+ $fp = fopen( $full_localfilename, 'w');
+ fwrite ($fp, $body);
+ fclose($fp);
+ $newAttachment = array();
+ $newAttachment['localfilename'] = $localfilename;
+ $newAttachment['type'] = "message/rfc822";
+ $newAttachment['remotefilename'] = $subject.'.eml';
+ $newAttachment['session'] = $session;
+ $attachments[] = $newAttachment;
+ }
+ return;
+}
+
function showInputForm ($session, $values=false) {
global $send_to, $send_to_cc, $body,
$passed_body, $color, $use_signature, $signature, $prefix_sig,
if (isset($session)) {
echo '<input type="hidden" name="session" value="' . $session . "\">\n";
}
-
+
+ if (isset($passed_id)) {
+ echo '<input type="hidden" name="passed_id" value="' . $passed_id . "\">\n";
+ }
if ($saved_draft == 'yes') {
echo '<BR><CENTER><B>'. _("Draft Saved").'</CENTER></B>';
$end = '">';
break;
case 'user-defined':
- $start = $reply_citation_start . ' ';
+ $start = $reply_citation_start .
+ ($reply_citation_start == '' ? '' : ' ');
$end = $reply_citation_end;
break;
default: