326 |
$result["mailbox"]=trim($mailbox); |
$result["mailbox"]=trim($mailbox); |
327 |
$result["host"]=trim($host); |
$result["host"]=trim($host); |
328 |
// $personal = mb_convert_encoding($personal, "EUC-JP", "auto"); |
// $personal = mb_convert_encoding($personal, "EUC-JP", "auto"); |
|
$personal = ereg_replace("\\(.)", $regs[1], $personal); |
|
329 |
if ($personal!="") $result["personal"]=$personal; |
if ($personal!="") $result["personal"]=$personal; |
330 |
$complete[]=$result; |
$complete[]=$result; |
331 |
return ($complete); |
return ($complete); |
447 |
else |
else |
448 |
$newvalue=headerDecode($newvalue); // maybe there are more encoded |
$newvalue=headerDecode($newvalue); // maybe there are more encoded |
449 |
return(mb_convert_encoding($newvalue, "EUC-JP", "auto")); // parts |
return(mb_convert_encoding($newvalue, "EUC-JP", "auto")); // parts |
450 |
} else { // there wasn't anything encoded, return the original string |
} else { |
451 |
return(mb_convert_encoding($value, "EUC-JP", "auto")); |
return(mb_convert_encoding(decode_structured_body($value), "EUC-JP", "auto")); |
452 |
} |
} |
453 |
} |
} |
454 |
|
|
550 |
case "x-newsreader:": |
case "x-newsreader:": |
551 |
case "x-mailer:": |
case "x-mailer:": |
552 |
case "user-agent:": |
case "user-agent:": |
553 |
$header->user_agent=trim($value); |
$header->user_agent=trim(decode_structured_body($value)); |
554 |
break; |
break; |
555 |
case "x-face:": |
case "x-face:": |
556 |
// echo "<p>-".base64_decode($value)."-</p>"; |
// echo "<p>-".base64_decode($value)."-</p>"; |
565 |
return $header; |
return $header; |
566 |
} |
} |
567 |
|
|
568 |
|
function decode_structured_body ($body) { |
569 |
|
$patterns = array ( |
570 |
|
"/\"((?:[^\"\\\\]+|\\\\.)*)\"/e", |
571 |
|
"/\(((?:[^)\\\\]+|\\\\.)*)\)/e", |
572 |
|
); |
573 |
|
$replace = array ( |
574 |
|
"mb_convert_encoding(decode_quoted_pair('\\1'), 'EUC-JP', 'auto')", |
575 |
|
"'('.mb_convert_encoding(decode_quoted_pair('\\1'), 'EUC-JP', 'auto').')'", |
576 |
|
); |
577 |
|
return preg_replace ($patterns, $replace, $body); |
578 |
|
} |
579 |
|
|
580 |
|
function decode_quoted_pair($value) { |
581 |
|
$value = ereg_replace('\\\\(\\\\")', "\\1", $value); |
582 |
|
return ereg_replace('\\\\(.)', "\\1", $value); |
583 |
|
} |
584 |
|
|
585 |
function decode_body($body,$encoding) { |
function decode_body($body,$encoding) { |
586 |
$bodyzeile=""; |
$bodyzeile=""; |
587 |
switch ($encoding) { |
switch ($encoding) { |
699 |
// if ($body=="") $body=" "; |
// if ($body=="") $body=" "; |
700 |
// } |
// } |
701 |
$body=decode_body($body,$message->header->content_transfer_encoding); |
$body=decode_body($body,$message->header->content_transfer_encoding); |
702 |
$message->body[0]=$body; |
$message->body[0] = mb_convert_encoding($body, "EUC-JP", "auto"); |
703 |
} |
} |
704 |
if (!isset($message->header->content_type_charset)) |
if (!isset($message->header->content_type_charset)) |
705 |
$message->header->content_type_charset=array("ISO-8859-1"); |
$message->header->content_type_charset=array("ISO-8859-1"); |
771 |
return false; |
return false; |
772 |
$rawmessage=array(); |
$rawmessage=array(); |
773 |
$line=lieszeile($ns); |
$line=lieszeile($ns); |
774 |
$line=mb_convert_encoding($line, "EUC-JP", "ISO-2022-JP"); |
#$line=mb_convert_encoding($line, "EUC-JP", "ISO-2022-JP"); |
775 |
while(strcmp($line,".") != 0) { |
while(strcmp($line,".") != 0) { |
776 |
$rawmessage[]=$line; |
$rawmessage[]=$line; |
777 |
$line=lieszeile($ns); |
$line=lieszeile($ns); |
778 |
$line=mb_convert_encoding($line, "EUC-JP", "ISO-2022-JP"); |
#$line=mb_convert_encoding($line, "EUC-JP", "ISO-2022-JP"); |
779 |
} |
} |
780 |
$message=parse_message($rawmessage); |
$message=parse_message($rawmessage); |
781 |
if (ereg('^[0-9]+$',$id)) $message->header->number=$id; |
if (ereg('^[0-9]+$',$id)) $message->header->number=$id; |
1699 |
// fputs($ns,"Mime-Version: 1.0\r\n"); |
// fputs($ns,"Mime-Version: 1.0\r\n"); |
1700 |
// fputs($ns,"Content-Type: text/plain; charset=ISO-8859-1\r\n"); |
// fputs($ns,"Content-Type: text/plain; charset=ISO-8859-1\r\n"); |
1701 |
// fputs($ns,"Content-Transfer-Encoding: 8bit\r\n"); |
// fputs($ns,"Content-Transfer-Encoding: 8bit\r\n"); |
1702 |
fputs($ns,"User-Agent: $text_ua["user_agent"]\r\n"); |
fputs($ns,"User-Agent: ".$text_ua["user_agent"]."\r\n"); |
1703 |
if ($send_poster_host) |
if ($send_poster_host) |
1704 |
fputs($ns,'X-HTTP-Posting-Host: '.gethostbyaddr(getenv("REMOTE_ADDR"))."\r\n"); |
fputs($ns,'X-HTTP-Posting-Host: '.gethostbyaddr(getenv("REMOTE_ADDR"))."\r\n"); |
1705 |
if ($ref!=false) fputs($ns,'References: '.$ref."\r\n"); |
if ($ref!=false) fputs($ns,'References: '.$ref."\r\n"); |