/[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.27 by wakaba, Sun Dec 2 00:59:42 2001 UTC revision 1.32 by wakaba, Sun Dec 2 02:55:25 2001 UTC
# Line 44  class headerType { Line 44  class headerType {
44    var $newsgroups;  // the Newsgroups where the article belongs to    var $newsgroups;  // the Newsgroups where the article belongs to
45    var $followup;    var $followup;
46    var $date;    var $date;
   var $organization;  
47    var $references;    var $references;
48    var $content_transfer_encoding;    var $content_transfer_encoding;
49    var $mime_version;    var $mime_version;
# Line 56  class headerType { Line 55  class headerType {
55    var $answers;    var $answers;
56    var $isAnswer;    var $isAnswer;
57    var $username;    var $username;
58    var $user_agent;    var $field;
59    var $isReply;    var $isReply;
60  }  }
61    
# Line 479  function parse_header($hdr,$number="") { Line 478  function parse_header($hdr,$number="") {
478    $header = new headerType;    $header = new headerType;
479    $header->isAnswer=false;    $header->isAnswer=false;
480    for ($count=0;$count<count($hdr);$count++) {    for ($count=0;$count<count($hdr);$count++) {
481      $variable=substr($hdr[$count],0,strpos($hdr[$count]," "));      $variable=substr($hdr[$count],0,strpos($hdr[$count],":"));
482      $value=trim(substr($hdr[$count],strpos($hdr[$count]," ")+1));      $value=trim(substr($hdr[$count],strpos($hdr[$count],":")+1));
483        $header->field[strtolower($variable)][] = $value;
484        switch (strtolower($variable)) {        switch (strtolower($variable)) {
485          case "from:":          case "from":
486            $fromline=address_decode(headerDecode($value),"nirgendwo");            $fromline=address_decode(headerDecode($value),"nirgendwo");
487            if (!isset($fromline[0]["host"])) $fromline[0]["host"]="";            if (!isset($fromline[0]["host"])) $fromline[0]["host"]="";
488            $header->from=$fromline[0]["mailbox"]."@".$fromline[0]["host"];            $header->from=$fromline[0]["mailbox"]."@".$fromline[0]["host"];
# Line 493  function parse_header($hdr,$number="") { Line 493  function parse_header($hdr,$number="") {
493              $header->name=$fromline[0]["personal"];              $header->name=$fromline[0]["personal"];
494            }            }
495            break;            break;
496          case "message-id:":          case "message-id":
497            $header->id=$value;            $header->id=$value;
498            break;            break;
499          case "subject:":          case "subject":
500            $header->subject = decode_unstructured_body($value);            $header->subject = decode_unstructured_body($value);
501            break;            break;
502          case "newsgroups:":          case "newsgroups":
503            $header->newsgroups=$value;            $header->newsgroups=$value;
504            break;            break;
505          case "organization:":          case "content-transfer-encoding":
           $header->organization = decode_unstructured_body($value);  
           break;  
         case "content-transfer-encoding:":  
506            $header->content_transfer_encoding=trim(strtolower($value));            $header->content_transfer_encoding=trim(strtolower($value));
507            break;            break;
508          case "content-type:":          case "content-type":
509            $header->content_type=array();            $header->content_type=array();
510            $subheader=split(";",$value);            $subheader=split(";",$value);
511            $header->content_type[0]=strtolower(trim($subheader[0]));            $header->content_type[0]=strtolower(trim($subheader[0]));
# Line 533  function parse_header($hdr,$number="") { Line 530  function parse_header($hdr,$number="") {
530              }              }
531            }            }
532            break;            break;
533          case "references:":          case "references":
534            $ref=ereg_replace("> *<", "> <", trim($value));            $ref=ereg_replace("> *<", "> <", trim($value));
535            while (strpos($ref,"> <") != false) {            while (strpos($ref,"> <") != false) {
536              $header->references[]=substr($ref,0,strpos($ref," "));              $header->references[]=substr($ref,0,strpos($ref," "));
# Line 541  function parse_header($hdr,$number="") { Line 538  function parse_header($hdr,$number="") {
538            }            }
539            $header->references[]=trim($ref);            $header->references[]=trim($ref);
540            break;            break;
541          case "date:":          case "date":
542            $header->date=getTimestamp(trim($value));            $header->date=getTimestamp(trim($value));
543            break;            break;
544          case "followup-to:":          case "followup-to":
545            $header->followup=trim($value);            $header->followup=trim($value);
546            break;            break;
547          case "x-newsreader:":  /*
548          case "x-mailer:":          case "x-newsreader":
549          case "user-agent:":          case "x-mailer":
550            case "user-agent":
551            $header->user_agent= decode_structured_body($value);            $header->user_agent= decode_structured_body($value);
552            break;            break;
553          case "x-moe:":  */
           $header->x_moe= decode_structured_body($value);  
           break;  
         case "x-face:":  
 //          echo "<p>-".base64_decode($value)."-</p>";  
           break;  
554        }        }
555    }    }
556    if (!isset($header->content_type[0]))    if (!isset($header->content_type[0]))
# Line 576  function decode_unstructured_body ($body Line 569  function decode_unstructured_body ($body
569        "mb_decode_mimeheader('\\1')",        "mb_decode_mimeheader('\\1')",
570    );    );
571    return preg_replace ($patterns, $replace,    return preg_replace ($patterns, $replace,
572                         mb_convert_encoding($body, "EUC-JP", "auto"));                         mb_convert_encoding(fake_jisx0213($body), "EUC-JP", "auto"));
573  }  }
574    
575  function decode_structured_body ($body) {  function decode_structured_body ($body) {
# Line 586  function decode_structured_body ($body) Line 579  function decode_structured_body ($body)
579  )*\)))*\)))*)\)/e",  )*\)))*\)))*)\)/e",
580    );    );
581    $replace = array (    $replace = array (
582        "mb_convert_encoding(decode_quoted_pair('\\1'), 'EUC-JP', 'auto')",      "mb_convert_encoding(fake_jisx0213(decode_quoted_pair('\\1')),'EUC-JP','auto')",
583        "'('.mb_convert_encoding(decode_quoted_pair('\\1'), 'EUC-JP', 'auto').')'",      "'('.mb_convert_encoding(fake_jisx0213(decode_quoted_pair('\\1')),
584                                 'EUC-JP','auto').')'",
585    );    );
586    return preg_replace ($patterns, $replace, $body);    return preg_replace ($patterns, $replace, $body);
587  }  }
# Line 597  function decode_quoted_pair($value) { Line 591  function decode_quoted_pair($value) {
591    return ereg_replace('\\\\(.)', "\\1", $value);    return ereg_replace('\\\\(.)', "\\1", $value);
592  }  }
593    
594    function fake_jisx0213 ($value) {
595      $value = preg_replace ("/\\x1B\\\$\\(O/", "\x1B\\\$B", $value);
596      $value = preg_replace ("/\\x1B\\\$\\(P/", "\x1B\\\$(D", $value);
597      return $value;
598    }
599    
600  function decode_body($body,$encoding) {  function decode_body($body,$encoding) {
601    $bodyzeile="";    $bodyzeile="";
602    switch ($encoding) {    switch ($encoding) {
# Line 1504  function show_header($head,$group) { Line 1504  function show_header($head,$group) {
1504      echo $text_header["newsgroups"].htmlspecialchars(str_replace(',',', ',$head->newsgroups))."<br>\n";      echo $text_header["newsgroups"].htmlspecialchars(str_replace(',',', ',$head->newsgroups))."<br>\n";
1505    if (isset($head->followup) && ($article_show["Followup"]) && ($head->followup != ""))    if (isset($head->followup) && ($article_show["Followup"]) && ($head->followup != ""))
1506      echo $text_header["followup"].htmlspecialchars($head->followup)."<br>\n";      echo $text_header["followup"].htmlspecialchars($head->followup)."<br>\n";
   if ((isset($head->organization)) && ($article_show["Organization"]) &&  
      ($head->organization != ""))  
     echo $text_header["organization"].  
          html_parse(htmlspecialchars($head->organization))."<br>\n";  
1507    if ($article_show["Date"])    if ($article_show["Date"])
1508      echo $text_header["date"].date($text_header["date_format"],$head->date)."<br>\n";      echo $text_header["date"].date($text_header["date_format"],$head->date)."<br>\n";
1509    if ($article_show["Message-ID"])    if ($article_show["Message-ID"])
# Line 1522  function show_header($head,$group) { Line 1518  function show_header($head,$group) {
1518      }      }
1519      echo "<br>";      echo "<br>";
1520    }    }
1521    if (isset($head->user_agent)) {    $fields = array ("x-moe", "x-brother", "x-syster", "x-wife",
1522      if ((isset($article_show["User-Agent"])) &&                     "x-daughter", "x-respect",
1523         ($article_show["User-Agent"])) {                     "user-agent", "x-mailer", "x-newsreader",
1524        echo $text_header["user-agent"].htmlspecialchars($head->user_agent)."<br>\n";                     "list-id", "x-uri", "x-mail-count", "keywords");
1525      } else {    for ($i = 0; $i < count($fields); $i++) {
1526        echo "<!-- User-Agent: ".htmlspecialchars($head->user_agent)." -->\n";      if (count($head->field[$fields[$i]])) {
1527          if ((isset($article_show[$fields[$i]])) && ($article_show[$fields[$i]])) {
1528            echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">"
1529                .$text_header[$fields[$i]]."</span> <span class=\"body\">"
1530                .htmlspecialchars(decode_structured_body(
1531                                    join(', ', $head->field[$fields[$i]])))
1532                ."</span></div>\n";
1533          }
1534      }      }
1535    }    }
1536    if (isset($head->x_moe)) {    $fields = array ("x-weather", "x-copyright", "comments", "organization");
1537      if ((isset($article_show["X-Moe"])) && ($article_show["X-Moe"])) {    for ($i = 0; $i < count($fields); $i++) {
1538        echo "<span class=\"field x-moe\"><span class=\"name\">".$text_header["X-Moe"]      if (count($head->field[$fields[$i]])) {
1539            ."</span> <span class=\"body\">"        if ((isset($article_show[$fields[$i]])) && ($article_show[$fields[$i]])) {
1540            .htmlspecialchars($head->x_moe)."</span>\n";          for ($j = 0; $j > count($head->field[$fields[$i]]); $j++) {
1541              echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">"
1542                  .$text_header[$fields[$i]]."</span> <span class=\"body\">"
1543                  .htmlspecialchars(decode_unstructured_body(
1544                                               $head->field[$fields[$i]][$j]))
1545                  ."</span></div>\n";
1546            }
1547          }
1548      }      }
1549    }    }
1550    if ((isset($attachment_show)) && ($attachment_show==true) &&    if ((isset($attachment_show)) && ($attachment_show==true) &&
# Line 1706  function quoted_printable_encode($line) Line 1716  function quoted_printable_encode($line)
1716   * $body: The article itself   * $body: The article itself
1717   */   */
1718  function verschicken($subject,$from,$newsgroups,$ref,$body) {  function verschicken($subject,$from,$newsgroups,$ref,$body) {
1719    global $server,$port,$send_poster_host,$organization,$text_error;    global $server,$port,$send_poster_host,$organization,$text_error,$text_ua;
1720    global $file_footer;    global $file_footer;
1721    flush();    flush();
1722    $ns=OpenNNTPconnection($server,$port);    $ns=OpenNNTPconnection($server,$port);

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.32

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24