use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
- our $dbh = DBI->connect("dbi:Pg:dbname=pr0n;host=127.0.0.1", "pr0n", "EsVdwImY")
+ our $dbh = DBI->connect("dbi:Pg:dbname=pr0n;host=" . $Sesse::pr0n::Config::db_host,
+ $Sesse::pr0n::Config::db_username, $Sesse::pr0n::Config::db_password)
-sub print_link {
- my ($r, $title, $baseurl, $param, $defparam) = @_;
- my $str = "<a href=\"$baseurl";
+sub get_query_string {
+ my ($param, $defparam) = @_;
while (my ($key, $value) = each %$param) {
next unless defined($value);
while (my ($key, $value) = each %$param) {
next unless defined($value);
-
- $str .= "\">$title</a>";
+ return $str;
+}
+
+sub print_link {
+ my ($r, $title, $baseurl, $param, $defparam) = @_;
+ my $str = "<a href=\"$baseurl" . get_query_string($param, $defparam) . "\">$title</a>";
if (!(defined($dbh) && $dbh->ping)) {
# Try to reconnect
Apache2::ServerUtil->server->log_error("Lost contact with PostgreSQL server, trying to reconnect...");
if (!(defined($dbh) && $dbh->ping)) {
# Try to reconnect
Apache2::ServerUtil->server->log_error("Lost contact with PostgreSQL server, trying to reconnect...");
- unless ($dbh = DBI->connect("dbi:Pg:dbname=pr0n;host=127.0.0.1", "pr0n", "EsVdwImY")) {
+ unless ($dbh = DBI->connect("dbi:Pg:dbname=pr0n;host=" . $Sesse::pr0n::Config::db_host,
+ $Sesse::pr0n::Config::db_user, $Sesse::pr0n::Config::db_password)) {
# update the last_picture cache as well (this should of course be done
# via a trigger, but this is less complicated :-) )
# update the last_picture cache as well (this should of course be done
# via a trigger, but this is less complicated :-) )
- $dbh->do('UPDATE events SET last_picture=(SELECT COALESCE(MAX(date),\'1970-01-01 00:00:00\') FROM images WHERE event=events.id) WHERE id=(SELECT event FROM images WHERE id=?)',
- undef, $id)
+ $dbh->do('UPDATE last_picture_cache SET last_picture=GREATEST(last_picture, ?) WHERE event=(SELECT event FROM images WHERE id=?)',
+ undef, $datetime, $id)
my ($r, $filename, $id, $dbwidth, $dbheight, $infobox, $xres, $yres, @otherres) = @_;
my $fname = get_disk_location($r, $id);
my ($r, $filename, $id, $dbwidth, $dbheight, $infobox, $xres, $yres, @otherres) = @_;
my $fname = get_disk_location($r, $id);
- if ($info->{'Flash'} =~ /did not fire/ || $info->{'Flash'} =~ /No Flash/) {
+ if ($info->{'Flash'} =~ /did not fire/i ||
+ $info->{'Flash'} =~ /no flash/i ||
+ $info->{'Flash'} =~ /not fired/i ||
+ $info->{'Flash'} =~ /Off/) {