📄 reply_tree.cgi
字号:
#!/usr/bin/perl
#############################################################
# Replyes Tree for LB5000
#
# Writed by RoyRoy http://www.LeoHacks.com
# Version Beta 1.5 Build 0306
#
# Require LB5000 Ver:all version of MX,XP
#
# -LB5000 Support Web Site
# http://www.CGIer.com/ CGI 编程者之家
# http://www.LeoBoard.com/ 雷傲论坛支持主页
# http://www.leoBBS.com/ 本论坛直通车
# http://www.LeoHacks.com/ 官方LeoBoard Hacks开发站点
# http://www.hennlong.idv.tw/leo/ 官方繁体版雷傲论坛
#
#############################################################
BEGIN {
$LBPATH = '.';
my $pgm = $0;
$pgm =~s/\\/\//g;
$pgm =~s/^.*\/([^\/]+)$/$1/g;
unless (-e $LBPATH.'/'.$pgm) {
foreach ($0, $ENV{'SCRIPT_FILENAME'}, $ENV{'PATH_TRANSLATED'}) {
s!\\!/!g; s/^(.*)\/[^\/]+$/$1/g;
if (-e $_ . '/' .$pgm) { $LBPATH = $_; last; }
}
}
unshift (@INC, "$LBPATH");
}
use LBCGI;
$LBCGI::POST_MAX=10000;
$LBCGI::DISABLE_UPLOADS = 1;
$LBCGI::HEADERS_ONCE = 1;
require "data/boardinfo.cgi";
require "data/styles.cgi";
require "lb.lib.pl";
$|++;
$query = new LBCGI;
#Cookie 路径
if ($COOKIE_USED eq 1) {$cookiepath ="";}
else {
$boardurltemp =$boardurl;
$boardurltemp =~ s/http\:\/\/(\S+?)\/(.*)/\/$2/;
$cookiepath = $boardurltemp;
$cookiepath =~ s/\/$//;
# $cookiepath =~ tr/A-Z/a-z/;
}
$treeviewnum = 15 if ($treeviewnum <=0);
$maxshow = $treeviewnum;
#封杀 IP
&ipbanned;
#取得论坛及主题编号
$inforum = int($query -> param('forum'));
$intopic = int($query -> param('topic'));
&ERROROUT("老大,别乱黑我的程序呀!") if (($inforum !~ /^[0-9]+$/)||($intopic !~ /^[0-9]+$/));
if (-e "${lbdir}data/style${inforum}.cgi") { require "${lbdir}data/style${inforum}.cgi"; }
$screenmode = $query->cookie("screenmode");
$screenmode = 8 if ($screenmode eq "");
$addtimes = ($timedifferencevalue + $timezone)*3600;
#取出主題 ID
$id_of_this_topid = sprintf("%04d%05d",$inforum,$intopic);
#用户资料
$inmembername = $query->cookie("amembernamecookie");
$inpassword = $query->cookie("apasswordcookie");
$userregistered = "no";
&ERROROUT("老大,别乱黑我的程序呀!") if (($inmembername =~ m/\//)||($inmembername =~ m/\\/)||($inmembername =~ m/\.\./));
unless ((!$inmembername) or ($inmembername eq "客人")) {
&getmembernolock("$inmembername");
$mymembercode=$membercode;
$myrating=$rating;
&ERROROUT("密码与用户名不相符,请重新登录!") if ($inpassword ne $password);
}
&ERROROUT("会员专用功能,请先登陆!") if ($userregistered eq "no");
#取得分论坛资料
&getoneforum("$inforum");
$testentry = cookie("forumsallowed$inforum");
if (((($testentry ne $forumpass)||($testentry eq ""))&&($privateforum eq "yes"))||(($startnewthreads eq "cert")&&($membercode eq "me")&&($userincert eq "no"))) {
&ERROROUT("你不允许进入该论坛!") if(($membercode ne "ad")&&($membercode ne 'smo')&&($inmembmod ne "yes"));
}
#初始化内容,回覆数
my($OUTPUT_TABLE,$REPLY_COUNT);
$REPLY_COUNT = 0;
$addtimes = ($timedifferencevalue + $timezone)*3600;
#读取内容
$file_of_this_topic = "$lbdir" . "forum$inforum/$intopic.thd.cgi";
open(FILE, "$file_of_this_topic") or &ERROROUT("这个主题不存在!可能已经被删除!");
@threads = <FILE>;
close(FILE);
chomp @threads;
#取得文章总数
$TREPLY_COUNT = @threads;
#取出主题文章
shift @threads;
&ERROROUT("本主题没有任何回复。") unless(@threads);
if (($screenmode >=8)||($tablewidth > 770)) { $topictitlemax = 90; } else { $topictitlemax = 42; }
#取得输出内容
foreach (@threads){
my @postdata = split(/\t/,$_);
#更新回覆数
$REPLY_COUNT++;
$OUTPUT_TABLE .= "//No.$REPLY_COUNT\n";
$OUTPUT_TABLE .= &OUTPUT_TABLE($postdata[0], $postdata[5], $postdata[6], $postdata[7]);
if($REPLY_COUNT >= $maxshow){
$OUTPUT_TABLE .= "//End\n";
$OUTPUT_TABLE .= qq(parent.followTd$id_of_this_topid.innerHTML+='<DIV style="BORDER-RIGHT: black 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: black 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; MARGIN-LEFT: 18px; BORDER-LEFT: black 1px solid; WIDTH: 240px; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: black 1px solid; BACKGROUND-COLOR: lightyellow;text-align:center">[ <a href="topic.cgi?forum=$inforum&topic=$intopic&start=$maxshow" target="_blank">其余回复请点击进入查看</a> ]</DIV>';);
last;
}
}
OUTPUT_TREE($boardname,$OUTPUT_TABLE,0);
#输出显示
sub OUTPUT_TABLE{
#取得内容,回覆者
my ($OUTPUT_NAME, $OUTPUT_TIME, $OUTPUT_MSG, $OUTPUT_ICON) = @_;
#处理文章内容
$OUTPUT_TIME = &dateformat($OUTPUT_TIME + $addtimes);
if (($dofilter eq "no")||($dofilter eq "all")) {
$OUTPUT_MSG = &postwordfilter("$OUTPUT_MSG");
}
if (($OUTPUT_MSG =~ /LBHIDDEN\[(.*?)\]LBHIDDEN/)||($OUTPUT_MSG =~ /LBSALE\[(.*?)\]LBSALE/)) {
$OUTPUT_MSG = "保密";
} else {
$OUTPUT_MSG =~ s/\[quote\](.*)\[quote\](.*)\[\/quote](.*)\[\/quote\]//isg;
$OUTPUT_MSG =~ s/\[quote\](.*)\[\/quote\]//isg;
$OUTPUT_MSG =~ s/\[hidepoll\]//isg;
$OUTPUT_MSG =~ s/\[这个(.+?)最后由(.+?)编辑\]\n//isg;
$OUTPUT_MSG =~ s/\[hide\](.*)\[hide\](.*)\[\/hide](.*)\[\/hide\]//isg;
$OUTPUT_MSG =~ s/\[hide\](.*)\[\/hide\]//isg;
$OUTPUT_MSG =~ s/\[post=(.+?)\](.+?)\[\/post\](.*)\[post=(.+?)\](.+?)\[\/post\]//isg;
$OUTPUT_MSG =~ s/\[post=(.+?)\](.+?)\[\/post\]//isg;
$OUTPUT_MSG = &temppost("$OUTPUT_MSG");
}
if (length($OUTPUT_MSG)>=$topictitlemax) {
$OUTPUT_MSG=&lbhz($OUTPUT_MSG,$topictitlemax);
}
$OUTPUT_MSG = "(无内容)" unless($OUTPUT_MSG ne "");
#初始化输出内容
my $OUTPUT_TABLE;
#处理连结值
my $START=0;my $SID=$REPLY_COUNT+1;
if($REPLY_COUNT > 12){
my ($crelyid,undef)=split(/\./,($REPLY_COUNT/12));
$START=$crelyid*12;
}
$SID="bottom" if($SID eq $TREPLY_COUNT);
if (($OUTPUT_ICON eq "")||($OUTPUT_ICON =~ /\<br\>/i)) {
$OUTPUT_ICON = int(rand(23));
$OUTPUT_ICON = "0$OUTPUT_ICON" if ($OUTPUT_ICON<10);
$OUTPUT_ICON = "$OUTPUT_ICON.gif";
}
$OUTPUT_ICON = qq~<img src=$imagesurl/posticons/$OUTPUT_ICON>~;
#输出内容表格
$OUTPUT_TABLE .= qq~<span style="width:100%"><span style="width:68%"> $OUTPUT_ICON <a href="topic.cgi?forum=$inforum&topic=$intopic&start=$START#$SID" target="_blank">$OUTPUT_MSG</a></span><span style="width:16%">[ <span style="cursor:hand" onClick="javascript:O9('~ . ($uri_escape eq "no" ? $OUTPUT_NAME : uri_escape($OUTPUT_NAME)) . qq~')">$OUTPUT_NAME</span> ]</span><span style="width:14%">$OUTPUT_TIME</span>~;
#处理输出内容
$OUTPUT_TABLE =~ s/\n//g;
$OUTPUT_TABLE =~ s/\'/\\\'/g;
return "parent.followTd$id_of_this_topid.innerHTML+='".$OUTPUT_TABLE."';\n";
}
#错误显示
sub ERROROUT{
#取得错误讯息
my $ERROR_MSG = shift;
#初始化内容
my $OUTPUT_TABLE;
#内容表格
$OUTPUT_TABLE .= qq(<DIV style="BORDER-RIGHT: black 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: black 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; MARGIN-LEFT: 18px; BORDER-LEFT: black 1px solid; WIDTH: 240px; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: black 1px solid; BACKGROUND-COLOR: lightyellow;cursor:hand" onclick="loadThreadFollow($inforum,$intopic,'$id_of_this_topid')">$ERROR_MSG</DIV>);
#处理内容
$OUTPUT_TABLE =~ s/\n//g;
$OUTPUT_TABLE =~ s/\'/\\\'/g;
&OUTPUT_TREE($boardname,"parent.followTd$id_of_this_topid.innerHTML+='".$OUTPUT_TABLE."';",1);
}
#输出
sub OUTPUT_TREE{
#標題,內容
my ($title,$output,$err) = @_;
chomp $output;
# unless($err){
#$output =qq(//表格開始
#parent.followTd$id_of_this_topid.innerHTML+='<table><tbody>';
#$output
#//表格結束
#parent.followTd$id_of_this_topid.innerHTML+='</tbody></table>';);
# }
#输出档头
print header(-charset=>gb2312);
#输出内容
print <<"HTML";
<html>
<head>
<title>$title - 文章树</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<SCRIPT>
<!--
//初始化回覆内容值
parent.followTd$id_of_this_topid.innerHTML='';
$output
//已读取
parent.document.images.followImg$id_of_this_topid.loaded='yes';
-->
</SCRIPT>
</body>
</html>
HTML
exit;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -