diff options
Diffstat (limited to 'lib/VNDB/Util/Misc.pm')
-rw-r--r-- | lib/VNDB/Util/Misc.pm | 55 |
1 files changed, 52 insertions, 3 deletions
diff --git a/lib/VNDB/Util/Misc.pm b/lib/VNDB/Util/Misc.pm index 71aca7a8..9f281ee7 100644 --- a/lib/VNDB/Util/Misc.pm +++ b/lib/VNDB/Util/Misc.pm @@ -4,14 +4,15 @@ package VNDB::Util::Misc; use strict; use warnings; use Exporter 'import'; +use TUWF ':html'; use VNDB::Func; -our @EXPORT = qw|filFetchDB|; +our @EXPORT = qw|filFetchDB ieCheck|; my %filfields = ( vn => [qw|length hasani tag_inc tag_exc taginc tagexc tagspoil lang olang plat|], - release => [qw|type patch freeware doujin date_before date_after minage lang olang resolution plat med voiced ani_story ani_ero|], + release => [qw|type patch freeware doujin date_before date_after released minage lang olang resolution plat med voiced ani_story ani_ero|], ); @@ -57,7 +58,7 @@ sub filFetchDB { # throwing 500's even for non-browse pages. We have to do some low-level # PostgreSQL stuff with savepoints to ensure that an error won't affect our # existing transaction. - my $dbh = $self->{_YAWF}{DB}{sql}; + my $dbh = $self->dbh; $dbh->pg_savepoint('filter'); my($r, $np); my $OK = eval { @@ -98,3 +99,51 @@ sub _fil_vn_compat { return 0; } + +sub ieCheck { + my $self = shift; + + return 1 if !$self->reqHeader('User-Agent') || + $self->reqHeader('User-Agent') !~ /MSIE [67]/ || $self->reqCookie('ie_sucks'); + + if($self->reqGet('i-still-want-access')) { + (my $ref = $self->reqHeader('Referer') || '/') =~ s/^\Q$self->{url}//; + $self->resRedirect($ref, 'temp'); + $self->resCookie('ie_sucks' => 1); + return; + } + + html; + head; + title 'Your browser sucks'; + style type => 'text/css', + q|body { background: black }| + .q|div { position: absolute; left: 50%; top: 50%; width: 500px; margin-left: -250px; height: 180px; margin-top: -90px; background-color: #012; border: 1px solid #258; text-align: center; }| + .q|p { color: #ddd; margin: 10px; font: 9pt "Tahoma"; }| + .q|h1 { color: #258; font-size: 14pt; font-family: "Futura", "Century New Gothic", "Arial", Serif; font-weight: normal; margin: 10px 0 0 0; } | + .q|a { color: #fff }|; + end 'head'; + body; + div; + h1 'Oops, we were too lazy to support your browser!'; + p; + lit qq|We decided to stop supporting Internet Explorer 6 and 7, as it's a royal pain in | + .qq|the ass to make our site look good in a browser that doesn't want to cooperate with us.<br />| + .qq|You can try one of the following free alternatives: | + .qq|<a href="http://www.mozilla.com/firefox/">Firefox</a>, | + .qq|<a href="http://www.opera.com/">Opera</a>, | + .qq|<a href="http://www.apple.com/safari/">Safari</a>, or | + .qq|<a href="http://www.google.com/chrome">Chrome</a>.<br /><br />| + .qq|If you're really stubborn about using Internet Explorer, upgrading to version 8 will also work.<br /><br />| + .qq|...and if you're mad, you can also choose to ignore this warning and | + .qq|<a href="/?i-still-want-access=1">open the site anyway</a>.|; + end; + end; + end 'body'; + end 'html'; + return 0; +} + + +1; + |