/[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.33 by wakaba, Sun Dec 2 05:07:42 2001 UTC
# Line 451  function headerDecode($value) { Line 451  function headerDecode($value) {
451    }    }
452  }  }
453    
 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;  
 }  
454    
455  function parse_header($hdr,$number="") {  function parse_header($hdr,$number="") {
456    for ($i=count($hdr)-1; $i>0; $i--)    for ($i=count($hdr)-1; $i>0; $i--)
# Line 539  function parse_header($hdr,$number="") { Line 520  function parse_header($hdr,$number="") {
520            $header->references[]=trim($ref);            $header->references[]=trim($ref);
521            break;            break;
522          case "date":          case "date":
523            $header->date=getTimestamp(trim($value));            $header->date = strtotime(trim($value));
524            break;            break;
525          case "followup-to":          case "followup-to":
526            $header->followup=trim($value);            $header->followup=trim($value);
# Line 875  function html_parse($comment, $group = " Line 856  function html_parse($comment, $group = "
856    return($comment);    return($comment);
857  }  }
858    
859    function uri_to_link($comment, $group = "", $msgidregex = "") {
860      global $frame_externallink;
861      global $file_article;
862      $comment = preg_replace (
863         '"((?:https?|mailto|urn|news|ftp|irc|mid|data|nntp|gother)):((?:[-_.!~*\'()A-Z0-9:;@=+$,%?/]+|&)+)(#(?:[-_.!~*\'()A-Z0-9;/?:@&=+$,%]+|&)+)?"ie',
864         'uri_to_link_uri("\1", "\2", "\3")',
865      $comment);
866      return($comment);
867    }
868    
869    function uri_to_link_uri ($scheme, $body, $fragment) {
870      global $file_article;
871      switch (strtolower($scheme)) {
872        case "urn":
873        case "data":
874          $uri = '/uri-res/N2L?'.urlencode($scheme.':'.$body);
875          break;
876        case "news":
877          if (!preg_match('"^//"', $body)) {
878            $uri = "../../".addslashes($file_article).'/junk/%3C'.$nbody.'%3E';
879          } else {
880            $uri = $scheme.':'.$body;
881          }
882          break;
883        case "mid":
884          $nbody = preg_replace('"/.*$"', "", $body);
885          $uri = "../../".addslashes($file_article).'/junk/%3C'.$nbody.'%3E';
886          break;
887        default:
888          $uri = $scheme.':'.$body;
889          break;
890      }
891      $uri = $uri . $fragment;
892      if (!empty($uri)) {
893        $uri = '<a href="'.$uri.'">'.$scheme.':'.$body.$fragment.'</a>';
894      }
895      return $uri;
896    }
897    
898    
899    
# Line 938  function interpretOverviewLine($zeile,$o Line 957  function interpretOverviewLine($zeile,$o
957        $article->subject=$subject;        $article->subject=$subject;
958      }      }
959      if ($overviewfmt[$i]=="Date:") {      if ($overviewfmt[$i]=="Date:") {
960        $article->date=getTimestamp($over[$i+1]);        $article->date = strtotime($over[$i+1]);
961      }      }
962      if ($overviewfmt[$i]=="From:") {      if ($overviewfmt[$i]=="From:") {
963        $fromline=address_decode(headerDecode($over[$i+1]),"nirgendwo");        $fromline=address_decode(headerDecode($over[$i+1]),"nirgendwo");
# Line 1527  function show_header($head,$group) { Line 1546  function show_header($head,$group) {
1546        if ((isset($article_show[$fields[$i]])) && ($article_show[$fields[$i]])) {        if ((isset($article_show[$fields[$i]])) && ($article_show[$fields[$i]])) {
1547          echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">"          echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">"
1548              .$text_header[$fields[$i]]."</span> <span class=\"body\">"              .$text_header[$fields[$i]]."</span> <span class=\"body\">"
1549              .htmlspecialchars(decode_structured_body(              .uri_to_link(htmlspecialchars(decode_structured_body(
1550                                  join(', ', $head->field[$fields[$i]])))                                  join(', ', $head->field[$fields[$i]]))))
1551              ."</span></div>\n";              ."</span></div>\n";
1552        }        }
1553      }      }
# Line 1540  function show_header($head,$group) { Line 1559  function show_header($head,$group) {
1559          for ($j = 0; $j > count($head->field[$fields[$i]]); $j++) {          for ($j = 0; $j > count($head->field[$fields[$i]]); $j++) {
1560            echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">"            echo "<div class=\"field ".$fields[$i]."\"><span class=\"name\">"
1561                .$text_header[$fields[$i]]."</span> <span class=\"body\">"                .$text_header[$fields[$i]]."</span> <span class=\"body\">"
1562                .htmlspecialchars(decode_unstructured_body(                .uri_to_link(htmlspecialchars(decode_unstructured_body(
1563                                             $head->field[$fields[$i]][$j]))                                             $head->field[$fields[$i]][$j])))
1564                ."</span></div>\n";                ."</span></div>\n";
1565          }          }
1566        }        }
# Line 1613  function show_article($group,$id,$attach Line 1632  function show_article($group,$id,$attach
1632  //        }  //        }
1633  //      echo $body[$i]."\n";  //      echo $body[$i]."\n";
1634          $b=$body[$i];          $b=$body[$i];
1635          echo html_parse(htmlspecialchars($b)."\n", $group, $msgidregex);          echo uri_to_link(htmlspecialchars($b)."\n", $group, $msgidregex);
1636        }        }
1637        echo "\n</pre>\n";        echo "\n</pre>\n";
1638      } else {      } else {

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24