📄 post.cgi
字号:
<td bgcolor=$miscbackone valign=top><font face="$font" color=$fontcolormisc><b>贴子复制</b><p></font></td>
<td bgcolor=$miscbackone valign=middle> <textarea cols=90 rows=12 wrap="soft" name="inpost">$temppost</textarea><BR><BR></td>
</tr><tr>
<center>
<td bgcolor=$miscbackone valign=middle colspan=2 align=center>
<input type="button" value="高亮显示文字" onClick="this.form.inpost.focus();this.form.inpost.select();">
<input type="button" value="复制到剪贴板" name="cmdCopy" onClick="copy(this.form.inpost)"></center></td>
</tr></td></table></table>
~;
} # the copy HACK
##### add the replyto the file.
sub addreply { # start routine
### Lets sort out the flood control, incase they used the back button...
&getmember("$inmembername");
if (($floodcontrol eq "on") && ($membercode ne "ad") && ($membercode ne "mo")) {
$currenttime = time;
($lastpost, $posturl, $posttopic) = split(/\%\%\%/,$lastpostdate);
$lastpost = ($lastpost + $floodcontrollimit);
if ($lastpost > $currenttime) {
&error("发表回复&灌水预防机制已经使用,您必须等待 $floodcontrollimit 秒钟才能再次发表!");
}
}
if ($userregistered eq "no") { &error("发表&您没有注册!"); }
elsif ($inpassword ne $password) { &error("发表&您的密码错误!"); }
elsif ($membercode eq "banned") { &error("发表&已被禁止发言!"); }
elsif ($inpost eq "") { &error("发表新回复&必须输入内容!"); }
else { # start else
&getforum("$inforum");
if (($allowedentry{$inforum} eq "yes")||($membercode eq "ad")) { $allowed = "yes"; }
if (($privateforum eq "yes") && ($allowed ne "yes")) {
&error("发表&对不起,您不允许在此论坛发表!");
}
# Grab the thread file
$filetoopen = "$ikondir" . "forum$inforum/$intopic.thd";
$filetoopen = &stripMETA($filetoopen);
if (-e $filetoopen) {
open(FILE, "$filetoopen") or &error("发表&这个主题不存在!");
@allmessages = <FILE>;
close(FILE);
}
else { unlink ("$ikondir" . "forum$inforum/$intopic.pl"); &error("发表&这个主题不存在!可能已经被删除!"); }
$totalthreadposts = @allmessages;
($trash, $topictitle) = split(/\|/,$allmessages[0]);
# Open the bad word filter
$filetomake = "$ikondir" . "forum$inforum/$intopic.thd";
$filetomake = &stripMETA($filetomake);
open(FILE, ">$filetomake");
flock(FILE, 2) if ($OS_USED eq "Unix");
foreach $messages (@allmessages) {
chomp $messages;
print FILE "$messages\n";
}
print FILE "$inmembername|$topictitle|$postipaddress|$inshowemoticons|$inshowsignature|$currenttime|$inpost|$inposticon|";
close(FILE);
my $file = "$ikondir" . "forum$inforum/$intopic.pl";
open (ENT, $file);
$in = <ENT>;
close (ENT);
($topicid, $topictitle, $topicdescription, $threadstate, $threadposts ,$threadviews, $startedby, $startedpostdate, $lastposter, $lastpostdate) = split(/\|/,$in);
$threadposts = @allmessages;
open(FILE, ">$file");
flock(FILE, 2) if ($OS_USED eq "Unix");
print FILE "$intopic|$topictitle|$topicdescription|$threadstate|$threadposts|$threadviews|$startedby|$startedpostdate|$inmembername|$currenttime|";
close(FILE);
$cleanmembername = $inmembername;
$cleanmembername =~ s/ /\_/isg;
$numberofposts++;
$lastpostdate = "$currenttime\%\%\%$threadprog?forum=$inforum&topic=$intopic\%\%\%$topictitle" if ($privateforum ne "yes");
chomp $lastpostdate;
$filetomake = "$ikondir" . "members/$cleanmembername.cgi";
$filetomake = &stripMETA($filetomake);
open(FILE, ">$filetomake");
flock(FILE, 2) if ($OS_USED eq "Unix");
print FILE "$inmembername|$password|$membertitle|$membercode|$numberofposts|$emailaddress|$showemail|$ipaddress|$homepage|$aolname|$icqnumber|$location|$interests|$joineddate|$lastpostdate|$signature|$timedifference|$privateforums|$useravatar|$misc1|$misc2|$misc3|$personalavatar|$personalwidth|$personalheight|";
close(FILE);
$filetoopen = "$ikondir" . "data/allforums.cgi";
$filetoopen = &stripMETA($filetoopen);
open(FILE, "$filetoopen");
flock (FILE, 1) if ($OS_USED eq "Unix");
@allforums = <FILE>;
close(FILE);
$filetomake = "$ikondir" . "data/allforums.cgi";
$filetomake = &stripMETA($filetomake);
open(FILE, ">$filetomake");
flock(FILE, 2) if ($OS_USED eq "Unix");
foreach $forum (@allforums) { #start foreach @forums
chomp($forum);
($tempno, $trash) = split(/\|/,$forum);
if ($inforum eq $tempno) {
($forumid, $category, $categoryplace, $forumname, $forumdescription, $forummoderator ,$htmlstate ,$idmbcodestate ,$privateforum, $startnewthreads ,$lastposter ,$lastposttime, $threads, $posts, $forumgraphic) = split(/\|/,$forum);
$lastposter = $inmembername;
$lastposttime = $currenttime;
$posts++;
print FILE "$forumid|$category|$categoryplace|$forumname|$forumdescription|$forummoderator|$htmlstate|$idmbcodestate|$privateforum|$startnewthreads|$lastposter|$lastposttime|$threads|$posts|$forumgraphic|\n";
}
else { print FILE "$forum\n"; }
}
close(FILE);
require "$ikondir" . "data/boardstats.cgi";
$filetomake = "$ikondir" . "data/boardstats.cgi";
$filetomake = &stripMETA($filetomake);
$totalposts++;
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);
### email functions
# First, lets open the maildata file, and add (if needed) the new requestee.
if ($emailfunctions eq "on") { # start mail
$filetoopen = "$ikondir" . "forum$inforum/$intopic.mal";
open (FILE, "$filetoopen");
@maildata = <FILE>;
close (FILE);
if ($innotify eq "yes") {
open (FILE, ">$filetoopen");
flock (FILE, 2) if ($OS_USED eq "Unix");
print FILE "$inmembername|$emailaddress|\n";
foreach $line (@maildata) {
chomp $line;
print FILE "$line\n";
}
close (FILE);
}
# Lets sort the data (there's no point adding the new requestee at this point!)
foreach $dataline (@maildata) {
($postersname,$posteremailaddress) = split(/\|/,$dataline);
if ($lastemailsent ne $postersname) {
# No point in getting your own post emailed to you, so...
if ($inmembername eq $postersname) { next; }
# If not,carry on!
$output .= "\n\n<!-- 处理 Email 发送 --> \n\n";
$toemail = "$posteremailaddress";
chomp $toemail;
$toemail =~ s/\\//g;
$fromemail = "$adminemail_out";
chomp $fromemail;
$fromemail =~ s/\\//g;
$topictitle =~ s/"\;/\"/g;
$topicdescription =~ s/"\;/\"/g;
$to = "$toemail";
$from = "$boardname <$fromemail>";
$subject = "[$forumname] 回复通知";
$message .= "$boardname\n";
$message .= "$boardurl/$forumsummaryprog\n";
$message .= "---------------------------------------------------------------------\n\n";
$message .= "$postersname, 你的贴子有了一个新回复!\n\n";
$message .= "回复人: $inmembername\n";
$message .= "分类: $category\n";
$message .= "论坛: $forumname\n";
$message .= "主题: $topictitle\n";
$message .= "点击下面的链接去查看详细内容:\n\n";
$message .= "$boardurl/$threadprog?forum=$inforum&topic=$intopic\n\n";
$message .= "---------------------------------------------------------------------\n";
&sendmail($from, $emailaddress, $to, $SMTP_SERVER, $subject, $message);
$lastemailsent = "$postersname";
# trash the details, just to be safe.
$message = "";
$to = "";
$from = "";
$subject = "";
} # end if
} # end foreach
} # end email send.
$numberofitems = $totalthreadposts + 1;
$numberofpages = $numberofitems / $maxthreads;
if ($numberofitems > $maxthreads) { #1
if ($maxthreads < $numberofitems) { #2
($integer,$decimal) = split(/\./,$numberofpages);
if ($decimal > 0) { $numberofpages = $integer + 1; }
$pagestart = 0;
$counter = 0;
while ($numberofpages > $counter) { #3
$counter++;
$threadpages .= qq~ <a href="$threadprog?forum=$inforum&topic=$topicid&start=$pagestart">$counter</a> ~;
$pagestart = $pagestart + $maxthreads;
} #e3
} #e2
$pagestoshow = qq~<font face="$font" color=$forumfontcolor> [ 第 $threadpages页 ]~;
} #e1
&mischeader("回复成功");
if ($refreshurl == 1) {
$relocurl = "$threadprog?forum=$inforum&topic=$intopic";
}
else {
$relocurl = "$forumsprog?forum=$inforum";
}
$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><a href="$threadprog?forum=$inforum&topic=$intopic">返回主题</a> $pages
<li><a href="$forumsprog?forum=$inforum">返回论坛</a>
<li><a href="$forumsummaryprog">返回论坛首页</a>
<li><a href="$postingsprog?action=lock&forum=$inforum&topic=$intopic">锁定贴子</a>
</ul>
</tr>
</td>
</table></td></tr></table>
<meta http-equiv="refresh" content="3; url=$relocurl">
~;
rebuildLIST(-Forum=>"$inforum");
} # end else
} # end addreply
###########################
# Thread Review
sub threadreview {
if ($badwords) {
@pairs = split(/\&/,$badwords);
foreach (@pairs) {
($bad, $good) = split(/=/,$_);
chop $good;
$topictitle =~ s/$bad/$good/isg;
}
}
$output .= qq~
<p>
<table cellpadding=0 cellspacing=0 border=0 width=$tablewidth bgcolor=$tablebordercolor align=center>
<tr><td>
<table cellpadding=8 cellspacing=1 border=0 width=100%>
<tr>
<td bgcolor=$titlecolor colspan=2><font face="$font" color=$titlefontcolor><b>贴子预览 $topictitle (新回复在最前)</b></td>
~;
foreach $threadline (@sortedthreads) {
($membername, $topictitle, $postipaddress ,$showemoticons ,$showsignature ,$postdate ,$post, $posticon) = split(/\|/, $threadline);
$postdate = $postdate + ($timedifferencevalue*3600) + ($timezone*3600);
$postdate = &dateformat("$postdate");
$post = &ikoncode("$post");
$post = &doemoticons("$post");
if (($emoticons eq 'on') && ($showemoticons eq 'yes')) {
$post = &smilecode("$post");
}
if ($badwords) {
@pairs = split(/\&/,$badwords);
foreach (@pairs) {
($bad, $good) = split(/=/,$_);
chop $good;
$post =~ s/$bad/$good/isg;
}
}
$output .= qq~
<tr>
<td bgcolor="$miscbackone" rowspan=2 valign="top" width=20%><font face="$font" color=$fontcolormisc>
<b>$membername</b></font></td>
<td bgcolor="$miscbackone"><font face="$font" color=$fontcolormisc><b>发表于: $postdate</b></td>
</tr>
<tr>
<td bgcolor="$miscbackone"><font face="$font" color=$fontcolormisc>$post</td>
</tr>
<tr>
<td colspan=2 bgcolor="$miscbacktwo"> </td>
</tr>
~;
} # end foreach
$output .= qq~</table></td></tr></table>~;
} # end routine
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -