📄 editpost.cgi
字号:
$edittimes++;
$inpost = qq~[这个贴子最后由$inmembername在 $editpostdate 第 $edittimes 次编辑]<br><br>$inpost~ if (($currenttime - $postdate) > 60 || $postermembername ne $inmembername);;
if ($inhiddentopic eq "yes") { $inposttemp = "(保密)"; $inpost="LBHIDDEN[$postweiwang]LBHIDDEN".$inpost; }
if ($inposttemp ne "(保密)") {
$inposttemp = $inpost;
$inposttemp = &temppost($inposttemp);
chomp $inposttemp;
$inposttemp = &lbhz($inposttemp,28);
}
$end_q_tag = 0;
$srt_q_tag = 0;
$end_q_tag++ while $inpost =~ m#\[/QUOTE\]#ig;
$srt_q_tag++ while $inpost =~ m#\[QUOTE\]#ig;
if ($end_q_tag ne $srt_q_tag) { &error("内容校验出错&你输入了 $srt_q_tag 个 [QUOTE] 标签和 $end_q_tag 个 [/QUOTE] 标签,数目不匹配!"); }
$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");
foreach $postline (@allthreads) {
chomp $postline;
if ($postcountcheck eq 0) { $water = "$inwater\t"; } else { $water=""; }
if ($postcountcheck eq $posttoget) {
print FILE "$postermembername\t$topictitle\t$postipaddress\t$inshowemoticons\t$inshowsignature\t$postdate\t$inpost\t$inposticon\t$water\n";
}
else {
(my $postermembertemp, my $topictitletemp, my @endall) = split(/\t/,$postline);
print FILE "$postermembertemp\t$topictitle\t";
foreach (@endall) {
print FILE "$_\t";
}
print FILE "\n";
}
$postcountcheck++;
}
close(FILE);
}
&winunlock($filetoopen) if ($OS_USED eq "Nt");
$postcountcheck--;
$topictitle =~ s/^*#!&*//;
if ((($inpostno eq 1)&&($topictitlecomp eq 0))||($postcountcheck eq $posttoget)) {
$filetoopen = "$lbdir" . "forum$inforum/$intopic.pl";
open(FILE, "$filetoopen");
my $topicall = <FILE>;
close(FILE);
chomp $topicall;
(my $topicidtemp, my $topictitletemp, my $topicdescription,my $threadstate,my $threadposts ,my $threadviews,my $startedby,my $startedpostdate,my $lastposter,my $lastpostdate,my $posticon,my $posttemp) = split(/\t/,$topicall);
$posttemp = $inposttemp if ($postcountcheck eq $posttoget);
if (open(FILE, ">$filetoopen")) {
print FILE "$intopic\t$topictitle\t$topicdescription\t$threadstate\t$threadposts\t$threadviews\t$startedby\t$startedpostdate\t$lastposter\t$lastpostdate\t$posticon\t$posttemp\t\n";
close(FILE);
}
$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");
@allthreads = <FILE>;
close(FILE);
if (open(FILE, ">$filetoopen")) {
flock(FILE, 2) if ($OS_USED eq "Unix");
foreach (@allthreads) {
chomp $_;
($tempno, my $nono) = split (/\t/,$_);
next if ($tempno !~ /^[0-9]+$/);
if ($tempno ne $intopic) {
print FILE "$_\n";
}
else {
print FILE "$intopic\t$topictitle\t$topicdescription\t$threadstate\t$threadposts\t$threadviews\t$startedby\t$startedpostdate\t$lastposter\t$lastpostdate\t$posticon\t$posttemp\t\n";
}
}
close(FILE);
}
&winunlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
}
if (($inpostno eq 1)&&($topictitlecomp eq 0)) {
$filetomakeopen = "$lbdir" . "data/recentpost.cgi";
open(FILE, "$filetomakeopen");
@recentposts=<FILE>;
close(FILE);
if (open (FILE, ">$filetomakeopen")) {
foreach (@recentposts) {
chomp $_;
($tempno1, $tempno2, $no, @endall) = split (/\t/,$_);
next if (($tempno1 !~ /^[0-9]+$/)||($tempno2 !~ /^[0-9]+$/));
if (($tempno1 eq $inforum)&&($tempno2 eq $intopic)) {
print FILE "$inforum\t$intopic\t$topictitle\t";
foreach (@endall) { print FILE "$_\t"; }
print FILE "\n"
}
else {
print FILE "$_\n"
}
}
close(FILE);
}
}
&mischeader("编辑贴子");
$relocurl = "topic.cgi?forum=$inforum&topic=$intopic";
$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="topic.cgi?forum=$inforum&topic=$intopic">返回主题</a><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=$relocurl">
~;
}
else { &error("编辑贴子&您不是原作者,或者用户名、密码错误!"); }
$p1=$inpostno-1;
$dirtoopen2 = "$imagesdir" . "usr/$inforum";
opendir (DIR, "$dirtoopen2");
@files = readdir(DIR);
closedir (DIR);
@files = grep(/^$inforum\_$intopic/,@files);
if ($p1>0) { @files = grep(/^$inforum\_$intopic\_$p1\./,@files);} else { @files = grep(/^$inforum\_$intopic\./,@files);}
foreach (@files) {
$oldname=$_;
}
if (($addme ne "")||($delimg ne "")) {
unlink ("$imagesdir/usr/$inforum/$oldname");
}
my $filesize=0;
if (($addme)&&((($inpostno eq "1")&&($arrowupload ne "off"))||(($inpostno ne "1")&&($allowattachment ne "no"))||($membercode eq "ad")||($membercode eq 'smo')||($inmembmod eq "yes"))) {
$uploadreqire = 0 if ($uploadreqire < 0);
if (($membercode ne "ad")&&($membercode ne 'smo')&&($membercode ne 'mo')&&($membercode ne 'rz')&&($inmembmod ne "yes")&&(($numberofposts+$numberofreplys) < $uploadreqire)) {
&error("上传出错&你必须发贴总数达到 <B>$uploadreqire</B> 才能在本区上传!");
}
my $up_filename =$query->uploadInfo($addme);
my ($up_name,$up_ext) = split(/\./,$up_filename);
$up_ext = lc($up_ext);
my $checkadd=0;
for (split(/\,\s*/,$addtype)){
$checkadd=1,last if ($up_ext eq lc($_));
}
&error("上传出错&为了安全,不支持你所上传的附件,请重新选择!") if ($up_ext eq "exe"||$up_ext eq "com"||$up_ext eq "pl"||$up_ext eq "cgi"||$up_ext eq "asp"||$up_ext eq "php"||$up_ext eq "php3"||$up_ext eq "phtml"||$up_ext eq "jsp"||$up_ext eq "cfml"||$up_ext eq "dll");
&error("上传出错&不支持你所上传的附件或者图片,请重新选择!") if ($checkadd==0);
my $buffer;
if ($p1==0) {
$dofile = "$imagesdir/usr/$forum/$forum\_$topic.$up_ext";
$HackDetail = "$forum\_$topic\_\=$forum\_$topic.$up_ext\=0";
open (FILE,">$dofile")
} else {
my $replynum=$postno-1;
$dofile = "$imagesdir/usr/$forum/$forum\_$topic\_$p1.$up_ext";
$HackDetail = "$forum\_$topic\_$p1\=$forum\_$topic\_$p1.$up_ext\=0";
open (FILE,">$dofile");
}
binmode (FILE);
while ((($buffer=$query->readUploadFile($addme,4096)))&&!(($filesize>$maxupload)&&($membercode ne "ad"))) {
if ($up_ext eq "txt"||$up_ext eq "cgi"||$up_ext eq "pl"||$up_ext eq "php3"||$up_ext eq "phtm"||$up_ext eq "phtml"||$up_ext eq "htm"||$up_ext eq "html"||$up_ext eq "asp"||$up_ext eq "php"||$up_ext eq "shtml"||$up_ext eq "phtml"||$up_ext eq "jsp"){
$buffer=~s/\.cookie/\&\#46\;cookie/isg;
$buffer =~ s/on(mouse|exit|error|click|key)/\&\#111\;n$1/isg;
$buffer=~s/script/scri\&\#112\;t/isg;
$buffer =~ s/style/\&\#115\;tyle/isg;
}
$filesize = $filesize + 4;
print FILE $buffer;
}
close (FILE);
if ($up_ext eq "gif"||$up_ext eq "jpg"||$up_ext eq "bmp"||$up_ext eq "jpeg"||$up_ext eq "png"||$up_ext eq "ppm"||$up_ext eq "svg"||$up_ext eq "xbm"||$up_ext eq "xpm") {
eval("use Image::Info qw(image_info);");
if ($@ eq "") {
my $info = image_info("$dofile");
if ($info->{error} eq "Unrecognized file format"){
unlink ("$dofile");
&error("上传出错&上传文件不是图片文件,请上传标准的图片文件!");
}
undef $info;
}
}
}
if (($filesize>$maxupload)&&($membercode ne "ad")) {
if ($postno==1) {
unlink ("$imagesdir/usr/$forum/$forum\_$topic.$up_ext");
} else {
my $replynum=$postno-1;
unlink ("$imagesdir/usr/$forum/$forum\_$topic\_$replynum.$up_ext");
}
&error("上传出错&上传文件大小超过$maxupload,请重新选择! ");
}
}
END {
if ($cpudisp eq "1") {
$spent_time = sprintf ("%.2f", ((times)[0] + (times)[1] - $start_time)*1000);
print "<center><font color=#c0c0c0>当前页面执行消耗时间: $spent_time 毫秒";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -