| ';
- $body .= "$display_filename | ";
- $body .= '' . show_readable_size($message->header->size) .
- ' | ';
- $body .= "[ $type0/$type1 ] | ";
- $body .= '';
+ $body .= ' | ' .
+ "$display_filename | " .
+ '' . show_readable_size($message->header->size) .
+ ' | ' .
+ "[ $type0/$type1 ] | " .
+ '';
if ($message->header->description)
$body .= '' . htmlspecialchars($message->header->description) . '';
$body .= ' | ';
-
-
+
+
$SkipSpaces = 1;
- foreach ($Links as $Val)
- {
- if ($SkipSpaces)
- {
+ foreach ($Links as $Val) {
+ if ($SkipSpaces) {
$SkipSpaces = 0;
- }
- else
- {
+ } else {
$body .= ' | ';
}
$body .= '' . $Val['text'] . '';
}
-
+
unset($Links);
-
+
$body .= " | \n";
}
- return $body;
} else {
for ($i = 0; $i < count($message->entities); $i++) {
$body .= formatAttachments ($message->entities[$i], $ent_id, $mailbox, $id);
}
- return $body;
}
+ return( $body );
}
}
@@ -683,34 +663,40 @@
global $show_html_default;
- if ($encoding == "quoted-printable") {
+ if ($encoding == 'quoted-printable') {
$body = quoted_printable_decode($body);
-
+
+
+ /*
+ Following code has been comented as I see no reason for it.
+ If there is any please tell me a mingo@rotedic.com
+
while (ereg("=\n", $body))
$body = ereg_replace ("=\n", "", $body);
- } else if ($encoding == "base64") {
+ */
+ } else if ($encoding == 'base64') {
$body = base64_decode($body);
}
-
+
// All other encodings are returned raw.
return $body;
}
- // This functions decode strings that is encoded according to
+ // This functions decode strings that is encoded according to
// RFC1522 (MIME Part Two: Message Header Extensions for Non-ASCII Text).
function decodeHeader ($string) {
- if (eregi('=\\?([^?]+)\\?(q|b)\\?([^?]+)\\?=',
+ if (eregi('=\\?([^?]+)\\?(q|b)\\?([^?]+)\\?=',
$string, $res)) {
if (ucfirst($res[2]) == "B") {
$replace = base64_decode($res[3]);
} else {
$replace = ereg_replace("_", " ", $res[3]);
- // Convert lowercase Quoted Printable to uppercase for
- // quoted_printable_decode to understand it.
- while (ereg("(=(([0-9][abcdef])|([abcdef][0-9])|([abcdef][abcdef])))", $replace, $res)) {
- $replace = str_replace($res[1], strtoupper($res[1]), $replace);
- }
+ // Convert lowercase Quoted Printable to uppercase for
+ // quoted_printable_decode to understand it.
+ while (ereg("(=(([0-9][abcdef])|([abcdef][0-9])|([abcdef][abcdef])))", $replace, $res)) {
+ $replace = str_replace($res[1], strtoupper($res[1]), $replace);
+ }
$replace = quoted_printable_decode($replace);
}
@@ -722,7 +708,7 @@
// In case there should be more encoding in the string: recurse
return (decodeHeader($string));
- } else
+ } else
return ($string);
}
@@ -731,7 +717,7 @@
// be encoded.
function encodeHeader ($string) {
global $default_charset;
-
+
// Encode only if the string contains 8-bit characters or =?
$j = strlen( $string );
$l = FALSE; // Must be encoded ?
@@ -739,31 +725,31 @@
for( $i=0; $i < $j; ++$i) {
switch( $string{$i} ) {
case '=':
- $ret .= '=3D';
- break;
- case '?':
- $l = TRUE;
- $ret .= '=3F';
- break;
- case '_':
- $ret .= '=5F';
- break;
- case ' ':
- $ret .= '_';
- break;
- default:
- $k = ord( $string{$i} );
- if( $k > 126 ) {
- $ret .= sprintf("=%02X", $k);
- $l = TRUE;
- } else
- $ret .= $string{$i};
+ $ret .= '=3D';
+ break;
+ case '?':
+ $l = TRUE;
+ $ret .= '=3F';
+ break;
+ case '_':
+ $ret .= '=5F';
+ break;
+ case ' ':
+ $ret .= '_';
+ break;
+ default:
+ $k = ord( $string{$i} );
+ if( $k > 126 ) {
+ $ret .= sprintf("=%02X", $k);
+ $l = TRUE;
+ } else
+ $ret .= $string{$i};
}
}
-
+
if( $l )
$string = "=?$default_charset?Q?$ret?=";
-
+
return( $string );
}
|