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

📄 moderation.inc.php

📁 极限网络智能办公系统 Office Automation V3.0官方100%源代码.
💻 PHP
📖 第 1 页 / 共 2 页
字号:
				showmessage('undefined_action');
			}

			$expiration = $level ? $expiration : 0;

			if($operation == 'stick') {

				$db->query("UPDATE {$tablepre}threads SET displayorder='$level', moderated='1' WHERE tid IN ($moderatetids)");

				$stickmodify = 0;
				foreach($threadlist as $thread) {
					$stickmodify = (in_array($thread['displayorder'], array(2, 3)) || in_array($level, array(2, 3))) && $level != $thread['displayorder'] ? 1 : $stickmodify;
				}

				if($globalstick && $stickmodify) {
					require_once DISCUZ_ROOT.'./include/cache.func.php';
					updatecache('globalstick');
				}

				$modaction = $level ? ($expiration ? 'EST' : 'STK') : 'UST';
				$db->query("UPDATE {$tablepre}threadsmod SET status='0' WHERE tid IN ($moderatetids) AND action IN ('STK', 'UST', 'EST', 'UES')", 'UNBUTTERED');

			} elseif($operation == 'digest') {

				$db->query("UPDATE {$tablepre}threads SET digest='$level', moderated='1' WHERE tid IN ($moderatetids)");

				foreach($threadlist as $thread) {
					if($thread['digest'] != $level) {
						$digestpostsadd = ($thread['digest'] > 0 && $level == 0) || ($thread['digest'] == 0 && $level > 0) ? 'digestposts=digestposts'.($level == 0 ? '-' : '+').'1' : '';
						updatecredits($thread['authorid'], $digestcredits, $level - $thread['digest'], $digestpostsadd);
					}
				}

				$modaction = $level ? ($expiration ? 'EDI' : 'DIG') : 'UDG';
				$db->query("UPDATE {$tablepre}threadsmod SET status='0' WHERE tid IN ($moderatetids) AND action IN ('DIG', 'UDI', 'EDI', 'UED')", 'UNBUTTERED');
			}
		} elseif($operation == 'close') {

			$modaction = empty($close) ? ($expiration ? 'EOP' : 'OPN'): ($expiration ? 'ECL' : 'CLS');
			$close = ($modaction == 'ECL' || $modaction == 'CLS') ? 1 : 0;

			$db->query("UPDATE {$tablepre}threads SET closed='$close', moderated='1' WHERE tid IN ($moderatetids)");
			$db->query("UPDATE {$tablepre}threadsmod SET status='0' WHERE tid IN ($moderatetids) AND action IN ('CLS','OPN', 'ECL', 'UCL', 'EOP', 'UEO')", 'UNBUTTERED');

		} elseif($operation == 'move') {

			$query = $db->query("SELECT fid, name, modnewposts, allowpostspecial FROM {$tablepre}forums WHERE fid='$moveto' AND status>0 AND type<>'group'");
			if(!$toforum = $db->fetch_array($query)) {
				showmessage('admin_move_invalid');
			} elseif($fid == $toforum['fid']) {
				showmessage('admin_move_illegal');
			} else {
				$moveto = $toforum['fid'];
				$modnewthreads = (!$allowdirectpost || $allowdirectpost == 1) && $toforum['modnewposts'] ? 1 : 0;
				$modnewreplies = (!$allowdirectpost || $allowdirectpost == 2) && $toforum['modnewposts'] ? 1 : 0;
				if($modnewthreads || $modnewreplies) {
					showmessage('admin_move_have_mod');
				}
			}

			if($adminid == 3) {
				if($accessmasks) {
					$accessadd1 = ', a.allowview, a.allowpost, a.allowreply, a.allowgetattach, a.allowpostattach';
					$accessadd2 = "LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid='$moveto'";
				}
				$query = $db->query("SELECT ff.postperm, m.uid AS istargetmod $accessadd1
						FROM {$tablepre}forumfields ff
						$accessadd2
						LEFT JOIN {$tablepre}moderators m ON m.fid='$moveto' AND m.uid='$discuz_uid'
						WHERE ff.fid='$moveto'");
				$priv = $db->fetch_array($query);
				if((($priv['postperm'] && !in_array($groupid, explode("\t", $priv['postperm']))) || ($accessmasks && ($priv['allowview'] || $priv['allowreply'] || $priv['allowgetattach'] || $priv['allowpostattach']) && !$priv['allowpost'])) && !$priv['istargetmod']) {
					showmessage('admin_move_nopermission');
				}
			}

			$moderate = array();
			$stickmodify = 0;
			foreach($threadlist as $tid => $thread) {
				if(!$thread['special'] || substr(sprintf('%04b', $toforum['allowpostspecial']), -$thread['special'], 1)) {
					$moderate[] = $tid;
					if(in_array($thread['displayorder'], array(2, 3))) {
						$stickmodify = 1;
					}
					if($type == 'redirect') {
						$db->query("INSERT INTO {$tablepre}threads (fid, readperm, iconid, author, authorid, subject, dateline, lastpost, lastposter, views, replies, displayorder, digest, closed, special, attachment)
							VALUES ('$thread[fid]', '$thread[readperm]', '$thread[iconid]', '".addslashes($thread['author'])."', '$thread[authorid]', '".addslashes($thread['subject'])."', '$thread[dateline]', '$thread[dblastpost]', '$thread[lastposter]', '0', '0', '0', '0', '$thread[tid]', '0', '0')");
					}
				}
			}

			if(!$moderatetids = implode(',', $moderate)) {
				showmessage('admin_moderate_invalid');
			}

			$displayorderadd = $adminid == 3 ? ', displayorder=\'0\'' : '';
			$db->query("UPDATE {$tablepre}threads SET fid='$moveto', moderated='1' $displayorderadd WHERE tid IN ($moderatetids)");
			$db->query("UPDATE {$tablepre}posts SET fid='$moveto' WHERE tid IN ($moderatetids)");

			if($globalstick && $stickmodify) {
				require_once DISCUZ_ROOT.'./include/cache.func.php';
				updatecache('globalstick');
			}

			$modaction = 'MOV';

			updateforumcount($moveto);
			updateforumcount($fid);

		} elseif($operation == 'highlight') {

			$stylebin = '';
			for($i = 1; $i <= 3; $i++) {
				$stylebin .= empty($highlight_style[$i]) ? '0' : '1';
			}

			$highlight_style = bindec($stylebin);
			if($highlight_style < 0 || $highlight_style > 7 || $highlight_color < 0 || $highlight_color > 8) {
				showmessage('undefined_action', NULL, 'HALTED');
			}

			$db->query("UPDATE {$tablepre}threads SET highlight='$highlight_style$highlight_color', moderated='1' WHERE tid IN ($moderatetids)", 'UNBUFFERED');

			$modaction = ($highlight_style + $highlight_color) ? ($expiration ? 'EHL' : 'HLT') : 'UHL';
			$expiration = $modaction == 'UHL' ? 0 : $expiration;
			$db->query("UPDATE {$tablepre}threadsmod SET status='0' WHERE tid IN ($moderatetids) AND action IN ('HLT', 'UHL', 'EHL', 'UEH')", 'UNBUTTERED');

		} elseif($operation == 'type') {

			if(!isset($forum['threadtypes']['types'][$typeid]) && !($typeid == 0 && !$forum['threadtypes']['required'])) {
				showmessage('admin_move_invalid');
			}

			$db->query("UPDATE {$tablepre}threads SET typeid='$typeid', moderated='1' WHERE tid IN ($moderatetids)");

			$modaction = 'TYP';

		} elseif($operation == 'bump') {

			if($isbump) {
				$modaction = 'BMP';

				$thread = array_pop($threadlist);
				$thread['subject'] = addslashes($thread['subject']);
				$thread['lastposter'] = addslashes($thread['lastposter']);

				$db->query("UPDATE {$tablepre}threads SET lastpost='$timestamp', moderated='1' WHERE tid IN ($moderatetids)");
				$db->query("UPDATE {$tablepre}forums SET lastpost='$thread[tid]\t$thread[subject]\t$timestamp\t$thread[lastposter]' WHERE fid='$fid'");

			} else {
				$modaction = 'DWN';
				$downtime = $timestamp - 86400 * 730;
				$db->query("UPDATE {$tablepre}threads SET lastpost='$downtime', moderated='1' WHERE tid IN ($moderatetids)");
			}

			$forum['threadcaches'] && deletethreadcaches($thread['tid']);

		} elseif($operation == 'supe_push') {
			if(!$supe['status']) {
				showmessage('supe_pushsetting_noopen');
			}
			if(!$supe_allowpushthread) {
				showmessage('admin_nopermission');
			}
			if($forum['supe_pushsetting']['status'] != '2') {
				showmessage('supe_pushsetting_nohand');
			}
			$supe_pushstatus = in_array($supe_pushstatus, array('2', '-2')) ? $supe_pushstatus : '2';
			$db->query("UPDATE {$tablepre}threads SET supe_pushstatus='$supe_pushstatus' WHERE tid IN ($moderatetids)");

			$modaction = $supe_pushstatus == '2' ? 'PTS' : ($supe_pushstatus == '-2' ? 'RFS' : '');
		}
	}

	$resultarray = array(
	'redirect'	=> (preg_match("/^topicadmin/", ($redirect = dreferer("forumdisplay.php?fid=$fid"))) ? "forumdisplay.php?fid=$fid" : $redirect),
	'reasonpm'	=> ($sendreasonpm ? array('data' => $threadlist, 'var' => 'thread', 'item' => ($operation == 'move' ? 'reason_move' : 'reason_moderate')) : array()),
	'modtids'	=> ($operation == 'delete' && !$forum['recyclebin']) ? 0 : $moderatetids,
	'modlog'	=> $threadlist,
	'expiration'=> $expiration
	);
	if($iscircleadmin && $supe_referer) {
		$resultarray['redirect'] = $supe_referer;
	}

	if(in_array($operation, array('stick', 'digest', 'highlight')) && !empty($next) && $next != $operation && in_array($next, array('stick', 'digest', 'highlight'))) {
		if(count($moderate) == 1) {
			$resultarray['redirect'] = "topicadmin.php?tid=$moderate[0]&amp;fid=$fid&amp;action=$next";
		} else {
			$resultarray['redirect'] = "topicadmin.php?action=moderate&amp;fid=$fid&amp;operation=$next";
			if(is_array($moderate)) {
				foreach($moderate as $modtid) {
					$resultarray['redirect'] .= "&moderate[]=$modtid";
				}
			}
		}
		$resultarray['message'] = 'admin_succeed_next';
	}
}

?>

⌨️ 快捷键说明

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