/[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 20 by dpavlin, Fri May 7 23:35:39 2004 UTC revision 24 by dpavlin, Sat May 8 14:27:54 2004 UTC
# Line 11  use IO::String; Line 11  use IO::String;
11  use CGI::Lite;  use CGI::Lite;
12  use Template;  use Template;
13  use MWS;  use MWS;
14    use URI::Escape;
15    
16  use Data::Dumper;  use Data::Dumper;
17    
# Line 23  my $tt = Template->new({ Line 24  my $tt = Template->new({
24          INCLUDE_PATH => $mws->{config}->val('global', 'templates'),          INCLUDE_PATH => $mws->{config}->val('global', 'templates'),
25          FILTERS => {          FILTERS => {
26                  'body5' => \&body5_filter,                  'body5' => \&body5_filter,
                 'subject_search' => \&subject_search_filter,  
27          },          },
28          EVAL_PERL => 1,          EVAL_PERL => 1,
29  });  });
# Line 110  while ( my $c = $d->accept ) { Line 110  while ( my $c = $d->accept ) {
110                          yyyy    => $yyyy,                          yyyy    => $yyyy,
111                          mm      => $mm,                          mm      => $mm,
112                          dd      => $dd,                          dd      => $dd,
113                            date_limit => $date_limit,
114                  };                  };
115    
116                  if ($date_limit) {                  #
117                          $param->{'search'} .= "and " if ($param->{'search'});                  # ?show_id=XXXXxxxx___message_id___xxxxXXXX
118                          $param->{'search'} .= $date_limit;                  if ($param->{'show_id'}) {
119                  }  
120                            $mws->reset_counters;
121                            my $row = $mws->fetch_result_by_id($param->{'show_id'});
122                            $tpl_var->{message} = $row;
123                    } elsif ($param->{'search'} || $date_limit) {
124    
125                            # show search results
126                            # ?search=foo:bar
127    
128                            my @search = ( $param->{'search'} );
129    
130                            if ($date_limit) {
131                                    push @search, "and" if (@search);
132                                    push @search, "date:\"$date_limit\"";
133                            }
134    
135                  # show search results                          if ($param->{sort_by}) {
136                  # ?search=foo:bar                                  push @search, "sort:".$param->{sort_by};
137                  if ($param->{'search'}) {                          }
138    
139                          print STDERR "search: ",$param->{'search'},"\n";                          print STDERR "search: ",join(" ",@search),"\n";
140    
141                          my $results = $mws->search($param->{'search'});                          my $results = $mws->search(@search);
142                          my @res = $mws->fetch_all_results();                          my @res = $mws->fetch_all_results();
143    
144                          $tpl_var->{results} = \@res if (@res);                          $tpl_var->{results} = \@res if (@res);
145                          $tpl_var->{total_hits} = $mws->{total_hits};                          $tpl_var->{total_hits} = $mws->{total_hits};
146    
   
                 #  
                 # ?show_id=XXXXxxxx___message_id___xxxxXXXX  
                 } elsif ($param->{'show_id'}) {  
   
                         $mws->reset_counters;  
                         my $row = $mws->fetch_result_by_id($param->{'show_id'});  
                         $tpl_var->{message} = $row;  
147                  }                  }
148    
 print Dumper($mws->{counter});  
149    
150                  # push counters to template                  # push counters to template
151                  foreach my $f (qw(from to cc bcc)) {                  foreach my $f (qw(from to cc bcc)) {
# Line 190  sub body5_filter { Line 196  sub body5_filter {
196          return $text;          return $text;
197  }  }
198    
 sub subject_search_filter {  
         my $s = shift;  
         # remove re: fdw: [list] preffixes from e-mail  
         while ( $s =~ s/^\s*\[(?:re|fwd|fw):\s+(.+)\]\s*$/$1/ig ||  
                 $s =~ s/^\s*(?:re|fwd|fw):\s+(.+?)\s*$/$1/ig ||  
                 $s =~ s/^\[\S+\]\s*//ig ||  
                 $s =~ s/^\[[^@]+@\w+\.\w+\s*:\s+(.+)\s*\]\s*$/$1/g ||  
                 $s =~ s/\(fwd\)\s*$//ig ||  
                 $s =~ s/\"//g  
         ) { };  
         return $s;  
 }  

Legend:
Removed from v.20  
changed lines
  Added in v.24

  ViewVC Help
Powered by ViewVC 1.1.26