/[suikacvs]/messaging/newsportal/newsportal.php
Suika

Diff of /messaging/newsportal/newsportal.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by wakaba, Sat Dec 1 11:17:31 2001 UTC revision 1.23 by wakaba, Sat Dec 1 14:02:09 2001 UTC
# Line 447  function headerDecode($value) { Line 447  function headerDecode($value) {
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"));      if (eregi('".*"',$value)) {  // quoted-pair
452          ereg('([^"]*)"(([^"]+|\\\\.)*)"(.*)',$value,$vals);
453          $newvalue = $vals[1].decode_quoted_pair($vals[2]).$vals[4];
454          return(mb_convert_encoding($newvalue, "EUC-JP", "auto"));
455        } else {   // there wasn't anything encoded, return the original string
456          return(mb_convert_encoding($value, "EUC-JP", "auto"));
457        }
458    }    }
459  }  }
460    
461    function decode_quoted_pair($value) {
462          return(ereg_replace('\\\\(.)',"\\1",$value));
463    }
464    
465  function getTimestamp($value) {  function getTimestamp($value) {
466    $months=array("Jan"=>1,"Feb"=>2,"Mar"=>3,"Apr"=>4,"May"=>5,"Jun"=>6,"Jul"=>7,"Aug"=>8,"Sep"=>9,"Oct"=>10,"Nov"=>11,"Dec"=>12);    $months=array("Jan"=>1,"Feb"=>2,"Mar"=>3,"Apr"=>4,"May"=>5,"Jun"=>6,"Jul"=>7,"Aug"=>8,"Sep"=>9,"Oct"=>10,"Nov"=>11,"Dec"=>12);
467    $value=str_replace("  "," ",$value);    $value=str_replace("  "," ",$value);
# Line 550  function parse_header($hdr,$number="") { Line 560  function parse_header($hdr,$number="") {
560          case "x-newsreader:":          case "x-newsreader:":
561          case "x-mailer:":          case "x-mailer:":
562          case "user-agent:":          case "user-agent:":
563            $header->user_agent=trim($value);            $header->user_agent=trim(decode_structured_body($value));
564            break;            break;
565          case "x-face:":          case "x-face:":
566  //          echo "<p>-".base64_decode($value)."-</p>";  //          echo "<p>-".base64_decode($value)."-</p>";
# Line 565  function parse_header($hdr,$number="") { Line 575  function parse_header($hdr,$number="") {
575    return $header;    return $header;
576  }  }
577    
578    function decode_structured_body ($body) {
579      ereg("(\"([^\"]+|\\\\.)*\"|\\(([^()]+|\\\\.)*\\)|[^\"])+", $body, $element);
580      return join('-', $element);
581    }
582    
583  function decode_body($body,$encoding) {  function decode_body($body,$encoding) {
584    $bodyzeile="";    $bodyzeile="";
585    switch ($encoding) {    switch ($encoding) {
# Line 754  function read_message($id,$bodynum=0,$gr Line 769  function read_message($id,$bodynum=0,$gr
769        return false;        return false;
770      $rawmessage=array();      $rawmessage=array();
771      $line=lieszeile($ns);      $line=lieszeile($ns);
772   $line=mb_convert_encoding($line, "EUC-JP", "ISO-2022-JP");   #$line=mb_convert_encoding($line, "EUC-JP", "ISO-2022-JP");
773      while(strcmp($line,".") != 0) {      while(strcmp($line,".") != 0) {
774        $rawmessage[]=$line;        $rawmessage[]=$line;
775        $line=lieszeile($ns);        $line=lieszeile($ns);
776   $line=mb_convert_encoding($line, "EUC-JP", "ISO-2022-JP");   #$line=mb_convert_encoding($line, "EUC-JP", "ISO-2022-JP");
777      }      }
778      $message=parse_message($rawmessage);      $message=parse_message($rawmessage);
779      if (ereg('^[0-9]+$',$id)) $message->header->number=$id;      if (ereg('^[0-9]+$',$id)) $message->header->number=$id;
# Line 1177  function formatTreeGraphic($newtree) { Line 1192  function formatTreeGraphic($newtree) {
1192          break;          break;
1193        }        }
1194      $return .= '" alt="'.$alt.'"';      $return .= '" alt="'.$alt.'"';
1195      if (strcmp($k,".") == 0) $return .=(' width="12" height="9"');      if (strcmp($k,".") == 0) $return .=(' style="width: 12px; height: 9px"');
1196      $return .= ' />';      $return .= '>';
1197    }    }
1198    return($return);    return($return);
1199  }  }
# Line 1256  function showThread(&$headers,&$liste,$d Line 1271  function showThread(&$headers,&$liste,$d
1271            echo "<br>\n";            echo "<br>\n";
1272            break;            break;
1273          case 1: // html-auflistung, kein baum          case 1: // html-auflistung, kein baum
1274            echo "<li><nobr>".$thread_fontPre;            echo "<li>".$thread_fontPre;
1275            if ($thread_showDate)            if ($thread_showDate)
1276              echo formatDate($c)." ";              echo formatDate($c)." ";
1277            if ($thread_showSubject)            if ($thread_showSubject)
1278              echo formatSubject($c,$group)." ";              echo formatSubject($c,$group)." ";
1279            if ($thread_showAuthor)            if ($thread_showAuthor)
1280              echo "<i>(".formatAuthor($c).")</i>";              echo "<em>(".formatAuthor($c).")</em>";
1281            echo $thread_fontPost."</nobr></li>";            echo $thread_fontPost."</li>";
1282            break;            break;
1283          case 2:   // table          case 2:   // table
1284            echo "<tr>";            echo "<tr>";
# Line 1275  function showThread(&$headers,&$liste,$d Line 1290  function showThread(&$headers,&$liste,$d
1290            }            }
1291            if ($thread_showAuthor) {            if ($thread_showAuthor) {
1292              echo "<td></td>";              echo "<td></td>";
1293              echo '<td nowrap="nowrap">'.$thread_fontPre.formatAuthor($c);              echo '<td>'.$thread_fontPre.formatAuthor($c);
1294              echo $thread_fontPost."</td>";              echo $thread_fontPost."</td>";
1295            }            }
1296            echo "</tr>\n";            echo "</tr>\n";
1297            break;            break;
1298          case 3: // html-tree          case 3: // html-tree
1299            echo "<li><nobr>".$thread_fontPre;            echo "<li>".$thread_fontPre;
1300            if ($thread_showDate)            if ($thread_showDate)
1301              echo formatDate($c)." ";              echo formatDate($c)." ";
1302            if ($thread_showSubject)            if ($thread_showSubject)
1303              echo formatSubject($c,$group)." ";              echo formatSubject($c,$group)." ";
1304            if ($thread_showAuthor)            if ($thread_showAuthor)
1305              echo "<i>(".formatAuthor($c).")</i>";              echo "<em>(".formatAuthor($c).")</em>";
1306            echo $thread_fontPost."</nobr>\n";            echo $thread_fontPost."\n";
1307            break;            break;
1308          case 4:  // thread          case 4:  // thread
1309            echo "<nobr><tt>".$thread_fontPre;            echo "".$thread_fontPre;
1310            if ($thread_showDate)            if ($thread_showDate)
1311              echo formatDate($c)." ";              echo formatDate($c)." ";
1312            echo formatTreeText($newtree)." ";            echo formatTreeText($newtree)." ";
1313            if ($thread_showSubject)            if ($thread_showSubject)
1314              echo formatSubject($c,$group)." ";              echo formatSubject($c,$group)." ";
1315            if ($thread_showAuthor)            if ($thread_showAuthor)
1316              echo "<i>(".formatAuthor($c).")</i>";              echo "<em>(".formatAuthor($c).")</em>";
1317            echo $thread_fontPost."</tt></nobr><br>";            echo $thread_fontPost."<br>";
1318            break;            break;
1319          case 5:  // thread, graphic          case 5:  // thread, graphic
1320            echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr>\n";            echo "<table><tr>\n";
1321            if ($thread_showDate)            if ($thread_showDate)
1322              echo '<td nowrap="nowrap">'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</td>";              echo '<td>'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</td>";
1323            echo "<td>".$thread_fontPre.formatTreeGraphic($newtree).$thread_fontPost."</td>";            echo "<td>".$thread_fontPre.formatTreeGraphic($newtree).$thread_fontPost."</td>";
1324            if ($thread_showSubject)            if ($thread_showSubject)
1325              echo '<td nowrap="nowrap">'.$thread_fontPre."&nbsp;".formatSubject($c,$group)." ";              echo '<td>'.$thread_fontPre."&nbsp;".formatSubject($c,$group)." ";
1326            if ($thread_showAuthor)            if ($thread_showAuthor)
1327              echo "(".formatAuthor($c).")".$thread_fontPost."</td>";              echo "(".formatAuthor($c).")".$thread_fontPost."</td>";
1328            echo "</tr></table>";            echo "</tr></table>";
# Line 1315  function showThread(&$headers,&$liste,$d Line 1330  function showThread(&$headers,&$liste,$d
1330          case 6:  // thread, table          case 6:  // thread, table
1331            echo "<tr>";            echo "<tr>";
1332            if ($thread_showDate)            if ($thread_showDate)
1333              echo '<td nowrap="nowrap"><tt>'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</tt></td>";              echo '<td>'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</td>";
1334            echo '<td nowrap="nowrap"><tt>'.$thread_fontPre.formatTreeText($newtree)." ";            echo '<td>'.$thread_fontPre.formatTreeText($newtree)." ";
1335            if ($thread_showSubject) {            if ($thread_showSubject) {
1336              echo formatSubject($c,$group).$thread_fontPost."</tt></td>";              echo formatSubject($c,$group).$thread_fontPost."</td>";
1337              echo "<td></td>";              echo "<td></td>";
1338            }            }
1339            if ($thread_showAuthor)            if ($thread_showAuthor)
1340              echo '<td nowrap="nowrap"><tt>'.$thread_fontPre.formatAuthor($c).$thread_fontPost."</tt></td>";              echo '<td>'.$thread_fontPre.formatAuthor($c).$thread_fontPost."</td>";
1341            echo "</tr>";            echo "</tr>";
1342            break;            break;
1343          case 7:  // thread, table, graphic          case 7:  // thread, table, graphic
1344            echo "<tr>";            echo "<tr>";
1345            if ($thread_showDate)            if ($thread_showDate)
1346              echo '<td nowrap="nowrap">'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</td>";              echo '<td>'.$thread_fontPre.formatDate($c)." ".$thread_fontPost."</td>";
1347            echo "<td><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";            echo "<td><table>\n";
1348            echo "<td>".formatTreeGraphic($newtree)."</td>";            echo "<td>".formatTreeGraphic($newtree)."</td>";
1349            if ($thread_showSubject)            if ($thread_showSubject)
1350              echo '<td nowrap="nowrap">'.$thread_fontPre."&nbsp;".formatSubject($c,$group).$thread_fontPost."</td>";              echo '<td>'.$thread_fontPre."&nbsp;".formatSubject($c,$group).$thread_fontPost."</td>";
1351            echo "</table></td>";            echo "</table></td>";
1352            if ($thread_showSubject) echo "<td></td>";            if ($thread_showSubject) echo "<td></td>";
1353            if ($thread_showAuthor)            if ($thread_showAuthor)
1354              echo '<td nowrap="nowrap">'.$thread_fontPre.formatAuthor($c).$thread_fontPost."</td>";              echo '<td>'.$thread_fontPre.formatAuthor($c).$thread_fontPost."</td>";
1355            echo "</tr>";            echo "</tr>";
1356            break;            break;
1357        }        }
# Line 1675  function verschicken($subject,$from,$new Line 1690  function verschicken($subject,$from,$new
1690      fputs($ns,"post\r\n");      fputs($ns,"post\r\n");
1691      $weg=lieszeile($ns);      $weg=lieszeile($ns);
1692  //    fputs($ns,'Subject: '.quoted_printable_encode($subject)."\r\n");  //    fputs($ns,'Subject: '.quoted_printable_encode($subject)."\r\n");
1693  //    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");
1694      fputs($ns,'Subject: '.mb_encode_mimeheader($subject)."\r\n");  //    fputs($ns,'Subject: '.mb_encode_mimeheader($subject)."\r\n");
1695      fputs($ns,'From: '.$from."\r\n");      fputs($ns,'From: '.$from."\r\n");
1696      fputs($ns,'Newsgroups: '.$newsgroups."\r\n");      fputs($ns,'Newsgroups: '.$newsgroups."\r\n");
1697  //    fputs($ns,"Mime-Version: 1.0\r\n");  //    fputs($ns,"Mime-Version: 1.0\r\n");
1698  //    fputs($ns,"Content-Type: text/plain; charset=ISO-8859-1\r\n");  //    fputs($ns,"Content-Type: text/plain; charset=ISO-8859-1\r\n");
1699  //    fputs($ns,"Content-Transfer-Encoding: 8bit\r\n");  //    fputs($ns,"Content-Transfer-Encoding: 8bit\r\n");
1700      fputs($ns,"User-Agent: NewsPortal 0.24pre3\r\n");      fputs($ns,"User-Agent: ".$text_ua["user_agent"]."\r\n");
1701      if ($send_poster_host)      if ($send_poster_host)
1702        fputs($ns,'X-HTTP-Posting-Host: '.gethostbyaddr(getenv("REMOTE_ADDR"))."\r\n");        fputs($ns,'X-HTTP-Posting-Host: '.gethostbyaddr(getenv("REMOTE_ADDR"))."\r\n");
1703      if ($ref!=false) fputs($ns,'References: '.$ref."\r\n");      if ($ref!=false) fputs($ns,'References: '.$ref."\r\n");

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.23

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24