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

📄 mawhole.php

📁 很好的一套PHP树形论坛程序
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?php
require_once('global.php');
require_once(R_P.'require/forum.php');
require_once(R_P.'require/updateforum.php');
require_once(R_P.'require/msg.php');
require_once(R_P.'require/writelog.php');
include_once(D_P.'data/bbscache/forum_cache.php');

!$windid && Showmsg('not_login');
if(!$tidarray && is_numeric($seltid)){
	$tidarray = array($seltid);
}
if (empty($fid) || empty($tidarray) || !in_array($action,array('type','check','del','move','copy','headtopic','digest','lock','pushtopic','edit'))){
	Showmsg('undefined_action');
}
$foruminfo = $db->get_one("SELECT * FROM pw_forums f LEFT JOIN pw_forumsextra fe USING(fid) WHERE f.fid='$fid' AND f.type<>'category'");
if(!$foruminfo){
	Showmsg('data_error');
}
wind_forumcheck($foruminfo);

list($db_moneyname,$db_moneyunit,$db_rvrcname,$db_rvrcunit,$db_creditname,$db_creditunit)=explode("\t",$db_credits);

if($windid == $manager){
	$admincheck = 1;
} elseif($foruminfo['forumadmin'] && strpos($foruminfo['forumadmin'],','.$windid.',') !== false){
	$admincheck = 1;
} else{
	$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;
	} elseif($action == "headtopic" && $SYSTEM['topped']){
		 $admincheck=1;
	} elseif($action == "banuser" && $SYSTEM['banuser']){
		$admincheck=1;
	}	elseif(($action=="digest" || $action=="lock" || $action=="pushtopic" || $action=="edit") && $SYSTEM['typeadmin']){
		$admincheck=1;
	}
}
!$admincheck && Showmsg('mawhole_right');

require_once(R_P.'require/header.php');
$tids = '';
$threaddb = array();
if (empty($_POST['step']) && is_array($tidarray)){
	$reason_sel='';
	$reason_a=explode("\n",$db_adminreason);
	foreach($reason_a as $k=>$v){
		if($v=trim($v)){
			$reason_sel .= "<option value=\"$v\">$v</option>";
		}else{
			$reason_sel .= "<option value=\"\">-------</option>";
		}
	}
	foreach($tidarray as $k=>$v){
		if(is_numeric($v)){
			$tids .= $tids ? ','.$v :$v;
		}
	}
	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){
				Showmsg('admin_forum_right');
			}
			if($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;
		}
	}
}
if($_POST['step']=='2'){
	if($db_enterreason && !$atc_content){
		Showmsg('enterreason');
	}
	$atc_content = Char_cv($atc_content);
}
if ($action == "type"){
	if (empty($_POST['step'])){
		$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');
		}
		require_once PrintEot('mawhole');
		footer();
	} else{
		count($tidarray) > 500 && Showmsg('mawhole_count');
		$tids = '';
		if(is_array($tidarray)){
			foreach($tidarray as $key => $value){
				if(is_numeric($value)){
					$tids .= $tids ? ','.$value : $value;
				}
			}
		}
		!$tids && Showmsg('mawhole_nodata');
		$db->update("UPDATE pw_threads SET type='$type' WHERE tid IN($tids)");
		refreshto("index.php?fid=$fid",'operate_success');
	}
}  elseif($_POST['action'] == "check"){
	if (empty($_POST['step'])){
		require_once PrintEot('mawhole');
		footer();
	} else{
		count($tidarray) > 500 && Showmsg('mawhole_count');
		$tids  = '';
		$count = 0;
		if(is_array($tidarray)){
			foreach($tidarray as $key => $value){
				if(is_numeric($value)){
					$tids .= $tids ? ','.$value : $value;
					$count++;
				}
			}
		}
		!$tids && Showmsg('mawhole_nodata');
		$db->update("UPDATE pw_threads SET ifcheck='1' WHERE tid IN($tids)");
		$rt = $db->get_one("SELECT tid,author,postdate,subject,lastpost,lastposter FROM pw_threads WHERE fid='$fid' ORDER BY lastpost DESC LIMIT 0,1");
		if($rt['postdate'] == $rt['lastpost']){
			$subject = substrs($rt['subject'],21);
			$author  = $rt['author'];
		}else{
			$subject = 'Re:'.substrs($rt['subject'],21);
			$author  = $rt['lastposter'];
		}
		$new_url  = "read.php?tid=$rt[tid]&page=e#a";
		$lastpost = addslashes($subject)."\t".addslashes($author)."\t".$rt['lastpost']."\t".$new_url;
		$db->update("UPDATE pw_forumdata SET lastpost='$lastpost',tpost=tpost+'$count',article=article+'$count',topic=topic+'$count' WHERE fid='$fid'");
		P_unlink(D_P.'data/bbscache/c_cache.php');
		refreshto("index.php?fid=$fid",'operate_success');
	}
} elseif($action == "del"){
	if (empty($_POST['step'])){
		require_once PrintEot('mawhole');
		footer();
	} else{
		count($tidarray) > 500 && Showmsg('mawhole_count');
		$delaids = $pollids = '';
		$delids = 0;
		foreach($tidarray as $key => $value){
			is_numeric($value) && $delids .= ','.$value;
		}
		!$delids && Showmsg('mawhole_nodata');

		$creditset    = get_creditset($foruminfo['creditset'],$db_creditset);
		$msg_delrvrc  = $ifdel ? floor($creditset['rvrc']['Delete']/10) : 0;
		$msg_delmoney = $ifdel ? $creditset['money']['Delete'] : 0;

		$updatetop = 0;
		$query = $db->query("SELECT t.tid,t.fid as tfid,t.postdate,tm.aid,t.author,t.authorid,t.subject,t.replies,t.topped,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))){
			$tfid != $fid && Showmsg('admin_forum_right');
			$topped > 0 && $updatetop = 1;
			if($aid){
				$attachs = unserialize(stripslashes($aid));
				foreach($attachs as $key => $value){
					is_numeric($key) && $delaids .= $key.',';
					if(!$db_recycle || $fid == $db_recycle){
						P_unlink("$attachdir/$value[attachurl]");
					}
				}
			}
			is_numeric($pollid) && $pollids .= $pollid.',';
			if($ifupload){
				$query2 = $db->query("SELECT aid FROM pw_posts WHERE tid='$tid' AND aid!=''");
				while(@extract($db->fetch_array($query2))){
					if($aid){
						$attachs = unserialize(stripslashes($aid));
						foreach($attachs as $key => $value){
							is_numeric($key) && $delaids .= $key.',';
							if(!$db_recycle || $fid == $db_recycle){
								P_unlink("$attachdir/$value[attachurl]");
							}
						}
					}
				}
			}
			if($ifmsg){
				$msgdb[] = array(
					$author,
					$winduid,
					'del_title',
					$timestamp,
					'del_content',
					'N',
					$windid,
					'fid'		=> $fid,
					'tid'		=> $tid,
					'subject'	=> $subject,
					'postdate'	=> get_date($postdate),
					'forum'		=> $forum[$fid]['name'],
					'affect'    => "{$db_rvrcname}:-{$msg_delrvrc},{$db_moneyname}:-{$msg_delmoney}",
					'admindate'	=> get_date($timestamp),
					'reason'	=> $atc_content
				);
			}
			$logdb[] = array(
				'type'      => 'delete',
				'username1' => $author,
				'username2' => $windid,
				'field1'    => $fid,
				'field2'    => '',
				'field3'    => '',
				'descrip'   => 'del_descrip',
				'timestamp' => $timestamp,
				'ip'        => $onlineip,
				'affect'    => "{$db_rvrcname}:-{$msg_delrvrc},{$db_moneyname}:-{$msg_delmoney}",
				'tid'		=> $tid,
				'subject'	=> substrs($subject,28),
				'forum'		=> $forum[$fid]['name'],
				'reason'	=> $atc_content
			);
			if($ifdel){
				dtchange($authorid,-$creditset['rvrc']['Delete'],-1,-$creditset['money']['Delete']);
				customcredit($authorid,$creditset,'Delete');
			}
			// 删除静态模版
			$htmurl = R_P.$htmdir.'/'.$fid.'/'.date('ym',$postdate).'/'.$tid.'.html';
			if(file_exists($htmurl)){
				P_unlink($htmurl);
			}
			if($db_recycle && $fid != $db_recycle){
				$db->update("INSERT INTO pw_recycle VALUES('$tid','$fid','$timestamp','".addslashes($windid)."')");
			}
		}
		foreach($msgdb as $key=>$val){
			writenewmsg($val,1);
		}
		foreach($logdb as $key=>$val){
			writelog($val);
		}
		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);
				$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{
			if($delaids){
				$delaids  = substr($delaids,0,-1);
				$db->update("UPDATE pw_attachs SET fid='$db_recycle' WHERE aid IN($delaids)");
			}
			$db->update("UPDATE pw_threads SET fid='$db_recycle',topped=0 WHERE tid IN($delids)");
			$db->update("UPDATE pw_posts   SET fid='$db_recycle' WHERE tid IN($delids)");
			updateforum($db_recycle);
		}
		updateforum($fid);
		if($updatetop){
			updatetop();
		}
		P_unlink(D_P.'data/bbscache/c_cache.php');
		refreshto("index.php?fid=$fid",'operate_success');
	}
} elseif($action == "move"){
	if (empty($_POST['step'])){
		$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]'> &nbsp;|- $rt[name]</option>";
				}
			}
		}
		@include_once(D_P.'data/bbscache/forumcache.php');
		require_once PrintEot('mawhole');
		footer();
	} else {
		if($forum[$to_id]['type'] == 'category'){
			Showmsg('mawhole_error');
		}
		count($tidarray) > 500 && Showmsg('mawhole_count');
		$mids = 0;
		foreach($tidarray as $key => $value){
			is_numeric($value) && $mids .= ','.$value;
		}
		!$mids && Showmsg('mawhole_nodata');

		$updatetop = 0;
		$query     = $db->query("SELECT tid,fid as tfid,author,postdate,subject,replies,topped,pollid FROM pw_threads WHERE tid IN($mids)");
		while($rt=$db->fetch_array($query)){
			Add_S($rt);
			@extract($rt);
			$tfid != $fid && Showmsg('admin_forum_right');
			$topped > 0 && $updatetop = 1;
			// 静态模版更新
			if($foruminfo['allowhtm'] == 1){
				$date=date('ym',$postdate);
				$htmurldel=R_P.$htmdir.'/'.$fid.'/'.$date.'/'.$tid.'.html';
				P_unlink($htmurldel);
			}
			$toname = addslashes($forum[$to_id]['name']);
			if($ifmsg){
				$msgdb[] =array(
					$author,

⌨️ 快捷键说明

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