". _("Download this as a file") ."

"; /** Display the ATTACHMENTS: message if there's more than one part **/ if (count($message["ENTITIES"]) > 1) { $body .= "
"; $body .= "ATTACHMENTS:"; $body .= "
"; $num = 0; for ($i = 0; $i < count($message["ENTITIES"]); $i++) { /** If we've displayed this entity, go to the next one **/ if ($ent_num == $i) continue; $type0 = strtolower($message["ENTITIES"][$i]["TYPE0"]); $type1 = strtolower($message["ENTITIES"][$i]["TYPE1"]); $num++; $filename = $message["ENTITIES"][$i]["FILENAME"]; if (trim($filename) == "") { $display_filename = "untitled$i"; } else { $display_filename = $filename; } $urlMailbox = urlencode($message["INFO"]["MAILBOX"]); $id = $message["INFO"]["ID"]; $body .= "   " . $display_filename . "  (TYPE: $type0/$type1)
"; } $body .= "
"; } return $body; } /** this function decodes the body depending on the encoding type. **/ function decodeBody($body, $encoding) { $encoding = strtolower($encoding); if ($encoding == "quoted-printable") { $body = quoted_printable_decode($body); while (ereg("=\n", $body)) $body = ereg_replace ("=\n", "", $body); } 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 // RFC1522 (MIME Part Two: Message Header Extensions for Non-ASCII Text). function decodeHeader ($string) { if (eregi('=\?([^?]+)\?(q|b)\?([^?]+)\?=', $string, $res)) { if (ucfirst($res[2]) == "B") { $replace = base64_decode($res[3]); } else { $replace = ereg_replace("_", " ", $res[3]); $replace = quoted_printable_decode($replace); } $replace = charset_decode ($res[1], $replace); $string = eregi_replace ('=\?([^?]+)\?(q|b)\?([^?]+)\?=', $replace, $string); // In case there should be more encoding in the string: recurse return (decodeHeader($string)); } else return ($string); } ?>