📄 forumoptions.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 {
$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;
use File::Copy;
$LBCGI::POST_MAX=2000;
$LBCGI::DISABLE_UPLOADS = 1;
$LBCGI::HEADERS_ONCE = 1;
require "data/boardinfo.cgi";
require "data/styles.cgi";
require "lb.lib.pl";
require "rebuildlist.pl";
$|++; # Unbuffer the output
$thisprog = "forumoptions.cgi";
$query = new LBCGI;
&ipbanned; #封杀一些 ip
$checked = $query -> param('checked');
$inforum = $query -> param('forum');
$intopic = $query -> param('topic');
$action = $query -> param('action');
$admin = $query -> param('admin');
$prunedays = $query -> param('prunedays');
$inmembername = $query -> param('membername');
$inpassword = $query -> param('password');
$movetoid = $query -> param('movetoid');
$inforum = &stripMETA("$inforum");
$intopic = &stripMETA("$intopic");
$action = &stripMETA("$action");
$prunedays = &stripMETA("$prunedays");
$inmembername = &stripMETA("$inmembername");
$inpassword = &stripMETA("$inpassword");
&error("打开文件&老大,别乱黑我的程序呀!") if (($intopic) && ($intopic !~ /^[0-9]+$/));
&error("打开文件&老大,别乱黑我的程序呀!") if (($inforum) && ($inforum !~ /^[0-9]+$/));
&error("打开文件&老大,别乱黑我的程序呀!") if (($movetoid) && ($movetoid !~ /^[0-9]+$/));
if (-e "${lbdir}data/style${inforum}.cgi") { require "${lbdir}data/style${inforum}.cgi"; }
print header(-charset=>gb2312);
if (($inforum !~ m|([0-9\G]+$)|g) or (!$inforum)) { &error("普通错误&请不要修改生成的 URL!"); }
if (($prunedays) && ($prunedays !~ /^[0-9]+$/)) { &error("普通错误&请不要修改生成的 URL!"); }
if (! $inmembername) { $inmembername = $query->cookie("amembernamecookie"); }
if (! $inpassword) { $inpassword = $query->cookie("apasswordcookie"); }
$inmembername =~ s/[\a\f\n\e\0\r\t\`\~\!\@\#\$\%\^\&\*\(\)\+\=\\\{\}\;\'\:\"\,\.\/\<\>\?]//isg;
$inpassword =~ s/[\a\f\n\e\0\r\t\|\@\;\#\{\}\$]//isg;
if ((!$inmembername) or ($inmembername eq "客人")) { $inmembername = "客人"; }
else {
# &getmember("$inmembername");
&getmembernolock("$inmembername");
&error("普通错误&此用户根本不存在!") if ($userregistered eq "no");
&error("普通错误&密码与用户名不相符,请重新登录!") if ($inpassword ne $password);
}
&getoneforum("$inforum");
#&moderator("$inforum");
if ($action eq "prune") {
$cleartoedit = "no";
&mischeader("批量管理");
if ($inpassword eq $password) {
$pwok = "密码不显示";
}
else {
$pwok = $inpassword;
}
$trueipaddress = $ENV{'HTTP_X_FORWARDED_FOR'};
$trueipaddress = "no" if (($trueipaddress eq "")||($trueipaddress eq "unknown"));
my $trueipaddress1 = $ENV{'HTTP_CLIENT_IP'};
$trueipaddress = $trueipaddress1 if (($trueipaddress1 ne "")&&($trueipaddress1 ne "unknown"));
my $thistime=time;
if($admin eq 'delete'){#Next-Hack
$filetomake = "$lbdir" . "data/baddel.cgi";
$maxdeloneday = 9 if (($maxdeloneday eq "")||($maxdeloneday <= 0));
if ($membercode ne "ad"){
&winlock($filetomake) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
open(FILE,"$filetomake");
flock (FILE, 2) if ($OS_USED eq "Unix");
my @delfile = <FILE>;
close(FILE);
my $delcount=0;
my $delcou=0;
my $totime=time-86400;
foreach (@delfile){
chomp($_);
(my $delname, my $no, my $noip, $no, $no ,my $notime) = split(/\t/,$_);
if (lc($delname) eq lc($inmembername)){
if ($notime > $totime){
$delcount++;
}
}
if ($noip eq "$ENV{'REMOTE_ADDR'}"){
if ($notime > $totime){
$delcou++;
}
}
}
if ($delcount > $maxdeloneday){&error("删除主题&你今天删除帖子太多,请明天继续!");}
if ($delcou > $maxdeloneday) {&error("删除主题&你今天删除帖子太多,请明天继续!");}
undef $delcount;
undef $delcou;
}
if (open(FILE, ">>$filetomake")) {
print FILE "$inmembername\t$pwok\t$ENV{'REMOTE_ADDR'}\t$trueipaddress\t批量删除$forumname $prunedays天前的贴子\t$thistime\t\n";
close(FILE);
}
} elsif ($admin eq 'move'){#Next-Hack
$filetomake = "$lbdir" . "data/badmove.cgi";
$maxmoveoneday = 9 if (($maxmoveoneday eq "")||($maxmoveoneday <= 0));
if ($membercode ne "ad"){
&winlock($filetomake) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
open(FILE,"$filetomake");
flock (FILE, 2) if ($OS_USED eq "Unix");
my @movefile = <FILE>;
close(FILE);
my $movecount=0;
my $movecou=0;
my $totime=time-86400;
foreach (@movefile){
chomp $_;
(my $movename, my $no, my $noip, $no, $no ,my $notime) = split(/\t/,$_);
if (lc($movename) eq lc($inmembername)){
if ($notime > $totime){
$movecount++;
}
}
if ($noip eq "$ENV{'REMOTE_ADDR'}"){
if ($notime > $totime){
$movecou++;
}
}
}
if ($movecount > $maxmoveoneday){&error("移动主题&你今天移动帖子太多,请明天继续!");}
if ($movecou > $maxmoveoneday) {&error("移动主题&你今天移动帖子太多,请明天继续!");}
undef $movecount;
undef $movecou;
}
if (open(FILE, ">>$filetomake")) {
print FILE "$inmembername\t$pwok\t$ENV{'REMOTE_ADDR'}\t$trueipaddress\t批量移动$forumname $prunedays天前的帖子\t$thistime\t\n";
close(FILE);
}
}
undef $thistime;
&winunlock($filetomake) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
if ((($membercode eq "ad") ||($membercode eq 'smo'))&& ($inpassword eq $password)) { $cleartoedit = "yes"; }
if (($inmembmod eq "yes") && ($inpassword eq $password)) { $cleartoedit = "yes"; }
unless ($cleartoedit eq "yes") { $cleartoedit = "no"; }
if ($cleartoedit eq "no" && $checked eq "yes") {&error("使用批量管理&您不是本论坛坛主、管理员或是您的密码输入错误!"); }
if (($cleartoedit eq "yes") && ($checked eq "yes")) {
if ($prunedays < 20) { &error("使用批量管理&指定管理的天数要大于 20 !"); }
#&getoneforum("$inforum");
# &getforum($inforum);
if($admin eq 'delete'){#Next-Hack
if (-e "${lbdir}boarddata/jinghua$inforum.cgi") {
open(FILE, "${lbdir}boarddata/jinghua$inforum.cgi");
my @jhdatas = <FILE>;
close(FILE);
$jhdata = join("\_",@jhdatas);
$jhdata = "\_$jhdata\_";
$jhdata =~ s/\W//isg;
}
$dirtoopen = "$lbdir" . "forum$inforum";
opendir (DIR, "$dirtoopen");
my @dirdata = readdir(DIR);
closedir (DIR);
@entry = grep(/\.thd\.cgi$/,@dirdata);
@entry = sort numerically(@entry);
$dirtoopen2 = "$imagesdir" . "usr/$inforum";
opendir (DIR, "$dirtoopen2");
@dirdata1 = readdir(DIR);
closedir (DIR);
foreach (@entry) {
(my $topicid, my $tr) = split(/\./,$_);
next if ($jhdata =~ /\_$topicid\_/);
$file1 = "$lbdir" . "forum$inforum/$topicid.thd.cgi";
open (TMP1, "$file1");
flock(TMP1, 1) if ($OS_USED eq "Unix");
my @tmp = <TMP1>;
close (TMP1);
$postcount = @tmp;
$postcount--;
my $tmp1 = $tmp[-1];
(my $no, my $no, my $no, my $no, my $no, my $lastpostdate, my $no, $no) = split(/\t/,$tmp1);
$currenttime = time;
$threadagelimit = $currenttime - $prunedays * 86400;
if ($lastpostdate < $threadagelimit) {
$filetotrash = "$lbdir" . "forum$inforum/$topicid.thd.cgi";
unlink $filetotrash;
$filetotrash = "$lbdir" . "forum$inforum/$topicid.mal.pl";
unlink $filetotrash;
$filetotrash = "$lbdir" . "forum$inforum/$topicid.poll.pl";
unlink $filetotrash;
$filetotrash = "$lbdir" . "forum$inforum/$topicid.pl";
unlink $filetotrash;
$filetounlink = "$lbdir" . "forum$inforum/rate$topicid.file.pl";
unlink $filetounlink;
$filetounlink = "$lbdir" . "forum$inforum/rateip$topicid.file.pl";
unlink $filetounlink;
@dirdata2 = grep(/^$inforum\_$intopic/,@dirdata1);
@files = grep(/^$inforum\_$intopic\./,@dirdata2);
foreach (@files) {
unlink ("$dirtoopen2/$_");
}
@files = grep(/^$inforum\_$intopic\_/,@dirdata2);
foreach (@files) {
unlink ("$dirtoopen2/$_");
}
$totaltopics_deleted++;
$totalposts_deleted = $totalposts_deleted + $postcount;
}
}
rebuildLIST(-Forum=>"$inforum");
$filetomake = "$lbdir" . "data/allforums.cgi";
&winlock($filetomake) if ($OS_USED eq "Nt");
open(FILE, "$filetomake");
flock(FILE, 1) if ($OS_USED eq "Unix");
@allforums = <FILE>;
close(FILE);
if (open(FILE, ">$filetomake")) {
flock(FILE, 2) if ($OS_USED eq "Unix");
foreach $forum (@allforums) {
chomp($forum);
($tempno, $trash) = split(/\t/,$forum);
if ($inforum eq $tempno) {
($forumid, $category, $categoryplace, $forumname, $forumdescription, $forummoderator ,$htmlstate ,$idmbcodestate ,$privateforum, $startnewthreads ,$lastposter ,$lastposttime, $threads, $posts, $forumgraphic, $ratings, $misc,$forumpass,$hiddenforum,$indexforum,$teamlogo,$teamurl, $fgwidth, $fgheight, $miscadd3, $miscadd4, $miscad5) = split(/\t/,$forum);
$posts = $posts - $totalposts_deleted;
$threads = $threads - $totaltopics_deleted;
print FILE "$forumid\t$category\t$categoryplace\t$forumname\t$forumdescription\t$forummoderator\t$htmlstate\t$idmbcodestate\t$privateforum\t$startnewthreads\t$lastposter\t$lastposttime\t$threads\t$posts\t$forumgraphic\t$ratings\t$misc\t$forumpass\t$hiddenforum\t$indexforum\t$teamlogo\t$teamurl\t$fgwidth\t$fgheight\t$miscadd3\t$miscadd4\t$miscad5\t\n";
open(INFOFILE,">${lbdir}forum$inforum/foruminfo.cgi");
print INFOFILE "$forumid\t$category\t$categoryplace\t$forumname\t$forumdescription\t$forummoderator\t$htmlstate\t$idmbcodestate\t$privateforum\t$startnewthreads\t$lastposter\t$lastposttime\t$threads\t$posts\t$forumgraphic\t$ratings\t$misc\t$forumpass\t$hiddenforum\t$indexforum\t$teamlogo\t$teamurl\t$fgwidth\t$fgheight\t$miscadd3\t$miscadd4\t$miscad5\t\n";
close(INFOFILE);
}
else { print FILE "$forum\n"; }
}
close(FILE);
}
&winunlock($filetomake) if ($OS_USED eq "Nt");
require "$lbdir" . "data/boardstats.cgi";
$filetomake = "$lbdir" . "data/boardstats.cgi";
$totalthreads = $totalthreads - $totaltopics_deleted;
$totalposts = $totalposts - $totalposts_deleted;
&winlock($filetomake) if ($OS_USED eq "Nt");
if (open(FILE, ">$filetomake")) {
flock(FILE, 2) if ($OS_USED eq "Unix");
print FILE "\$lastregisteredmember = \"$lastregisteredmember\"\;\n";
print FILE "\$totalmembers = \"$totalmembers\"\;\n";
print FILE "\$totalthreads = \"$totalthreads\"\;\n";
print FILE "\$totalposts = \"$totalposts\"\;\n";
print FILE "\n1\;";
close (FILE);
}
&winunlock($filetomake) if ($OS_USED eq "Nt");
if (! $totaltopics_deleted) { $totaltopics_deleted = "0"; }
if (! $totalposts_deleted) { $totalposts_deleted = "0"; }
$output .= qq~
<table cellpadding=0 cellspacing=0 border=0 width=$tablewidth bgcolor=$tablebordercolor align=center>
<tr>
<td>
<table cellpadding=6 cellspacing=1 border=0 width=100%>
<tr>
<td bgcolor=$miscbacktwo valign=middle align=center><font face="$font" color=$fontcolormisc><b>论坛文章已经被删除</b></font></td></tr>
<tr>
<td bgcolor=$miscbackone valign=middle><font face="$font" color=$fontcolormisc>
统计资料:
<ul>
<li>共删除主题:$totaltopics_deleted 篇
<li>共删除回复:$totalposts_deleted 篇
<li><a href="forums.cgi?forum=$inforum">返回论坛$savetopicid</a>
<li><a href="leoboard.cgi">返回论坛首页</a>
</ul>
</tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -