/[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.32 by wakaba, Sun Dec 2 02:55:25 2001 UTC revision 1.34 by wakaba, Mon Feb 11 13:27:21 2002 UTC
# Line 396  function showgroups($gruppen) { Line 396  function showgroups($gruppen) {
396      echo '<a ';      echo '<a ';
397      if ((isset($frame_threadframeset)) && ($frame_threadframeset != ""))      if ((isset($frame_threadframeset)) && ($frame_threadframeset != ""))
398        echo 'target="'.$frame_threadframeset.'" ';        echo 'target="'.$frame_threadframeset.'" ';
399      echo 'href="'.$file_thread.'/'.urlencode($g->name).'/index.html">'.$g->name."</a></td>\n";      echo 'href="'.$file_thread.'/'.encode_newsgroup ($g->name).'/index">'.$g->name."</a></td>\n";
400      echo "<td>$g->description</td></tr>\n";      echo "<td>$g->description</td></tr>\n";
401      flush();      flush();
402    }    }
403    echo "</table>\n";    echo "</table>\n";
404  }  }
405    
406    function encode_newsgroup ($groupname) {
407      return urlencode (str_replace ('.', ':', $groupname));
408    }
409    
410  /*  /*
411   * gets a list of aviable articles in the group $groupname   * gets a list of aviable articles in the group $groupname
412   */   */
# Line 451  function headerDecode($value) { Line 455  function headerDecode($value) {
455    }    }
456  }  }
457    
 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;  
 }  
458    
459  function parse_header($hdr,$number="") {  function parse_header($hdr,$number="") {
460    for ($i=count($hdr)-1; $i>0; $i--)    for ($i=count($hdr)-1; $i>0; $i--)
# Line 539  function parse_header($hdr,$number="") { Line 524  function parse_header($hdr,$number="") {
524            $header->references[]=trim($ref);            $header->references[]=trim($ref);
525            break;            break;
526          case "date":          case "date":
527            $header->date=getTimestamp(trim($value));            $header->date = strtotime(trim($value));
528            break;            break;
529          case "followup-to":          case "followup-to":
530            $header->followup=trim($value);            $header->followup=trim($value);
# Line 875  function html_parse($comment, $group = " Line 860  function html_parse($comment, $group = "
860    return($comment);    return($comment);
861  }  }
862    
863    function uri_to_link($comment, $group = "", $msgidregex = "") {
864      global $frame_externallink;
865      global $file_article;
866      $comment = preg_replace (
867         '"((?:https?|mailto|urn|news|ftp|irc|mid|data|nntp|gother)):((?:[-_.!~*\'()A-Z0-9:;@=+$,%?/]+|&amp;)+)(#(?:[-_.!~*\'()A-Z0-9;/?:@&=+$,%]+|&amp;)+)?"ie',
868         'uri_to_link_uri("\1", "\2", "\3")',
869      $comment);
870      return($comment);
871    }
872    
873    function uri_to_link_uri ($scheme, $body, $fragment) {
874      global $file_article;
875      switch (strtolower($scheme)) {
876        case "urn":
877        case "data":
878          $uri = '/uri-res/N2L?'.urlencode($scheme.':'.$body);
879          break;
880        case "news":
881          if (!preg_match('"^//"', $body)) {
882            $uri = "../../".addslashes($file_article).'/junk/%3C'.$nbody.'%3E';
883          } else {
884            $uri = $scheme.':'.$body;
885          }
886          break;
887        case "mid":
888          $nbody = preg_replace('"/.*$"', "", $body);
889          $uri = "../../".addslashes($file_article).'/junk/%3C'.$nbody.'%3E';
890          break;
891        default:
892          $uri = $scheme.':'.$body;
893          break;
894      }
895      $uri = $uri . $fragment;
896      if (!empty($uri)) {
897        $uri = '<a href="'.$uri.'">'.$scheme.':'.$body.$fragment.'</a>';
898      }
899      return $uri;
900    }
901    
902    
903    
# Line 938  function interpretOverviewLine($zeile,$o Line 961  function interpretOverviewLine($zeile,$o
961        $article->subject=$subject;        $article->subject=$subject;
962      }      }
963      if ($overviewfmt[$i]=="Date:") {      if ($overviewfmt[$i]=="Date:") {
964        $article->date=getTimestamp($over[$i+1]);        $article->date = strtotime($over[$i+1]);
965      }      }
966      if ($overviewfmt[$i]=="From:") {      if ($overviewfmt[$i]=="From:") {
967        $fromline=address_decode(headerDecode($over[$i+1]),"nirgendwo");        $fromline=address_decode(headerDecode($over[$i+1]),"nirgendwo");
# Line 1527  function show_header($head,$group) { Line 1550  function show_header($head,$group) {
1550        if ((isset($article_show[$fields[$i]])) && ($article_show[$fields[$i]])) {        if ((isset($article_show[$fields[$i]])) && ($article_show[$fields[$i]])) {
1551          echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">"          echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">"
1552              .$text_header[$fields[$i]]."</span> <span class=\"body\">"              .$text_header[$fields[$i]]."</span> <span class=\"body\">"
1553              .htmlspecialchars(decode_structured_body(              .uri_to_link(htmlspecialchars(decode_structured_body(
1554                                  join(', ', $head->field[$fields[$i]])))                                  join(', ', $head->field[$fields[$i]]))))
1555              ."</span></div>\n";              ."</span></div>\n";
1556        }        }
1557      }      }
# Line 1540  function show_header($head,$group) { Line 1563  function show_header($head,$group) {
1563          for ($j = 0; $j > count($head->field[$fields[$i]]); $j++) {          for ($j = 0; $j > count($head->field[$fields[$i]]); $j++) {
1564            echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">"            echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">"
1565                .$text_header[$fields[$i]]."</span> <span class=\"body\">"                .$text_header[$fields[$i]]."</span> <span class=\"body\">"
1566                .htmlspecialchars(decode_unstructured_body(                .uri_to_link(htmlspecialchars(decode_unstructured_body(
1567                                             $head->field[$fields[$i]][$j]))                                             $head->field[$fields[$i]][$j])))
1568                ."</span></div>\n";                ."</span></div>\n";
1569          }          }
1570        }        }
# Line 1613  function show_article($group,$id,$attach Line 1636  function show_article($group,$id,$attach
1636  //        }  //        }
1637  //      echo $body[$i]."\n";  //      echo $body[$i]."\n";
1638          $b=$body[$i];          $b=$body[$i];
1639          echo html_parse(htmlspecialchars($b)."\n", $group, $msgidregex);          echo uri_to_link(htmlspecialchars($b)."\n", $group, $msgidregex);
1640        }        }
1641        echo "\n</pre>\n";        echo "\n</pre>\n";
1642      } else {      } else {

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24