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-21 15:58:29 (GMT)
committer Moritz Lenz <moritz@faui2k3.org>2010-07-21 15:58:29 (GMT)
commit5aa99e918e93ae93a202ff112582b2ec32f6d71a (patch)
treeb82e95dbc7a3afc672c86067e9db0c4f9295cafc
parent5ebea803c7a333b20f0906c00180120cdafb494a (diff)
parent498d07c753a42b14e7b619dd2b39b6f81c4a4ba9 (diff)
Merge remote branch 'origin/reverse'
-rwxr-xr-xcgi/text.pl12
1 files changed, 10 insertions, 2 deletions
diff --git a/cgi/text.pl b/cgi/text.pl
index 14346ec..83b567a 100755
--- a/cgi/text.pl
+++ b/cgi/text.pl
@@ -21,14 +21,22 @@ my $q = new CGI;
my $dbh = get_dbh();
my $channel = $q->param('channel') || $default_channel;
+my $reverse = $q->param('reverse') || 0;
+
my $date = $q->param('date') || gmt_today;
if ($channel !~ m/^\w+(?:-\w+)*\z/sx){
# guard against channel=../../../etc/passwd or so
confess 'Invalid channel name';
}
-my $db = $dbh->prepare('SELECT nick, timestamp, line FROM irclog '
- . 'WHERE day = ? AND channel = ? AND NOT spam ORDER BY id');
+
+#Check for reverse
+my $statement = 'SELECT nick, timestamp, line FROM irclog '
+ . 'WHERE day = ? AND channel = ? AND NOT spam ORDER BY id';
+
+$statement .= ' DESC' if $reverse;
+
+my $db = $dbh->prepare($statement);
$db->execute($date, '#' . $channel);