summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-06-15 20:25:20 +0200
committerYorhel <git@yorhel.nl>2009-06-15 20:25:50 +0200
commit9c917a5d7c1f55b44d6feba50e41639e798f7011 (patch)
tree0f0f20d1d7247aaa6cd76cb8e56cef72dd9a92c2 /lib
parent7db9c59dcad1cd8891f23cd7af0ead799513bfd4 (diff)
Don't show NSFW images on diff pages by default
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Handler/VNPage.pm7
-rw-r--r--lib/VNDB/Util/CommonHTML.pm4
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index fac6305b..21c0e13d 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -216,7 +216,12 @@ sub _revision {
return @r ? @r : ('[no screenshots]');
}],
[ image => 'Image', htmlize => sub {
- $_[0] > 0 ? sprintf '<img src="%s/cv/%02d/%d.jpg" />', $self->{url_static}, $_[0]%100, $_[0] : $_[0] < 0 ? '[processing]' : 'No image';
+ my $url = sprintf "%s/cv/%02d/%d.jpg", $self->{url_static}, $_[0]%100, $_[0];
+ if($_[0] > 0) {
+ return $_[1]->{img_nsfw} && !$self->authInfo->{show_nsfw} ? "<a href=\"$url\">(NSFW)</a>" : "<img src=\"$url\" />";
+ } else {
+ return $_[0] < 0 ? '[processing]' : 'No image';
+ }
}],
[ img_nsfw => 'Image NSFW', serialize => sub { $_[0] ? 'Not safe' : 'Safe' } ],
);
diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm
index 7421b1c0..8199cf20 100644
--- a/lib/VNDB/Util/CommonHTML.pm
+++ b/lib/VNDB/Util/CommonHTML.pm
@@ -317,8 +317,8 @@ sub revdiff {
$o{diff}++ if $o{split};
$o{join} ||= '';
- my $ser1 = $o{serialize} ? $o{serialize}->($old->{$short}) : $old->{$short};
- my $ser2 = $o{serialize} ? $o{serialize}->($new->{$short}) : $new->{$short};
+ my $ser1 = $o{serialize} ? $o{serialize}->($old->{$short}, $old) : $old->{$short};
+ my $ser2 = $o{serialize} ? $o{serialize}->($new->{$short}, $new) : $new->{$short};
return if $ser1 eq $ser2;
if($o{diff} && $ser1 && $ser2) {