📄 forumoptions.cgi
字号:
#!/usr/bin/perl
#############################################################
# Ikonboard v2.1
# Copyright 2000 Ikondiscussion.com - All Rights Reserved
# Ikondiscussion is a trademark of Ikondiscussion.com
#
# Software Distributed by: Ikondiscussion.com
# Visit us online at http://www.ikondiscussion.com
# Email us on boards@ikondiscussion.com
#
# All files written by Matthew Mecham
#############################################################
#use CGI::Carp "fatalsToBrowser"; # Output errors to browser
use CGI qw(:standard); # Saves loads of work
$CGI::POST_MAX=1024 * 150; # limit post data
$CGI::DISABLE_UPLOADS = 1; # Disable uploads
eval {
($0 =~ m,(.*)/[^/]+,) and unshift (@INC, "$1");
($0 =~ m,(.*)\\[^\\]+,) and unshift (@INC, "$1");
require "ikon.lib"; # Require ikonboard ()
require "data/progs.cgi"; # Require prog names
require "data/boardinfo.cgi";# Require board info
require "data/styles.cgi"; # Require styles info
};
if ($@) {
print header(-charset=>"gb2312"); print start_html(-title=>"Ikonboard Error!");
print "不能够找到文件:$@\n如果您使用的是 Windows 类操作系统,请在每一个程序中更改 require 的设置,填入绝对路径!";
print end_html; exit;
}
$|++; # Unbuffer the output
#################--- Begin the program ---###################
$thisprog = "forumoptions.cgi";
$query = new CGI;
&checkVALIDITY;
$checked = $query -> param('checked');
$inforum = $query -> param('forum');
$intopic = $query -> param('topic');
$action = $query -> param('action');
$prunedays = $query -> param('prunedays');
$inmembername = $query -> param('membername');
$inpassword = $query -> param('password');
$inforum = &stripMETA("$inforum");
$intopic = &stripMETA("$intopic");
$action = &stripMETA("$action");
$prunedays = &stripMETA("$prunedays");
$inmembername = &stripMETA("$inmembername");
$inpassword = &stripMETA("$inpassword");
print header(-charset=>"gb2312");
if (($inforum !~ m|([0-9\G]+$)|g) or (!$inforum)) { &error("普通&请不要修改生成的 URL!"); }
if (($prunedays) && ($prunedays !~ /^[0-9]+$/)) { &error("普通&请不要修改生成的 URL!"); }
if (! $inmembername) { $inmembername = cookie("amembernamecookie"); }
if (! $inpassword) { $inpassword = cookie("apasswordcookie"); }
&moderator;
if ($action eq "prune") {
&getmember("$inmembername");
&moderator;
# &error("使用批量删除&请完整填写表单!") if (!$inmembername);
# &error("使用批量删除&请完整填写表单!") if (!$inpassword);
# &error("使用批量删除&没有找到相应的用户!") if ($userregistered eq "no");
$cleartoedit = "no";
&mischeader("批量删除");
if (($membercode eq "ad") && ($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")) {
if (! $prunedays) { &error("使用批量删除&指定删除的天数要大于 0 !"); }
### Grab the list from the forum folder.
$filetoopen = "$ikondir" . "forum$inforum/list.cgi";
$filetoopen = &stripMETA($filetoopen);
open(FILE, "$filetoopen") or die "无法定位所需文件!";
@topics = <FILE>;
close(FILE);
foreach (@topics) {
($topicid, $tr, $tr, $tr, $tr, $tr, $tr, $tr, $tr, $lastpostdate) = split(/\|/,$_);
$currenttime = time;
$threadagelimit = $currenttime - ($prunedays * 86400);
if ($lastpostdate < $threadagelimit) {
$filetoopen = "$ikondir" . "forum$inforum/$topicid.thd";
$filetoopen = &stripMETA($filetoopen);
open (FILE, "$filetoopen");
@temppostcount = <FILE>;
close (FILE);
$postcount = @temppostcount;
$postcount--;
$filetotrash = "$ikondir" . "forum$inforum/$topicid.thd";
unlink $filetotrash;
$filetotrash = "$ikondir" . "forum$inforum/$topicid.mal";
unlink $filetotrash;
$filetotrash = "$ikondir" . "forum$inforum/$topicid.pl";
unlink $filetotrash;
$totaltopics_deleted++;
$totalposts_deleted = $totalposts_deleted + $postcount;
}
}
### Recreate the list:
rebuildLIST(-Forum=>"$inforum");
### Update the post counts
$filetoopen = "$ikondir" . "data/allforums.cgi";
$filetoopen = &stripMETA($filetoopen);
open(FILE, "$filetoopen") or die "无法定位所需文件!";
@allforums = <FILE>;
close(FILE);
$filetomake = "$ikondir" . "data/allforums.cgi";
$filetomake = &stripMETA($filetomake);
open(FILE, ">$filetomake") or die "无法定位所需文件!";
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);
$posts = $posts - $totalposts_deleted;
$threads = $threads - $totaltopics_deleted;
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";
$totalthreads = $totalthreads - $totaltopics_deleted;
$totalposts = $totalposts - $totalposts_deleted;
open(FILE, ">$filetomake") or die "无法定位所需文件!";
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);
if (! $totaltopics_deleted) { $totaltopics_deleted = "no"; }
if (! $totalposts_deleted) { $totalposts_deleted = "no"; }
$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>共删除主题:$totaltopics_deleted 篇
<li>共删除回复:$totalposts_deleted 篇
<li><a href="$forumsprog?forum=$inforum">返回论坛</a>
<li><a href="$forumsummaryprog">返回论坛首页</a>
</ul>
</tr>
</td>
</table></td></tr></table>
~;
} # end if clear to edit
else {
&mischeader("批量删除");
$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 colspan=2 align=center>
<form action="$thisprog" method="post">
<input type=hidden name="action" value="prune">
<input type=hidden name="checked" value="yes">
<input type=hidden name="forum" value="$inforum">
<font face="$font" color=$fontcolormisc><b>请输入您的详细资料以便进入删除模式[批量删除]</b></font></td></tr>
<tr>
<td bgcolor=$miscbackone valign=middle colspan=2><font face="$font" color=$fontcolormisc><b>一旦您删除了文章,将不能够恢复!</b>
<br>下面将删除发表时间超过一定天数外的所有文章。如果您确定这样做,请仔细检查您输入的信息。</font></td>
<tr>
<td bgcolor=$miscbackone valign=middle><font face="$font" color=$fontcolormisc>您的用户名</font></td>
<td bgcolor=$miscbackone valign=middle><input type=text name="membername" value="$inmembername"0></td></tr>
<tr>
<td bgcolor=$miscbackone valign=middle><font face="$font" color=$fontcolormisc>您的密码</font></td>
<td bgcolor=$miscbackone valign=middle><input type=password name="password" value="$inpassword"0></td></tr>
<tr>
<td bgcolor=$miscbackone valign=middle><font face="$font" color=$fontcolormisc>删除多少天以外的文章<br>例如:输入'30',将删除超过 30 天的所有文章。</font></td>
<td bgcolor=$miscbackone valign=middle><input type=text name="prunedays"0></td></tr>
<tr>
<td bgcolor=$miscbacktwo valign=middle colspan=2 align=center><input type=submit name="submit" value="提 交"></td></tr></form></table></td></tr></table>
</table></td></tr></table>
~;
}
} # end massprune
else { &error("普通&未指定功能名!"); }
&output(
-Title => "$boardname - 批量删除",
-ToPrint => $output,
-Version => $versionnumber
);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -