📄 jinghua.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 {
$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");
}
use LBCGI;
use File::Copy;
$LBCGI::POST_MAX=2000;
$LBCGI::DISABLE_UPLOADS = 1;
$LBCGI::HEADERS_ONCE = 1;
require "data/boardinfo.cgi";
require "data/styles.cgi";
require "code.cgi";
require "lb.lib.pl";
require "rebuildlist.pl";
$|++;
$thisprog = "jinghua.cgi";
$query = new LBCGI;
&ipbanned; #封杀一些 ip
$inshow = $query -> param('show');
$inshow = &stripMETA("$inshow");
for ('forum','topic','membername','password','action','checked','movetoid') {
next unless defined $_;
next if $_ eq 'SEND_MAIL';
$tp = $query->param($_);
$tp = &cleaninput("$tp");
${$_} = $tp;
}
$inforum = $forum;
$intopic = $topic;
$inmembername = $membername;
$inpassword = $password;
@intopic=split(/ /,$intopic);
$intopic=~ s/ //g;
&error("打开文件&老大,别乱黑我的程序呀!") if (($intopic) && ($intopic !~ /^[0-9]+$/));
&error("打开文件&老大,别乱黑我的程序呀!") if (($inforum) && ($inforum !~ /^[0-9]+$/));
if (-e "${lbdir}data/style${inforum}.cgi") { require "${lbdir}data/style${inforum}.cgi"; }
print header(-charset=>gb2312);
if (($inforum) && ($inforum !~ /^[0-9]+$/)) { &error("普通错误&请不要修改生成的 URL!"); }
if (($intopic ) && ($intopic !~ /^[0-9]+$/)) { &error("普通错误&请不要修改生成的 URL!"); }
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 = "客人";
}
else
{
# &getmember("$inmembername");
&getmembernolock("$inmembername");
&error("普通错误&密码与用户名不相符,请重新登录!") if ($inpassword ne $password);
&error("普通错误&此用户根本不存在!") if ($userregistered eq "no");
}
&getoneforum("$inforum");
#&moderator("$inforum");
my %Mode = (
'add' => \&add,
'del' => \&del,
);
if($Mode{$action}) {
$Mode{$action}->();
}
elsif (($inforum ne "")&&($action eq "list")) { &list; }
else { &error("普通&请以正确的方式访问本程序"); }
&output(
-Title => $boardname,
-ToPrint => $output,
-Version => $versionnumber
);
sub add {
$cleartoedit = "no";
&mischeader("标记精华贴子");
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") { &error("标记精华贴子&您不是本论坛坛主或版主,或者您的密码错误!"); }
if (($cleartoedit eq "yes") && ($checked eq "yes")) {
my $file = "$lbdir" . "boarddata/jinghua$inforum.cgi";
if (open (ENT, $file)) {
@toptopic = <ENT>;
close (ENT);
$jhdata = join("\_",@toptopic);
$jhdata = "\_$jhdata\_";
$jhdata =~ s/\W//isg;
if (open (ENT, ">$file")) {
undef @intopictemp;
$jhdata1 = "\_";
foreach (@intopic){
chomp $_;
if ((-e "${lbdir}forum$inforum/$_.thd.cgi")&&($_ ne "")) {
print ENT "$_\n";
$jhdata1 = "\_$_$jhdata1";
push(@intopictemp, $_);
}
}
foreach (@toptopic) {
chomp $_;
if ((-e "${lbdir}forum$inforum/$_.thd.cgi")&&($_ ne "")&&($jhdata1 !~ /\_$_\_/)) {
print ENT "$_\n";
$jhdata1 = "$jhdata1\_$_";
}
}
close (ENT);
}
}
else {
if (open (ENT, ">$file")) {
$jhdata = "\_";
undef @intopictemp;
foreach (@intopic){
chomp $_;
if ((-e "${lbdir}forum$inforum/$_.thd.cgi")&&($_ ne "")&&($jhdata !~ /\_$_\_/)) {
print ENT "$_\n";
$jhdata = "\_$_$jhdata";
push(@intopictemp, $_);
}
}
close (ENT);
}
}
@intopic = @intopictemp;
undef @intopictemp;
$alloldposts = @intopic;
if ($movetoid ne ""){
if ($movetoid == $inforum) { &error("拷贝主题&不允许在同个论坛上拷贝主题!"); }
my @inforumwrite;
$alloldthreadposts = 0;
opendir (DIR, "${imagesdir}usr/$inforum");
@files = readdir(DIR);
closedir (DIR);
foreach $intopic (@intopic) {
$currenttime = time;
if ($newthreadnumber eq "") {
if (open(FILE, "${lbdir}boarddata/lastnum$movetoid.cgi")) {
$newthreadnumber = <FILE>;
close(FILE);
chomp $newthreadnumber;
$newthreadnumber ++;
}
}
else { $newthreadnumber ++; }
unless ((!(-e "${lbdir}forum$movetoid/$newthreadnumber.pl"))&&($newthreadnumber =~ /^[0-9]+$/)) {
opendir (DIR, "${lbdir}forum$movetoid");
@sorteddirdata = readdir(DIR);
closedir (DIR);
@sorteddirdata = grep(/.thd.cgi$/,@sorteddirdata);
@sorteddirdata = sort {$b <=> $a} (@sorteddirdata);
$highestno = $sorteddirdata[0];
undef @sorteddirdata;
$highestno =~ s/.thd.cgi$//;
$newthreadnumber = $highestno + 1;
}
$intopic =~ s/\W//isg;
chomp $intopic;
open (ENT, "${lbdir}forum$inforum/$intopic.pl");
$in = <ENT>;
close (ENT);
chomp $in;
($topicid, $topictitle, $topicdescription1, $threadstate, $threadposts ,$threadviews, $startedby, $startedpostdate, $lastposter, $lastpostdate, $lastinposticon, $inposttemp) = split(/\t/,$in);
$inforumwrite = "$newthreadnumber\t$topictitle\t\t$threadstate\t$threadposts\t$threadviews\t$startedby\t$startedpostdate\t$lastposter\t$currenttime\t$lastinposticon\t$inposttemp\t";
if (open(FILE, ">${lbdir}forum$movetoid/$newthreadnumber.pl")) {
print FILE "$inforumwrite";
close(FILE);
}
push (@inforumwrite, "$inforumwrite");
$filetoopen = "${lbdir}forum$inforum/$intopic.thd.cgi";
open(FILE, "$filetoopen");
my @oldforummessages = <FILE>;
close(FILE);
$oldthreadposts = @oldforummessages - 1;
$alloldthreadposts = $alloldthreadposts + $oldthreadposts;
copy("${lbdir}forum$inforum/$intopic.thd.cgi", "${lbdir}forum$movetoid/$newthreadnumber.thd.cgi") if (-e "${lbdir}forum$inforum/$intopic.thd.cgi");
copy("${lbdir}forum$inforum/$intopic.mal.pl", "${lbdir}forum$movetoid/$newthreadnumber.mal.pl") if (-e "${lbdir}forum$inforum/$intopic.mal.pl");
copy("${lbdir}forum$inforum/$intopic.poll.cgi", "${lbdir}forum$movetoid/$newthreadnumber.poll.cgi") if (-e "${lbdir}forum$inforum/$intopic.poll.cgi");
copy("${lbdir}forum$inforum/rate$intopic.file.pl", "${lbdir}forum$movetoid/rate$newthreadnumber.file.pl") if (-e "${lbdir}forum$inforum/rate$intopic.file.pl");
copy("${lbdir}forum$inforum/rateip$intopic.file.pl","${lbdir}forum$movetoid/rateip$newthreadnumber.file.pl") if (-e "${lbdir}forum$inforum/rateip$intopic.file.pl");
@files1 = grep(/^$inforum\_$intopic\./,@files);
$files1 = @files1;
if ($files1 > 0) {
foreach (@files1) {
(my $name,my $ext) = split(/\./,$_);
copy("${imagesdir}usr/$inforum/$name.$ext","${imagesdir}usr/$movetoid/$movetoid\_$newthreadnumber\.$ext");
}
}
@files1 = grep(/^$inforum\_$intopic\_/,@files);
$files1 = @files1;
if ($files1 > 0) {
foreach (@files1) {
(my $name,my $ext) = split(/\./,$_);
(my $name1,my $name2,my $name3) = split(/\_/,$name);
copy("${imagesdir}usr/$inforum/$name.$ext","${imagesdir}usr/$movetoid/$movetoid\_$newthreadnumber\_$name3\.$ext");
}
}
}
$file = "$lbdir" . "boarddata/list$movetoid.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>;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -