Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKartik Thakore <thakore.kartik@gmail.com>2010-07-21 15:56:38 (GMT)
committer Kartik Thakore <thakore.kartik@gmail.com>2010-07-21 15:56:38 (GMT)
commit498d07c753a42b14e7b619dd2b39b6f81c4a4ba9 (patch)
treeb82e95dbc7a3afc672c86067e9db0c4f9295cafc
parent5ebea803c7a333b20f0906c00180120cdafb494a (diff)
Added reverse option to text.pl. It was quicker to do in perl then js
-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);