summaryrefslogtreecommitdiffstats
path: root/staticweb
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-07-03 14:50:54 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-07-03 14:50:54 +0800
commitb28691c2d7446e6194f180573c954dff0b55ed6c (patch)
treec3dfd59a31f4473f9f1fda812f426c714b5a3701 /staticweb
parent2934f2e18f04ee139dd12ff9bfaa924f948ffa55 (diff)
downloadpttbbs-b28691c2d7446e6194f180573c954dff0b55ed6c.tar
pttbbs-b28691c2d7446e6194f180573c954dff0b55ed6c.tar.gz
pttbbs-b28691c2d7446e6194f180573c954dff0b55ed6c.tar.bz2
pttbbs-b28691c2d7446e6194f180573c954dff0b55ed6c.tar.lz
pttbbs-b28691c2d7446e6194f180573c954dff0b55ed6c.tar.xz
pttbbs-b28691c2d7446e6194f180573c954dff0b55ed6c.tar.zst
pttbbs-b28691c2d7446e6194f180573c954dff0b55ed6c.zip
*** empty log message ***
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@1004 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'staticweb')
-rwxr-xr-xstaticweb/man.pl67
-rwxr-xr-xstaticweb/manbuilder.pl11
2 files changed, 76 insertions, 2 deletions
diff --git a/staticweb/man.pl b/staticweb/man.pl
new file mode 100755
index 00000000..307108c7
--- /dev/null
+++ b/staticweb/man.pl
@@ -0,0 +1,67 @@
+#!/usr/bin/perl
+# $Id: man.pl,v 1.1 2003/07/03 06:49:23 in2 Exp $
+use CGI qw/:standard/;
+use lib qw/./;
+use LocalVars;
+use DB_File;
+use strict;
+use Data::Dumper;
+use Date::Calc qw(:all);
+use Template;
+use HTML::Calendar::Simple;
+use OurNet::FuzzyIndex;
+use Data::Serializer;
+use vars qw/%db $brdname $fpath/;
+
+sub main
+{
+ my($tmpl, $rh);
+
+ if( !(($brdname, $fpath) = $ENV{PATH_INFO} =~ m|^/([\w\-]+?)(/.*)|) ||
+ !(tie %db, 'DB_File',
+ "$MANDATA/$brdname.db", O_RDONLY, 0666, $DB_HASH) ){
+ return redirect("/man.pl/$1/")
+ if( $ENV{PATH_INFO} =~ m|^/([\w\-]+?)$| );
+ print header(-status => 404);
+ return;
+ }
+
+ charset('');
+ print header();
+
+ $rh = (($fpath =~ m|/$|) ? dirmode($fpath) : articlemode($fpath));
+ $tmpl = Template->new({INCLUDE_PATH => '.',
+ ABSOLUTE => 0,
+ RELATIVE => 0,
+ RECURSION => 0,
+ EVAL_PERL => 0});
+ $tmpl->process($rh->{tmpl}, $rh);
+}
+
+sub dirmode
+{
+ my(%th);
+ my $serial = Data::Serializer->new(serializer => 'Storable',
+ digester => 'MD5',
+ compress => 0,
+ );
+ foreach( @{$serial->deserialize($db{$fpath})} ){
+ push @{$th{dat}}, {isdir => (($_->[0] =~ m|/$|) ? 1 : 0),
+ fn => "/man.pl/$brdname$_->[0]",
+ title => $_->[1]};
+ }
+
+ $th{tmpl} = 'dir.html';
+ return \%th;
+}
+
+sub articlemode
+{
+ my(%th);
+ $th{tmpl} = 'article.html';
+ $th{content} = $db{$fpath};
+ return \%th;
+}
+
+main();
+1;
diff --git a/staticweb/manbuilder.pl b/staticweb/manbuilder.pl
index ecb0972e..3ae5b22a 100755
--- a/staticweb/manbuilder.pl
+++ b/staticweb/manbuilder.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $Id: manbuilder.pl,v 1.1 2003/07/03 05:49:45 in2 Exp $
+# $Id: manbuilder.pl,v 1.2 2003/07/03 06:50:54 in2 Exp $
use lib '/home/bbs/bin/';
use strict;
use OurNet::FuzzyIndex;
@@ -43,7 +43,14 @@ sub build($$)
}
else{
push @tdir, ["$doffset/$fn", $bfh{"$_.title"}];
- $db{"$doffset/$fn"} = $bfh{"$_.content"};
+ my $c = $bfh{"$_.content"};
+ $c =~ s/\</&lt;/gs;
+ $c =~ s/\>/&gt;/gs;
+ $c =~ s/\"/&quot;/gs;
+ $c =~ s/\'/&apos;/gs;
+ $c =~ s/ /&nbsp;/gs;
+ $c =~ s/\n/<br \/>\n/gs;
+ $db{"$doffset/$fn"} = $c;
}
}
$db{"$doffset/"} = $serial->serialize(\@tdir);