X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=perl%2FSesse%2Fpr0n%2FIndex.pm;h=70ac117d1eb4f2cb6d2261d351a722cadc39e75c;hp=08491bb775830224f4e99a2d281c46a0276e0853;hb=1077ff24c69b1ebf86c4b96bd86ce2d9107ee3eb;hpb=0d94c302534584de439b115a9140ceac4163fd69 diff --git a/perl/Sesse/pr0n/Index.pm b/perl/Sesse/pr0n/Index.pm index 08491bb..70ac117 100644 --- a/perl/Sesse/pr0n/Index.pm +++ b/perl/Sesse/pr0n/Index.pm @@ -77,7 +77,7 @@ sub handler { } # Any NEF files => default to processing - my $ref = $dbh->selectrow_hashref("SELECT * FROM images WHERE vhost=? $where AND LOWER(filename) LIKE '%.nef' LIMIT 1", + my $ref = $dbh->selectrow_hashref("SELECT * FROM images WHERE vhost=? $where AND ( LOWER(filename) LIKE '%.nef' OR LOWER(filename) LIKE '%.cr2' ) LIMIT 1", undef, $r->get_server_name) and $defsettings{'xres'} = $defsettings{'yres'} = undef; @@ -96,7 +96,7 @@ sub handler { if (($s eq "num" || $s eq "xres" || $s eq "yres") && defined($val) && $val == -1) { $settings{$s} = $val; } - if ($s eq "model" || $s eq "lens" || $s eq "author") { + if (($s eq "model" || $s eq "lens" || $s eq "author") && defined($val)) { $settings{$s} = Sesse::pr0n::Common::pretty_unescape($val); } } @@ -150,14 +150,14 @@ sub handler { my ($date, $name); if ($event eq '+all' || defined($tag)) { - $ref = $dbh->selectrow_hashref("SELECT EXTRACT(EPOCH FROM MAX(last_update)) AS last_update FROM events WHERE vhost=?", + $ref = $dbh->selectrow_hashref("SELECT EXTRACT(EPOCH FROM MAX(last_update)) AS last_update FROM last_picture_cache WHERE vhost=?", undef, $r->get_server_name) or error($r, "Could not list events", 404, "File not found"); $date = undef; $name = Sesse::pr0n::Templates::fetch_template($r, 'all-event-title'); $r->set_last_modified($ref->{'last_update'}); } else { - $ref = $dbh->selectrow_hashref("SELECT name,date,EXTRACT(EPOCH FROM last_update) AS last_update FROM events WHERE vhost=? AND event=?", + $ref = $dbh->selectrow_hashref("SELECT name,date,EXTRACT(EPOCH FROM last_update) AS last_update FROM events NATURAL JOIN last_picture_cache WHERE vhost=? AND event=?", undef, $r->get_server_name, $event) or error($r, "Could not find event $event", 404, "File not found");