📄 topic.cgi
字号:
#!/usr/bin/perl
#############################################################
# LeoBoard ver.5000 / LB5000 / 雷傲超级论坛 ver.5000
#
# 版权所有: 雷傲工作室(原蓝宝石软件工作室)
#
# 制作人 : 山鹰糊 (Shining Hu)
# 花无缺 (Ifairy Han)
#
# 主页地址: http://www.CGIer.com/ CGI 编程者之家
# http://www.LeoBoard.com/ 雷傲论坛支持主页
# http://www.leoBBS.com/ 本论坛直通车
#
#############################################################
BEGIN {
$start_time = (times)[0] + (times)[1];
$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=2000;
$LBCGI::DISABLE_UPLOADS = 1;
$LBCGI::HEADERS_ONCE = 1;
require "code.cgi";
require "data/boardinfo.cgi";
require "data/membertitles.cgi";
require "data/styles.cgi";
require "lb.lib.pl";
require "visitforum.lib.pl";
$|++;
#################--- Begin the program ---###################
$thisprog = "topic.cgi";
srand;
$query = new LBCGI;
if ($COOKIE_USED eq 1) {$cookiepath ="";}
else {
$boardurltemp =$boardurl;
$boardurltemp =~ s/http\:\/\/(\S+?)\/(.*)/\/$2/;
$cookiepath = $boardurltemp;
$cookiepath =~ s/\/$//;
# $cookiepath =~ tr/A-Z/a-z/;
}
$jumpto = $query -> param('jumpto'); if ($jumpto) { print redirect(-location=>"$jumpto"); exit; }
$inforum = $query -> param('forum');
$intopic = $query -> param('topic');
&error("打开文件&老大,别乱黑我的程序呀!") if (($intopic !~ /^[0-9]+$/)||($inforum !~ /^[0-9]+$/));
$instart = $query -> param('start');
$inshow = $query -> param('show');
if (-e "${lbdir}data/style${inforum}.cgi") { require "${lbdir}data/style${inforum}.cgi"; }
if ((($forumimagead eq "1")&&($useimageadtopic eq "1"))||(($forumimagead1 eq "1")&&($useimageadtopic1 eq "1"))) {
require "${lbdir}imagead.cgi";
}
$inmembername = $query->cookie("amembernamecookie");
$inpassword = $query->cookie("apasswordcookie");
$inmembername =~ s/[\a\f\n\e\0\r\t\`\~\!\@\#\$\%\^\&\*\(\)\+\=\\\{\}\;\'\:\"\,\.\/\<\>\?]//isg;
$inpassword =~ s/[\a\f\n\e\0\r\t\|\@\;\#\{\}\$]//isg;
$nodisp = $query->cookie("nodisp");
($nodispavatar, $nodispsign, $nodispphoto) = split(/\|/,$nodisp);
$treeview1 = $query -> cookie("treeview");
$treeview = $treeview1 if ($treeview1 ne "");
$treeview = "no" if ($treeview eq "");
$changemode = $query -> param('changemode');
$replynum = $query -> param('replynum');
if ($changemode ne "") { $treeview=($treeview eq "yes")?"no":"yes"; }
$screenmode = $query->cookie("screenmode");
$screenmode = 8 if ($screenmode eq "");
&ipbanned; #封杀一些 ip
$maxpoststr = "" if ($maxpoststr eq 0);
#&getforum($inforum);
if ((!$inmembername) or ($inmembername eq "客人")) { $inmembername = "客人"; $myrating= "-1"; $mymembercode="no"; }
else {
&getmember("$inmembername");
# &getmembernolock("$inmembername");
$mymembercode=$membercode;
$myrating=$rating;
&error("普通错误&密码与用户名不相符,请重新登录!") if ($inpassword ne $password);
&error("普通错误&用户没有登录或注册!") if ($userregistered eq "no");
}
$testentry = $query->cookie("forumsallowed$inforum");
&getoneforum("$inforum");
#&moderator("$inforum");
$myinmembmod = $inmembmod;
if (($allowedentry{$inforum} eq "yes")||(($testentry eq $forumpass)&&($testentry ne ""))||($membercode eq "ad")||($inmembmod eq "yes")||($membercode eq 'smo')) { $allowed = "yes"; } else { $allowed = "no"; }
&getlastvisit;
$forumlastvisit = $lastvisitinfo{$inforum};
$currenttime = time;
&setlastvisit("$inforum,$currenttime");
$addtimes = ($timedifferencevalue + $timezone)*3600;
$myrating = -6 if ($myrating eq "");
$cpudisp = 1 if (($membercode eq "ad")||($membercode eq "smo")||($membercode eq "cmo"));
if (($privateforum eq "yes" && $allowed ne "yes")) { &error("进入私有论坛&对不起,您没有权限进入该私有论坛!"); }
if (($startnewthreads eq "cert")&&(($membercode ne "ad" && $membercode ne "smo" && $membercode ne "cmo" && $membercode ne "mo" && $membercode ne "rz")||($inmembername eq "客人"))&&($userincert eq "no")) { &error("进入论坛&你一般会员不允许进入此论坛!"); }
#&forumjump; #必须在 getforum 函数后
$treeviewcookie = cookie(-name => "treeview" , -value => "$treeview", -path => "$cookiepath/" , -expires => "+30d");
print header(-cookie=>[$treeviewcookie, $tempvisitcookie, $permvisitcookie], -charset=>gb2312);
if ($forumgraphic) {
if ($forumgraphic =~ /\.swf$/i) {$forumgraphic = qq~<PARAM NAME=PLAY VALUE=TRUE><PARAM NAME=LOOP VALUE=TRUE><PARAM NAME=QUALITY VALUE=HIGH><embed src=$imagesurl/myimages/$forumgraphic quality=high width=$fgwidth height=$fgheight pluginspage="http:\/\/www.macromedia.com\/shockwave\/download\/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application\/x-shockwave-flash"><\/embed>~}
else {$forumgraphic = qq~<a href=forums.cgi?forum=$inforum><img src=$imagesurl/myimages/$forumgraphic border=0></a>~};
} else {
if ($boardlogo =~ /\.swf$/i) {$forumgraphic = qq~<PARAM NAME=PLAY VALUE=TRUE><PARAM NAME=LOOP VALUE=TRUE><PARAM NAME=QUALITY VALUE=HIGH><embed src=$imagesurl/myimages/$boardlogo quality=high width=$boardlogow height=$boardlogoh pluginspage="http:\/\/www.macromedia.com\/shockwave\/download\/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application\/x-shockwave-flash"><\/embed>~}
else {$forumgraphic = qq~<a href=forums.cgi?forum=$inforum><img src=$imagesurl/myimages/$boardlogo border=0></a>~};
}
my $filetoopen = "$lbdir" . "forum$inforum/$intopic.thd.cgi";
#&winlock($filetoopen) if ($OS_USED eq "Nt");
if (open(FILE, "$filetoopen")) {
# flock(FILE, 1) if ($OS_USED eq "Unix");
@threads = <FILE>;
close(FILE);
# &winunlock($filetoopen) if ($OS_USED eq "Nt");
$numberofitems = @threads;
}
else {
# &winunlock($filetoopen) if ($OS_USED eq "Nt");
&error("打开主题&这个主题不存在!可能已经被删除!");
}
if ($mymembercode eq "ad" or $mymembercode eq "smo" or $myinmembmod eq "yes") {
$viewhide = 1;
}
else {
$viewhide = 0;
if ($hidejf eq "yes" ) {
my @viewhide=grep(/^$inmembername\t/i,@threads);
$viewhide=@viewhide;
$viewhide=1 if($viewhide >= 1);
}
}
$StartCheck=$numberofposts+$numberofreplys;
my $filetoopen = "$lbdir" . "boarddata/list$inforum.cgi";
my $filetoopens = &lockfilename($filetoopen);
if (!(-e "$filetoopens.lck")) {#0
&winlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
open(FILE, "$filetoopen");
flock(FILE, 1) if ($OS_USED eq "Unix");
my @allthreads = <FILE>;
close(FILE);
&winunlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
$totalthreadcount = $#allthreads;
if ($totalthreadcount >= 0) {#a
my $count = 0;
@allthreadtemp = "";
my $keepno = "";
$nextno = "";
$backno = "";
foreach $line (@allthreads) { #1
chomp $line;
($tempno, $trash) = split(/\t/, $line);
if (($intopic eq $tempno)&&($keepno eq "")) { #2
($topicid, $topictitle, $topicdescription, $threadstate, $threadposts ,$threadviews, $startedby, $startedpostdate, $lastposter, $lastpostdate, $posticon, $posttemp) = split(/\t/,$line);
$keepno = $tempno;
if ($count eq 0) { $backno = ""; } else { ($backno, my $trash) = split(/\t/, $allthreads[$count-1]); }
if ($count eq $totalthreadcount) { $nextno = ""; } else { ($nextno, my $trash) = split(/\t/, $allthreads[$count+1]); }
$threadviews++;
if (($threadposts eq "")||($threadposts > 1000000)) { $threadposts = $numberofitems - 1; }
if (($topictitle eq "")||($startedby eq "")||($startedpostdate eq "")) { #3
my $postfirst = $threads[0];
$postfirst =~ s/[\a\f\n\e\0\r]//isg;
my $postlast = $threads[-1];
$postlast =~ s/[\a\f\n\e\0\r]//isg;
($startedby, $topictitle, my $no, $no, $no, $startedpostdate, $no, $posticon) = split(/\t/,$postfirst);
($lastposter, $no, $no, $no, $no, $lastpostdate, $no, $posticon1) = split(/\t/,$postlast);
chomp $posticon;
if ($posticon =~/<br>/i) { #4
$posticon=~s/<br>/\t/ig;
my @temppoll = split(/\t/, $posticon);
if ($#temppoll >= 1) { $posticon = "<br>"; } else { $posticon = ""; }
}
else { $posticon = $posticon1 if ($sortposticonshow eq "yes"); } #4
if ($threadposts eq 0) { $lastpostdate = $startedpostdate; $lastposter = ""; }
} #3
$threadstate = "poll" if (($posticon =~ m/<br>/i)&&($threadstate ne "poll")&&($threadstate ne "pollclosed"));
if ($threadstate eq "") { $threadstate = "open"; }
$threadviews = ($threadposts+1) * 8 if ($threadviews < $threadposts);
$posticon = "<br>" if ($posticon =~/<br>/i);
$topictitle =~ s/^*#!&*//;
$linetokeep = "$intopic\t$topictitle\t$topicdescription\t$threadstate\t$threadposts\t$threadviews\t$startedby\t$startedpostdate\t$lastposter\t$lastpostdate\t$posticon\t$posttemp\t";
if ($count < 250) {
push (@allthreadtemp, $linetokeep);
}
else {
push (@allthreadtemp, "$intopic\t$topictitle\t\t$threadstate\t\t$threadviews\t$startedby\t\t\t$lastpostdate\t");
}
} #2
else {
my ($topicid, $topictitle, $topicdescription, $threadstate, $threadposts ,$threadviews, $startedby, $startedpostdate, $lastposter, $lastpostdate, $posticon, $posttemp) = split(/\t/,$line);
if ($count < 250) {
push (@allthreadtemp, $line);
}
else {
(my $intopic, my $trash) = split(/\t/, $line);
push (@allthreadtemp, "$intopic\t$topictitle\t\t$threadstate\t\t$threadviews\t$startedby\t\t\t$lastpostdate\t");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -