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; |
1194 |
break; |
break; |
1195 |
} |
} |
1196 |
$return .= '" alt="'.$alt.'"'; |
$return .= '" alt="'.$alt.'"'; |
1197 |
if (strcmp($k,".") == 0) $return .=(' width="12" height="9"'); |
if (strcmp($k,".") == 0) $return .=(' style="width: 12px; height: 9px"'); |
1198 |
$return .= ' />'; |
$return .= '>'; |
1199 |
} |
} |
1200 |
return($return); |
return($return); |
1201 |
} |
} |
1273 |
echo "<br>\n"; |
echo "<br>\n"; |
1274 |
break; |
break; |
1275 |
case 1: // html-auflistung, kein baum |
case 1: // html-auflistung, kein baum |
1276 |
echo "<li><nobr>".$thread_fontPre; |
echo "<li>".$thread_fontPre; |
1277 |
if ($thread_showDate) |
if ($thread_showDate) |
1278 |
echo formatDate($c)." "; |
echo formatDate($c)." "; |
1279 |
if ($thread_showSubject) |
if ($thread_showSubject) |
1280 |
echo formatSubject($c,$group)." "; |
echo formatSubject($c,$group)." "; |
1281 |
if ($thread_showAuthor) |
if ($thread_showAuthor) |
1282 |
echo "<i>(".formatAuthor($c).")</i>"; |
echo "<em>(".formatAuthor($c).")</em>"; |
1283 |
echo $thread_fontPost."</nobr></li>"; |
echo $thread_fontPost."</li>"; |
1284 |
break; |
break; |
1285 |
case 2: // table |
case 2: // table |
1286 |
echo "<tr>"; |
echo "<tr>"; |
1292 |
} |
} |
1293 |
if ($thread_showAuthor) { |
if ($thread_showAuthor) { |
1294 |
echo "<td></td>"; |
echo "<td></td>"; |
1295 |
echo '<td nowrap="nowrap">'.$thread_fontPre.formatAuthor($c); |
echo '<td>'.$thread_fontPre.formatAuthor($c); |
1296 |
echo $thread_fontPost."</td>"; |
echo $thread_fontPost."</td>"; |
1297 |
} |
} |
1298 |
echo "</tr>\n"; |
echo "</tr>\n"; |
1299 |
break; |
break; |
1300 |
case 3: // html-tree |
case 3: // html-tree |
1301 |
echo "<li><nobr>".$thread_fontPre; |
echo "<li>".$thread_fontPre; |
1302 |
if ($thread_showDate) |
if ($thread_showDate) |
1303 |
echo formatDate($c)." "; |
echo formatDate($c)." "; |
1304 |
if ($thread_showSubject) |
if ($thread_showSubject) |
1305 |
echo formatSubject($c,$group)." "; |
echo formatSubject($c,$group)." "; |
1306 |
if ($thread_showAuthor) |
if ($thread_showAuthor) |
1307 |
echo "<i>(".formatAuthor($c).")</i>"; |
echo "<em>(".formatAuthor($c).")</em>"; |
1308 |
echo $thread_fontPost."</nobr>\n"; |
echo $thread_fontPost."\n"; |
1309 |
break; |
break; |
1310 |
case 4: // thread |
case 4: // thread |
1311 |
echo "<nobr><tt>".$thread_fontPre; |
echo "".$thread_fontPre; |
1312 |
if ($thread_showDate) |
if ($thread_showDate) |
1313 |
echo formatDate($c)." "; |
echo formatDate($c)." "; |
1314 |
echo formatTreeText($newtree)." "; |
echo formatTreeText($newtree)." "; |
1315 |
if ($thread_showSubject) |
if ($thread_showSubject) |
1316 |
echo formatSubject($c,$group)." "; |
echo formatSubject($c,$group)." "; |
1317 |
if ($thread_showAuthor) |
if ($thread_showAuthor) |
1318 |
echo "<i>(".formatAuthor($c).")</i>"; |
echo "<em>(".formatAuthor($c).")</em>"; |
1319 |
echo $thread_fontPost."</tt></nobr><br>"; |
echo $thread_fontPost."<br>"; |
1320 |
break; |
break; |
1321 |
case 5: // thread, graphic |
case 5: // thread, graphic |
1322 |
echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr>\n"; |
echo "<table><tr>\n"; |
1323 |
if ($thread_showDate) |
if ($thread_showDate) |
1324 |
echo '<td nowrap="nowrap">'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</td>"; |
echo '<td>'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</td>"; |
1325 |
echo "<td>".$thread_fontPre.formatTreeGraphic($newtree).$thread_fontPost."</td>"; |
echo "<td>".$thread_fontPre.formatTreeGraphic($newtree).$thread_fontPost."</td>"; |
1326 |
if ($thread_showSubject) |
if ($thread_showSubject) |
1327 |
echo '<td nowrap="nowrap">'.$thread_fontPre." ".formatSubject($c,$group)." "; |
echo '<td>'.$thread_fontPre." ".formatSubject($c,$group)." "; |
1328 |
if ($thread_showAuthor) |
if ($thread_showAuthor) |
1329 |
echo "(".formatAuthor($c).")".$thread_fontPost."</td>"; |
echo "(".formatAuthor($c).")".$thread_fontPost."</td>"; |
1330 |
echo "</tr></table>"; |
echo "</tr></table>"; |
1332 |
case 6: // thread, table |
case 6: // thread, table |
1333 |
echo "<tr>"; |
echo "<tr>"; |
1334 |
if ($thread_showDate) |
if ($thread_showDate) |
1335 |
echo '<td nowrap="nowrap"><tt>'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</tt></td>"; |
echo '<td>'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</td>"; |
1336 |
echo '<td nowrap="nowrap"><tt>'.$thread_fontPre.formatTreeText($newtree)." "; |
echo '<td>'.$thread_fontPre.formatTreeText($newtree)." "; |
1337 |
if ($thread_showSubject) { |
if ($thread_showSubject) { |
1338 |
echo formatSubject($c,$group).$thread_fontPost."</tt></td>"; |
echo formatSubject($c,$group).$thread_fontPost."</td>"; |
1339 |
echo "<td></td>"; |
echo "<td></td>"; |
1340 |
} |
} |
1341 |
if ($thread_showAuthor) |
if ($thread_showAuthor) |
1342 |
echo '<td nowrap="nowrap"><tt>'.$thread_fontPre.formatAuthor($c).$thread_fontPost."</tt></td>"; |
echo '<td>'.$thread_fontPre.formatAuthor($c).$thread_fontPost."</td>"; |
1343 |
echo "</tr>"; |
echo "</tr>"; |
1344 |
break; |
break; |
1345 |
case 7: // thread, table, graphic |
case 7: // thread, table, graphic |
1346 |
echo "<tr>"; |
echo "<tr>"; |
1347 |
if ($thread_showDate) |
if ($thread_showDate) |
1348 |
echo '<td nowrap="nowrap">'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</td>"; |
echo '<td>'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</td>"; |
1349 |
echo "<td><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n"; |
echo "<td><table>\n"; |
1350 |
echo "<td>".formatTreeGraphic($newtree)."</td>"; |
echo "<td>".formatTreeGraphic($newtree)."</td>"; |
1351 |
if ($thread_showSubject) |
if ($thread_showSubject) |
1352 |
echo '<td nowrap="nowrap">'.$thread_fontPre." ".formatSubject($c,$group).$thread_fontPost."</td>"; |
echo '<td>'.$thread_fontPre." ".formatSubject($c,$group).$thread_fontPost."</td>"; |
1353 |
echo "</table></td>"; |
echo "</table></td>"; |
1354 |
if ($thread_showSubject) echo "<td></td>"; |
if ($thread_showSubject) echo "<td></td>"; |
1355 |
if ($thread_showAuthor) |
if ($thread_showAuthor) |
1356 |
echo '<td nowrap="nowrap">'.$thread_fontPre.formatAuthor($c).$thread_fontPost."</td>"; |
echo '<td>'.$thread_fontPre.formatAuthor($c).$thread_fontPost."</td>"; |
1357 |
echo "</tr>"; |
echo "</tr>"; |
1358 |
break; |
break; |
1359 |
} |
} |
1692 |
fputs($ns,"post\r\n"); |
fputs($ns,"post\r\n"); |
1693 |
$weg=lieszeile($ns); |
$weg=lieszeile($ns); |
1694 |
// fputs($ns,'Subject: '.quoted_printable_encode($subject)."\r\n"); |
// fputs($ns,'Subject: '.quoted_printable_encode($subject)."\r\n"); |
1695 |
// 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"); |
1696 |
fputs($ns,'Subject: '.mb_encode_mimeheader($subject)."\r\n"); |
// fputs($ns,'Subject: '.mb_encode_mimeheader($subject)."\r\n"); |
1697 |
fputs($ns,'From: '.$from."\r\n"); |
fputs($ns,'From: '.$from."\r\n"); |
1698 |
fputs($ns,'Newsgroups: '.$newsgroups."\r\n"); |
fputs($ns,'Newsgroups: '.$newsgroups."\r\n"); |
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: NewsPortal 0.24pre3\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"); |