📄 masingle.php
字号:
<?
require("userdata/style.php");
require("global.php");
if(empty($login_status))
{
unset($superadmin);
unset($dj_user);
require("header.php");echo"$headertp";
headguide("您正处在<br>$bbs_title<br>的 MA 程式中",
"<a href=\"thread.php?forumid=$forumid\">$forum_name</a>",
"MA程式","no");
$status="你想黑我们论坛么?,你的用心太恶毒了,我们已经记录你的IP 如果造成损失,我们将追究责任";
print_err();
require("footer.php");echo"$footertp";
exit;
}
get_forum_info();
if (empty($forumid) || empty($filename) || empty($action) || !ereg("^f_[0-9]+$",$filename)) {
$status="未知的工作指示,别乱调用程序呀";
require("header.php");echo"$headertp";
headguide("您正处在<br>$bbs_title<br>的 MA 程式中",
"<a href=\"thread.php?forumid=$forumid\">$forum_name</a>",
"MA程式","no");
print_err();
require("footer.php");echo"$footertp";
exit;
}
//---------check-----------
$check_user=0;
if ($login_status==1 && $username==$manager) $check_user=1;
if ($login_status==1 && $check_user==0 && file_exists("bbsdata/admin.php")) {
$adminlist=file("bbsdata/admin.php");
$admincount=count($adminlist);
for ($i=0; $i<$admincount; $i++) {
$detail=explode("|", str_replace("\n","", $adminlist[$i]));
if ($detail[0]==$forumid && $detail[1]==$username) $check_user=1;
}
}
//---------check-----------
get_father_info();
if ($exists_forum_father==1) {
if (file_exists("bbsdata/admin.php")) {
$adminlist=file("bbsdata/admin.php");
$count=count($adminlist);
for ($i=0; $i<$count; $i++) {
$detail=explode("|", trim($adminlist[$i]));
$admin_list[]=$detail[1];
if ($detail[0]==$father_id && $username==$detail[1]) $check_user=1;
}
}
}
if($forum_father){
$adminlistfather=file("bbsdata/admin.php");
$countfather=count($adminlistfather);
for ($i=0; $i<$countfather; $i++) {
$detailfather=explode("|", trim($adminlistfather[$i]));
$admin_listfather[]=$detailfather[1];
if ($detailfather[0]==$forum_father && $username==$detailfather[1]) { $check_user=1; break; }
}
}
//----让增加的管理员有权管理!----------
if (file_exists("bbsdata/superadmin.php")) {
include("bbsdata/superadmin.php");
if ($superadmin && in_array($username,$superadmin)) {
$check_user=1;
}
}
if ($check_user==0) {
$status="您没有权利进行操作,请您以合适的身份登录(管理员,斑竹)";
require("header.php");echo"$headertp";
headguide("您正处在<br>$bbs_title<br>的 MA 程式中",
"<a href=\"thread.php?forumid=$forumid\">$forum_name</a>",
"MA程式","no");
print_err();
require("footer.php");echo"$footertp";
exit;
}
if (empty($step)) {
require("header.php");echo"$headertp";
headguide("您正处在<br>$bbs_title<br>的 MA 程式中",
"<a href=\"thread.php?forumid=$forumid\">$forum_name</a>",
"MA程式","no");
print_confirm();
require("footer.php");echo"$footertp";
exit;
}
if ($action=="del") {
if (!$filename || !$forumid || !ereg("^f_[0-9]+$",$filename)) exit;
if (!file_exists("{$idpath}forum$forumid/$filename")) exit;
$articlelist=file("{$idpath}forum$forumid/$filename");
$count=count($articlelist);
if (!$articlelist[0]) exit;
list($oldarticletitle,$author,$oldarticlecontent,$time,$area,$oldicon,$p,$rvrc,$pfzhe)=explode("|",$articlelist[0]);
if($login_status==1 && $author==$username) $check_user=1;
}
if ($action=="move" || $action=="copy") {
if (file_exists("{$idpath}forum$forumid/list.php")) {
//------get the line from the original list------
$fp=fopen("{$idpath}forum$forumid/list.php","r");
flock($fp,LOCK_SH);
$oldlist=file("{$idpath}forum$forumid/list.php");
fclose($fp);
$count=count($oldlist);
for ($i=0; $i<$count; $i++) {
$detail=explode("|",$oldlist[$i]);
if ($detail[5]==$filename) {
$detail=explode("|",$oldlist[$i]);
$detail[3]=$forumid.",".$username.",".$timestamp;
$oldlist[$i]=implode("|",$detail);
$gotline=$oldlist[$i];
unset($oldlist[$i]);
break;
}
}
if ($action=="move") {
//------Delete from the original list-------
$oldlist=implode("",$oldlist);
writetofile("{$idpath}forum$forumid/list.php",$oldlist);
}
//------move the file---------
$fileinfo=explode("|",$gotline);
$source="{$idpath}forum$forumid/$fileinfo[5]";
if (file_exists("{$idpath}forum$newforumid/list.php")) {
$newlist=readfromfile("{$idpath}forum$newforumid/list.php");
$desname=get_next_filename($newlist,$newforumid);
} else {
$newlist="";
$desname="f_1";
}
copy($source, "{$idpath}forum$newforumid/$desname");
if ($action=="move") unlink($source);
if (file_exists($source.".sta")) {
copy($source.".sta", "{$idpath}forum$newforumid/$desname.sta");
if ($action=="move") unlink($source.".sta");
}
if (file_exists($source.".u")) {
copy($source.".u", "{$idpath}forum$newforumid/$desname.u");
if ($action=="move") unlink($source.".u");
}
//------write to the target LIST-----
$gotline=str_replace($fileinfo[5],$desname,$gotline);
$newlist=$gotline.$newlist;
$newlist=push_heldtopics($newlist);
writetofile("{$idpath}forum$newforumid/list.php",$newlist);
//----change the information in newforum's last_mo.php
$temp=explode("|",readfromfile("{$idpath}forum$newforumid/last_mo.php"));
$temp[0]="$detail[0],$detail[1],".get_date($timestamp)." ".get_time($timestamp).",$desname";
$temp[1]++;
writetofile("{$idpath}forum$newforumid/last_mo.php","$temp[0]|$temp[1]");
//----change the information in oldforum's last_mo.php
$temp=explode("|",readfromfile("{$idpath}forum$forumid/last_mo.php"));
$temp[1]--;
writetofile("{$idpath}forum$forumid/last_mo.php","$temp[0]|$temp[1]");
jump_page("thread.php?forumid=$forumid","管理程式已经成功执行了操作");
}
}
if (file_exists("{$idpath}forum$forumid/list.php")) {
$fp=fopen("{$idpath}forum$forumid/list.php","r");
flock($fp,LOCK_SH);
$oldlist=file("{$idpath}forum$forumid/list.php");
fclose($fp);
$count=count($oldlist);
for ($i=0; $i<$count; $i++) {
$detail=explode("|",$oldlist[$i]);
if ($detail[5]==$filename) {
if ($action=="lock") {
$detail[9]=$detail[9]+1;
$oldlist[$i]=implode("|",$detail); break;}
elseif ($action=="unlock") {
if ($detail[9]==1 || $detail[9]==3) $detail[9]=$detail[9]-1;
$oldlist[$i]=implode("|",$detail);
break;}
elseif ($action=="jihua") {
if($username==$detail[1]){
require("header.php");echo"$headertp";
$status="就算您是管理员也不可精华自己的帖子";
headguide("您正处在<br>$bbs_title<br>的 MA 程式中",
"<a href=\"thread.php?forumid=$forumid\">$forum_name</a>",
"MA程式","no");
print_err();
require("footer.php");echo"$footertp";
exit;}
$detail[9]=$detail[9]+2;
$jinhua_wws=$jinhua_ww*10;
dtchange($detail[1],$jinhua_wws,"0",$jinhua_money);
if (file_exists("userdata/$msgpath/{$detail[1]}1.php")) $msg=file("userdata/$msgpath/{$detail[1]}1.php"); else $msg[0]="";
$new="<?die;?>|帖子信息|恭喜恭喜!|$timestamp|恭喜 $username 将您的帖子设置为精华贴 这是帖子的最高奖励,因此您的威望增加了{$jinhua_ww},金钱增加{$jinhua_money}.希望您再接再厉。<a href=read.php?forumid=$forumid&filename=$filename target=_blank>点击查看帖子</a>|0|\n";
$old=implode("",$msg);
writetofile("userdata/$msgpath/{$detail[1]}1.php",$new.$old);
$oldlist[$i]=implode("|",$detail);
break;}
elseif ($action=="unjihua") {
if ($detail[9]==2 || $detail[9]==3)
$detail[9]=$detail[9]-2;
$jinhua_wws=$jinhua_ww*10;
dtchange($detail[1],-$jinhua_wws,"0",-$jinhua_money);
$oldlist[$i]=implode("|",$detail);
break;}
elseif ($action=="del") {
//-------------把帖子移动到论坛回收站开始-----------------
if ($forumid != $recycle){
$articlelist1="{$idpath}forum$forumid/$filename";
if (file_exists("{$idpath}forum$recycle/list.php")) {
$newlist1=readfromfile("{$idpath}forum$recycle/list.php");
$desname1=get_next_filename($newlist1,$recycle);
} else {
$newlist1="";
$desname1="f_1";
}
copy($articlelist1, "{$idpath}forum$recycle/$desname1");
if (file_exists($articlelist1.".sta")) {
copy($articlelist1.".sta", "{$idpath}forum$recycle/$desname1.sta");}
if (file_exists($articlelist.".u")) {
copy($articlelist.".u", "{$idpath}forum$recycle/$desname1.u");}
$detail=explode("|",$oldlist[$i]);
$detail[3]=$forumid.",".$username.",".$timestamp;
$oldlist[$i]=implode("|",$detail);
$oldlist1=$oldlist[$i];
$oldlist1=str_replace($filename,$desname1,$oldlist1);
$newlist1=$oldlist1.$newlist1;
$newlist1=push_heldtopics($newlist1);
writetofile("{$idpath}forum$recycle/list.php",$newlist1);
}
//-------------把帖子移动到论坛回收站结束---------------------------
$articlelist=file("{$idpath}forum$forumid/$filename");
list($topic_name,$topic_author,$topic_content,$topic_date,$topic_area)=explode("|",$articlelist[0]);
$delrvrc=$del_rvrc*10;
dtchange($topic_author,-$delrvrc,"-1",-$del_ofstar);
$oldlist[$i]="";
unlink("{$idpath}forum$forumid/$detail[5]");
if (file_exists("{$idpath}forum$forumid/$detail[5].sta")) unlink("{$idpath}forum$forumid/$detail[5].sta");
if (file_exists("{$idpath}forum$forumid/$detail[5].u")) unlink("{$idpath}forum$forumid/$detail[5].u");
break;
}
}
}
$oldlist=implode("",$oldlist);
writetofile("{$idpath}forum$forumid/list.php",$oldlist);
if ($action=="del") {
//----change the information in newforum's last_mo.php
$temp=explode("|",readfromfile("{$idpath}forum$forumid/last_mo.php"));
$temp[1]--;
writetofile("{$idpath}forum$forumid/last_mo.php","$temp[0]|$temp[1]");
//----change the information of the total posts of the bbs
$temp=explode("|",readfromfile("bbsdata/newuser.php"));
$temp[2]--;
writetofile("bbsdata/newuser.php","$temp[0]|$temp[1]|$temp[2]");
}
//删除该主题的全部附件
$upload_path=opendir("upload/");
while($upload_file=readdir($upload_path)){
if(($upload_file!=".") && ($upload_file!="..") && ($upload_file!="")) $upload_array[]=$upload_file;}
closedir($upload_path);
$upload_count=count($upload_array);
for($i=0;$i<=$upload_count;$i++){
if(ereg("^forum".$forumid."_".$detail[5],$upload_array[$i])) unlink("upload/$upload_array[$i]");}
// 删除主题或回复后更新首页最后更新列表
if(!file_exists("{$idpath}forum$forumid")) return;
$oldlist=readfromfile("{$idpath}forum$forumid/list.php");
$oldlist=explode("\n",$oldlist);
for($i=0;$i<count($oldlist);$i++){
$newlist=explode("|",$oldlist[$i]);
if($newlist[10]==0){
if(file_exists("{$idpath}forum$forumid/last_mo.php")){
$filecc=readfromfile("{$idpath}forum$forumid/last_mo.php");
$temp=explode('|',$filecc);
$art_count=$temp[1];}
$tempList=explode(",",$newlist[8]);
$newlist[2]=get_date($tempList[2]).' '.get_time($tempList[2]);
$new_line="$newlist[0],$tempList[1],$newlist[2],$newlist[5],reply|$art_count";
writetofile("{$idpath}forum$forumid/last_mo.php",$new_line);break;}}
//--------------------
if (file_exists("bbsdata/forumevent.php"))
$forumevent=explode("\n",readfromfile("bbsdata/forumevent.php"));
else $forumevent[0]="";
$newevent="删除贴子|$forumid||$topic_name|$topic_author|无聊的帖子|-$del_rvrc|-$del_ofstar|$timestamp|$username|\n";
$forumevent=implode("\n",$forumevent);
writetofile("bbsdata/forumevent.php",$newevent.$forumevent);
jump_page("thread.php?forumid=$forumid","管理程式已经成功执行了操作");
}
function print_err() {
global $status;
$title="发生错误";
$content="管理程式发生了错误,情况:<br>
<br>$status<br><ul>
<li><a href='javascript:history.back(1)'>返回前一页</a></li>
</ul>";
msg_box($title,$content);
}
function print_confirm() {
global $action,$forumid,$filename,$author;
$title="确认";
if ($action=="move" || $action=="copy") {
$content="<form action=\"masingle.php\" method=POST><select name=newforumid>";
$forumlist=file("bbsdata/forumdata.php");
$count=count($forumlist)-1;
for ($i=0; $i<=$count; $i++) {
$forum_list_info=explode("|",$forumlist[$i]);
if ($forum_list_info[0]!="category" && $forum_list_info[3]!=$forumid){
if ($forum_list_info[4]==0) $content.="<OPTION value=\"$forum_list_info[3]\">$forum_list_info[1]";
else $content.="<OPTION value=\"$forum_list_info[3]\"> |- $forum_list_info[1]";
}
}
$content.="</OPTION></select>
<br><br><input type=submit value=' 确 认 继 续 '><br><br>
<input type=hidden name=action value='$action'>
<input type=hidden name=filename value='$filename'>
<input type=hidden name=forumid value='$forumid'>
<input type=hidden name=step value='2'></form>";
}
else $content="
管理程式需要您确认这次操作:<font color=red>";
if($action=="del") $content.="删除贴子";
if($action=="move") $content.="转移贴子:请选择要转移到的版块";
if($action=="copy") $content.="复制贴子:请选择要复制到的版块";
if($action=="lock") $content.="锁住贴子";
if($action=="unlock") $content.="解锁贴子";
if($action=="jihua") $content.="将贴子加入精华";
if($action=="unjihua") $content.="将贴子取消精华";
$content.="</font><br>
<br>
真的要继续吗?<br><ul>
<li><a href='javascript:history.back(1)'>返回前一页</a></li>";
if ($action!="move" && $action!="copy") $content.="<br><br><li><a href='masingle.php?action=$action&forumid=$forumid&filename=$filename&step=2&author=$author'>确认并继续</a></li>";
$content.="</ul>";
msg_box($title,$content);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -