Fix some Perl deprecation warnings. Patches from xim.
[pr0n] / perl / Sesse / pr0n / Select.pm
index 781c59899786d2c3b20d97cedf40b6763bd88790..53dc8a019d7695eee5e6fe83b682302800c7f338 100644 (file)
@@ -23,14 +23,18 @@ sub handler {
                local $dbh->{AutoCommit} = 0;
                local $dbh->{RaiseError} = 1;
 
-               # 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);
+               my $selected = $apr->param('selected');
+               my $sql_selected = 'f';
+               if (!defined($selected) || $selected eq '1') {
+                       $sql_selected = 't';
+               }
+               $dbh->do('UPDATE images SET selected=? WHERE vhost=? AND event=? AND filename=?', undef, $sql_selected, $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)
+       $dbh->do('UPDATE last_picture_cache SET last_update=CURRENT_TIMESTAMP WHERE vhost=? AND event=?', undef, $r->get_server_name, $event)
                or dberror($r, "Cache invalidation failed");
-
+       Sesse::pr0n::Common::purge_cache($r, "/$event/");
        Sesse::pr0n::Common::footer($r);
 
        return Apache2::Const::OK;