📄 editpoll.cgi
字号:
$smileyname =~ s/\.gif$//ig;
$output .= qq~<img src=$imagesurl/emot/$_ border=0 onClick="smilie('$smileyname');form.inpost.focus()" style="cursor:hand"> ~;
}
$output .= qq~</td></tr><tr><td bgcolor=$miscbacktwo valign=top><font color=$fontcolormisc><b>选项</b><p>$helpurl</font></td><td bgcolor=$miscbacktwo>
<font color=$fontcolormisc><input type=checkbox name="uselbcode" value="yes"$uselbcodecheck>使用 LB5000 标签?<br>$requestnotify$emoticonsbutton$weiwangoptionbutton</font></td></tr><tr><td bgcolor=$miscbackone colspan=2 align=center>
<input type=Submit value="发 表" name=Submit> <input type="reset" name="Clear" value="清 除"></td></form></tr></table></tr></td></table>
~;
}
sub processedit {
$filetoopen = "$lbdir" . "forum$inforum/$intopic.thd.cgi";
if (-e $filetoopen) {
&winlock($filetoopen) if ($OS_USED eq "Nt");
open(FILE, "$filetoopen");
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("编辑&这个主题不存在!"); }
($postermembername, $topictitle, $postipaddress, $showemoticons, $showsignature ,$postdate, $post, $posticon) = split(/\t/, $allthreads[0]);
($edittimes, $temp) = split(/ 次编辑/, $post);
($temp, $edittimes) = split(/第 /, $edittimes);
$edittimes = 0 unless ($edittimes);
if (($membercode ne "ad")&&($membercode ne "smo")&&($inmembmod ne "yes")&&($inmembername ne $postermembername)) {&error("编辑帖子&您不是原作者、论坛管理员 , 或者用户名、密码错誤!");}
$testentry = $query->cookie("forumsallowed$inforum");
if (($allowedentry{$inforum} eq "yes")||(($testentry eq $forumpass)&&($testentry ne ""))||($membercode eq "ad")||($membercode eq 'smo')||($inmembmod eq "yes")) { $allowed = "yes"; }
else { $allowed = "no"; }
if (($privateforum eq "yes") && ($allowed ne "yes")) { &error("发表投票&对不起,您不允许在此论坛发表投票!"); }
&error("编辑帖子&没搞错吧,这根本不是投票贴子啊!") if ($posticon !~ /<BR>/i);
&error("编辑帖子&对不起,本论坛不允许发表超过 <B>$maxpoststr</B> 个字符的文章!") if ((length($inpost) > $maxpoststr)&&($maxpoststr ne "")&&($membercode ne "ad")&&($membercode ne 'smo')&&($membercode ne 'cmo') && ($membercode ne "mo") && ($membercode ne "rz") && ($inmembmod ne "yes"));
if (($membercode eq "banned")||($membercode eq "masked")) { &error("编辑投票&您被禁止发言或者发言已经被屏蔽,请联系坛主以便解决!"); }
if (($membercode eq "ad") && ($inpassword eq $password)) { $cleartoedit = "yes"; }
if(($membercode eq 'smo') && ($inpassword eq $password)) { $cleartoedit = "yes";}
if (($inmembmod eq "yes") && ($inpassword eq $password)) { $cleartoedit = "yes"; }
if ((lc($inmembername) eq lc($postermembername)) && ($inpassword eq $password) && ($usereditpost ne "no")) { $cleartoedit = "yes"; }
unless ($cleartoedit eq "yes") { $cleartoedit eq "no"; }
if ($cleartoedit eq "yes") {
$editpostdate = $currenttime + ($timezone + $timedifferencevalue)*3600;
$editpostdate = &dateformat("$editpostdate");
$inpost =~ s/\t//g;
$inpost =~ s/\r//g;
$inpost =~ s/ / /g;
$inpost =~ s/\n\n/\<p\>/g;
$inpost =~ s/\n/\<br\>/g;
$inpost =~ s/\[这个(.+?)最后由(.+?)编辑\]//isg;
$filetoopen = "$lbdir" . "forum$inforum/$intopic.poll.cgi";
if(!(-e $filetoopen)){
$inposticon=~s/<p>/<BR>/isg;
$inposticon=~s/<BR><BR>/<BR>/isg;
$inposticon =~ s/(.*)<BR>$/$1/i;
$inposticon =~ s/^<BR>(.*)/$1/i;
$inposticon =~ s/<BR>(\s*)/<BR>/i;
$inposticon =~ s/(\s*)<BR>/<BR>/i;
$inposticontemp = $inposticon;
$inposticontemp=~s/<br>/\t/ig;
my @temppoll = split(/\t/, $inposticontemp);
my $temppoll = @temppoll;
$canpoll=$temppoll if($canpoll > $temppoll || $canpoll =~m/[^0-9]/);
$inshowsignature.=$canpoll if($inshowsignature ne "no");
if ($inposticon !~ m/<br>/i) { &error("编辑投票&投票选项太少!"); }
if ($temppoll > 25 ) { &error("编辑投票&投票选项过多,不能超过 25 项!(您此次投票的选项有 $temppoll 项)"); }
} else {
$inposticon=$posticon;
$inposticontemp = $inposticon;
$inposticontemp=~s/<br>/\t/ig;
my @temppoll = split(/\t/, $inposticontemp);
my $temppoll = @temppoll;
$canpoll=$temppoll if($canpoll > $temppoll || $canpoll =~m/[^0-9]/);
$inshowsignature.=$canpoll if($inshowsignature ne "no");
}
if (($dofilter eq "yes")||($dofilter eq "all")) {
my $temp = &dofilter("$newtopictitle\t$inpost");
($newtopictitle,$inpost) = split(/\t/,$temp);
}
if ($newtopictitle eq "") { &error("编辑投票&对不起,贴子主题不能为空!");}
if (length($newtopictitle) > 82) { &error("编辑投票&对不起,主题标题过长!"); }
$newtopictitletemp = $newtopictitle;
$newtopictitle = "*#!&*$newtopictitle";
$edittimes++;
$inpost = qq~[这个投票最后由$inmembername在 $editpostdate 第 $edittimes 次编辑]<br><br>$inpost~ if (($currenttime - $postdate) > 60 || $postermembername ne $inmembername);;
$inpost =~ s/\[hidepoll\]//isg;
$inpost .="[hidepoll]" if($hidepoll eq "yes");
$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] 标签,数目不匹配!"); }
if ($inhiddentopic eq "yes") { $inposttemp = "(保密)"; $inpost="LBHIDDEN[$postweiwang]LBHIDDEN".$inpost; }
else {
$inposttemp = $inpost;
$inposttemp = &temppost($inposttemp);
chomp $inposttemp;
$inposttemp = &lbhz($inposttemp,28);
}
$inpost =~ s/\[hidepoll\]//isg;
$inpost .="[hidepoll]" if ($hidepoll eq "yes");
$postcountcheck = 0;
$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) {
print FILE "$postermembername\t$newtopictitle\t$postipaddress\t$inshowemoticons\t$inshowsignature\t$postdate\t$inpost\t$inposticon\t$inwater\t\n";
}
else {
(my $postermembertemp, my $no, my @endall) = split(/\t/,$postline);
print FILE "$postermembertemp\t$newtopictitle\t";
foreach (@endall) {
print FILE "$_\t";
}
print FILE "\n";
}
$postcountcheck++;
}
close(FILE);
}
&winunlock($filetoopen) if ($OS_USED eq "Nt");
$threadnum = @allthreads;
$newtopictitle =~ s/^*#!&*//;
$filetoopen = "${lbdir}forum$inforum/$intopic.pl";
open(FILE, "$filetoopen");
my $topicall = <FILE>;
close(FILE);
(my $topicidtemp, $topictitletemp, my @endall) = split (/\t/, $topicall);
if (($topictitletemp ne $newtopictitletemp)||($threadnum eq 1)) {
$oldinposttemp = pop(@endall);
$oldinposttemp = $inposttemp if ($threadnum eq 1);
if (open(FILE, ">$filetoopen")) {
print FILE "$intopic\t$newtopictitletemp\t";
foreach (@endall) {
print FILE "$_\t";
}
print FILE "$oldinposttemp\t";
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");
my @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$newtopictitletemp\t";
foreach (@endall) {
print FILE "$_\t";
}
print FILE "$oldinposttemp\t";
print FILE "\n";
}
}
close(FILE);
}
&winunlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
}
if ($topictitletemp ne $newtopictitletemp) {
$filetomakeopen = "$lbdir" . "data/recentpost.cgi";
my $filetoopens = &lockfilename($filetomakeopen);
if (!(-e "$filetoopens.lck")) {
&winlock($filetomakeopen) if ($OS_USED eq "Nt");
open(FILE, "$filetomakeopen");
flock (FILE, 1) if ($OS_USED eq "Unix");
my @recentposts=<FILE>;
close(FILE);
if (open (FILE, ">$filetomakeopen")) {
flock (FILE, 2) if ($OS_USED eq "Unix");
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);
}
&winunlock($filetomakeopen) if ($OS_USED eq "Nt");
}
}
}
&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">
~;
}
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 + -