📄 rebuildlist.pl
字号:
#############################################################
# LeoBoard ver.5000 / LB5000 / 雷傲超级论坛 ver.5000
#
# 版权所有: 雷傲工作室(原蓝宝石软件工作室)
#
# 制作人 : 山鹰糊 (Shining Hu)
# 花无缺 (Ifairy Han)
#
# 主页地址: http://www.CGIer.com/ CGI 编程者之家
# http://www.LeoBoard.com/ 雷傲论坛支持主页
# http://www.leoBBS.com/ 本论坛直通车
#
#############################################################
sub rebuildLIST {
my %IN = ( -Forum => "", @_, );
undef @sortdat;
opendir (DIR, "${lbdir}forum$IN{-Forum}");
my @dirdata = readdir(DIR);
closedir (DIR);
@dirdata = grep(/\.thd\.cgi$/,@dirdata);
foreach (@dirdata) {
(my $id, my $tr) = split(/\./,$_);
my $rr = &readthreadpl($IN{-Forum},$id);
push (@sortdat, $rr) if ($rr ne "");
}
undef @dirdata;
@sortdat = sort({$a<=>$b}@sortdat);
@sortdat = reverse(@sortdat);
my $allposts = 0;
my $allthreads = 0;
my $file = "$lbdir" . "boarddata/list$IN{-Forum}.cgi";
&winlock($file) if (($OS_USED eq "Nt")||($OS_USED eq "Unix"));
if (open (LIST, ">$file")) {
flock (LIST, 2) if ($OS_USED eq "Unix");
foreach (@sortdat) {
chomp $_;
$_ =~ s/[\a\f\n\e\0\r]//isg;
(my $lastpostdate, my $topicid, my $topictitle, my $topicdescription, my $threadstate, my $threadposts, my $threadviews, my $startedby, my $startedpostdate, my $lastposter, my $posticon, my $posttemp) = split (/\t/,$_);
next if (($topicid !~ /^[0-9]+$/)||($topictitle eq ""));
if (($posticon =~ m/<br>/i)&&($threadstate ne "poll")&&($threadstate ne "pollclosed")) { $threadstate = "poll"; }
else { $threadstate="open" if ($threadstate eq ""); }
if ($allthreads < 250) {
print LIST "$topicid\t$topictitle\t$topicdescription\t$threadstate\t$threadposts\t$threadviews\t$startedby\t$startedpostdate\t$lastposter\t$lastpostdate\t$posticon\t$posttemp\t\n";
}
else {
print LIST "$topicid\t$topictitle\t\t$threadstate\t\t$threadviews\t$startedby\t\t\t$lastpostdate\t\n";
}
$allposts = $allposts + $threadposts;
$allthreads ++ ;
}
close (LIST);
}
&winunlock($file) if (($OS_USED eq "Nt")||($OS_USED eq "Unix"));
return ("$allthreads|$allposts");
}
sub readthreadpl {
my($inforum,$id) = @_;
open (PLFILE, "${lbdir}forum$inforum/$id.pl");
my $topicinfo = <PLFILE>;
close (PLFILE);
chomp $topicinfo;
$topicinfo =~ s/[\a\f\n\e\0\r]//isg;
(my $topicid, my $topictitle, my $topicdescription, my $threadstate, my $threadposts, my $threadviews, my $startedby, my $startedpostdate, my $lastposter, my $lastpostdate, my $posticon, my $inposttemp) = split (/\t/,$topicinfo);
if (($topictitle eq "")||($startedby eq "")||($startedpostdate eq "")||($threadposts eq "")||($threadposts > 1000000)){
open (THDFILE, "${lbdir}forum$inforum/$id.thd.cgi");
my @topicall = <THDFILE>;
close (THDFILE);
my $topicall = @topicall;
my $postfirst = $topicall[0];
$postfirst =~ s/[\a\f\n\e\0\r]//isg;
my $postlast = $topicall[-1];
$postlast =~ s/[\a\f\n\e\0\r]//isg;
(my $membername1, my $topictitle1, my $postipaddress1, my $showemoticons1, my $showsignature1, my $postdate1, my $post1, my $posticon1) = split(/\t/,$postfirst);
(my $membername2, my $topictitle2, my $postipaddress2, my $showemoticons2, my $showsignature2, my $postdate2, my $post2, my $posticon2) = split(/\t/,$postlast);
$topictitle1 =~ s/^*#!&*//;
if ($topictitle1 eq "") { $topictitle1 = $topictitle2; $topictitle1 =~ s/^*#!&*//; }
$threadviews = ($topicall+1) * 8 if ($threadviews eq "");
$membername2 = "" if ($topicall eq 0);
$post2 = "(保密)" if ($post2=~/LBHIDDEN\[(.*?)\]LBHIDDEN/sg);
$post2 = &temppost($post2);
$post2 = &lbhz($post2,28);
chomp $posticon1;
$posticon1 =~ s/\s//isg;
if ($posticon1 =~/<br>/i) {
$posticon1 =~ s/<br>/\t/ig;
my @temppoll = split(/\t/, $posticon1);
if ($#temppoll >= 1) { $posticon1 = "<br>"; } else { $posticon1 = ""; }
}
else { $posticon1 = $posticon2 if ($sortposticonshow eq "yes"); }
if (($posticon =~ m/<br>/i)&&($threadstate ne "poll")&&($threadstate ne "pollclosed")) { $threadstate = "poll"; }
else { $threadstate="open" if ($threadstate eq ""); }
if ($topictitle1 eq "") { return ""; }
else {
if (($dofilter eq "yes")||($dofilter eq "all")) {
my $temp = &postwordfilter("$topictitle1\t$topicdescription\t$post2");
($topictitle1,$topicdescription,$post2) = split(/\t/,$temp);
}
my $line = "$postdate2\t$id\t$topictitle1\t$topicdescription\t$threadstate\t$topicall\t$threadviews\t$membername1\t$postdate1\t$membername2\t$posticon1\t$post2\t";
$line =~ s/[\a\f\n\e\0\r]//isg;
return ("$line");
}
}
else {
$topictitle =~ s/^*#!&*//;
$posticon =~ s/\s//isg;
if ($posticon =~/<br>/i) { $posticon = "<br>"; }
$threadviews = ($threadposts+1) * 8 if ($threadviews eq "");
# $threadviews = 9999 if ($threadviews > 9999);
if ($topictitle eq "") { return ""; }
else {
if (($dofilter eq "yes")||($dofilter eq "all")) {
my $temp = &postwordfilter("$topictitle\t$topicdescription\t$inposttemp");
($topictitle,$topicdescription,$inposttemp) = split(/\t/,$temp);
}
my $line = "$lastpostdate\t$id\t$topictitle\t$topicdescription\t$threadstate\t$threadposts\t$threadviews\t$startedby\t$startedpostdate\t$lastposter\t$posticon\t$inposttemp\t";
$line =~ s/[\a\f\n\e\0\r]//isg;
return ("$line");
}
}
}
1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -