X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=perl%2FSesse%2Fpr0n%2FListing.pm;h=c8f93f249fae58c2ef8ba34ea9c093bf7e58eb5e;hp=b871e88d1451170fb8566d27f2f76a1a6a5a88a8;hb=0e78a33060a85ac0ac6aea40c55d09f77325e255;hpb=7d83b76289605efa52cf631d184093d0096383c5 diff --git a/perl/Sesse/pr0n/Listing.pm b/perl/Sesse/pr0n/Listing.pm index b871e88..c8f93f2 100644 --- a/perl/Sesse/pr0n/Listing.pm +++ b/perl/Sesse/pr0n/Listing.pm @@ -24,9 +24,9 @@ sub handler { } # find the last modification - my $ref = $dbh->selectrow_hashref('SELECT EXTRACT(EPOCH FROM last_update) AS last_update FROM events WHERE vhost=? ORDER BY last_update DESC LIMIT 1', + my $ref = $dbh->selectrow_hashref('SELECT EXTRACT(EPOCH FROM last_update) AS last_update FROM last_picture_cache WHERE vhost=? ORDER BY last_update DESC LIMIT 1', undef, $r->get_server_name) - or error($r, "Could not any events", 404, "File not found"); + or error($r, "Could not find any events", 404, "File not found"); $r->set_last_modified($ref->{'last_update'}); $r->content_type('text/html; charset=utf-8'); @@ -48,7 +48,7 @@ sub handler { my $cloud = HTML::TagCloud->new; while (my $ref = $q->fetchrow_hashref()) { - my $tag = Encode::decode_utf8($ref->{'tag'}); + my $tag = $ref->{'tag'}; my $html = HTML::Entities::encode_entities($tag); # is this right? my $uri = Sesse::pr0n::Common::pretty_escape($tag); # and this? @@ -63,7 +63,7 @@ sub handler { # main listing # my $q = $dbh->prepare('SELECT t1.id,t1.date,t1.name FROM events t1 LEFT JOIN images t2 ON t1.id=t2.event WHERE t1.vhost=? GROUP BY t1.id,t1.date,t1.name ORDER BY COALESCE(MAX(t2.date),\'1970-01-01 00:00:00\'),t1.id') or # dberror($r, "Couldn't list events"); - my $q = $dbh->prepare('SELECT event,date,name FROM events e JOIN last_picture_cache c USING (vhost,event) WHERE vhost=? ORDER BY last_picture DESC') + my $q = $dbh->prepare('SELECT event,date,name FROM events e JOIN last_picture_cache c USING (vhost,event) WHERE vhost=? ORDER BY last_picture DESC NULLS LAST') or dberror($r, "Couldn't list events"); $q->execute($r->get_server_name) or dberror($r, "Couldn't get events"); @@ -86,8 +86,8 @@ sub handler { while (my $ref = $q->fetchrow_hashref()) { my $id = $ref->{'event'}; - my $date = HTML::Entities::encode_entities(Encode::decode_utf8($ref->{'date'})); - my $name = HTML::Entities::encode_entities(Encode::decode_utf8($ref->{'name'})); + my $date = HTML::Entities::encode_entities($ref->{'date'}); + my $name = HTML::Entities::encode_entities($ref->{'name'}); $r->print("
  • $name ($date)
  • \n"); }