56 |
var $answers; |
var $answers; |
57 |
var $isAnswer; |
var $isAnswer; |
58 |
var $username; |
var $username; |
59 |
var $user_agent; |
// var $user_agent; |
60 |
|
var $field; |
61 |
var $isReply; |
var $isReply; |
62 |
} |
} |
63 |
|
|
327 |
$result["mailbox"]=trim($mailbox); |
$result["mailbox"]=trim($mailbox); |
328 |
$result["host"]=trim($host); |
$result["host"]=trim($host); |
329 |
// $personal = mb_convert_encoding($personal, "EUC-JP", "auto"); |
// $personal = mb_convert_encoding($personal, "EUC-JP", "auto"); |
|
$personal = ereg_replace("\\(.)", $regs[1], $personal); |
|
330 |
if ($personal!="") $result["personal"]=$personal; |
if ($personal!="") $result["personal"]=$personal; |
331 |
$complete[]=$result; |
$complete[]=$result; |
332 |
return ($complete); |
return ($complete); |
448 |
else |
else |
449 |
$newvalue=headerDecode($newvalue); // maybe there are more encoded |
$newvalue=headerDecode($newvalue); // maybe there are more encoded |
450 |
return(mb_convert_encoding($newvalue, "EUC-JP", "auto")); // parts |
return(mb_convert_encoding($newvalue, "EUC-JP", "auto")); // parts |
451 |
} else { // there wasn't anything encoded, return the original string |
} else { |
452 |
return(mb_convert_encoding($value, "EUC-JP", "auto")); |
return(mb_convert_encoding(decode_structured_body($value), "EUC-JP", "auto")); |
453 |
} |
} |
454 |
} |
} |
455 |
|
|
480 |
$header = new headerType; |
$header = new headerType; |
481 |
$header->isAnswer=false; |
$header->isAnswer=false; |
482 |
for ($count=0;$count<count($hdr);$count++) { |
for ($count=0;$count<count($hdr);$count++) { |
483 |
$variable=substr($hdr[$count],0,strpos($hdr[$count]," ")); |
$variable=substr($hdr[$count],0,strpos($hdr[$count],":")); |
484 |
$value=trim(substr($hdr[$count],strpos($hdr[$count]," ")+1)); |
$value=trim(substr($hdr[$count],strpos($hdr[$count],":")+1)); |
485 |
|
$header->field[strtolower($variable)][] = $value; |
486 |
switch (strtolower($variable)) { |
switch (strtolower($variable)) { |
487 |
case "from:": |
case "from": |
488 |
$fromline=address_decode(headerDecode($value),"nirgendwo"); |
$fromline=address_decode(headerDecode($value),"nirgendwo"); |
489 |
if (!isset($fromline[0]["host"])) $fromline[0]["host"]=""; |
if (!isset($fromline[0]["host"])) $fromline[0]["host"]=""; |
490 |
$header->from=$fromline[0]["mailbox"]."@".$fromline[0]["host"]; |
$header->from=$fromline[0]["mailbox"]."@".$fromline[0]["host"]; |
495 |
$header->name=$fromline[0]["personal"]; |
$header->name=$fromline[0]["personal"]; |
496 |
} |
} |
497 |
break; |
break; |
498 |
case "message-id:": |
case "message-id": |
499 |
$header->id=$value; |
$header->id=$value; |
500 |
break; |
break; |
501 |
case "subject:": |
case "subject": |
502 |
$header->subject=headerDecode($value); |
$header->subject = decode_unstructured_body($value); |
503 |
break; |
break; |
504 |
case "newsgroups:": |
case "newsgroups": |
505 |
$header->newsgroups=$value; |
$header->newsgroups=$value; |
506 |
break; |
break; |
507 |
case "organization:": |
case "organization": |
508 |
$header->organization=$value; |
$header->organization = decode_unstructured_body($value); |
509 |
break; |
break; |
510 |
case "content-transfer-encoding:": |
case "content-transfer-encoding": |
511 |
$header->content_transfer_encoding=trim(strtolower($value)); |
$header->content_transfer_encoding=trim(strtolower($value)); |
512 |
break; |
break; |
513 |
case "content-type:": |
case "content-type": |
514 |
$header->content_type=array(); |
$header->content_type=array(); |
515 |
$subheader=split(";",$value); |
$subheader=split(";",$value); |
516 |
$header->content_type[0]=strtolower(trim($subheader[0])); |
$header->content_type[0]=strtolower(trim($subheader[0])); |
535 |
} |
} |
536 |
} |
} |
537 |
break; |
break; |
538 |
case "references:": |
case "references": |
539 |
$ref=ereg_replace("> *<", "> <", trim($value)); |
$ref=ereg_replace("> *<", "> <", trim($value)); |
540 |
while (strpos($ref,"> <") != false) { |
while (strpos($ref,"> <") != false) { |
541 |
$header->references[]=substr($ref,0,strpos($ref," ")); |
$header->references[]=substr($ref,0,strpos($ref," ")); |
543 |
} |
} |
544 |
$header->references[]=trim($ref); |
$header->references[]=trim($ref); |
545 |
break; |
break; |
546 |
case "date:": |
case "date": |
547 |
$header->date=getTimestamp(trim($value)); |
$header->date=getTimestamp(trim($value)); |
548 |
break; |
break; |
549 |
case "followup-to:": |
case "followup-to": |
550 |
$header->followup=trim($value); |
$header->followup=trim($value); |
551 |
break; |
break; |
552 |
case "x-newsreader:": |
/* |
553 |
case "x-mailer:": |
case "x-newsreader": |
554 |
case "user-agent:": |
case "x-mailer": |
555 |
$header->user_agent=trim($value); |
case "user-agent": |
556 |
break; |
$header->user_agent= decode_structured_body($value); |
|
case "x-face:": |
|
|
// echo "<p>-".base64_decode($value)."-</p>"; |
|
557 |
break; |
break; |
558 |
|
*/ |
559 |
} |
} |
560 |
} |
} |
561 |
if (!isset($header->content_type[0])) |
if (!isset($header->content_type[0])) |
566 |
return $header; |
return $header; |
567 |
} |
} |
568 |
|
|
569 |
|
function decode_unstructured_body ($body) { |
570 |
|
$patterns = array ( |
571 |
|
"/(=\\?[^\\x00-\\x20()<>@,;:\\\"\\/\\[\\]?.=\\x7F]+\\?[BQ]\\?[^\\x00-\\x20\\x3F\\x7F]*\\?=)/ei", |
572 |
|
); |
573 |
|
$replace = array ( |
574 |
|
"mb_decode_mimeheader('\\1')", |
575 |
|
); |
576 |
|
return preg_replace ($patterns, $replace, |
577 |
|
mb_convert_encoding(fake_jisx0213($body), "EUC-JP", "auto")); |
578 |
|
} |
579 |
|
|
580 |
|
function decode_structured_body ($body) { |
581 |
|
$patterns = array ( |
582 |
|
"/\"((?:[^\"\\\\]+|\\\\.)*)\"/e", |
583 |
|
"/\(((?:[^()\\\\]+|\\\\.|(?:\((?:[^()\\\\]+|\\\\.|(?:\((?:[^)\\\\]+|\\\\.\ |
584 |
|
)*\)))*\)))*)\)/e", |
585 |
|
); |
586 |
|
$replace = array ( |
587 |
|
"mb_convert_encoding(fake_jisx0213(decode_quoted_pair('\\1')),'EUC-JP','auto')", |
588 |
|
"'('.mb_convert_encoding(fake_jisx0213(decode_quoted_pair('\\1')), |
589 |
|
'EUC-JP','auto').')'", |
590 |
|
); |
591 |
|
return preg_replace ($patterns, $replace, $body); |
592 |
|
} |
593 |
|
|
594 |
|
function decode_quoted_pair($value) { |
595 |
|
$value = ereg_replace('\\\\(\\\\")', "\\1", $value); |
596 |
|
return ereg_replace('\\\\(.)', "\\1", $value); |
597 |
|
} |
598 |
|
|
599 |
|
function fake_jisx0213 ($value) { |
600 |
|
$value = preg_replace ("/\\x1B\\\$\\(O/", "\x1B\\\$B", $value); |
601 |
|
$value = preg_replace ("/\\x1B\\\$\\(P/", "\x1B\\\$(D", $value); |
602 |
|
return $value; |
603 |
|
} |
604 |
|
|
605 |
function decode_body($body,$encoding) { |
function decode_body($body,$encoding) { |
606 |
$bodyzeile=""; |
$bodyzeile=""; |
607 |
switch ($encoding) { |
switch ($encoding) { |
719 |
// if ($body=="") $body=" "; |
// if ($body=="") $body=" "; |
720 |
// } |
// } |
721 |
$body=decode_body($body,$message->header->content_transfer_encoding); |
$body=decode_body($body,$message->header->content_transfer_encoding); |
722 |
$message->body[0]=$body; |
$message->body[0] = mb_convert_encoding($body, "EUC-JP", "auto"); |
723 |
} |
} |
724 |
if (!isset($message->header->content_type_charset)) |
if (!isset($message->header->content_type_charset)) |
725 |
$message->header->content_type_charset=array("ISO-8859-1"); |
$message->header->content_type_charset=array("ISO-8859-1"); |
791 |
return false; |
return false; |
792 |
$rawmessage=array(); |
$rawmessage=array(); |
793 |
$line=lieszeile($ns); |
$line=lieszeile($ns); |
794 |
$line=mb_convert_encoding($line, "EUC-JP", "ISO-2022-JP"); |
#$line=mb_convert_encoding($line, "EUC-JP", "ISO-2022-JP"); |
795 |
while(strcmp($line,".") != 0) { |
while(strcmp($line,".") != 0) { |
796 |
$rawmessage[]=$line; |
$rawmessage[]=$line; |
797 |
$line=lieszeile($ns); |
$line=lieszeile($ns); |
798 |
$line=mb_convert_encoding($line, "EUC-JP", "ISO-2022-JP"); |
#$line=mb_convert_encoding($line, "EUC-JP", "ISO-2022-JP"); |
799 |
} |
} |
800 |
$message=parse_message($rawmessage); |
$message=parse_message($rawmessage); |
801 |
if (ereg('^[0-9]+$',$id)) $message->header->number=$id; |
if (ereg('^[0-9]+$',$id)) $message->header->number=$id; |
1214 |
break; |
break; |
1215 |
} |
} |
1216 |
$return .= '" alt="'.$alt.'"'; |
$return .= '" alt="'.$alt.'"'; |
1217 |
if (strcmp($k,".") == 0) $return .=(' width="12" height="9"'); |
if (strcmp($k,".") == 0) $return .=(' style="width: 12px; height: 9px"'); |
1218 |
$return .= ' />'; |
$return .= '>'; |
1219 |
} |
} |
1220 |
return($return); |
return($return); |
1221 |
} |
} |
1293 |
echo "<br>\n"; |
echo "<br>\n"; |
1294 |
break; |
break; |
1295 |
case 1: // html-auflistung, kein baum |
case 1: // html-auflistung, kein baum |
1296 |
echo "<li><nobr>".$thread_fontPre; |
echo "<li>".$thread_fontPre; |
1297 |
if ($thread_showDate) |
if ($thread_showDate) |
1298 |
echo formatDate($c)." "; |
echo formatDate($c)." "; |
1299 |
if ($thread_showSubject) |
if ($thread_showSubject) |
1300 |
echo formatSubject($c,$group)." "; |
echo formatSubject($c,$group)." "; |
1301 |
if ($thread_showAuthor) |
if ($thread_showAuthor) |
1302 |
echo "<i>(".formatAuthor($c).")</i>"; |
echo "<em>(".formatAuthor($c).")</em>"; |
1303 |
echo $thread_fontPost."</nobr></li>"; |
echo $thread_fontPost."</li>"; |
1304 |
break; |
break; |
1305 |
case 2: // table |
case 2: // table |
1306 |
echo "<tr>"; |
echo "<tr>"; |
1312 |
} |
} |
1313 |
if ($thread_showAuthor) { |
if ($thread_showAuthor) { |
1314 |
echo "<td></td>"; |
echo "<td></td>"; |
1315 |
echo '<td nowrap="nowrap">'.$thread_fontPre.formatAuthor($c); |
echo '<td>'.$thread_fontPre.formatAuthor($c); |
1316 |
echo $thread_fontPost."</td>"; |
echo $thread_fontPost."</td>"; |
1317 |
} |
} |
1318 |
echo "</tr>\n"; |
echo "</tr>\n"; |
1319 |
break; |
break; |
1320 |
case 3: // html-tree |
case 3: // html-tree |
1321 |
echo "<li><nobr>".$thread_fontPre; |
echo "<li>".$thread_fontPre; |
1322 |
if ($thread_showDate) |
if ($thread_showDate) |
1323 |
echo formatDate($c)." "; |
echo formatDate($c)." "; |
1324 |
if ($thread_showSubject) |
if ($thread_showSubject) |
1325 |
echo formatSubject($c,$group)." "; |
echo formatSubject($c,$group)." "; |
1326 |
if ($thread_showAuthor) |
if ($thread_showAuthor) |
1327 |
echo "<i>(".formatAuthor($c).")</i>"; |
echo "<em>(".formatAuthor($c).")</em>"; |
1328 |
echo $thread_fontPost."</nobr>\n"; |
echo $thread_fontPost."\n"; |
1329 |
break; |
break; |
1330 |
case 4: // thread |
case 4: // thread |
1331 |
echo "<nobr><tt>".$thread_fontPre; |
echo "".$thread_fontPre; |
1332 |
if ($thread_showDate) |
if ($thread_showDate) |
1333 |
echo formatDate($c)." "; |
echo formatDate($c)." "; |
1334 |
echo formatTreeText($newtree)." "; |
echo formatTreeText($newtree)." "; |
1335 |
if ($thread_showSubject) |
if ($thread_showSubject) |
1336 |
echo formatSubject($c,$group)." "; |
echo formatSubject($c,$group)." "; |
1337 |
if ($thread_showAuthor) |
if ($thread_showAuthor) |
1338 |
echo "<i>(".formatAuthor($c).")</i>"; |
echo "<em>(".formatAuthor($c).")</em>"; |
1339 |
echo $thread_fontPost."</tt></nobr><br>"; |
echo $thread_fontPost."<br>"; |
1340 |
break; |
break; |
1341 |
case 5: // thread, graphic |
case 5: // thread, graphic |
1342 |
echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr>\n"; |
echo "<table><tr>\n"; |
1343 |
if ($thread_showDate) |
if ($thread_showDate) |
1344 |
echo '<td nowrap="nowrap">'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</td>"; |
echo '<td>'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</td>"; |
1345 |
echo "<td>".$thread_fontPre.formatTreeGraphic($newtree).$thread_fontPost."</td>"; |
echo "<td>".$thread_fontPre.formatTreeGraphic($newtree).$thread_fontPost."</td>"; |
1346 |
if ($thread_showSubject) |
if ($thread_showSubject) |
1347 |
echo '<td nowrap="nowrap">'.$thread_fontPre." ".formatSubject($c,$group)." "; |
echo '<td>'.$thread_fontPre." ".formatSubject($c,$group)." "; |
1348 |
if ($thread_showAuthor) |
if ($thread_showAuthor) |
1349 |
echo "(".formatAuthor($c).")".$thread_fontPost."</td>"; |
echo "(".formatAuthor($c).")".$thread_fontPost."</td>"; |
1350 |
echo "</tr></table>"; |
echo "</tr></table>"; |
1352 |
case 6: // thread, table |
case 6: // thread, table |
1353 |
echo "<tr>"; |
echo "<tr>"; |
1354 |
if ($thread_showDate) |
if ($thread_showDate) |
1355 |
echo '<td nowrap="nowrap"><tt>'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</tt></td>"; |
echo '<td>'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</td>"; |
1356 |
echo '<td nowrap="nowrap"><tt>'.$thread_fontPre.formatTreeText($newtree)." "; |
echo '<td>'.$thread_fontPre.formatTreeText($newtree)." "; |
1357 |
if ($thread_showSubject) { |
if ($thread_showSubject) { |
1358 |
echo formatSubject($c,$group).$thread_fontPost."</tt></td>"; |
echo formatSubject($c,$group).$thread_fontPost."</td>"; |
1359 |
echo "<td></td>"; |
echo "<td></td>"; |
1360 |
} |
} |
1361 |
if ($thread_showAuthor) |
if ($thread_showAuthor) |
1362 |
echo '<td nowrap="nowrap"><tt>'.$thread_fontPre.formatAuthor($c).$thread_fontPost."</tt></td>"; |
echo '<td>'.$thread_fontPre.formatAuthor($c).$thread_fontPost."</td>"; |
1363 |
echo "</tr>"; |
echo "</tr>"; |
1364 |
break; |
break; |
1365 |
case 7: // thread, table, graphic |
case 7: // thread, table, graphic |
1366 |
echo "<tr>"; |
echo "<tr>"; |
1367 |
if ($thread_showDate) |
if ($thread_showDate) |
1368 |
echo '<td nowrap="nowrap">'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</td>"; |
echo '<td>'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</td>"; |
1369 |
echo "<td><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n"; |
echo "<td><table>\n"; |
1370 |
echo "<td>".formatTreeGraphic($newtree)."</td>"; |
echo "<td>".formatTreeGraphic($newtree)."</td>"; |
1371 |
if ($thread_showSubject) |
if ($thread_showSubject) |
1372 |
echo '<td nowrap="nowrap">'.$thread_fontPre." ".formatSubject($c,$group).$thread_fontPost."</td>"; |
echo '<td>'.$thread_fontPre." ".formatSubject($c,$group).$thread_fontPost."</td>"; |
1373 |
echo "</table></td>"; |
echo "</table></td>"; |
1374 |
if ($thread_showSubject) echo "<td></td>"; |
if ($thread_showSubject) echo "<td></td>"; |
1375 |
if ($thread_showAuthor) |
if ($thread_showAuthor) |
1376 |
echo '<td nowrap="nowrap">'.$thread_fontPre.formatAuthor($c).$thread_fontPost."</td>"; |
echo '<td>'.$thread_fontPre.formatAuthor($c).$thread_fontPost."</td>"; |
1377 |
echo "</tr>"; |
echo "</tr>"; |
1378 |
break; |
break; |
1379 |
} |
} |
1527 |
} |
} |
1528 |
echo "<br>"; |
echo "<br>"; |
1529 |
} |
} |
1530 |
|
/* |
1531 |
if (isset($head->user_agent)) { |
if (isset($head->user_agent)) { |
1532 |
if ((isset($article_show["User-Agent"])) && |
if ((isset($article_show["User-Agent"])) && |
1533 |
($article_show["User-Agent"])) { |
($article_show["User-Agent"])) { |
1536 |
echo "<!-- User-Agent: ".htmlspecialchars($head->user_agent)." -->\n"; |
echo "<!-- User-Agent: ".htmlspecialchars($head->user_agent)." -->\n"; |
1537 |
} |
} |
1538 |
} |
} |
1539 |
|
*/ |
1540 |
|
$fields = array ("x-moe", "x-brother", "x-syster", "x-wife", |
1541 |
|
"x-daughter", "x-respect", |
1542 |
|
"user-agent", "x-mailer", "x-newsreader", |
1543 |
|
"list-id", "x-uri", "x-mail-count", "keywords"); |
1544 |
|
for ($i = 0; $i < count($fields); $i++) { |
1545 |
|
if (count($head->field[$fields[$i]])) { |
1546 |
|
if ((isset($article_show[$fields[$i]])) && ($article_show[$fields[$i]])) { |
1547 |
|
echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">" |
1548 |
|
.$text_header[$fields[$i]]."</span> <span class=\"body\">" |
1549 |
|
.htmlspecialchars(decode_structured_body( |
1550 |
|
join(', ', $head->field[$fields[$i]]))) |
1551 |
|
."</span></div>\n"; |
1552 |
|
} |
1553 |
|
} |
1554 |
|
} |
1555 |
|
$fields = array ("x-weather", "x-copyright", "comments"); |
1556 |
|
for ($i = 0; $i < count($fields); $i++) { |
1557 |
|
if (count($head->field[$fields[$i]])) { |
1558 |
|
if ((isset($article_show[$fields[$i]])) && ($article_show[$fields[$i]])) { |
1559 |
|
for ($j = 0; $j > count($head->field[$fields[$i]]); $j++) { |
1560 |
|
echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">" |
1561 |
|
.$text_header[$fields[$i]]."</span> <span class=\"body\">" |
1562 |
|
.htmlspecialchars(decode_unstructured_body( |
1563 |
|
$head->field[$fields[$i]][$j])) |
1564 |
|
."</span></div>\n"; |
1565 |
|
} |
1566 |
|
} |
1567 |
|
} |
1568 |
|
} |
1569 |
if ((isset($attachment_show)) && ($attachment_show==true) && |
if ((isset($attachment_show)) && ($attachment_show==true) && |
1570 |
(isset($head->content_type[1]))) { |
(isset($head->content_type[1]))) { |
1571 |
echo $text_header["attachments"]; |
echo $text_header["attachments"]; |
1743 |
fputs($ns,"post\r\n"); |
fputs($ns,"post\r\n"); |
1744 |
$weg=lieszeile($ns); |
$weg=lieszeile($ns); |
1745 |
// fputs($ns,'Subject: '.quoted_printable_encode($subject)."\r\n"); |
// fputs($ns,'Subject: '.quoted_printable_encode($subject)."\r\n"); |
1746 |
// fputs($ns,'Subject: '.mb_convert_encoding($subject, "ISO-2022-JP", "EUC-JP")."\r\n"); |
fputs($ns,'Subject: '.mb_convert_encoding($subject, "ISO-2022-JP", "EUC-JP")."\r\n"); |
1747 |
fputs($ns,'Subject: '.mb_encode_mimeheader($subject)."\r\n"); |
// fputs($ns,'Subject: '.mb_encode_mimeheader($subject)."\r\n"); |
1748 |
fputs($ns,'From: '.$from."\r\n"); |
fputs($ns,'From: '.$from."\r\n"); |
1749 |
fputs($ns,'Newsgroups: '.$newsgroups."\r\n"); |
fputs($ns,'Newsgroups: '.$newsgroups."\r\n"); |
1750 |
// fputs($ns,"Mime-Version: 1.0\r\n"); |
// fputs($ns,"Mime-Version: 1.0\r\n"); |
1751 |
// fputs($ns,"Content-Type: text/plain; charset=ISO-8859-1\r\n"); |
// fputs($ns,"Content-Type: text/plain; charset=ISO-8859-1\r\n"); |
1752 |
// fputs($ns,"Content-Transfer-Encoding: 8bit\r\n"); |
// fputs($ns,"Content-Transfer-Encoding: 8bit\r\n"); |
1753 |
fputs($ns,"User-Agent: NewsPortal 0.24pre3\r\n"); |
fputs($ns,"User-Agent: ".$text_ua["user_agent"]."\r\n"); |
1754 |
if ($send_poster_host) |
if ($send_poster_host) |
1755 |
fputs($ns,'X-HTTP-Posting-Host: '.gethostbyaddr(getenv("REMOTE_ADDR"))."\r\n"); |
fputs($ns,'X-HTTP-Posting-Host: '.gethostbyaddr(getenv("REMOTE_ADDR"))."\r\n"); |
1756 |
if ($ref!=false) fputs($ns,'References: '.$ref."\r\n"); |
if ($ref!=false) fputs($ns,'References: '.$ref."\r\n"); |