/[mws]/trunk/httpd.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/httpd.pl

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

revision 6 by dpavlin, Wed May 5 13:42:27 2004 UTC revision 7 by dpavlin, Wed May 5 15:38:35 2004 UTC
# Line 69  while ( my $c = $d->accept ) { Line 69  while ( my $c = $d->accept ) {
69                  # XXX LOG                  # XXX LOG
70                  print $r->method," ",$url,Dumper($param);                  print $r->method," ",$url,Dumper($param);
71    
72                  # generate HTML                  # template file name (use ?format=html as default)
73                    my $tpl_file = 'master.';
74                    $tpl_file .= $param->{'format'} || 'html';
75    
76                    #
77                    # implement functionality and generate HTML
78                    #
79                  my $html;                  my $html;
80    
81                  my $s=$param->{'search'};                  # show search results
82                    # ?search=foo:bar
83                    if ($param->{'search'}) {
84    
85                  if ($s) {                          print STDERR "search: ",$param->{'search'},"\n";
   
                         print STDERR "search: $s\n";  
   
                         my $results = $mws->search($s);  
86    
87                            my $results = $mws->search($param->{'search'});
88                          my @res = $mws->fetch_all_results();                          my @res = $mws->fetch_all_results();
89    
                         my $tpl_file = 'master.';  
                         $tpl_file .= $param->{'format'} || 'html';  
   
90                          $tt->process($tpl_file, {                          $tt->process($tpl_file, {
91                                  query   => $s,                                  query   => $param->{'search'},
92                                  results => \@res,                                  results => \@res,
93                                  param   => $param,                                  param   => $param,
94                          }, \$html) || die $tt->error();                          }, \$html) || die $tt->error();
95    
96                    #
97                    # ?show_id=XXXXxxxx___message_id___xxxxXXXX
98                    } elsif ($param->{'show_id'}) {
99                            
100                            my $row = $mws->fetch_result_by_id($param->{'show_id'});
101                            $tt->process($tpl_file, {
102                                    message => $row,
103                            }, \$html) || die $tt->error();
104                  }                  }
105    
106                    #
107                    # send HTMLto client
108                    #
109    
110                  my $res = HTTP::Response->new(RC_OK);                  my $res = HTTP::Response->new(RC_OK);
111                  $res->header( 'Content-type' => 'text/html; charset=iso-8859-2' );                  $res->header( 'Content-type' => 'text/html; charset=iso-8859-2' );
112                  $res->content($html);                  $res->content($html);
# Line 107  while ( my $c = $d->accept ) { Line 122  while ( my $c = $d->accept ) {
122  sub body5_filter {  sub body5_filter {
123          my $text = shift;          my $text = shift;
124          $text =~ s/^\s+//gs;          $text =~ s/^\s+//gs;
125          $text =~ s/^(.*?[\n\r]+){5}.*$/$1/s;          $text =~ s/[\n\r]+[\>:\|=]+\s*.*?[\n\r]+//sg;   # remove quoted text
126            $text =~ s,^((?:.*?[\n\r]){5}).*$,$1<span style="color:#808080">--8&lt;--[cut]--8&lt;--</span>,s;
127            $text =~ s/[\n\r]+--\s*[\n\r]+.*$//s;
128          return $text;          return $text;
129  }  }
130    

Legend:
Removed from v.6  
changed lines
  Added in v.7

  ViewVC Help
Powered by ViewVC 1.1.26