summaryrefslogtreecommitdiffstats
path: root/staticweb/index.pl
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-02-19 14:57:12 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-02-19 14:57:12 +0800
commite09e51ba692403a5bf119847dadef4296898b8ad (patch)
tree17229d3b6c498bd9c75412866a3fbc28b32aa231 /staticweb/index.pl
parentaf4fcde1441db15ab1365ef724196d3351a050b9 (diff)
downloadpttbbs-e09e51ba692403a5bf119847dadef4296898b8ad.tar
pttbbs-e09e51ba692403a5bf119847dadef4296898b8ad.tar.gz
pttbbs-e09e51ba692403a5bf119847dadef4296898b8ad.tar.bz2
pttbbs-e09e51ba692403a5bf119847dadef4296898b8ad.tar.lz
pttbbs-e09e51ba692403a5bf119847dadef4296898b8ad.tar.xz
pttbbs-e09e51ba692403a5bf119847dadef4296898b8ad.tar.zst
pttbbs-e09e51ba692403a5bf119847dadef4296898b8ad.zip
use boardlist.db
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1544 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'staticweb/index.pl')
-rwxr-xr-xstaticweb/index.pl31
1 files changed, 25 insertions, 6 deletions
diff --git a/staticweb/index.pl b/staticweb/index.pl
index 25bd0359..e6d647ba 100755
--- a/staticweb/index.pl
+++ b/staticweb/index.pl
@@ -5,12 +5,24 @@ use LocalVars;
use CGI qw/:standard/;
use strict;
use Template;
-use boardlist;
+#use boardlist;
use b2g;
+use DB_File;
+use Data::Serializer;
+
+sub deserialize
+{
+ my($what) = @_;
+ my $obj = Data::Serializer->new(serializer => 'Storable',
+ digester => 'MD5',
+ compress => 0,
+ );
+ return $obj->deserialize($what);
+}
sub main
{
- my($tmpl, %rh, $bid);
+ my($tmpl, %rh, $bid, %brd);
if( param('gb') ){
$rh{gb} = 1;
@@ -30,19 +42,25 @@ sub main
charset('');
print header();
+ tie %brd, 'DB_File', 'boardlist.db', O_RDONLY, 0666, $DB_HASH;
($bid) = $ENV{PATH_INFO} =~ m|.*/(\d+)/$|;
$bid ||= 0;
$rh{isroot} = ($bid == 0);
- if( !$brd{$bid} ){
+ if( !exists $brd{"class.$bid"} ){
print "sorry, this bid $bid not found :(";
return ;
}
- foreach( @{$brd{$bid}} ){
- next if( $_->[0] == -1 && ! -e "$MANDATA/$_->[1].db" );
- push @{$rh{dat}}, $_;
+ foreach( @{deserialize($brd{"class.$bid"})} ){
+ next if( $brd{"$_.isboard"} &&
+ !-e "$MANDATA/".$brd{"tobrdname.$_"}.'.db' );
+
+ push @{$rh{dat}}, [$brd{"$_.isboard"} ? -1 : $_,
+ $brd{"$_.brdname"},
+ $brd{"$_.title"},
+ ];
}
my $path = '';
@@ -71,6 +89,7 @@ sub main
b2g::big5togb($output);
print $output;
}
+ untie %brd;
}
main();