/[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.31 by wakaba, Sun Dec 2 02:37:48 2001 UTC revision 1.37 by wakaba, Mon Apr 1 01:40:44 2002 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;
 //  var $user_agent;  
58    var $field;    var $field;
59    var $isReply;    var $isReply;
60  }  }
# Line 202  function get_mimetype_by_filename($name) Line 200  function get_mimetype_by_filename($name)
200  }  }
201    
202  function showPageSelectMenu($article_count,$first) {  function showPageSelectMenu($article_count,$first) {
203    global $articles_per_page,$file_thread,$file_framethread,$name;    global $articles_per_page,$name;
 /*  if (isset($file_framethread)) {  
     $thread=$file_framethread;  
   } else {  
     $thread=$file_thread;  
   }  
 */  
204    $pages=ceil($article_count / $articles_per_page);    $pages=ceil($article_count / $articles_per_page);
205    if ($article_count > $articles_per_page)    if ($article_count > $articles_per_page)
206      for ($i = 0; $i < $pages; $i++) {      for ($i = 0; $i < $pages; $i++) {
207        echo '[';        echo '[';
208        if ($first != $i*$articles_per_page+1)        if ($first != $i*$articles_per_page+1)
209          echo '<a href="'.($i*$articles_per_page+1).'_'.          echo '<a href="'.($i*$articles_per_page+1).'-'.
210               ($i+1)*$articles_per_page.'.html">';               ($i+1)*$articles_per_page.'">';
211        echo ($i*$articles_per_page+1).'-';        echo ($i*$articles_per_page+1).'-';
212        if ($i == $pages-1) {        if ($i == $pages-1) {
213          echo $article_count;          echo $article_count;
# Line 386  function readGroups($server,$port) { Line 378  function readGroups($server,$port) {
378   */   */
379  function showgroups($gruppen) {  function showgroups($gruppen) {
380    if ($gruppen == false) return;    if ($gruppen == false) return;
381    global $file_thread,$text_groups;    global $uri_thread,$text_groups;
382    $c = count($gruppen);    $c = count($gruppen);
383    echo "<table>\n";    echo "<table>\n";
384    echo "<tr><td>#</td><td>".$text_groups["newsgroup"].    echo "<tr><td>#</td><td>".$text_groups["newsgroup"].
# Line 398  function showgroups($gruppen) { Line 390  function showgroups($gruppen) {
390      echo '<a ';      echo '<a ';
391      if ((isset($frame_threadframeset)) && ($frame_threadframeset != ""))      if ((isset($frame_threadframeset)) && ($frame_threadframeset != ""))
392        echo 'target="'.$frame_threadframeset.'" ';        echo 'target="'.$frame_threadframeset.'" ';
393      echo 'href="'.$file_thread.'/'.urlencode($g->name).'/index.html">'.$g->name."</a></td>\n";      echo 'href="'.$uri_thread.'/'.encode_newsgroup ($g->name).'/">'.$g->name."</a></td>\n";
394      echo "<td>$g->description</td></tr>\n";      echo "<td>$g->description</td></tr>\n";
395      flush();      flush();
396    }    }
397    echo "</table>\n";    echo "</table>\n";
398  }  }
399    
400    function encode_newsgroup ($groupname) {
401      return str_replace ('.', ':', urlencode ($groupname));
402    }
403    
404  /*  /*
405   * gets a list of aviable articles in the group $groupname   * gets a list of aviable articles in the group $groupname
406   */   */
# Line 453  function headerDecode($value) { Line 449  function headerDecode($value) {
449    }    }
450  }  }
451    
 function getTimestamp($value) {  
   $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);  
   $value=str_replace("  "," ",$value);  
   $d=split(" ",$value,5);  
   if (strcmp(substr($d[0],strlen($d[0])-1,1),",") == 0) {  
     $date[0]=$d[1];  // day  
     $date[1]=$d[2];  // month  
     $date[2]=$d[3];  // year  
     $date[3]=$d[4];  // hours:minutes:seconds  
   } else {  
     $date[0]=$d[0];  // day  
     $date[1]=$d[1];  // month  
     $date[2]=$d[2];  // year  
     $date[3]=$d[3];  // hours:minutes:seconds  
   }  
   $time=split(":",$date[3]);  
   $timestamp=mktime($time[0],$time[1],$time[2],$months[$date[1]],$date[0],$date[2]);  
   return $timestamp;  
 }  
452    
453  function parse_header($hdr,$number="") {  function parse_header($hdr,$number="") {
454    for ($i=count($hdr)-1; $i>0; $i--)    for ($i=count($hdr)-1; $i>0; $i--)
# Line 504  function parse_header($hdr,$number="") { Line 481  function parse_header($hdr,$number="") {
481          case "newsgroups":          case "newsgroups":
482            $header->newsgroups=$value;            $header->newsgroups=$value;
483            break;            break;
         case "organization":  
           $header->organization = decode_unstructured_body($value);  
           break;  
484          case "content-transfer-encoding":          case "content-transfer-encoding":
485            $header->content_transfer_encoding=trim(strtolower($value));            $header->content_transfer_encoding=trim(strtolower($value));
486            break;            break;
# Line 544  function parse_header($hdr,$number="") { Line 518  function parse_header($hdr,$number="") {
518            $header->references[]=trim($ref);            $header->references[]=trim($ref);
519            break;            break;
520          case "date":          case "date":
521            $header->date=getTimestamp(trim($value));            $header->date = strtotime(trim($value));
522            break;            break;
523          case "followup-to":          case "followup-to":
524            $header->followup=trim($value);            $header->followup=trim($value);
# Line 580  function decode_unstructured_body ($body Line 554  function decode_unstructured_body ($body
554  function decode_structured_body ($body) {  function decode_structured_body ($body) {
555    $patterns = array (    $patterns = array (
556        "/\"((?:[^\"\\\\]+|\\\\.)*)\"/e",        "/\"((?:[^\"\\\\]+|\\\\.)*)\"/e",
557        "/\(((?:[^()\\\\]+|\\\\.|(?:\((?:[^()\\\\]+|\\\\.|(?:\((?:[^)\\\\]+|\\\\.\        "/\(((?:[^()\\\\]+|\\\\.|(?:\((?:[^()\\\\]+|\\\\.|(?:\((?:[^)\\\\]+|\\\\.\)*\))*\)))*)))\)/e",
 )*\)))*\)))*)\)/e",  
558    );    );
559    $replace = array (    $replace = array (
560      "mb_convert_encoding(fake_jisx0213(decode_quoted_pair('\\1')),'EUC-JP','auto')",      "mb_convert_encoding(fake_jisx0213(decode_quoted_pair('\\1')),'EUC-JP','auto')",
# Line 880  function html_parse($comment, $group = " Line 853  function html_parse($comment, $group = "
853    return($comment);    return($comment);
854  }  }
855    
856    function uri_to_link($comment, $group = "", $msgidregex = "") {
857      global $frame_externallink;
858      global $file_article;
859      $comment = preg_replace (
860         '"((?:https?|mailto|urn|news|ftp|irc|mid|data|nntp|gother)):((?:[-_.!~*\'()A-Z0-9:;@=+$,%?/]+|&amp;)+)(#(?:[-_.!~*\'()A-Z0-9;/?:@&=+$,%]+|&amp;)+)?"ie',
861         'uri_to_link_uri("\1", "\2", "\3")',
862      $comment);
863      return($comment);
864    }
865    
866    function uri_to_link_uri ($scheme, $body, $fragment) {
867      global $file_article;
868      switch (strtolower($scheme)) {
869        case "urn":
870        case "data":
871          $uri = '/uri-res/N2L?'.urlencode($scheme.':'.$body);
872          break;
873        case "news":
874          if (!preg_match('"^//"', $body)) {
875            $uri = "../../".addslashes($file_article).'/junk/%3C'.$nbody.'%3E';
876          } else {
877            $uri = $scheme.':'.$body;
878          }
879          break;
880        case "mid":
881          $nbody = preg_replace('"/.*$"', "", $body);
882          $uri = "../../".addslashes($file_article).'/junk/%3C'.$nbody.'%3E';
883          break;
884        default:
885          $uri = $scheme.':'.$body;
886          break;
887      }
888      $uri = $uri . $fragment;
889      if (!empty($uri)) {
890        $uri = '<a href="'.$uri.'">'.$scheme.':'.$body.$fragment.'</a>';
891      }
892      return $uri;
893    }
894    
895    
896    
# Line 943  function interpretOverviewLine($zeile,$o Line 954  function interpretOverviewLine($zeile,$o
954        $article->subject=$subject;        $article->subject=$subject;
955      }      }
956      if ($overviewfmt[$i]=="Date:") {      if ($overviewfmt[$i]=="Date:") {
957        $article->date=getTimestamp($over[$i+1]);        $article->date = strtotime($over[$i+1]);
958      }      }
959      if ($overviewfmt[$i]=="From:") {      if ($overviewfmt[$i]=="From:") {
960        $fromline=address_decode(headerDecode($over[$i+1]),"nirgendwo");        $fromline=address_decode(headerDecode($over[$i+1]),"nirgendwo");
# Line 1509  function show_header($head,$group) { Line 1520  function show_header($head,$group) {
1520      echo $text_header["newsgroups"].htmlspecialchars(str_replace(',',', ',$head->newsgroups))."<br>\n";      echo $text_header["newsgroups"].htmlspecialchars(str_replace(',',', ',$head->newsgroups))."<br>\n";
1521    if (isset($head->followup) && ($article_show["Followup"]) && ($head->followup != ""))    if (isset($head->followup) && ($article_show["Followup"]) && ($head->followup != ""))
1522      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";  
1523    if ($article_show["Date"])    if ($article_show["Date"])
1524      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";
1525    if ($article_show["Message-ID"])    if ($article_show["Message-ID"])
# Line 1527  function show_header($head,$group) { Line 1534  function show_header($head,$group) {
1534      }      }
1535      echo "<br>";      echo "<br>";
1536    }    }
 /*  
   if (isset($head->user_agent)) {  
     if ((isset($article_show["User-Agent"])) &&  
        ($article_show["User-Agent"])) {  
       echo $text_header["user-agent"].htmlspecialchars($head->user_agent)."<br>\n";  
     } else {  
       echo "<!-- User-Agent: ".htmlspecialchars($head->user_agent)." -->\n";  
     }  
   }  
 */  
1537    $fields = array ("x-moe", "x-brother", "x-syster", "x-wife",    $fields = array ("x-moe", "x-brother", "x-syster", "x-wife",
1538                     "x-daughter", "x-respect",                     "x-daughter", "x-respect",
1539                     "user-agent", "x-mailer", "x-newsreader",                     "user-agent", "x-mailer", "x-newsreader",
# Line 1546  function show_header($head,$group) { Line 1543  function show_header($head,$group) {
1543        if ((isset($article_show[$fields[$i]])) && ($article_show[$fields[$i]])) {        if ((isset($article_show[$fields[$i]])) && ($article_show[$fields[$i]])) {
1544          echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">"          echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">"
1545              .$text_header[$fields[$i]]."</span> <span class=\"body\">"              .$text_header[$fields[$i]]."</span> <span class=\"body\">"
1546              .htmlspecialchars(decode_structured_body(              .uri_to_link(htmlspecialchars(decode_structured_body(
1547                                  join(', ', $head->field[$fields[$i]])))                                  join(', ', $head->field[$fields[$i]]))))
1548              ."</span></div>\n";              ."</span></div>\n";
1549        }        }
1550      }      }
1551    }    }
1552    $fields = array ("x-weather", "x-copyright", "comments");    $fields = array ("x-weather", "x-copyright", "comments", "organization");
1553    for ($i = 0; $i < count($fields); $i++) {    for ($i = 0; $i < count($fields); $i++) {
1554      if (count($head->field[$fields[$i]])) {      if (count($head->field[$fields[$i]])) {
1555        if ((isset($article_show[$fields[$i]])) && ($article_show[$fields[$i]])) {        if ((isset($article_show[$fields[$i]])) && ($article_show[$fields[$i]])) {
1556          for ($j = 0; $j > count($head->field[$fields[$i]]); $j++) {          for ($j = 0; $j > count($head->field[$fields[$i]]); $j++) {
1557            echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">"            echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">"
1558                .$text_header[$fields[$i]]."</span> <span class=\"body\">"                .$text_header[$fields[$i]]."</span> <span class=\"body\">"
1559                .htmlspecialchars(decode_unstructured_body(                .uri_to_link(htmlspecialchars(decode_unstructured_body(
1560                                             $head->field[$fields[$i]][$j]))                                             $head->field[$fields[$i]][$j])))
1561                ."</span></div>\n";                ."</span></div>\n";
1562          }          }
1563        }        }
# Line 1632  function show_article($group,$id,$attach Line 1629  function show_article($group,$id,$attach
1629  //        }  //        }
1630  //      echo $body[$i]."\n";  //      echo $body[$i]."\n";
1631          $b=$body[$i];          $b=$body[$i];
1632          echo html_parse(htmlspecialchars($b)."\n", $group, $msgidregex);          echo uri_to_link(htmlspecialchars($b)."\n", $group, $msgidregex);
1633        }        }
1634        echo "\n</pre>\n";        echo "\n</pre>\n";
1635      } else {      } else {
# Line 1735  function quoted_printable_encode($line) Line 1732  function quoted_printable_encode($line)
1732   * $body: The article itself   * $body: The article itself
1733   */   */
1734  function verschicken($subject,$from,$newsgroups,$ref,$body) {  function verschicken($subject,$from,$newsgroups,$ref,$body) {
1735    global $server,$port,$send_poster_host,$organization,$text_error;    global $server,$port,$send_poster_host,$organization,$text_error,$text_ua;
1736    global $file_footer;    global $file_footer;
1737    flush();    flush();
1738    $ns=OpenNNTPconnection($server,$port);    $ns=OpenNNTPconnection($server,$port);

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.37

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24