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 => { |
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 |
|
|
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); |