summaryrefslogtreecommitdiffstats
path: root/staticweb
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-07-05 13:19:18 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-07-05 13:19:18 +0800
commit1880cc2f73e5094ee203416552493f783ed24258 (patch)
treefe1647f60a5ae72a864a30ddc5b98eec6d4cf4ce /staticweb
parent8a1cf189dd04d506d835a9d19e7cdc13c38929e2 (diff)
downloadpttbbs-1880cc2f73e5094ee203416552493f783ed24258.tar
pttbbs-1880cc2f73e5094ee203416552493f783ed24258.tar.gz
pttbbs-1880cc2f73e5094ee203416552493f783ed24258.tar.bz2
pttbbs-1880cc2f73e5094ee203416552493f783ed24258.tar.lz
pttbbs-1880cc2f73e5094ee203416552493f783ed24258.tar.xz
pttbbs-1880cc2f73e5094ee203416552493f783ed24258.tar.zst
pttbbs-1880cc2f73e5094ee203416552493f783ed24258.zip
gb support
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@1022 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'staticweb')
-rw-r--r--staticweb/article.html8
-rw-r--r--staticweb/dir.html20
-rw-r--r--staticweb/header.html8
-rw-r--r--staticweb/index.html10
-rwxr-xr-xstaticweb/index.pl16
-rwxr-xr-xstaticweb/man.pl33
6 files changed, 61 insertions, 34 deletions
diff --git a/staticweb/article.html b/staticweb/article.html
index 706626a0..0d7d3e57 100644
--- a/staticweb/article.html
+++ b/staticweb/article.html
@@ -1,7 +1,7 @@
[% INCLUDE header.html %]
<table width="75%" align="center"><tr><td>
-狾: <a href="/man.pl/[% brdname %]/">[% brdname %]</a><br />
-<a href="."></a><br />
+[% IF gb %]看板[% ELSE %]狾[% END %]: <a href="/man.pl/[% brdname %]/[% IF gb %]?gb=1[% END %]">[% brdname %]</a><br />
+<a href="./[% IF gb %]?gb=1[% END %]">[% IF gb %]回上页[% ELSE %][% END %]</a><br />
<hr />
</tr></td><tr><td>
<font size=+2><pre>
@@ -9,8 +9,8 @@
</pre></font>
</td></tr><tr><td>
<hr>
-<a href="."></a><br />
-<a href="telnet://ptt.cc">у金金龟穨</a> (<a href="http://ptt.cc">PttWeb</a>)
+<a href="./[% IF gb %]?gb=1[% END %]">[% IF gb %]回上页[% ELSE %][% END %]</a><br />
+<a href="telnet://ptt.cc">[% IF gb %]批踢踢实业坊[% ELSE %]у金金龟穨[% END %]</a> (<a href="http://ptt.cc">PttWeb</a>)
</td></tr>
</table>
diff --git a/staticweb/dir.html b/staticweb/dir.html
index a70d9a04..6b626a93 100644
--- a/staticweb/dir.html
+++ b/staticweb/dir.html
@@ -4,39 +4,39 @@
<td>
<div id="banner">
<h1><a href="http://blog.ptt.cc/blog.pl/ptt/"
- accesskey="1">у金金龟穨</a></h1>
+ accesskey="1">[% IF gb %]批踢踢实业坊[% ELSE %]у金金龟穨[% END %]</a></h1>
</div>
</td></tr>
<tr><td>
-<a href="http://man.ptt.cc">呼弘地跋</a>
-<a href="http://man.ptt.cc/man.pl/[% brdname %]/">[% brdname %]弘地跋</a>
-<a href="http://blog.ptt.cc">у金金场辅</a>
+<a href="http://man.ptt.cc/[% IF gb %]?gb=1[% END %]">[% IF gb %]网页版精华区首页[% ELSE %]呼弘地跋[% END %]</a>
+<a href="http://man.ptt.cc/man.pl/[% brdname %]/[% IF gb %]?gb=1[% END %]">[% brdname %][% IF gb %]精华区首页[% ELSE %]弘地跋[% END %]</a>
+<a href="http://blog.ptt.cc">[% IF gb %]批踢踢部落格(big5 only)[% ELSE %]у金金场辅[% END %]</a>
<br />
-<font size=+1>狾嘿: <a href="/man.pl/[% brdname %]/">[% brdname %]</a></font>
+<font size=+1>[% IF gb %]看板名称[% ELSE %]狾嘿[% END %]: <a href="/man.pl/[% brdname %]/">[% brdname %]</a></font>
<hr />
</td></tr>
<tr><td>
[% IF !isroot %]
-<a href="../"><img src="http://images.ptt.cc/folder.gif" style="border:0;" />糷</a><br />
+<a href="../[% IF gb %]?gb=1[% END %]"><img src="http://images.ptt.cc/folder.gif" style="border:0;" />[% IF gb %]返回上一层[% ELSE %]糷[% END %]</a><br />
[% END %]
[% FOREACH x=dat %]
-<a href="[% x.fn %]">
<img src="http://images.ptt.cc/[% IF x.isdir %]folder.gif[% ELSE %]f.gif[% END %]" style="border:0;" />
+<a href="/[% x.fn %][% IF gb %]?gb=1[% END %]">
[% x.title %]</a><br />
[% END %]
</td></tr>
<tr><td>
<hr />
<form method="POST" action="/man.pl/[% brdname %]/">
-硂弘地跋ず陆
+[% IF gb %]在这个精华区内翻弄[% ELSE %]硂弘地跋ず陆[% END %]
<input type="text" name="key">
-<input type="submit" value="即">
+<input type="submit" value="[% IF gb %]捞[% ELSE %]即[% END %]">
</form>
<hr />
-<a href="telnet://ptt.cc">у金金龟穨</a> (<a href="http://ptt.cc">PttWeb</a>)
+<a href="telnet://ptt.cc">[% IF gb %]批踢踢实业坊[% ELSE %]у金金龟穨[% END %]</a> (<a href="http://ptt.cc">PttWeb</a>)
</td></tr>
</table>
</body>
diff --git a/staticweb/header.html b/staticweb/header.html
index 465e9ff7..7f33ab66 100644
--- a/staticweb/header.html
+++ b/staticweb/header.html
@@ -1,13 +1,13 @@
-<?xml version="1.0" encoding="Big5"?>
+<?xml version="1.0" encoding="[% encoding %]"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
- xml:lang="zh_TW" lang="zh_TW">
+ xml:lang="[% lang %]" lang="[% lang %]">
<head>
- <title>у金金龟穨</title>
+ <title>[% IF gb %]批踢踢实业坊[% ELSE %]у金金龟穨[% END %]</title>
<meta http-equiv="Content-Type"
- content="text/html; charset=big5" />
+ content="text/html; charset=[% charset %]">
<meta name="generator" content="pttMan" />
<meta name="robots" content="all" />
<link rel="stylesheet" href="/styles.css" type="text/css" />
diff --git a/staticweb/index.html b/staticweb/index.html
index d0722654..a9f37606 100644
--- a/staticweb/index.html
+++ b/staticweb/index.html
@@ -4,22 +4,22 @@
<td>
<div id="banner">
<h1><a href="http://blog.ptt.cc/blog.pl/ptt/"
- accesskey="1">у金金龟穨</a></h1>
+ accesskey="1">[% IF gb %]批踢踢实业坊[% ELSE %]у金金龟穨[% END %]</a></h1>
</div>
</td></tr>
<tr><td>
-у金金龟穨ぇ弘地跋(experimental)<br />
-ヘ玡矗ㄑ弘地跋戈:<br />
+[% IF gb %]批踢踢实业坊之精华区[% ELSE %]у金金龟穨ぇ弘地跋[% END %](experimental)<br />
+[% IF gb %]目前提供下列精华区资料[% ELSE %]ヘ玡矗ㄑ弘地跋戈[% END %]:<br />
<br />
[% FOREACH x=dat %]
-<a href="/man.pl/[% x.brdname %]/">[% x.brdname %]</a><br />
+<a href="/man.pl/[% x.brdname %]/[% IF gb %]?gb=1[% END %]">[% x.brdname %]</a><br />
[% END %]
</td></tr>
<tr><td>
<hr />
-<a href="telnet://ptt.cc">у金金龟穨</a> (<a href="http://ptt.cc">PttWeb</a>)
+<a href="telnet://ptt.cc">[% IF gb %]批踢踢实业坊[% ELSE %]у金金龟穨[% END %]</a> (<a href="http://ptt.cc">PttWeb</a>)
</td></tr>
</table>
</body>
diff --git a/staticweb/index.pl b/staticweb/index.pl
index 2fcd7e30..71ad6117 100755
--- a/staticweb/index.pl
+++ b/staticweb/index.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $Id: index.pl,v 1.2 2003/07/04 05:59:05 in2 Exp $
+# $Id: index.pl,v 1.3 2003/07/05 05:19:18 in2 Exp $
use lib qw/./;
use LocalVars;
use CGI qw/:standard/;
@@ -10,8 +10,18 @@ sub main
{
my($tmpl, %rh);
- print redirect("/man.pl/$1/")
- if( $ENV{REDIRECT_REQUEST_URI} =~ m|/\?(.*)| );
+ if( param('gb') ){
+ $rh{gb} = 1;
+ $rh{encoding} = 'gb2312';
+ $rh{lang} = 'zh_CN';
+ $rh{charset} = 'gb2312'; }
+ else{
+ print redirect("/man.pl/$1/")
+ if( $ENV{REDIRECT_REQUEST_URI} =~ m|/\?(.*)| );
+ $rh{encoding} = 'Big5';
+ $rh{lang} = 'zh_TW';
+ $rh{charset} = 'big5';
+ }
charset('');
print header();
diff --git a/staticweb/man.pl b/staticweb/man.pl
index 28d21ae0..0baa69be 100755
--- a/staticweb/man.pl
+++ b/staticweb/man.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $Id: man.pl,v 1.4 2003/07/04 05:58:45 in2 Exp $
+# $Id: man.pl,v 1.5 2003/07/05 05:19:18 in2 Exp $
use CGI qw/:standard/;
use lib qw/./;
use LocalVars;
@@ -11,7 +11,8 @@ use Template;
use HTML::Calendar::Simple;
use OurNet::FuzzyIndex;
use Data::Serializer;
-use vars qw/%db $brdname $fpath/;
+use Encode;
+use vars qw/%db $brdname $fpath $isgb/;
sub main
{
@@ -26,6 +27,7 @@ sub main
return;
}
+ $isgb = (param('gb') ? 1 : 0);
charset('');
print header();
@@ -41,21 +43,34 @@ sub main
RELATIVE => 0,
RECURSION => 0,
EVAL_PERL => 0,
- COMPILE_EXT => '.tmpl',
- COMPILE_DIR => $MANCACHE});
+# COMPILE_EXT => '.tmpl',
+# COMPILE_DIR => $MANCACHE,
+ });
+ if( $rh->{gb} = $isgb ){
+ $rh->{encoding} = 'gb2312';
+ $rh->{lang} = 'zh_CN';
+ $rh->{charset} = 'gb2312';
+ }
+ else{
+ $rh->{encoding} = 'Big5';
+ $rh->{lang} = 'zh_TW';
+ $rh->{charset} = 'big5';
+ }
$tmpl->process($rh->{tmpl}, $rh);
}
sub dirmode
{
- my(%th);
+ my(%th, $isdir);
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]",
+ Encode::from_to($_->[1], 'big5', 'gb2312') if( $isgb );
+ $isdir = (($_->[0] =~ m|/$|) ? 1 : 0);
+ push @{$th{dat}}, {isdir => $isdir,
+ fn => "man.pl/$brdname$_->[0]",
title => $_->[1]};
}
@@ -71,7 +86,7 @@ sub articlemode
$th{content} = $db{$fpath};
$th{content} =~ s/\033\[.*?m//g;
- $th{content} =~ s|(http://[\w\-\.\:\/\,@]+)|<a href="$1">$1</a>|gs;
+ $th{content} =~ s|(http://[\w\-\.\:\/\,@\?=]+)|<a href="$1">$1</a>|gs;
$th{content} =~ s|(ftp://[\w\-\.\:\/\,@]+)|<a href="$1">$1</a>|gs;
$th{content} =~
s|у金金ㄟ|<a href="http://blog.ptt2.cc">у金金ㄟ</a>|gs;
@@ -81,6 +96,8 @@ sub articlemode
s|ptt\.csie\.ntu\.edu\.tw|<a href="telnet://ptt.csie.ntu.edu.tw">ptt.csie.ntu.edu.tw</a>|gs;
$th{content} =~
s|ptt\.twbbs\.org|<a href="telnet://ptt.csie.ntu.edu.tw">ptt.twbbs.org</a>|gs;
+
+ Encode::from_to($th{content}, 'big5', 'gb2312') if( $isgb );
return \%th;
}