Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoritz Lenz <moritz@faui2k3.org>2010-07-18 19:58:35 (GMT)
committer Moritz Lenz <moritz@faui2k3.org>2010-07-18 19:58:35 (GMT)
commit5ebea803c7a333b20f0906c00180120cdafb494a (patch)
tree8ae56eb97ed76aa0bb675794092fffddd31661cc
parenta801de51fa4760f631d1a0d33bc8fce1dbb2032c (diff)
implement "yesterday" in URLs
-rw-r--r--cgi/.htaccess3
-rwxr-xr-xcgi/out.pl3
2 files changed, 6 insertions, 0 deletions
diff --git a/cgi/.htaccess b/cgi/.htaccess
index 089baac..56e94fd 100644
--- a/cgi/.htaccess
+++ b/cgi/.htaccess
@@ -16,6 +16,9 @@ RewriteRule ^([\w_-]+)/?$ /channel-index.pl?channel=$1 [L]
RewriteCond %{HTTP_REQUEST} !^search
RewriteRule ^([^/]+)/today$ out.pl?channel=$1
+RewriteCond %{HTTP_REQUEST} !^search
+RewriteRule ^([^/]+)/yesterday$ out.pl?channel=$1;date=yesterday
+
RewriteCond %{QUERY_STRING} ^channel=([^;]+);date=(\d\d\d\d-\d\d-\d\d)
RewriteCond %{HTTP_REQUEST} ^out\.pl
RewriteRule ^out.pl /%1/%2? [R=301,L]
diff --git a/cgi/out.pl b/cgi/out.pl
index 2c9a732..ba79a82 100755
--- a/cgi/out.pl
+++ b/cgi/out.pl
@@ -60,7 +60,10 @@ my $channel = $q->param('channel') || $default_channel;
my $date = $q->param('date') || gmt_today();
if ($date eq 'today') {
$date = gmt_today();
+} elsif ($date eq 'yesterday') {
+ $date = date(gmt_today()) - 1;
}
+
if ($date eq gmt_today()) {
print http_header({ nocache => 1});
} else {