summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoryorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b>2008-05-01 08:44:25 +0000
committeryorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b>2008-05-01 08:44:25 +0000
commit59f6e2061ab2c19a626813e99b59d416f730180c (patch)
treedc080dd22ce4578cb9b9b893cf74ea9ccb53bba1 /lib
parent2e533bd16346ec74216415c01a57c7276d608cf8 (diff)
Another batch of changes... see the ChangeLog!
git-svn-id: svn://vndb.org/vndb@10 1fe2e327-d9db-4752-bcf7-ef0cb4a1748b
Diffstat (limited to 'lib')
-rw-r--r--lib/ChangeLog13
-rw-r--r--lib/Multi/IRC.pm20
-rw-r--r--lib/Multi/RG.pm4
-rw-r--r--lib/Multi/Sitemap.pm8
-rw-r--r--lib/VNDB.pm7
-rw-r--r--lib/VNDB/HomePages.pm34
-rw-r--r--lib/VNDB/Util/DB.pm2
-rw-r--r--lib/VNDB/Util/Response.pm34
8 files changed, 56 insertions, 66 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 3e325ccd..5cc2c5a4 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -10,14 +10,19 @@ TODO:
uploaded or not
+ Use AniDB's daily title dump and implement a search feature to add
anime relations without having to visit AniDB.
+ + Clear up style.css (or wait until the new layout is ready...)
1.15 - ?
- Relation graph now also updated on VN title change
- Anime relations
- - [js] Position of the dropdown box is now relative to the link element, not
- the cursor
- - Used inline-block instead of block for icon image sprites (to avoid stupid
- float hacks)
+ - [js] Position of the dropdown box is now relative to the link element
+ - Used inline-block for icon image sprites (to avoid stupid float hacks)
+ - Used icons to indicate the release status type on VN pages
+ - Give a 'not logged in' dropdown edit box when the user isn't logged in
+ - Fixed the redirects for old URLs
+ - Designed a better system to handle documentation
+ - Created a centralised system for site errors within the same layout
+ - Wrote some more documentation
1.14 - 2008-04-26
- Removed the ID gap prevention method
diff --git a/lib/Multi/IRC.pm b/lib/Multi/IRC.pm
index 4643a8fb..b8f6d44b 100644
--- a/lib/Multi/IRC.pm
+++ b/lib/Multi/IRC.pm
@@ -157,23 +157,3 @@ sub shutdown {
1;
-
-__END__
-
-# debug
-sub _default {
- my($event,$args) = @_[ ARG0 .. $#_ ];
- my $arg_number = 0;
- for (@$args) {
- print " ARG$arg_number = ";
- if ( ref($_) eq 'ARRAY' ) {
- print "$_ = [", join ( ", ", @$_ ), "]\n";
- }
- else {
- print "'".($_||'')."'\n";
- }
- $arg_number++;
- }
- return 0;
-}
-
diff --git a/lib/Multi/RG.pm b/lib/Multi/RG.pm
index 4931ef96..b32fedba 100644
--- a/lib/Multi/RG.pm
+++ b/lib/Multi/RG.pm
@@ -34,8 +34,8 @@ sub _start {
$_[KERNEL]->alias_set('rg');
$_[KERNEL]->call(core => register => qr/^relgraph ((?:[0-9]+)(?:\s+[0-9]+)*|all)$/, 'cmd_relgraph');
- # regenerate all relation graphs twice a month (every 1st and 15nd day at 03:00)
- $_[KERNEL]->post(core => addcron => '0 3 1,15 * *', 'relgraph all');
+ # regenerate all relation graphs once a month
+ $_[KERNEL]->post(core => addcron => '0 3 1 * *', 'relgraph all');
}
diff --git a/lib/Multi/Sitemap.pm b/lib/Multi/Sitemap.pm
index 24981910..991244fd 100644
--- a/lib/Multi/Sitemap.pm
+++ b/lib/Multi/Sitemap.pm
@@ -88,8 +88,8 @@ sub vnpages {
|);
$q->execute;
while(local $_ = $q->fetchrow_arrayref) {
- $_[KERNEL]->call(sitemap => addurl => 'v/'.$_->[0], 'w', $_->[1], 0.7);
- $_[KERNEL]->call(sitemap => addurl => 'v/'.$_->[0].'/rg', 'w', $_->[1], 0.7) if $_->[2];
+ $_[KERNEL]->call(sitemap => addurl => 'v'.$_->[0], 'w', $_->[1], 0.7);
+ $_[KERNEL]->call(sitemap => addurl => 'v'.$_->[0].'/rg', 'w', $_->[1], 0.7) if $_->[2];
}
$_[KERNEL]->yield('releasepages');
@@ -107,7 +107,7 @@ sub releasepages {
|);
$q->execute;
while(local $_ = $q->fetchrow_arrayref) {
- $_[KERNEL]->call(sitemap => addurl => 'r/'.$_->[0], 'w', $_->[1], 0.3);
+ $_[KERNEL]->call(sitemap => addurl => 'r'.$_->[0], 'w', $_->[1], 0.3);
}
$_[KERNEL]->yield('producerpages');
@@ -125,7 +125,7 @@ sub producerpages {
|);
$q->execute;
while(local $_ = $q->fetchrow_arrayref) {
- $_[KERNEL]->call(sitemap => addurl => 'p/'.$_->[0], 'w', $_->[1]);
+ $_[KERNEL]->call(sitemap => addurl => 'p'.$_->[0], 'w', $_->[1]);
}
$_[KERNEL]->yield('finish');
diff --git a/lib/VNDB.pm b/lib/VNDB.pm
index ffec7881..2632a358 100644
--- a/lib/VNDB.pm
+++ b/lib/VNDB.pm
@@ -30,6 +30,7 @@ our %VNDBopts = (
],
imgpath => '/www/vndb/static/cv',
mappath => '/www/vndb/data/rg',
+ docpath => '/www/vndb/data/docs',
);
$VNDBopts{ranks}[0][1] = { (map{$_,1} map { keys %{$VNDBopts{ranks}[$_]} } 1..5) };
@@ -52,9 +53,8 @@ use VNDB::VN;
my %VNDBuris = ( # wildcards: * -> (.+), + -> ([0-9]+)
'/' => sub { shift->HomePage },
- faq => sub { shift->FAQ },
'd+' => sub { shift->DocPage(shift) },
- nospam => sub { shift->DocPage(6) },
+ nospam => sub { shift->ResAddTpl(error => { err => 'formerr' }) },
hist => {'*'=> sub { shift->History(undef, undef, $_[1]) } },
# users
u => {
@@ -127,6 +127,7 @@ my %VNDBuris = ( # wildcards: * -> (.+), + -> ([0-9]+)
# provide redirects for old URIs
my %OLDuris = (
+ faq => sub { shift->ResRedirect('/d6', 'perm') },
vn => {
rss => sub { shift->ResRedirect('/hist/rss?t=v&e=1', 'perm') },
'*' => sub { shift->ResRedirect('/v/'.$_[1], 'perm') },
@@ -194,7 +195,7 @@ sub checkuri {
my @ouri = @uri; # items in @uri can be modified by uri2page
$self->uri2page(\%VNDBuris, \@uri, 0);
$self->uri2page(\%OLDuris, \@ouri, 0) # provide redirects for old uris
- if $self->{_Res}->{whattouse} == 4 && $self->{_Res}->{rc} == 404;
+ if $self->{_Res}->{code} == 404;
}
diff --git a/lib/VNDB/HomePages.pm b/lib/VNDB/HomePages.pm
index eb0f9e0b..0e99f517 100644
--- a/lib/VNDB/HomePages.pm
+++ b/lib/VNDB/HomePages.pm
@@ -7,7 +7,7 @@ use Exporter 'import';
use vars ('$VERSION', '@EXPORT');
$VERSION = $VNDB::VERSION;
-@EXPORT = qw| HomePage FAQ DocPage History HistRevert HistDelete |;
+@EXPORT = qw| HomePage DocPage History HistRevert HistDelete |;
sub HomePage {
@@ -31,12 +31,34 @@ sub HomePage {
}
-sub FAQ {
- shift->ResAddTpl(faq => {});
-}
-
sub DocPage {
- shift->ResAddTpl(docs => { p => shift });
+ my($s,$p) = @_;
+
+ open my $F, '<', sprintf('%s/%d', $s->{docpath}, $p) or return $s->ResNotFound();
+ my @c = <$F>;
+ close $F;
+
+ (my $title = shift @c) =~ s/^:TITLE://;
+ chomp $title;
+
+ my $sec = 0;
+ for (@c) {
+ s{^:SUB:(.+)\r?\n$}{
+ $sec++;
+ qq|<h3><a href="#$sec" name="$sec">$sec. $1</a></h3>\n|
+ }eg;
+ s{^:INC:(.+)\r?\n$}{
+ open $F, '<', sprintf('%s/%s', $s->{docpath}, $1) or die $!;
+ my $ii = join('', <$F>);
+ close $F;
+ $ii;
+ }eg;
+ }
+
+ $s->ResAddTpl(docs => {
+ title => $title,
+ content => join('', @c),
+ });
}
diff --git a/lib/VNDB/Util/DB.pm b/lib/VNDB/Util/DB.pm
index f10f7b67..e5eba14f 100644
--- a/lib/VNDB/Util/DB.pm
+++ b/lib/VNDB/Util/DB.pm
@@ -1274,7 +1274,7 @@ sub qs { # ISO SQL2-quoting, with some PgSQL-specific stuff
# depends on the standard_conforming_strings configuration option of PgSQL,
# while E'' will always behave the same regardless of the server configuration.
for (@r) {
- (!defined $_ or $_ eq '_NULL_') && ($_ = 'NULL') && next;
+ (!defined $_ or $_ eq '_NULL_') && next;
s/'/''/g;
s/\\/\\\\/g;
$_ = "E'$_'";
diff --git a/lib/VNDB/Util/Response.pm b/lib/VNDB/Util/Response.pm
index 619429ae..8d3f33b8 100644
--- a/lib/VNDB/Util/Response.pm
+++ b/lib/VNDB/Util/Response.pm
@@ -13,7 +13,7 @@ require bytes;
use vars ('$VERSION', '@EXPORT');
$VERSION = $NTL::VERSION;
-@EXPORT = qw| ResRedirect ResNotFound ResDown ResDenied ResFile
+@EXPORT = qw| ResRedirect ResNotFound ResDenied ResFile
ResForceBody ResSetContentType ResAddHeader ResAddTpl ResAddDefaultStuff
ResStartXML ResGetXML ResGetBody ResGet ResGetCGI ResSetModPerl |;
@@ -31,7 +31,6 @@ sub new {
xmlobj => undef,
xmldata => undef,
whattouse => 1,
- rc => 0,
}, $type;
return $me;
@@ -54,40 +53,23 @@ sub ResRedirect {
my $code = !$type ? 301 :
$type eq 'temp' ? 307 :
$type eq 'post' ? 303 : 301;
+ $info->{body} = 'Redirecting...';
$info->{code} = $code;
- $info->{tpl} = {
- error => {
- url => $url,
- code => $code,
- }
- };
$info->{headers} = [ 'Location', "$self->{root_url}$url" ];
$info->{contenttype} = 'text/html; charset=UTF-8';
- $info->{whattouse} = 2;
+ $info->{whattouse} = 1;
}
sub ResNotFound {
my $s = shift;
my $i = $s->{_Res};
$i->{code} = 404;
- $i->{whattouse} = 4;
- push @{$i->{headers}}, 'X-Sendfile' => '/www/vndb/www/files/notfound.html';
-}
-
-sub ResDown {
- my $self = shift;
- my $msg = shift || '';
- my $info = $self->{_Res} || $self;
-
- $info->{code} = 200;
- $info->{tpl} = {
- error => {
- code => 1,
- msg => $msg, # specifies which message should be displayed
- }
+ $i->{whattouse} = 2;
+ $i->{tpl} = {
+ page => { error => {
+ err => 'notfound'
+ }},
};
- $info->{contenttype} = 'text/html; charset=UTF-8';
- $info->{whattouse} = 2;
}
sub ResDenied {