📄 postings.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 {
$start_time = (times)[0] + (times)[1];
$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");
# $ENV{'TMP'}="$LBPATH/lock"; #如果你不能上传图片,请去掉前面的#
# $ENV{'TEMP'}="$LBPATH/lock";#如果你不能上传图片,请去掉前面的#
}
use LBCGI;
use File::Copy;
use Image::Info qw(image_info);
$LBCGI::DISABLE_UPLOADS = 1;
$LBCGI::HEADERS_ONCE = 1;
$LBCGI::POST_MAX=1024 * 150;
require "code.cgi";
require "data/boardinfo.cgi";
require "data/styles.cgi";
require "lb.lib.pl";
require "postjs.cgi";
require "rebuildlist.pl";
$|++;
$thisprog = "postings.cgi";
$query = new LBCGI;
for ('forum','topic','membername','password','action','inpost','checked') {
next unless defined $_;
next if $_ eq 'SEND_MAIL';
$tp = $query->param($_);
$tp = &cleaninput("$tp");
${$_} = $tp;
}
$inforum = $forum;
$intopic = $topic;
&error("打开文件&老大,别乱黑我的程序呀!") if (($intopic) && ($intopic !~ /^[0-9 ]+$/));
&error("打开文件&老大,别乱黑我的程序呀!") if ($inforum !~ /^[0-9 ]+$/);
$inmembername = $membername;
$inpassword = $password;
$currenttime = time;
if (-e "${lbdir}data/style${inforum}.cgi") { require "${lbdir}data/style${inforum}.cgi"; }
print header(-charset=>gb2312);
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 eq "" || $inmembername eq "客人" ) {
$inmembername = "客人";
} else {
# &getmember("$inmembername");
&getmembernolock("$inmembername");
&error("普通错误&此用户根本不存在!") if ($userregistered eq "no");
&error("普通错误&密码与用户名不相符,请重新登录!") if ($inpassword ne $password);
}
$cpudisp = 1 if (($membercode eq "ad")||($membercode eq "smo")||($membercode eq "cmo"));
#&getoneforum("$inforum");
&moderator("$inforum");
my %Mode = (
'lock' => \&lockthread,
'unlock' => \&unlockthread,
'puttop' => \&puttop,
'repireforum' => \&repireforum,
'locktop' => \&locktop,
'unlocktop' => \&unlocktop,
'catlocktop' => \&catlocktop,
'catunlocktop' => \&catunlocktop,
'abslocktop' => \&abslocktop,
'absunlocktop' => \&absunlocktop,
);
if ($Mode{$action}) { $Mode{$action}->(); } else { &error("普通&请以正确的方式访问本程序"); }
&output( -Title => $boardname, -ToPrint => $output, -Version => $versionnumber );
exit;
sub lockthread {
&mischeader("主题锁定");
$cleartoedit = "no";
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"; }
open (ENT, "${lbdir}forum$inforum/$intopic.pl");
$in = <ENT>;
close (ENT);
chomp $in;
($topicid, $topictitle, $topicdescription, $threadstate, $threadposts ,$threadviews, $startedby, $startedpostdate, $lastposter, $lastpostdate, $inposticon, $inposttemp) = split(/\t/,$in);
$topictitle =~ s/^*#!&*//;
if ($arrowuserdel eq "on") {
if ((lc($inmembername) eq lc($startedby)) && ($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 (($threadstate eq "poll")||($threadstate eq "pollclosed")) { $threadstate = "pollclosed"; } else { $threadstate = "closed"; }
if (open(FILE, ">${lbdir}forum$inforum/$intopic.pl")) {
print FILE "$intopic\t$topictitle\t$topicdescription\t$threadstate\t$threadposts\t$threadviews\t$startedby\t$startedpostdate\t$lastposter\t$lastpostdate\t$inposticon\t$inposttemp\t";
close(FILE);
}
$file = "$lbdir" . "boarddata/list$inforum.cgi";
&winlock($file) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
open (LIST, "$file");
flock (LIST, 1) if ($OS_USED eq "Unix");
@listall=<LIST>;
close (LIST);
if ($#listall >= 200) {
if (open (LIST, ">$file")) {
flock (LIST, 2) if ($OS_USED eq "Unix");
foreach (@listall) {
chomp $_;
(my $listone, my $noneed) = split(/\t/,$_);
next if ($listone !~ /^[0-9]+$/);
if ($listone ne $intopic) {
print LIST "$_\n";
}
else {
print LIST "$intopic\t$topictitle\t$topicdescription\t$threadstate\t$threadposts\t$threadviews\t$startedby\t$startedpostdate\t$lastposter\t$lastpostdate\t$inposticon\t$inposttemp\t\n";
}
}
close (LIST);
}
&winunlock($file) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
}
else {
&winunlock($file) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
rebuildLIST(-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 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 {
$inmembername =~ s/\_/ /g;
$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">
<input type=hidden name="action" value="lock">
<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><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=$miscbacktwo colspan=2 align=center><input type=submit name="submit" value="登 陆"></td></form></tr></table></td></tr></table>
</table></td></tr></table>
~;
}
}
sub unlockthread {
&mischeader("主题解锁");
$cleartoedit = "no";
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"; }
unless ($cleartoedit eq "yes") { $cleartoedit = "no"; }
if ($cleartoedit eq "no" && $checked eq "yes") { &error("主题解锁&您不是本论坛坛主或版主,或者您的密码错误!"); }
if (($cleartoedit eq "yes") && ($checked eq "yes")) {
my $file = "${lbdir}forum$inforum/$intopic.pl";
open (ENT, $file);
$in = <ENT>;
close (ENT);
chomp $in;
($topicid, $topictitle, $topicdescription, $threadstate, $threadposts ,$threadviews, $startedby, $startedpostdate, $lastposter, $lastpostdate,$inposticon, $inposttemp) = split(/\t/,$in);
$topictitle =~ s/^*#!&*//;
if (($threadstate eq "pollclosed")||($threadstate eq "poll")) { $threadstate = "poll"; } else { $threadstate = "open"; }
if (open(FILE, ">$file")) {
print FILE "$intopic\t$topictitle\t$topicdescription\t$threadstate\t$threadposts\t$threadviews\t$startedby\t$startedpostdate\t$lastposter\t$lastpostdate\t$inposticon\t$inposttemp\t";
close(FILE);
}
$file = "${lbdir}boarddata/list$inforum.cgi";
&winlock($file) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
open (LIST, "$file");
flock (LIST, 1) if ($OS_USED eq "Unix");
@listall=<LIST>;
close (LIST);
if ($#listall >= 200) {
if (open (LIST, ">$file")) {
flock (LIST, 2) if ($OS_USED eq "Unix");
foreach (@listall) {
chomp $_;
($listone,$noneed) = split(/\t/,$_);
next if ($listone !~ /^[0-9]+$/);
if ($listone ne $intopic) {
print LIST "$_\n";
}
else {
print LIST "$intopic\t$topictitle\t$topicdescription\t$threadstate\t$threadposts\t$threadviews\t$startedby\t$startedpostdate\t$lastposter\t$lastpostdate\t$inposticon\t$inposttemp\t\n";
}
}
close (LIST);
}
&winunlock($file) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
} else {
&winunlock($file) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
rebuildLIST(-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 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 {
$inmembername =~ s/\_/ /g;
$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">
<input type=hidden name="action" value="unlock">
<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><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=$miscbacktwo colspan=2 align=center><input type=submit name="submit" value="登 陆"></td></form></tr></table></td></tr></table>
</table></td></tr></table>
~;
}
}
sub repireforum {
&mischeader("论坛修复");
$cleartoedit = "no";
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"; }
unless ($cleartoedit eq "yes") { $cleartoedit = "no"; }
if ($cleartoedit eq "no" && $checked eq "yes") { &error("论坛修复&您不是本论坛坛主或版主,或者您的密码错误!"); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -