summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2008-11-20 19:58:40 +0100
committerYorhel <git@yorhel.nl>2008-11-20 19:58:40 +0100
commit416d2db0bc9a8d1d98216c27fbbd8c2f7c7a2fe6 (patch)
treeda58a1309a8cca4ef4bc8d27be0e989c64ae7992 /lib
parent36965ef4a51ebdd341e5a9e63a77e8c7bb736d6f (diff)
Proper handing of NSFW VN images
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Handler/VNPage.pm17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index 7aaf6eaf..9f8055eb 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -32,11 +32,20 @@ sub page {
# image
div class => 'vnimg';
- # TODO: check for img_nsfw and processing flag
- if($v->{image}) {
- img src => sprintf("%s/cv/%02d/%d.jpg", $self->{url_static}, $v->{image}%100, $v->{image}), alt => $v->{title};
- } else {
+ if(!$v->{image}) {
p 'No image uploaded yet';
+ } elsif($v->{image} < 0) {
+ p '[processing image, please return in a few minutes]';
+ } elsif($v->{img_nsfw} && !$self->authInfo->{show_nsfw}) {
+ img id => 'nsfw_hid', src => sprintf("%s/cv/%02d/%d.jpg", $self->{url_static}, $v->{image}%100, $v->{image}), alt => $v->{title};
+ p id => 'nsfw_show';
+ txt "This image has been flagged\nas Not Safe For Work.\n\n";
+ a href => '#', id => 'nsfw_show', 'Show me anyway';
+ txt "\n\n(This warning can be disabled in your account)";
+ end;
+ } else {
+ img src => sprintf("%s/cv/%02d/%d.jpg", $self->{url_static}, $v->{image}%100, $v->{image}), alt => $v->{title};
+ i 'Flagged as NSFW' if $v->{img_nsfw} && $self->authInfo->{show_nsfw};
}
end;