moderate.inc.php

来自「极限网络智能办公系统 Office Automation V3.0官方100%源」· PHP 代码 · 共 769 行 · 第 1/3 页

PHP
769
字号
		$displayorder = -2;
		$filter = 'normal';
		$filteroptions = '<option value="normal" selected>'.$lang['moderate_none'].'</option><option value="ignore">'.$lang['moderate_ignore'].'</option>';
	}

	$forumoptions = '<option value="all"'.(empty($modfid) ? ' selected' : '').'>'.$lang['moderate_all_fields'].'</option>';
	foreach($forumlist as $fid => $forumname) {
		$selected = $modfid == $fid ? ' selected' : '';
		$forumoptions .= '<option value="'.$fid.'" '.$selected.'>'.$forumname.'</option>'."\n";
	}

	require_once DISCUZ_ROOT.'./include/misc.func.php';
	$modreasonoptions = '<option value="">'.$lang['none'].'</option><option value="">--------</option>'.modreasonselect();

}

if($action == 'modthreads') {

	shownav('menu_moderate_modthreads');

	$validatedthreads = array();

	if(submitcheck('modsubmit')) {

		$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
		if(is_array($mod)) {
			foreach($mod as $tid => $action) {
				$moderation[$action][] = intval($tid);
			}
		}

		if($moderation['ignore']) {
			$ignoretids = '\''.implode('\',\'', $moderation['ignore']).'\'';
			$db->query("UPDATE {$tablepre}threads SET displayorder='-3' WHERE tid IN ($ignoretids) AND displayorder='-2'");
		}

		$threadsmod = 0;
		$pmlist = array();
		if($moderation['delete']) {
			$deletetids = '0';
			$recyclebintids = '0';
			$query = $db->query("SELECT tid, fid, authorid, subject FROM {$tablepre}threads WHERE tid IN ('".implode('\',\'', $moderation['delete'])."') AND displayorder='$displayorder' $fidadd[and]$fidadd[fids]");
			while($thread = $db->fetch_array($query)) {
				if($recyclebins[$thread['fid']]) {
					$recyclebintids .= ','.$thread['tid'];
				} else {
					$deletetids .= ','.$thread['tid'];
				}
				$pm = 'pm_'.$thread['tid'];
				if(isset($$pm) && $$pm <> '' && $thread['authorid']) {
					$pmlist[] = array(
						'act' => 'modthreads_delete_',
						'authorid' => $thread['authorid'],
						'thread' =>  $thread['subject'],
						'reason' => dhtmlspecialchars($$pm)
					);
				}
			}

			if($recyclebintids) {
				$db->query("UPDATE {$tablepre}threads SET displayorder='-1', moderated='1' WHERE tid IN ($recyclebintids)");
				updatemodworks('MOD', $db->affected_rows());

				$db->query("UPDATE {$tablepre}posts SET invisible='-1' WHERE tid IN ($recyclebintids)");
				updatemodlog($recyclebintids, 'DEL');
			}

			$query = $db->query("SELECT attachment, thumb, remote FROM {$tablepre}attachments WHERE tid IN ($deletetids)");
			while($attach = $db->fetch_array($query)) {
				dunlink($attach['attachment'], $attach['thumb'], $attach['remote']);
			}

			$db->query("DELETE FROM {$tablepre}threads WHERE tid IN ($deletetids)", 'UNBUFFERED');
			$db->query("DELETE FROM {$tablepre}posts WHERE tid IN ($deletetids)", 'UNBUFFERED');
			$db->query("DELETE FROM {$tablepre}polloptions WHERE tid IN ($deletetids)");
			$db->query("DELETE FROM {$tablepre}polls WHERE tid IN ($deletetids)", 'UNBUFFERED');
			$db->query("DELETE FROM {$tablepre}attachments WHERE tid IN ($deletetids)", 'UNBUFFERED');
		}

		if($moderation['validate']) {

			$forums = array();
			$validatetids = '\''.implode('\',\'', $moderation['validate']).'\'';

			$tids = $supe_pushtids = $comma = $comma2 = '';
			$authoridarray = $moderatedthread = array();
			$query = $db->query("SELECT t.fid, t.tid, t.authorid, t.subject, t.author, t.dateline, t.supe_pushstatus, ff.postcredits, ff.supe_pushsetting FROM {$tablepre}threads t
				LEFT JOIN {$tablepre}forumfields ff USING(fid)
				WHERE t.tid IN ($validatetids) AND t.displayorder='$displayorder' $fidadd[and]$fidadd[t]$fidadd[fids]");
			while($thread = $db->fetch_array($query)) {
				$supe_pushsetting = unserialize($thread['supe_pushsetting']);
				if($supe['status'] && $thread['supe_pushstatus'] == 0 && $supe_allowpushthread && $supe_pushsetting['status'] == '1') {
					$supe_pushtids .= $comma2.$thread['tid'];
					$comma2 = ',';
				}
				$tids .= $comma.$thread['tid'];
				$comma = ',';
				if($thread['postcredits']) {
					updatepostcredits('+', $thread['authorid'], unserialize($thread['postcredits']));
				} else {
					$authoridarray[] = $thread['authorid'];
				}
				$forums[] = $thread['fid'];
				$validatedthreads[] = $thread;

				$pm = 'pm_'.$thread['tid'];
				if(isset($$pm) && $$pm <> '' && $thread['authorid']) {
					$pmlist[] = array(
							'act' => 'modthreads_validate_',
							'authorid' => $thread['authorid'],
							'tid' => $thread['tid'],
							'thread' => $thread['subject'],
							'reason' => dhtmlspecialchars($$pm)
							);
				}
			}


			if($supe_pushtids) {
				$db->query("UPDATE {$tablepre}threads SET supe_pushstatus='1' WHERE tid IN ($supe_pushtids)");
			}

			if($tids) {

				if($authoridarray) {
					updatepostcredits('+', $authoridarray, $creditspolicy['post']);
				}

				$db->query("UPDATE {$tablepre}posts SET invisible='0' WHERE tid IN ($tids)");
				$db->query("UPDATE {$tablepre}threads SET displayorder='0', moderated='1' WHERE tid IN ($tids)");
				$threadsmod = $db->affected_rows();

				foreach(array_unique($forums) as $fid) {
					updateforumcount($fid);
				}

				updatemodworks('MOD', $threadsmod);
				updatemodlog($tids, 'MOD');

			}
		}

		if($pmlist) {
			foreach($pmlist as $pm) {
				$reason = $pm['reason'];
				$threadsubject = $pm['thread'];
				$tid = intval($pm['tid']);
				sendpm($pm['authorid'], $pm['act'].'subject', $pm['act'].'message', $fromid = '', $from = '');
			}
		}

	}

	if(!empty($validatedthreads)) {
?>
<form id="topicadmin" name="topicadmin" method="POST" action="topicadmin.php" target="_blank">
<input type="hidden" name="tid" value="">
<input type="hidden" name="fid" value="">
<input type="hidden" name="action" value="">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableborder">
<tr class="header"><td colspan="5"><?=$lang['moderate_validate_list']?></td></tr>
<tr class="category" align="center"><td>Tid</td><td><?=$lang['subject']?></td><td><?=$lang['author']?></td><td><?=$lang['dateline']?></td><td><?=$lang['front_moderation']?></td></tr>
<?

		foreach($validatedthreads as $thread) {
			echo '<tr><td width="8%" class="altbg1">'.$thread['tid'].'</td>'.
				'<td width="45%" class="altbg2"><a href="viewthread.php?tid='.$thread['tid'].'" target="_blank">'.$thread['subject'].'</a></td>'.
				'<td width="12%" class="altbg1"><a href="viewpro.php?uid='.$thread['authorid'].'" target="_blank">'.$thread['author'].'</a></td>'.
				'<td width="20%" class="altbg2">'.gmdate("$dateformat $timeformat", $thread['dateline'] + 3600 * $timeoffset).'</td>'.
				'<td width="15%" class="altbg1"><select name="action2" id="action2" onchange="if(this.options[this.selectedIndex].value != \'\') {$(\'topicadmin\').action.value= this.options[this.selectedIndex].value; $(\'topicadmin\').tid.value='.$thread['tid'].'; $(\'topicadmin\').fid.value='.$thread['fid'].'; $(\'topicadmin\').submit();}">
				<option value="" selected>'.$lang['admin_modoptions'].'</option>
				<option value="delete">'.$lang['admin_delthread'].'</option>
				<option value="close">'.$lang['admin_close'].'</option>
				<option value="move">'.$lang['admin_move'].'</option>
				<option value="copy">'.$lang['admin_copy'].'</option>
				<option value="highlight">'.$lang['admin_highlight'].'</option>
				<option value="digest">'.$lang['admin_digest'].'</option>
				<option value="stick">'.$lang['admin_stick'].'</option>
				<option value="merge">'.$lang['admin_merge'].'</option>
				<option value="bump">'.$lang['admin_bump'].'</option>
				<option value="repair">'.$lang['admin_repair'].'</option>
				</select></td></tr>';
		}
		echo '</table></form><br>';
	}

	require_once DISCUZ_ROOT.'./include/discuzcode.func.php';

	$tpp = 10;
	$page = max(1, intval($page));
	$start_limit = ($page - 1) * $tpp;

	$query = $db->query("SELECT COUNT(*) FROM {$tablepre}threads WHERE $fidadd[fids]$fidadd[and] displayorder='$displayorder'");
	$modcount = $db->result($query, 0);
	$multipage = multi($modcount, $tpp, $page, "admincp.php?action=modthreads&filter=$filter&modfid=$modfid");

	$threads = '';
	$query = $db->query("SELECT f.name AS forumname, f.allowsmilies, f.allowhtml, f.allowbbcode, f.allowimgcode,
			t.tid, t.fid, t.author, t.authorid, t.subject, t.dateline, t.attachment,
			p.pid, p.message, p.useip, p.attachment, p.htmlon, p.smileyoff, p.bbcodeoff
			FROM {$tablepre}threads t
			LEFT JOIN {$tablepre}posts p ON p.tid=t.tid
			LEFT JOIN {$tablepre}forums f ON f.fid=t.fid
			WHERE $fidadd[t]$fidadd[fids]$fidadd[and] t.displayorder='$displayorder'
			ORDER BY t.dateline DESC LIMIT $start_limit, $tpp");

	while($thread = $db->fetch_array($query)) {
		if($thread['authorid'] && $thread['author']) {
			$thread['author'] = "<a href=\"viewpro.php?uid=$thread[authorid]\" target=\"_blank\">$thread[author]</a>";
		} elseif($thread['authorid'] && !$thread['author']) {
			$thread['author'] = "<a href=\"viewpro.php?uid=$thread[authorid]\" target=\"_blank\">$lang[anonymous]</a>";
		} else {
			$thread['author'] = $lang['guest'];
		}

		$thread['dateline'] = gmdate("$dateformat $timeformat", $thread['dateline'] + $timeoffset * 3600);
		$thread['message'] = discuzcode($thread['message'], $thread['smileyoff'], $thread['bbcodeoff'], $thread['htmlon'], $thread['allowsmilies'], $thread['allowbbcode'], $thread['allowimgcode'], $thread['allowhtml']);

		$thisbg = $thisbg == 'altbg2' ? 'altbg1' : 'altbg2';

		$threads .= "<tr><td colspan=2 style=\"height: 2px\"></td></tr><tr class=\"altbg1\" id=\"mod_$thread[tid]_row1\"><td width=\"15%\" height=\"100%\">\n".
		"<b>$thread[author]</b> ({$thread[useip]})</td>\n".
		"<td><a href=\"forumdisplay.php?fid=$thread[fid]\" target=\"_blank\">$thread[forumname]</a> <b>&raquo;</b> <b>$thread[subject]</b></td></tr>\n".
		"<tr class=\"altbg2\" id=\"mod_$thread[tid]_row2\"><td valign=\"middle\" >".
		"<input class=\"radio\" type=\"radio\" name=\"mod[$thread[tid]]\" id=\"mod_$thread[tid]_1\" value=\"validate\" checked  onclick=\"mod_setbg($thread[tid], 'validate');\">$lang[validate]<br>\n".
		"<input class=\"radio\" type=\"radio\" name=\"mod[$thread[tid]]\" id=\"mod_$thread[tid]_2\" value=\"delete\" onclick=\"mod_setbg($thread[tid], 'delete');\">$lang[delete]<br>\n".
		"<input class=\"radio\" type=\"radio\" name=\"mod[$thread[tid]]\" id=\"mod_$thread[tid]_3\" value=\"ignore\" onclick=\"mod_setbg($thread[tid], 'ignore');\">$lang[ignore]\n".
		"</td>\n".
		"<td style=\"border-left: 1px #BBDCF1 solid; padding: 4px;\"><div style=\"overflow: auto; overflow-x: hidden; height:120px; word-break: break-all\">$thread[message]";

		if($thread['attachment']) {
			require_once DISCUZ_ROOT.'./include/attachment.func.php';

			$queryattach = $db->query("SELECT aid, filename, filetype, filesize, attachment, isimage FROM {$tablepre}attachments WHERE tid='$thread[tid]'");
			while($attach = $db->fetch_array($queryattach)) {
				$attach['url'] = $attach['isimage']
						? " $attach[filename] (".sizecount($attach['filesize']).")<br><br><img src=\"$attachurl/$attach[attachment]\" onload=\"if(this.width > 400) {this.resized=true; this.width=400;}\">"
						 : "<a href=\"$attachurl/$attach[attachment]\" target=\"_blank\">$attach[filename]</a> (".sizecount($attach['filesize']).")";
				$threads .= "<br><br>$lang[attachment]: ".attachtype(fileext($thread['filename'])."\t".$attach['filetype']).$attach['url'];
			}
		}
		$threads .= "</div></td></tr><tr class=altbg2 id=\"mod_$thread[tid]_row3\"><td style=\"text-align: center; padding: 0px;\">$thread[dateline]</td><td style=\"border-left: 1px #BBDCF1 solid; padding: 2px 10px 2px 10px;\">\n".
			"<a href=\"post.php?action=edit&fid=$thread[fid]&tid=$thread[tid]&pid=$thread[pid]&page=1&mod=edit\" target=\"_blank\">".$lang['moderate_edit_thread']."</a> ".
			"&nbsp;&nbsp;|&nbsp;&nbsp; ".$lang['moderate_reasonpm']."&nbsp; <input type=text size=30 name=pm_$thread[tid] id=pm_$thread[tid] style=\"margin: 0px;\"> &nbsp; <select style=\"margin: 0px;\" onchange=\"$('pm_$thread[tid]').value=this.value\">$modreasonoptions</select>".
			"</td></tr>\n";
	}

	$threads = $threads ? $threads : '<tr><td colspan="2" class="altbg1"><a href="admincp.php?action=modreplies">'.$lang['moderate_threads_none'].'</a></td></tr>';

?>
<style type="text/css">
.mod_validate td{ background: #FFFFFF; }
.mod_delete td{	background: #FFEBE7; }
.mod_ignore td{	background: #EEEEEE; }
</style>
<script type="text/javascript">
function mod_setbg(tid, value) {

⌨️ 快捷键说明

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