class mime_decode {
var $content = Array();
function mime_encode_headers($string) {
if($string == "") return;
if(!eregi("^([[:print:]]*)$",$string))
$string = "=?ISO-8859-1?Q?".str_replace("+","_",str_replace("%","=",urlencode($string)))."?=";
return $string;
}
function decode_mime_string($string) {
if(($pos = strpos($string,"=?")) === false) return $string;
while(!($pos === false)) {
$newresult .= substr($string,0,$pos);
$string = substr($string,$pos+2,strlen($string));
$intpos = strpos($string,"?");
$charset = substr($string,0,$intpos);
$enctype = strtolower(substr($string,$intpos+1,1));
$string = substr($string,$intpos+3,strlen($string));
$endpos = strpos($string,"?=");
$mystring = substr($string,0,$endpos);
$string = substr($string,$endpos+2,strlen($string));
if($enctype == "q") {
$mystring = str_replace("_"," ",$mystring);
$mystring = $this->decode_qp($mystring);