/[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 25 by dpavlin, Sat May 8 16:06:58 2004 UTC revision 27 by dpavlin, Sat May 8 20:34:26 2004 UTC
# Line 17  use Data::Dumper; Line 17  use Data::Dumper;
17    
18  my $debug = 1;  my $debug = 1;
19    
20    my $config_file = shift @ARGV || 'global.conf';
21    
22    if (! -f $config_file) {
23            print qq{Usage: $0 [/path/to/local.conf]
24    
25    If local.conf is not specified, global.conf in current directory will
26    be used.
27    };
28            exit 1;
29    }
30    
31  my $d = HTTP::Daemon->new( Reuse => 1, LocalPort => 6969 ) || die;  my $d = HTTP::Daemon->new( Reuse => 1, LocalPort => 6969 ) || die;
32  my $cgi = new CGI::Lite;  my $cgi = new CGI::Lite;
33  my $mws = MWS->new('global.conf');  my $mws = MWS->new($config_file);
34  my $tt = Template->new({  my $tt = Template->new({
35          INCLUDE_PATH => $mws->{config}->val('global', 'templates'),          INCLUDE_PATH => $mws->{config}->val('global', 'templates'),
36          FILTERS => {          FILTERS => {
# Line 123  while ( my $c = $d->accept ) { Line 134  while ( my $c = $d->accept ) {
134                          date_limit => $date_limit,                          date_limit => $date_limit,
135                  };                  };
136    
137                  #                  # is this access to root of web server?
138                    if ($url eq "/" && !$param->{'search'}) {
139                            # if first access, go to current year
140                            $date_limit = $mws->fmtdate($yyyy);
141                            $param->{sort} = "date desc";
142                    }
143    
144                  # ?show_id=XXXXxxxx___message_id___xxxxXXXX                  # ?show_id=XXXXxxxx___message_id___xxxxXXXX
145                  if ($param->{'show_id'}) {                  if ($param->{'show_id'}) {
146    
# Line 135  while ( my $c = $d->accept ) { Line 152  while ( my $c = $d->accept ) {
152                          # show search results                          # show search results
153                          # ?search=foo:bar                          # ?search=foo:bar
154    
155                          my @search = ( $param->{'search'} );                          my @search;
156                            push @search, $param->{'search'} if ($param->{'search'});
157    
158                          if ($date_limit) {                          if ($date_limit) {
159                                  push @search, "and" if (@search);                                  push @search, "and" if (@search);

Legend:
Removed from v.25  
changed lines
  Added in v.27

  ViewVC Help
Powered by ViewVC 1.1.26