--- src/compose.php.orig Thu Jun 3 23:32:39 2004
+++ src/compose.php Thu Jun 3 23:43:12 2004
@@ -150,7 +150,8 @@
function getReplyCitation($orig_from, $orig_date) {
global $reply_citation_style, $reply_citation_start, $reply_citation_end;
- $orig_from = decodeHeader($orig_from->getAddress(false),false,false);
+// $orig_from = decodeHeader($orig_from->getAddress(false),false,false);
+ $orig_from = decodeHeader($orig_from->getAddress(false),true,false);
// $from = decodeHeader($orig_header->getAddr_s('from',"\n$indent"),false,false);
/* First, return an empty string when no citation style selected. */
if (($reply_citation_style == '') || ($reply_citation_style == 'none')) {
@@ -202,11 +203,14 @@
foreach($display as $key => $val) {
$display[$key] = $key .': '. str_pad('', $maxsize - $val);
}
- $from = decodeHeader($orig_header->getAddr_s('from',"\n$indent"),false,false);
+// $from = decodeHeader($orig_header->getAddr_s('from',"\n$indent"),false,false);
+ $from = decodeHeader($orig_header->getAddr_s('from',"\n$indent"),true,false);
$from = str_replace(' ',' ',$from);
- $to = decodeHeader($orig_header->getAddr_s('to',"\n$indent"),false,false);
+// $to = decodeHeader($orig_header->getAddr_s('to',"\n$indent"),false,false);
+ $to = decodeHeader($orig_header->getAddr_s('to',"\n$indent"),true,false);
$to = str_replace(' ',' ',$to);
- $subject = decodeHeader($orig_header->subject,false,false);
+// $subject = decodeHeader($orig_header->subject,false,false);
+ $subject = decodeHeader($orig_header->subject,true,false);
$subject = str_replace(' ',' ',$subject);
$bodyTop = str_pad(' '._("Original Message").' ',$editor_size -2,'-',STR_PAD_BOTH) .
"\n". $display[_("Subject")] . $subject . "\n" .
@@ -214,7 +218,8 @@
$display[_("Date")] . getLongDateString( $orig_header->date ). "\n" .
$display[_("To")] . $to . "\n";
if ($orig_header->cc != array() && $orig_header->cc !='') {
- $cc = decodeHeader($orig_header->getAddr_s('cc',"\n$indent"),false,false);
+// $cc = decodeHeader($orig_header->getAddr_s('cc',"\n$indent"),false,false);
+ $cc = decodeHeader($orig_header->getAddr_s('cc',"\n$indent"),true,false);
$cc = str_replace(' ',' ',$cc);
$bodyTop .= $display[_("Cc")] .$cc . "\n";
}
@@ -612,8 +617,9 @@
$type0 = $message->type0;
$type1 = $message->type1;
foreach ($entities as $ent) {
- $unencoded_bodypart = mime_fetch_body($imapConnection, $passed_id, $ent);
+// $unencoded_bodypart = mime_fetch_body($imapConnection, $passed_id, $ent);
$body_part_entity = $message->getEntity($ent);
+ $unencoded_bodypart = charset_decode($body_part_entity->header->getParameter('charset'), mime_fetch_body($imapConnection, $passed_id, $ent));
$bodypart = decodeBody($unencoded_bodypart,
$body_part_entity->header->encoding);
if ($type1 == 'html') {
@@ -681,10 +687,14 @@
case ('draft'):
$use_signature = FALSE;
$composeMessage->rfc822_header = $orig_header;
- $send_to = decodeHeader($orig_header->getAddr_s('to'),false,false);
- $send_to_cc = decodeHeader($orig_header->getAddr_s('cc'),false,false);
- $send_to_bcc = decodeHeader($orig_header->getAddr_s('bcc'),false,false);
- $subject = decodeHeader($orig_header->subject,false,false);
+// $send_to = decodeHeader($orig_header->getAddr_s('to'),false,false);
+ $send_to = decodeHeader($orig_header->getAddr_s('to'),true,false);
+// $send_to_cc = decodeHeader($orig_header->getAddr_s('cc'),false,false);
+ $send_to_cc = decodeHeader($orig_header->getAddr_s('cc'),true,false);
+// $send_to_bcc = decodeHeader($orig_header->getAddr_s('bcc'),false,false);
+ $send_to_bcc = decodeHeader($orig_header->getAddr_s('bcc'),true,false);
+// $subject = decodeHeader($orig_header->subject,false,false);
+ $subject = decodeHeader($orig_header->subject,true,false);
/* remember the references and in-reply-to headers in case of an reply */
$composeMessage->rfc822_header->more_headers['References'] = $orig_header->references;
$composeMessage->rfc822_header->more_headers['In-Reply-To'] = $orig_header->in_reply_to;
@@ -698,39 +708,52 @@
}
unset($body_ary[$i]);
}
- sqUnWordWrap($body);
+// sqUnWordWrap($body);
$composeMessage = getAttachments($message, $composeMessage, $passed_id, $entities, $imapConnection);
break;
case ('edit_as_new'):
- $send_to = decodeHeader($orig_header->getAddr_s('to'),false,false);
- $send_to_cc = decodeHeader($orig_header->getAddr_s('cc'),false,false);
- $send_to_bcc = decodeHeader($orig_header->getAddr_s('bcc'),false,false);
- $subject = decodeHeader($orig_header->subject,false,false);
+// $send_to = decodeHeader($orig_header->getAddr_s('to'),false,false);
+ $send_to = decodeHeader($orig_header->getAddr_s('to'),true,false);
+// $send_to_cc = decodeHeader($orig_header->getAddr_s('cc'),false,false);
+ $send_to_cc = decodeHeader($orig_header->getAddr_s('cc'),true,false);
+// $send_to_bcc = decodeHeader($orig_header->getAddr_s('bcc'),false,false);
+ $send_to_bcc = decodeHeader($orig_header->getAddr_s('bcc'),true,false);
+// $subject = decodeHeader($orig_header->subject,false,false);
+ $subject = decodeHeader($orig_header->subject,true,false);
$mailprio = $orig_header->priority;
$orig_from = '';
$composeMessage = getAttachments($message, $composeMessage, $passed_id, $entities, $imapConnection);
- sqUnWordWrap($body);
+// sqUnWordWrap($body);
break;
case ('forward'):
$send_to = '';
- $subject = decodeHeader($orig_header->subject,false,false);
+// $subject = decodeHeader($orig_header->subject,false,false);
+ $subject = decodeHeader($orig_header->subject,true,false);
if ((substr(strtolower($subject), 0, 4) != 'fwd:') &&
(substr(strtolower($subject), 0, 5) != '[fwd:') &&
(substr(strtolower($subject), 0, 6) != '[ fwd:')) {
$subject = '[Fwd: ' . $subject . ']';
}
$body = getforwardHeader($orig_header) . $body;
- sqUnWordWrap($body);
+// sqUnWordWrap($body);
$composeMessage = getAttachments($message, $composeMessage, $passed_id, $entities, $imapConnection);
$body = "\n" . $body;
break;
case ('forward_as_attachment'):
+// $subject = decodeHeader($orig_header->subject,false,true);
+ $subject = decodeHeader($orig_header->subject,true,true);
+ if ((substr(strtolower($subject), 0, 4) != 'fwd:') &&
+ (substr(strtolower($subject), 0, 5) != '[fwd:') &&
+ (substr(strtolower($subject), 0, 6) != '[ fwd:')) {
+ $subject = '[Fwd: ' . $subject . ']';
+ }
$composeMessage = getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, $passed_ent_id, $imapConnection);
$body = '';
break;
case ('reply_all'):
$send_to_cc = replyAllString($orig_header);
- $send_to_cc = decodeHeader($send_to_cc,false,false);
+// $send_to_cc = decodeHeader($send_to_cc,false,false);
+ $send_to_cc = decodeHeader($send_to_cc,true,false);
case ('reply'):
$send_to = $orig_header->reply_to;
if (is_array($send_to) && count($send_to)) {
@@ -740,8 +763,10 @@
} else {
$send_to = $orig_header->getAddr_s('from');
}
- $send_to = decodeHeader($send_to,false,false);
- $subject = decodeHeader($orig_header->subject,false,false);
+// $send_to = decodeHeader($send_to,false,false);
+ $send_to = decodeHeader($send_to,true,false);
+// $subject = decodeHeader($orig_header->subject,false,false);
+ $subject = decodeHeader($orig_header->subject,true,false);
$subject = str_replace('"', "'", $subject);
$subject = trim($subject);
if (substr(strtolower($subject), 0, 3) != 're:') {
@@ -757,9 +782,11 @@
sqWordWrap($rewrap_body[$i], ($editor_size));
if (preg_match("/^(>+)/", $rewrap_body[$i], $matches)) {
$gt = $matches[1];
- $body .= $body .= '>' . str_replace("\n", "\n>$gt ", rtrim($rewrap_body[$i])) ."\n";
+// $body .= $body .= '>' . str_replace("\n", "\n>$gt ", rtrim($rewrap_body[$i])) ."\n";
+ $body .= '>' . str_replace("\n", "\n>$gt ", rtrim($rewrap_body[$i])) ."\n";
} else {
- $body .= $body .= '> ' . str_replace("\n", "\n> ", rtrim($rewrap_body[$i])) . "\n";
+// $body .= $body .= '> ' . str_replace("\n", "\n> ", rtrim($rewrap_body[$i])) . "\n";
+ $body .= '> ' . str_replace("\n", "\n> ", rtrim($rewrap_body[$i])) . "\n";
}
unset($rewrap_body[$i]);
}
@@ -1053,21 +1080,38 @@
if ($default_charset == 'iso-2022-jp') {
echo "\n\n".($prefix_sig==true? "-- \n":'').mb_convert_encoding($signature, 'EUC-JP');
} else {
- echo "\n\n".($prefix_sig==true? "-- \n":'').decodeHeader($signature,false,false);
+// echo "\n\n".($prefix_sig==true? "-- \n":'').decodeHeader($signature,false,false);
+ echo "\n\n".($prefix_sig==true? "-- \n":'').decodeHeader($signature,true,false);
}
- echo "\n\n".htmlspecialchars(decodeHeader($body,false,false));
+// echo "\n\n".htmlspecialchars(decodeHeader($body,false,false));
+ if ($default_charset == "utf-8") {
+ echo "\n\n".decodeHeader($body,true,false);
+ } else {
+ echo "\n\n".htmlspecialchars(decodeHeader($body,true,false));
+ }
}
else {
- echo "\n\n".htmlspecialchars(decodeHeader($body,false,false));
+// echo "\n\n".htmlspecialchars(decodeHeader($body,false,false));
+ if ($default_charset == "utf-8") {
+ echo "\n\n".decodeHeader($body,true,false);
+ } else {
+ echo "\n\n".htmlspecialchars(decodeHeader($body,true,false));
+ }
if ($default_charset == 'iso-2022-jp') {
echo "\n\n".($prefix_sig==true? "-- \n":'').mb_convert_encoding($signature, 'EUC-JP');
}else{
- echo "\n\n".($prefix_sig==true? "-- \n":'').decodeHeader($signature,false,false);
+// echo "\n\n".($prefix_sig==true? "-- \n":'').decodeHeader($signature,false,false);
+ echo "\n\n".($prefix_sig==true? "-- \n":'').decodeHeader($signature,true,false);
}
}
}
else {
- echo htmlspecialchars(decodeHeader($body,false,false));
+// echo htmlspecialchars(decodeHeader($body,false,false));
+ if ($default_charset == "utf-8") {
+ echo decodeHeader($body,true,false);
+ } else {
+ echo htmlspecialchars(decodeHeader($body,true,false));
+ }
}
echo '
' . "\n" .
' ' . "\n" .
--- functions/forms.php.orig Thu Jun 3 23:32:10 2004
+++ functions/forms.php Thu Jun 3 23:32:10 2004
@@ -12,15 +12,35 @@
* @package squirrelmail
*/
+function formsspecialchars($str) {
+// $str = str_replace("&", htmlspecialchars("&"), $str);
+ $str = str_replace("<", htmlspecialchars("<"), $str);
+ $str = str_replace(">", htmlspecialchars(">"), $str);
+ $str = str_replace("'", htmlspecialchars("'"), $str);
+ $str = str_replace("\"", htmlspecialchars("\""), $str);
+ return($str);
+}
/**
* Helper function to create form fields, not to be called directly,
* only by other functions below.
*/
function addInputField($type, $name = null, $value = null, $attributes = '') {
- return '\n";
+// return '\n";
+ global $default_charset;
+ if ($default_charset == "utf-8") {
+ return '\n";
+ } else {
+ return '\n";
+ }
}
/**
@@ -81,20 +101,39 @@
*/
function addSelect($name, $values, $default = null, $usekeys = false)
{
+ global $default_charset;
// only one element
if(count($values) == 1) {
$k = key($values); $v = array_pop($values);
- return addHidden($name, ($usekeys ? $k:$v)).
- htmlspecialchars($v) . "\n";
+// return addHidden($name, ($usekeys ? $k:$v)).
+// htmlspecialchars($v) . "\n";
+ if ($default_charset == "utf-8") {
+ return addHidden($name, ($usekeys ? $k:$v)).
+ formsspecialchars($v) . "\n";
+ } else {
+ return addHidden($name, ($usekeys ? $k:$v)).
+ htmlspecialchars($v) . "\n";
+ }
}
$ret = '\n";
@@ -119,9 +158,19 @@
* Textarea form element.
*/
function addTextArea($name, $text = '', $cols = 40, $rows = 10, $attr = '') {
- return '\n";
+ global $default_charset;
+// return '\n";
+ if ($default_charset == "utf-8") {
+ return '\n";
+ } else {
+ return '\n";
+ }
}
/**