⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 attachadmin.cgi

📁 一个linux论坛
💻 CGI
📖 第 1 页 / 共 3 页
字号:
	}
	if($nforum ne $forum){
move("$attachdir/$attachfiles[0]","$nattachdir/$newfilename");
	}else{
rename("$attachdir/$attachfiles[0]","$nattachdir/$newfilename");
	}
$forumlist=(join("\n",@forums))."\n";
$forumlist=~s/(.+?)\t(.+?)\t(.+?)\t(.+?)\t(.+?)\n/<option value="$1">$4<\/option>/g;
if($forumlist=~/<option value="$nforum">(.+?)<\/option>/){
$forumname=$1;
}
	print qq~
	<tr><td bgcolor="#FFFFFF" align=center valign="top" height="*">
	<table width=100% cellspacing="0" cellpadding="2">
	<tr><td width="25%" align="right">原附件名称:</td><td colspan="3">$attachfiles[0]</td></tr>
	<tr><td width="25%" align="right">新附件名称:</td><td colspan="3">$newfilename</td></tr>
	<tr><td width="25%" align="right">現所在分论坛:</td><td colspan="3">$forumname</td></tr>
	<tr><td width="25%" align="right">主题编号:</td><td width="25%">$ntopic</td><td width="25%" align="right">回覆编号:</td><td width="25%">$nreply</td></tr>
	<tr><td width="100%" colspan="4" align="center">移动完成</td></tr>
	</table>
	</td></tr>
	<script>opener.location.reload();setTimeout("self.close()",3000);</script>
	~;
	}else{
$forumlist=(join("\n",@forums))."\n";
$forumlist=~s/(.+?)\t(.+?)\t(.+?)\t(.+?)\t(.+?)\n/<option value="$1">$4<\/option>/g;
if($forumlist=~/<option value="$forum">(.+?)<\/option>/){
$forumname=$1;
}
$forumlist =~ s/option value=\"$forum\"/option value=\"$forum\" selected style='color:"#990000"'>>/g;
	print qq~
<script language="JavaScript" type="text/javascript">
function CheckTopic(forumid,topicid,replyid){
creplyid=replyid;
	while(creplyid > $maxtopics){
creplyid-=$maxtopics;
	}
start=creplyid*$maxtopics;
window.open("topic.cgi?forum="+forumid+"&topic="+topicid+"&start="+start+"#"+replyid);
}
</script>
	<tr><form action="$thisprog" method=post name=form><td bgcolor="#FFFFFF" align=center valign="top" height="*">
	<table width=100% cellspacing="0" cellpadding="2">
	<tr><td width="25%" align="right">附件名称:</td><td colspan="3">$attachfiles[0]</td></tr>
	<tr><td width="25%" align="right">所在分论坛:</td><td colspan="3">$forumname</td></tr>
	<tr><td width="25%" align="right">目标分论坛:</td><td colspan="3"><select name="nforum" style="width:100%">$forumlist</select></td></tr>
	<tr><td width="25%" align="right">目标主题编号:</td><td width="25%"><input type="text" name="ntopic" value="$topic" style="width:100%"></td><td width="25%" align="right">回覆编号:</td><td width="25%"><input type="text" name="nreply" value="$reply" style="width:100%"></td></tr>
	<tr><td width="100%" colspan="4" align="center"><input type="hidden" name="forum" value="$forum"><input type="hidden" name="topic" value="$topic"><input type="hidden" name="reply" value="$reply"><input type="hidden" name="count" value="$count"><input type="hidden" name="action" value="moveattach"><input type="hidden" name="start" value="checked"><input type="submit" value="确定移动"> <input type="button" value="检查文章" onClick="CheckTopic(this.form.nforum.value,this.form.ntopic.value,this.form.nreply.value);"></td></tr>
	</table>
	</td></form></tr>
	~;
	}
}
sub copyattach{
	print qq~<tr><td bgcolor="#333333" height="20"><font color="#FFFFFF">
	<b>论坛管理中心 / 复制文章附件</b>
	</td></tr>~;
	if($forum eq "" || $topic eq ""){
	&erroroutsmall("分论坛与主题编号不能为空!");return;
	}
	$attachdir="${imagesdir}usr/$forum";
	if(!-d $attachdir){
	&erroroutsmall("找不到附件目录 - $attachdir");return;
	}
opendir(DIR,"$attachdir");
	if($count == 0){
@attachfiles=grep(/^$forum\_$topic./,readdir(DIR)) if($reply == 0);
@attachfiles=grep(/^$forum\_$topic\_$reply./,readdir(DIR)) if($reply > 0);
	}else{
@attachfiles=grep(/^$forum\_$topic.$count./,readdir(DIR)) if($reply == 0);
@attachfiles=grep(/^$forum\_$topic\_$reply.$count./,readdir(DIR)) if($reply > 0);
	}
closedir(DIR);
chomp @attachfiles;
	if($#attachfiles < 0){
	&erroroutsmall("找不到该附件!");return;
	}
my $filetoopen = "$lbdir" . "data/allforums.cgi";
$filetoopen = &stripMETA($filetoopen);
open(FILE, "$filetoopen");
flock(FILE, 2) if ($OS_USED eq "Unix");
my @forums = <FILE>;
close(FILE);
chomp @forums;
	if($start eq "checked"){
	if($nforum eq "" || $ntopic eq ""){
	&erroroutsmall("新分论坛与主题编号不能为空!");return;
	}
	if($forum eq $nforum && $topic eq $ntopic && $reply eq $nreply){
	&erroroutsmall("新分论坛不能和旧编号相同!");return;
	}
	@checktopic=&getpl($nforum,$ntopic);
	if($#checktopic == 0){
	&erroroutsmall("找不到该主题");return;
	}elsif($nreply > $checktopic[3]){
	&erroroutsmall("找不到该回覆");return;
	}
	$nattachdir="${imagesdir}usr/$nforum";
	@oldfilename=split(/\./,$attachfiles[0]);
	$fileext=pop(@oldfilename);
	$newfilename="$nforum\_$ntopic";
	$newfilename.="\_$nreply" if($nreply > 0);
	$newfilename.=".$count" if($count > 0);
	$newfilename.=".$fileext";
	if(-e "$nattachdir/$newfilename"){
	&erroroutsmall("该文章已有附件存在!");return;
	}
copy("$attachdir/$attachfiles[0]","$nattachdir/$newfilename");
$forumlist=(join("\n",@forums))."\n";
$forumlist=~s/(.+?)\t(.+?)\t(.+?)\t(.+?)\t(.+?)\n/<option value="$1">$4<\/option>/g;
if($forumlist=~/<option value="$nforum">(.+?)<\/option>/){
$forumname=$1;
}
	print qq~
	<tr><td bgcolor="#FFFFFF" align=center valign="top" height="*">
	<table width=100% cellspacing="0" cellpadding="2">
	<tr><td width="25%" align="right">原附件名称:</td><td colspan="3">$attachfiles[0]</td></tr>
	<tr><td width="25%" align="right">新附件名称:</td><td colspan="3">$newfilename</td></tr>
	<tr><td width="25%" align="right">所在分论坛:</td><td colspan="3">$forumname</td></tr>
	<tr><td width="25%" align="right">主题编号:</td><td width="25%">$ntopic</td><td width="25%" align="right">回覆编号:</td><td width="25%">$nreply</td></tr>
	<tr><td width="100%" colspan="4" align="center">复制完成</td></tr>
	</table>
	</td></tr>
	<script>opener.location.reload();setTimeout("self.close()",3000);</script>
	~;
	}else{
$forumlist=(join("\n",@forums))."\n";
$forumlist=~s/(.+?)\t(.+?)\t(.+?)\t(.+?)\t(.+?)\n/<option value="$1">$4<\/option>/g;
if($forumlist=~/<option value="$forum">(.+?)<\/option>/){
$forumname=$1;
}
$forumlist =~ s/option value=\"$forum\"/option value=\"$forum\" selected style='color:"#990000"'>>/g;
	print qq~
<script language="JavaScript" type="text/javascript">
function CheckTopic(forumid,topicid,replyid){
creplyid=replyid;
	while(creplyid > $maxtopics){
creplyid-=$maxtopics;
	}
start=creplyid*$maxtopics;
window.open("topic.cgi?forum="+forumid+"&topic="+topicid+"&start="+start+"#"+replyid);
}
</script>
	<tr><form action="$thisprog" method=post name=form><td bgcolor="#FFFFFF" align=center valign="top" height="*">
	<table width=100% cellspacing="0" cellpadding="2">
	<tr><td width="25%" align="right">附件名称:</td><td colspan="3">$attachfiles[0]</td></tr>
	<tr><td width="25%" align="right">所在分论坛:</td><td colspan="3">$forumname</td></tr>
	<tr><td width="25%" align="right">目标分论坛:</td><td colspan="3"><select name="nforum" style="width:100%">$forumlist</select></td></tr>
	<tr><td width="25%" align="right">目标主题编号:</td><td width="25%"><input type="text" name="ntopic" value="$topic" style="width:100%"></td><td width="25%" align="right">回覆编号:</td><td width="25%"><input type="text" name="nreply" value="$reply" style="width:100%"></td></tr>
	<tr><td width="100%" colspan="4" align="center"><input type="hidden" name="forum" value="$forum"><input type="hidden" name="topic" value="$topic"><input type="hidden" name="reply" value="$reply"><input type="hidden" name="count" value="$count"><input type="hidden" name="action" value="copyattach"><input type="hidden" name="start" value="checked"><input type="submit" value="确定复制"> <input type="button" value="检查文章" onClick="CheckTopic(this.form.nforum.value,this.form.ntopic.value,this.form.nreply.value);"></td></tr>
	</table>
	</td></form></tr>
	~;
	}
}
sub deleteattach{
	print qq~<tr><form action="$thisprog" method=post name=form><td bgcolor="#333333" height="20"><font color="#FFFFFF">
	<b>论坛管理中心 / 删除文章附件</b>
	</td></tr>~;
	if($forum eq "" || $topic eq ""){
	&erroroutsmall("分论坛与主题编号不能为空!");return;
	}
	$attachdir="${imagesdir}usr/$forum";
	if(!-d $attachdir){
	&erroroutsmall("找不到附件目录 - $attachdir");return;
	}
opendir(DIR,"$attachdir");
	if($count == 0){
@attachfiles=grep(/^$forum\_$topic./,readdir(DIR)) if($reply == 0);
@attachfiles=grep(/^$forum\_$topic\_$reply./,readdir(DIR)) if($reply > 0);
	}else{
@attachfiles=grep(/^$forum\_$topic.$count./,readdir(DIR)) if($reply == 0);
@attachfiles=grep(/^$forum\_$topic\_$reply.$count./,readdir(DIR)) if($reply > 0);
	}
closedir(DIR);
chomp @attachfiles;
	if($#attachfiles < 0){
	&erroroutsmall("找不到该附件!");return;
	}
my $filetoopen = "$lbdir" . "data/allforums.cgi";
$filetoopen = &stripMETA($filetoopen);
open(FILE, "$filetoopen");
flock(FILE, 2) if ($OS_USED eq "Unix");
my @forums = <FILE>;
close(FILE);
chomp @forums;
	if($start eq "checked"){
	unlink("$attachdir/$attachfiles[0]");
	print qq~
	<tr><td bgcolor="#FFFFFF" align=center valign="top" height="*">
	<table width=100% cellspacing="0" cellpadding="2">
	<tr><td width="33%">原附件名称:</td><td>$attachfiles[0]</td></tr>
	<tr><td width="33%" colspan="2" align="center">刪除完成</td></tr>
	</table>
	</td></tr>
	<script>opener.location.reload();setTimeout("self.close()",3000);</script>
	~;
	}else{
$forumlist=(join("\n",@forums))."\n";
$forumlist=~s/(.+?)\t(.+?)\t(.+?)\t(.+?)\t(.+?)\n/<option value="$1">$4<\/option>/g;
if($forumlist=~/<option value="$forum">(.+?)<\/option>/){
$forumname=$1;
}
	print qq~
	<tr><td bgcolor="#FFFFFF" align=center valign="top" height="*">
	<table width=100% cellspacing="0" cellpadding="2">
	<tr><td width="33%">附件名称:</td><td>$attachfiles[0]</td></tr>
	<tr><td width="33%">所在分论坛:</td><td>$forumname</td></tr>
	<tr><td width="33%" colspan="2" align="center"><font color=red><b>删除後是不能够复原的,请先再三考虑!</b></font></td></tr>
	<tr><td width="33%" colspan="2" align="center"><input type="hidden" name="forum" value="$forum"><input type="hidden" name="topic" value="$topic"><input type="hidden" name="reply" value="$reply"><input type="hidden" name="count" value="$count"><input type="hidden" name="action" value="deleteattach"><input type="hidden" name="start" value="checked"><input type="submit" value="确定删除"></td></tr>
	</table>
	</td></form></tr>
	~;
	}
}
sub erroroutsmall{
	my($errormsg)=shift;
	print qq~<tr><td bgcolor="#FFFFFF" align=center valign="middle" height="*"><font color=red><b>$errormsg</b></font></td></tr>~;
}
sub errorout{
	#sub errorout v2.0
	my($errortype,$errormsg)=@_;
	print qq~
	<tr>
	<td bgcolor="#EEEEEE" align=center>
	<font color="#990000"><b>$errortype</b>
	</td>
	</tr>
	<tr>
	<td bgcolor="#FFFFFF" align="center"><font color=red>$errormsg</font></td>
	</tr>
	<tr>
	<td bgcolor="#FFFFFF" align="center" height="100" valign="bottom">-- <a href="$thisprog">返回</a> --</td>
	</tr>
	~;
}
sub getpl{
	my($forumid,$topicid)=@_;
	my $plfile="${lbdir}forum$forumid/$topicid.pl";
	if(-e $plfile){
	&winlock($plfile) if ($OS_USED eq "Nt");
	open (ENT, $plfile);
	flock(ENT, 2) if ($OS_USED eq "Unix");
	$in = <ENT>;
	close (ENT);
	&winunlock($plfile) if ($OS_USED eq "Nt");
	my ($ptopicid, $ptopictitle, $ptopicdescription, $pthreadstate, $pthreadposts ,$pthreadviews, $pstartedby, $pstartedpostdate, $plastposter, $plastpostdate, $pposticon,$pposttemp) = split(/\t/,$in);
	return ($ptopictitle,$pstartedby,$pstartedpostdate,$pthreadposts,$pthreadviews);
	}else{
	return ("undef");
	}
}
sub size{
	(stat("$attachdir/$b"))[7] <=> (stat("$attachdir/$a"))[7];
}
sub lastmod{
	(stat("$attachdir/$b"))[9] <=> (stat("$attachdir/$a"))[9];
}
sub name{
	my @aa=split(/\./,$a);my @an=split(/\_/,$aa[0]);
	my @ba=split(/\./,$b);my @bn=split(/\_/,$ba[0]);
	$bn[1] <=> $an[1];
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -