mawhole.php
来自「一个可以实时查看股票行情的小程序,真是一个好程序哦,直得大家」· PHP 代码 · 共 347 行
PHP
347 行
<?php
require_once('./global.php');
require_once(R_P.'require/forum.php');
require_once(R_P.'require/updateforum.php');
require_once(R_P.'require/postfunc.php');
/**
* 版块缓冲文件
*/
include_once(R_P.'data/bbscache/forum_cache.php');
require_once(R_P.'require/msg.php');
$foruminfo=$db->get_one("SELECT * FROM pw_forums WHERE fid='$fid' AND type<>'category'");
if(!$foruminfo){
require_once(R_P.'require/url_error.php');
}
wind_forumcheck($foruminfo);
/**
* 管理验证
*/
$groupid=='guest' && Showmsg('not_login');
if(!$tidarray && $deltid){
$tidarray=array($deltid);
}
$secondurl="thread.php?fid=$fid";
if (empty($fid) || empty($tidarray) ||($action!="type" && $action!="check" && $action!="del" && $action!="move" && $action!="copy") ){
Showmsg('undefined_action');
}
/**
* 获取创始人和版主权限
*/
if($windid==$manager){
$admincheck=1;
} elseif($foruminfo['forumadmin'] && strpos($foruminfo['forumadmin'],','.$windid.',')!==false){
$admincheck=1;
} else{
$admincheck=0;
}
!$windid && $admincheck=0;
if(!$admincheck && $groupid!=5){
/*
* 获取用户组权限
*/
if($action=="type" && $SYSTEM['tpctype']){
$admincheck=1;
}elseif($action=="check" && $SYSTEM['check']){
$admincheck=1;
}elseif($action=="del" && $SYSTEM['delatc']){
$admincheck=1;
} elseif($action=="move" && $SYSTEM['moveatc']){
$admincheck=1;
} elseif($action=="copy" && $SYSTEM['copyatc']){
$admincheck=1;
}
}
if(!$admincheck){
Showmsg('mawhole_right');
}
/**
* 特殊版块删除积分获得
*/
if($foruminfo['f_score']!=''){
list($P_Prvrc,$P_Rrvrc,$P_Pmoney,$P_Rmoney,$P_Drvrc,$P_Dmoney)=explode("|",$foruminfo['f_score']);
is_numeric($P_Drvrc) && $db_dtdelrvrc=$P_Drvrc;
is_numeric($P_Dmoney) && $db_dtdelmoney=$P_Dmoney;
}
/**
* 通过验证进入管理模式
*/
if (empty($_POST['step'])){
require_once('./header.php');
$guidename=forumindex($foruminfo['fup']);
$msg_guide=headguide($guidename);
$msg_delrvrc=floor($db_dtdelrvrc/10);
if ($action=="move" || $action=="copy"){
$forumadd='';
$query=$db->query("SELECT fid,name,allowvisit FROM pw_forums WHERE f_type='hidden'");
if($query){
while($rt=$db->fetch_array($query)){
if(strpos($rt['allowvisit'],','.$groupid.',')!==false){
$forumadd.="<option value='$rt[fid]'> |- $rt[name]</option>";
}
}
}
@include_once(R_P.'data/bbscache/forumcache.php');
} elseif($action == "type"){
$typesel='';
$t_typedb=array();
$t_db=$foruminfo['t_type'];
if(trim($t_db)){
$t_typedb=explode("\t",$t_db);
$t_typedb = array_unique ($t_typedb);
unset($t_typedb[0]);
} else{
Showmsg('mawhole_notype');
}
}
$tids=0;
if(is_array($tidarray)){
foreach($tidarray as $tid){
is_numeric($tid) && $tids.=','.$tid;
}
}
$threaddb=array();
if($tids){
$query=$db->query("SELECT fid,tid,author,authorid,postdate,subject FROM pw_threads WHERE tid IN($tids)");
while($rt=$db->fetch_array($query)){
if($rt['fid']!=$fid && ($groupid==5 || !$SYSTEM['delatc'])){
Showmsg('admin_forum_right');
}
if($windid!=$manager && $groupid!=3 && $groupid!=4){
$authordb=$db->get_one("SELECT groupid FROM pw_members WHERE uid='$rt[authorid]'");
if($authordb['groupid']==3 || $authordb['groupid']==4){
Showmsg('modify_admin');
}
}
$rt['date']=get_date($rt['postdate']);
$threaddb[]=$rt;
}
}
require_once PrintEot('mawhole');
footer();
} elseif($_POST['action']=="type"){
count($tidarray)>500 && Showmsg('mawhole_count');
$tids='0';
if(is_array($tidarray)){
foreach($tidarray as $key => $value){
is_numeric($value) && $tids.=','.$value;
}
}
!$tids && Showmsg('mawhole_nodata');
$db->update("UPDATE pw_threads SET type='$type' WHERE tid IN($tids)");
refreshto("thread.php?fid=$fid",'operate_success');
} elseif($_POST['action']=="check"){
count($tidarray)>500 && Showmsg('mawhole_count');
$tids='0';
if(is_array($tidarray)){
foreach($tidarray as $key => $value){
is_numeric($value) && $tids.=','.$value;
}
}
!$tids && Showmsg('mawhole_nodata');
$db->update("UPDATE pw_threads SET ifcheck='1' WHERE tid IN($tids)");
@unlink(R_P.'data/bbscache/c_cache.php');
refreshto("thread.php?fid=$fid",'operate_success');
} elseif($_POST['action']=="del"){
/**
* 开始删除贴子
*/
count($tidarray)>500 && Showmsg('mawhole_count');
$newlog_forum=$delaids=$pollids='';
$delids=0;
foreach($tidarray as $key => $value){
is_numeric($value) && $delids.=','.$value;
}
!$delids && Showmsg('mawhole_nodata');
$query=$db->query("SELECT t.tid,t.postdate,tm.aid,t.author,t.authorid,t.subject,t.replies,t.ifupload,t.pollid FROM pw_threads t LEFT JOIN pw_tmsgs tm ON tm.tid=t.tid WHERE t.tid IN($delids)");
while(@extract($db->fetch_array($query))){
if($aid){
$attachs= unserialize(stripslashes($aid));
foreach($attachs as $key=>$value){
is_numeric($key) && $delaids.=$key.',';
}
}
is_numeric($pollid) && $pollids.=$pollid.',';
if($ifupload){
$query2=$db->query("SELECT aid FROM pw_posts WHERE tid='$tid'");
while(@extract($db->fetch_array($query2))){
if($aid){
$attachs= unserialize(stripslashes($aid));
foreach($attachs as $key=>$value){
is_numeric($key) && $delaids.=$key.',';
}
}
}
}
if($ifmsg){
writenewmsg(array($author,$winduid,'Delete Article',$timestamp,$reason,'N',$windid),1);
}
$reason=str_replace("\n","",$reason);
$newlog_forum.="<?die;?>|Delete Article|$fid||$subject|$author|$reason|-$msg_delrvrc|-$db_dtdelmoney|$timestamp|$windid|$onlineip|\n";
if($ifdel){
dtchange($authorid,-$db_dtdelrvrc,"-1",-$db_dtdelmoney);
}
/**
* 删除静态模版
*/
$htmurl='htm_data/'.$fid.'/'.date('ym',$postdate).'/'.$tid.'.html';
if(file_exists($htmurl)){
@unlink($htmurl);
}
}
/*
* 管理日志
*/
writeover(R_P."data/bbscache/log_forum.php",$newlog_forum,"ab");
if(!$db_recycle ||$fid==$db_recycle){
if($pollids){
$pollids=substr($pollids,0,-1);
$db->update("DELETE FROM pw_polls WHERE pollid IN($pollids)");
}
if($delaids){
$delaids=substr($delaids,0,-1);
$query=$db->query("SELECT attachurl FROM pw_attachs WHERE aid IN($delaids)");
while($rs=$db->fetch_array($query)){
@unlink("$attachpath/$rs[attachurl]");
}
$db->update("DELETE FROM pw_attachs WHERE aid IN($delaids)");
}
/**
* 删除帖子
*/
$db->update("DELETE FROM pw_threads WHERE tid IN($delids)");
$db->update("DELETE FROM pw_posts WHERE tid IN($delids)");
$db->update("DELETE FROM pw_tmsgs WHERE tid IN($delids)");
} else{
/*
* 回收站ID
*/
$db->update("UPDATE pw_threads SET fid='$db_recycle',topped=0,lastpost='$timestamp' WHERE tid IN($delids)");
$db->update("UPDATE pw_posts SET fid='$db_recycle' WHERE tid IN($delids)");
updateforum($db_recycle);lastinfo($db_recycle);
}
/**
* 更新版块数据
*/
updateforum($fid);
lastinfo($fid);
@unlink(R_P.'data/bbscache/c_cache.php');
refreshto("thread.php?fid=$fid",'operate_success');
} elseif($_POST['action']=="move"){
/**
* 开始移动贴子
*/
if($forum[$to_id]['type']=='category'){
Showmsg('mawhole_error');
}
count($tidarray)>500 && Showmsg('mawhole_count');
$newlog_forum='';
$mids=0;
foreach($tidarray as $key => $value){
is_numeric($value) && $mids.=','.$value;
}
!$mids && Showmsg('mawhole_nodata');
$query=$db->query("SELECT tid,author,postdate,subject,replies,pollid FROM pw_threads WHERE tid IN($mids)");
while(@extract($db->fetch_array($query))){
/**
* 静态模版更新
*/
if($foruminfo['allowhtm']==1){
$date=date('ym',$postdate);
$htmurldel='htm_data/'.$fid.'/'.$date.'/'.$tid.'.html';
@unlink($htmurldel);
}
$toname=$forum[$to_id]['name'];
$subject = addslashes($subject);
$toname = addslashes($toname);
if($ifmsg){
$wreason=str_replace(' $','$',$reason);
$wreason=str_replace('$tid',$tid,$wreason);
$wreason=str_replace('$to_id',$to_id,$wreason);
$wreason=str_replace('$toname',$toname,$wreason);
$wreason=str_replace('$subject',$subject,$wreason);
writenewmsg(array($author,$winduid,'Article Move',$timestamp,$wreason,'N',$windid),1);
}
$wreason=str_replace("\n","",$wreason);
$newlog_forum.="<?die;?>|Move Article|$fid||$subject|$author|$wreason|-|-|$timestamp|$windid|$onlineip|\n";
}
/*
* 管理日志
*/
writeover(R_P."data/bbscache/log_forum.php",$newlog_forum,"ab");
$db->update("UPDATE pw_threads SET fid='$to_id',lastpost='$timestamp' WHERE tid IN($mids)");
$db->update("UPDATE pw_posts SET fid='$to_id' WHERE tid IN($mids)");
updateforum($fid);
lastinfo($fid);
updateforum($to_id);
lastinfo($to_id);
@unlink(R_P.'data/bbscache/c_cache.php');
refreshto("thread.php?fid=$fid",'operate_success');
} elseif($_POST['action']=='copy'){
/**
* 开始复制贴子
*/
if($forum[$to_id]['type']=='category'){
Showmsg('mawhole_error');
}
count($tidarray)>500 && Showmsg('mawhole_count');
$newlog_forum='';
foreach($tidarray as $cid){
@extract($db->get_one("SELECT * FROM pw_threads t LEFT JOIN pw_tmsgs tm ON tm.tid=t.tid WHERE t.tid='$cid'"));
$toname=$forum[$to_id]['name'];
$subject = addslashes($subject);
$toname = addslashes($toname);
if($ifmsg){
$wreason=str_replace(' $','$',$reason);
$wreason=str_replace('$subject',$subject,$wreason);
$wreason=str_replace('$tid',$tid,$wreason);
$wreason=str_replace('$to_id',$to_id,$wreason);
$wreason=str_replace('$toname',$toname,$wreason);
writenewmsg(array($author,$winduid,'Article Copy',$timestamp,$wreason,'N',$windid),1);
}
$wreason=str_replace("\n","",$wreason);
$newlog_forum.="<?die;?>|Copy Article|$fid||$subject|$author|$wreason|-|-|$timestamp|$windid|$onlineip|\n";
if($pollid){
$rs=$db->get_one("SELECT voteopts FROM pw_polls WHERE pollid='$pollid'");
$voteopts=$rs['voteopts'];
$db->update("INSERT INTO pw_polls (voteopts) VALUES('$voteopts')");
$newpollid=$db->insert_id();
} else{
$newpollid='';
}
$db->update("INSERT INTO pw_threads (fid,icon,titlefont,author,authorid,subject,ifcheck, postdate,lastpost,lastposter,hits,replies,topped,locked,digest,ifupload,pollid,ifmail) VALUES('$to_id','$icon','$titlefont','".addslashes($author)."','$authorid','".addslashes($subject)."','$ifcheck','$postdate','$timestamp','$lastposter','$hits','$replies','$topped','$locked','$digest','$ifupload','$newpollid','$ifmail')");
$newtid = $db->insert_id();
$aid=str_replace("'","\'",$aid);
$db->update("INSERT INTO pw_tmsgs (tid,aid,userip,ifsign,buy,ipfrom,ifconvert,content) VALUES('$newtid','$aid','$userip','$ifsign','$buy','$ipfrom','$ifconvert','".addslashes($content)."')");
$query=$db->query("SELECT * FROM pw_posts WHERE tid='$cid'");
while(@extract($db->fetch_array($query))){
$db->update("INSERT INTO pw_posts (fid,tid,aid,author,authorid,icon,postdate,subject,userip,ifsign,alterinfo,ipfrom,ifconvert,ifcheck,content) VALUES ('$to_id','$newtid','$aid','$author','$authorid','$icon','$postdate','".addslashes($subject)."','$userip','$ifsign','$alterinfo','$ipfrom','$ifconvert','$ifcheck','".addslashes($content)."')");
}
}
/*
* 管理日志
*/
writeover(R_P."data/bbscache/log_forum.php",$newlog_forum,"ab");
/**
* 更新有关版块数据
*/
updateforum($to_id);
lastinfo($to_id);
refreshto("thread.php?fid=$fid",'operate_success');
}
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?