X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=perl%2FSesse%2Fpr0n%2FCommon.pm;h=6fb5536f5911e312034042b57a1f73f379bef3b3;hb=c8fb633d012a9078990d0abc28cdd527d1362e4a;hp=8227c80db13562418ca335fc90bfd3da14bf2bd5;hpb=80109fa17438d698875f3ff6877cbd205335b2e2;p=pr0n diff --git a/perl/Sesse/pr0n/Common.pm b/perl/Sesse/pr0n/Common.pm index 8227c80..6fb5536 100644 --- a/perl/Sesse/pr0n/Common.pm +++ b/perl/Sesse/pr0n/Common.pm @@ -34,7 +34,7 @@ BEGIN { require Sesse::pr0n::Config_local; }; - $VERSION = "v2.30"; + $VERSION = "v2.40"; @ISA = qw(Exporter); @EXPORT = qw(&error &dberror); %EXPORT_TAGS = qw(); @@ -91,7 +91,7 @@ sub header { $quote = LWP::Simple::get("http://itk.samfundet.no/include/quotes.cli.php"); $quote = "Error: Could not fetch quotes." if (!defined($quote)); } - Sesse::pr0n::Templates::print_template($r, "header", { title => $title, quotes => $quote }); + Sesse::pr0n::Templates::print_template($r, "header", { title => $title, quotes => Encode::decode_utf8($quote) }); } sub footer { @@ -220,7 +220,7 @@ sub update_image_info { # update the last_picture cache as well (this should of course be done # via a trigger, but this is less complicated :-) ) - $dbh->do('UPDATE last_picture_cache SET last_picture=GREATEST(last_picture, ?) WHERE event=(SELECT event FROM images WHERE id=?)', + $dbh->do('UPDATE last_picture_cache SET last_picture=GREATEST(last_picture, ?) WHERE (vhost,event)=(SELECT vhost,event FROM images WHERE id=?)', undef, $datetime, $id) or die "Couldn't update last_picture in SQL: $!"; } @@ -444,6 +444,8 @@ sub make_infobox { my ($a, $b) = ($1, $2); my $gcd = gcd($a, $b); push @classic_fields, ($a/$gcd . "/" . $b/$gcd . "s"); + } elsif (defined($info->{'ExposureTime'}) && $info->{'ExposureTime'} =~ /^(\d+)$/) { + push @classic_fields, ($1 . "s"); } if (defined($info->{'FNumber'}) && $info->{'FNumber'} =~ /^(\d+)\/(\d+)$/) { my $f = $1/$2; @@ -571,11 +573,11 @@ sub add_new_event { return @errors; } - $dbh->do("INSERT INTO events (id,date,name,vhost) VALUES (?,?,?,?)", + $dbh->do("INSERT INTO events (event,date,name,vhost) VALUES (?,?,?,?)", undef, $id, $date, $desc, $vhost) or return ("Kunne ikke sette inn ny hendelse" . $dbh->errstr); - $dbh->do("INSERT INTO last_picture_cache (event,last_picture) VALUES (?,NULL)", - undef, $id) + $dbh->do("INSERT INTO last_picture_cache (vhost,event,last_picture) VALUES (?,?,NULL)", + undef, $vhost, $id) or return ("Kunne ikke sette inn ny cache-rad" . $dbh->errstr); return ();