X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=perl%2FSesse%2Fpr0n%2FSelect.pm;h=781c59899786d2c3b20d97cedf40b6763bd88790;hp=777e02b37cd3adc236f1ef7d161afc0eb0e2c4bb;hb=2a98fc654ff4ec29aa576ac5ba68fcba08682ef3;hpb=0737361d60ab3c2be28045ac522ce19722d2ffaf diff --git a/perl/Sesse/pr0n/Select.pm b/perl/Sesse/pr0n/Select.pm index 777e02b..781c598 100644 --- a/perl/Sesse/pr0n/Select.pm +++ b/perl/Sesse/pr0n/Select.pm @@ -23,27 +23,14 @@ sub handler { local $dbh->{AutoCommit} = 0; local $dbh->{RaiseError} = 1; - if (defined($apr->param('mode')) && $apr->param('mode') eq 'single') { - # single mode; enable one (FIXME: need to support disable too) - my $filename = $apr->param('filename'); - $dbh->do('UPDATE images SET selected=\'t\' WHERE event=? AND filename=?', undef, $event, $filename); - } else { - # traditional multi-mode - $dbh->do('UPDATE images SET selected=\'f\' WHERE event=?', undef, $event); - - my @params = $apr->param(); - my $key; - for $key (@params) { - if ($key =~ /^sel-(\d+)/ && $apr->param($key) eq 'on') { - my $id = $1; - my $q = $dbh->do('UPDATE images SET selected=\'t\' WHERE id=?', undef, $id) - or dberror($r, "Selection of $id failed: $!"); - $r->print("

Selected image ID `$id'.

\n"); - } - } - } + # FIXME: need to support disable too + my $filename = $apr->param('filename'); + $dbh->do('UPDATE images SET selected=\'t\' WHERE vhost=? AND event=? AND filename=?', undef, $r->get_server_name, $event, $filename); } + $dbh->do('UPDATE events SET last_update=CURRENT_TIMESTAMP WHERE vhost=? AND event=?', undef, $r->get_server_name, $event) + or dberror($r, "Cache invalidation failed"); + Sesse::pr0n::Common::footer($r); return Apache2::Const::OK;