if ($model eq '') {
# no defined model
- $where .= " AND id NOT IN ( SELECT image FROM exif_info WHERE key='Model' AND TRIM(value)<>'' )";
+ $where .= " AND model IS NULL";
} else {
- $where .= " AND id IN ( SELECT image FROM exif_info WHERE key='Model' AND TRIM(value)=$mq )";
+ $where .= " AND model=$mq";
}
- # This doesn't match 1:1 if there's both lens and lensspec, but it should be OK in practice
if ($lens eq '') {
# no defined lens
- $where .= " AND id NOT IN ( SELECT image FROM exif_info WHERE (key='Lens' OR key='LensSpec') AND TRIM(value)<>'' )";
+ $where .= " AND lens IS NULL";
} else {
- $where .= " AND id IN ( SELECT image FROM exif_info WHERE (key='Lens' OR key='LensSpec') AND TRIM(value)=$lq )";
+ $where .= " AND lens=$lq";
}
}
if (defined($author)) {
my $returnurl = "http://" . $r->get_server_name . "/" . $event . "/" .
Sesse::pr0n::Common::get_query_string(\%settings_no_fullscreen, \%defsettings);
+
+ my %settings_bookmark = %settings;
+ $settings_bookmark{'start'} = $defsettings{'start'};
+ my $bookmark_url_base = "http://" . $r->get_server_name . "/" . $event . "/" .
+ Sesse::pr0n::Common::get_query_string(\%settings_bookmark, \%defsettings);
+
+ if ($bookmark_url_base =~ /\?/) {
+ $bookmark_url_base .= ';start=';
+ } else {
+ $bookmark_url_base .= '?start=';
+ }
# *whistle*
$returnurl =~ s/&/&/g;
+ $bookmark_url_base =~ s/&/&/g;
Sesse::pr0n::Templates::print_template($r, "fullscreen-footer", {
vhost => $r->get_server_name,
start => $settings{'start'} - 1,
returnurl => $returnurl,
+ bookmarkurlbase => $bookmark_url_base,
sel => $settings{'sel'},
infobox => $infobox
});
if (1 || $event ne '+all') {
# Find the equipment used
my $eq = $dbh->prepare("
- SELECT
- TRIM(model.value) AS model,
- coalesce(TRIM(lens_spec.value), TRIM(lens.value)) AS lens,
+ SELECT
+ model,
+ lens,
COUNT(*) AS num
- FROM ( SELECT * FROM images WHERE vhost=? $where ) i
- LEFT JOIN exif_info model ON i.id=model.image
- LEFT JOIN ( SELECT * FROM exif_info WHERE key='Lens' ) lens ON i.id=lens.image
- LEFT JOIN ( SELECT * FROM exif_info WHERE key='LensSpec') lens_spec ON i.id=lens_spec.image
- WHERE model.key='Model'
+ FROM images
+ WHERE vhost=? $where
GROUP BY 1,2
ORDER BY 1,2")
or die "Couldn't prepare to find equipment: $!";