📄 delpost.cgi
字号:
flock (FILE, 2) if ($OS_USED eq "Unix");
foreach (@recentposts) {
chomp $_;
($tempno1, $tempno2, $no) = split (/\t/,$_);
next if (($tempno1 !~ /^[0-9]+$/)||($tempno2 !~ /^[0-9]+$/));
my $checkme=0;
$checkme = 1 if ($intopic eq $tempno2);
foreach $intopic (@intopic){
if ($tempno2 eq $intopic) {
$checkme=1;
}
}
unless (($tempno1 eq $inforum)&&($checkme eq 1)) {
print FILE "$_\n"
}
}
close(FILE);
}
&winunlock($filetomakeopen) if ($OS_USED eq "Nt");
$filetoopen = "$lbdir" . "boarddata/ontop$inforum.cgi";
if (-e $filetoopen) {
open(FILE, "$filetoopen");
@ontop = <FILE>;
close(FILE);
if (open(FILE, ">$filetoopen")) {
flock(FILE, 2) if ($OS_USED eq "Unix");
foreach (@ontop) {
chomp $_;
my $checkme=0;
$checkme = 1 if ($intopic eq $_);
foreach $intopic (@intopic){
if ($_ eq $intopic) {
$checkme=1;
}
}
print FILE "$_\n" if ($checkme ==0);
}
close(FILE);
}
}
$filetoopen = "$lbdir" . "boarddata/absontop.cgi";
if (-e $filetoopen) {
open(FILE, "$filetoopen");
@toptopic = <FILE>;
close(FILE);
if (open(FILE, ">$filetoopen")) {
foreach (@toptopic) {
chomp $_;
next if ($_ eq "");
($tempinforum,$tempintopic) = split (/\|/,$_);
unless (($tempinforum eq $inforum)&&($tempintopic eq $intopic)) {
print FILE "$_\n";
}
}
close(FILE);
}
}
$filetoopen = "$lbdir" . "data/allforums.cgi";
$filetoopen1 = "$lbdir" . "boarddata/list$inforum.cgi";
my $filetoopens1 = &lockfilename($filetoopen);
my $filetoopens2 = &lockfilename($filetoopen1);
if ((!(-e "$filetoopens1.lck"))&&(!(-e "$filetoopens2.lck"))) {
$filetoopen = "$lbdir" . "boarddata/list$inforum.cgi";
&winlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
open(FILE, "$filetoopen");
flock(FILE, 1) if ($OS_USED eq "Unix");
$linetokeep = <FILE>;
close(FILE);
&winunlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
chomp $linetokeep;
($topicid, $topictitle, $trash, $trash, $trash, $trash, $lastforumposter1, $trash, $lastforumposter, $lastforumpostdate) = split(/\t/,$linetokeep);
$filetoopen = "$lbdir" . "data/allforums.cgi";
&winlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
open(FILE, "$filetoopen");
flock(FILE, 1) if ($OS_USED eq "Unix");
@allforums = <FILE>;
close(FILE);
$filetomake = "$lbdir" . "data/allforums.cgi";
if (open(FILE, ">$filetomake")) {
flock(FILE, 2) if ($OS_USED eq "Unix");
foreach $forum (@allforums) { #start foreach @forums
chomp($forum);
next if ($forum eq "");
($tempno, $trash) = split(/\t/,$forum);
next if ($tempno !~ /^[0-9]+$/);
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 - $alldelpost;
$threads=$threads-$alldeltopic;
$lastforumposter = $lastforumposter1 if ($lastforumposter eq "");
$lastforumpostdate = "$lastforumpostdate\%\%\%$topicid\%\%\%$topictitle";
print FILE "$forumid\t$category\t$categoryplace\t$forumname\t$forumdescription\t$forummoderator\t$htmlstate\t$idmbcodestate\t$privateforum\t$startnewthreads\t$lastforumposter\t$lastforumpostdate\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";
}
else { print FILE "$forum\n"; }
}
close(FILE);
}
&winunlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
}
require "$lbdir" . "data/boardstats.cgi";
$filetomake = "$lbdir" . "data/boardstats.cgi";
my $filetoopens = &lockfilename($filetomake);
if (!(-e "$filetoopens.lck")) {
$totalthreads=$totalthreads-$alldeltopic;
$totalposts = $totalposts - $alldelpost;
&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");
}
}#1
$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 align=center><font color=$fontcolormisc><b>删除成功</b></font></td></tr>
<tr><td bgcolor=$miscbackone><font color=$fontcolormisc>具体情况:<ul>
<li><a href="forums.cgi?forum=$inforum">返回论坛</a>
<li><a href="leoboard.cgi">返回论坛首页</a>
</ul></tr></td></table></td></tr></table>
<meta http-equiv="refresh" content="3; url=forums.cgi?forum=$inforum">
~;
} else {
@intopic = $query -> param('topic');
$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 colspan=2 align=center>
<form action="$thisprog" method="post" enctype="multipart/form-data">
<input type=hidden name="action" value="delete">
<input type=hidden name="checked" value="yes">
<input type=hidden name="forum" value="$inforum">
<input type=hidden name="topic" value="@intopic">
<font color=$fontcolormisc><b>请输入您的用户名、密码进入版主模式 [删除主题]</b></font></td></tr>
<tr><td bgcolor=$miscbackone colspan=2><font color=$fontcolormisc><b>该操作是不可逆的,请仔细考虑!</font></td>
<tr><td bgcolor=$miscbackone><font color=$fontcolormisc>请输入您的用户名</font></td>
<td bgcolor=$miscbackone><input type=text name="membername" value="$inmembername"></td></tr>
<tr><td bgcolor=$miscbackone><font color=$fontcolormisc>请输入您的密码</font></td>
<td bgcolor=$miscbackone><input type=password name="password" value="$inpassword"> <font color=$fontcolormisc><a href="profile.cgi?action=lostpass" style="cursor:help">忘记密码?</a></font></td></tr>
<tr><td bgcolor=$miscbackone><font color=$fontcolormisc>是否计算进文章被删数?</font></td>
<td bgcolor=$miscbackone><font color=$fontcolormisc><input type="radio" name="leavemessage" value="yes" checked>计算 <input type="radio" name="leavemessage" value="no">不计算 </font></td></tr>
<tr><td bgcolor=$miscbacktwo colspan=2 align=center><input type=submit name="submit" value="登 陆"></td></tr></form></table></td></tr></table>
</table></td></tr></table>
~;
}
} # end deletethread
sub deletepost {
$filetoopen = "$lbdir" . "forum$inforum/$intopic.thd.cgi";
if (-e $filetoopen) {
&winlock($filetoopen) if ($OS_USED eq "Nt");
open(FILE, "$filetoopen") or &error("删除&这个主题不存在!");
flock(FILE, 1) if ($OS_USED eq "Unix");
@allthreads = <FILE>;
close(FILE);
&winunlock($filetoopen) if ($OS_USED eq "Nt");
}else { unlink ("$lbdir" . "forum$inforum/$intopic.pl"); &error("删除&这个主题不存在!"); }
@threads=@allthreads;
$tt=@threads;
$postcountcheck = 0;
$totalposts = @allthreads;
$cleartoedit = "no";
if (($membercode eq "ad") && ($inpassword eq $password)) { $cleartoedit = "yes";$checkcandelm="YES";}
if (($membercode eq 'smo') && ($inpassword eq $password)) { $cleartoedit = "yes";$checkcandelm="YES";}
if (($inmembmod eq "yes") && ($inpassword eq $password)) { $cleartoedit = "yes";$checkcandelm="YES";}
@newallthread=@allthreads;
$threadscount=@allthreads;
@inpostno=grep(/[0-9]+/,@inpostno);
@oldinpostno=@inpostno;
$delcount=@inpostno;
&error("删除回复&请先选择需要删除的回复!") if($delcount <= 0);
$checkcandel=0;
foreach $posttodelete (@inpostno){
$posttodelete--;
if ($posttodelete eq "0") { &error("删除回复&这里是用来删除回复的,不能删除主题!"); }
($startedby[$posttodelete], undef) = split(/\t/,$allthreads[$posttodelete]);
if ($arrowuserdel eq "on" && $checkcandelm ne "YES") {
if ((lc($inmembername) eq lc($startedby[$posttodelete])) && ($inpassword eq $password)) { $cleartoedit = "yes";$checkcandel++;
}else{ &error("删除回复&不是原作者、论坛管理员,或者您的密码错误!"); }
}
unless ($cleartoedit eq "yes") { $cleartoedit = "no"; }
$newallthread[$posttodelete]="";
$checkaddon[$posttodelete]="YES";
}
unless ($cleartoedit eq "yes") { $cleartoedit = "no"; }
if (($cleartoedit eq "no"||($checkcandel != $delcount && $checkcandelm ne "YES")) && $checked eq "yes") { &error("删除回复&不是原作者、论坛管理员,或者您的密码错误!"); }
if ($cleartoedit eq "yes" && ($checkcandel == $delcount || $checkcandelm eq "YES")) {
foreach $posttodelete (@inpostno){
$startedby=$startedby[$posttodelete];
$nametocheck = $startedby;
$nametocheck =~ s/ /\_/g;
$nametocheck =~ tr/A-Z/a-z/;
$nametocheck = &stripMETA($nametocheck);
my $filetoopen = "${lbdir}$memdir/$nametocheck.cgi";
$filetoopen = "${lbdir}$memdir/old/$nametocheck.cgi" if (!(-e $filetoopen));
if (-e $filetoopen) {
&winlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
open(FILE,"$filetoopen");
flock (FILE, 1) if ($OS_USED eq "Unix");
$filedata = <FILE>;
close(FILE);
chomp($filedata);
($membername, $password, $membertitle, $membercode, $numberofposts, $emailaddress, $showemail, $ipaddress, $homepage, $oicqnumber, $icqnumber ,$location ,$interests, $joineddate, $lastpostdate, $signature, $timedifference, $privateforums, $useravatar, $misc1, $userxz, $usersx, $personalavatar, $personalwidth, $personalheight, $rating, $lastgone, $visitno, $addjy, $meili, $mymoney, $postdel, $sex, $education, $marry, $work, $born, $chatlevel, $chattime,$jhmp ,$useradd3, $useradd4, $onlinetime,$userquestion, $useradd6, $useradd7, $useradd8 ) = split(/\t/,$filedata);
if (($membername ne "")&&($password ne "")) {
open(FILE,">$filetoopen");
flock (FILE, 2) if ($OS_USED eq "Unix");
$lastgone=time;
$postdel ++ if ($inleavemessage eq "yes");
print FILE "$membername\t$password\t$membertitle\t$membercode\t$numberofposts\t$emailaddress\t$showemail\t$ipaddress\t$homepage\t$oicqnumber\t$icqnumber\t$location\t$interests\t$joineddate\t$lastpostdate\t$signature\t$timedifference\t$privateforums\t$useravatar\t$misc1\t$userxz\t$usersx\t$personalavatar\t$personalwidth\t$personalheight\t$rating\t$lastgone\t$visitno\t$addjy\t$meili\t$mymoney\t$postdel\t$sex\t$education\t$marry\t$work\t$born\t$chatlevel\t$chattime\t$jhmp\t$useradd3\t$useradd4\t$onlinetime\t$userquestion\t$useradd6\t$useradd7\t$useradd8\t\n";
close(FILE);
}
&winunlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
}
}
chomp @newallthread;
@newallthread=grep(/^(.+?)$/,@newallthread);
$newallthread=join("\n",@newallthread);
$newallthread=~s/\n\n/\n/isg;
chomp $newallthread;
$filetoopen = "$lbdir" . "forum$inforum/$intopic.thd.cgi";
&winlock($filetoopen) if ($OS_USED eq "Nt");
if (open(FILE, ">$filetoopen")) {
flock(FILE, 2) if ($OS_USED eq "Unix");
print FILE "$newallthread\n";
close(FILE);
}
&winunlock($filetoopen) if ($OS_USED eq "Nt");
($postermembername2, $topictitle2, $postipaddress2, $showemoticons2, $showsignature2 ,$postdate2, $post2, $posticon2) = split(/\t/, $newallthread[$#newallthread]);
$inposttemp = $post2;
$inposttemp="(密)" if ($inposttemp=~/LBHIDDEN\[(.*?)\]LBHIDDEN/sg);
$inposttemp="(密)" if ($inposttemp=~/LBSALE\[(.*?)\]LBSALE/sg);
$inposttemp=&temppost($inposttemp);
$inposttemp = &lbhz($inposttemp,$maxsavepost);
$filetoopen = "$lbdir" . "boarddata/list$inforum.cgi";
&winlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
open(FILE, "$filetoopen");
flock(FILE, 1) if ($OS_USED eq "Unix");
@alltopics = grep(/^[0-9]+\t/,<FILE>);
close(FILE);
&winunlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
chomp @alltopics;
@linetokeep= grep(/^$intopic\t/,@alltopics);
chomp @linetokeep;
($topicid, $topictitle, $topicdescription, $threadstate, $threadposts ,$threadviews, $startedby, $startedpostdate, $lastposter, $lastpostdate, $posticon, $no) = split(/\t/,$linetokeep[0]);
$threadposts = $#newallthread;
$newline="$topicid\t$topictitle\t$topicdescription\t$threadstate\t$threadposts\t$threadviews\t$startedby\t$startedpostdate\t$postermembername2\t$postdate2\t$posticon\t$inposttemp\t";
$filetomake = "$lbdir" . "boarddata/list$inforum.cgi";
&winlock($filetomake) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
if (open(FILE, ">$filetomake")) {
flock(FILE, 2) if ($OS_USED eq "Unix");
foreach $line(@alltopics){
chomp $line;
($tempid,undef) = split(/\t/,$line);
if($tempid == $intopic){
print FILE "$newline\n";
}else{
print FILE "$line\n";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -