📄 moderation.inc.php
字号:
<?php
/*
[Discuz!] (C)2001-2007 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$RCSfile: moderation.inc.php,v $
$Revision: 1.11.2.5 $
$Date: 2007/03/21 15:52:38 $
*/
if(!defined('IN_DISCUZ') || !defined('CURSCRIPT') || CURSCRIPT != 'topicadmin') {
exit('Access Denied');
}
if($action != 'moderate') {
$operation = $action;
$action = 'moderate';
$moderate = array($tid);
}
if(!in_array($operation, array('delete', 'move', 'copy', 'highlight', 'type', 'close', 'stick', 'digest', 'supe_push', 'removereward', 'bump')) || (!$allowdelpost && $operation == 'delete') || (!$allowstickthread && $operation == 'stick')) {
showmessage('admin_moderate_invalid');
}
$threadlist = $loglist = array();
if($tids = implodeids($moderate)) {
$sgidadd = $iscircleadmin ? "AND sgid='$gid'" : '';
$query = $db->query("SELECT * FROM {$tablepre}threads WHERE tid IN ($tids) AND fid='$fid' AND displayorder>='0' $sgidadd LIMIT $tpp");
while($thread = $db->fetch_array($query)) {
$thread['lastposterenc'] = rawurlencode($thread['lastposter']);
$thread['dblastpost'] = $thread['lastpost'];
$thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);
$threadlist[$thread['tid']] = $thread;
$tid = empty($tid) ? $thread['tid'] : $tid;
}
}
if(empty($threadlist)) {
showmessage('admin_moderate_invalid');
}
$modpostsnum = count($threadlist);
$single = $modpostsnum == 1 ? TRUE : FALSE;
$referer = "forumdisplay.php?fid=$fid";
if(!submitcheck('modsubmit')) {
if($operation == 'move') {
require_once DISCUZ_ROOT.'./include/forum.func.php';
$forumselect = forumselect();
} elseif($operation == 'highlight') {
$stylecheck = array();
$colorcheck = array(0 => 'checked');
if($single) {
$string = sprintf('%02d', $thread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
for($i = 1; $i <= 3; $i++) {
$stylecheck[$i] = $stylestr[$i - 1] ? 'checked' : '';
}
$colorcheck = array($string[1] => 'checked');
}
} elseif($operation == 'type') {
$typeselect = typeselect();
}
if(in_array($operation, array('stick', 'digest', 'highlight', 'close', 'supe_push'))) {
$expirationmin = gmdate($dateformat, $timestamp + 86400 + $timeoffset * 3600);
$expirationmax = gmdate($dateformat, $timestamp + 86400 * 180 + $timeoffset * 3600);
$expirationdefault = '';
$stickcheck = $digestcheck = $closecheck = $supe_pushstatus = array();
if($single) {
empty($threadlist[$tid]['displayorder']) ? $stickcheck[1] ='checked' : $stickcheck[$threadlist[$tid]['displayorder']] = 'checked';
empty($threadlist[$tid]['digest']) ? $digestcheck[1] = 'checked' : $digestcheck[$threadlist[$tid]['digest']] = 'checked';
empty($threadlist[$tid]['supe_pushstatus']) ? $supe_pushstatus[2] = 'checked' : $supe_pushstatus[$threadlist[$tid]['supe_pushstatus']] = 'checked';
empty($threadlist[$tid]['closed']) ? $closecheck[0] = 'checked' : $closecheck[1] = 'checked';
if($threadlist[$tid]['moderated']) {
switch($operation) {
case 'stick': $actionarray = array('EST'); break;
case 'digest': $actionarray = array('EDI'); break;
case 'highlight': $actionarray = array('EHL'); break;
case 'close': $actionarray = array('ECL', 'EOP'); break;
case 'supe_push': $actionarray = array('PTS', 'RFS'); break;
}
$query = $db->query("SELECT * FROM {$tablepre}threadsmod WHERE tid='{$threadlist[0][tid]}' ORDER BY dateline DESC");
while($log = $db->fetch_array($query)) {
$log['dateline'] = gmdate("$dateformat $timeformat", $log['dateline'] + $timeoffset * 3600);
$log['expiration'] = !empty($log['expiration']) ? gmdate("$dateformat", $log['expiration'] + $timeoffset * 3600) : '';
if($log['status'] && in_array($log['action'], $actionarray)) {
$expirationdefault = $log['expiration'];
}
$log['status'] = empty($log['status']) ? 'style="text-decoration: line-through" disabled' : '';
$loglist[] = $log;
}
if(!empty($loglist)) {
include_once language('modactions');
}
}
}
}
include template('topicadmin_moderate');
} else {
$moderatetids = implodeids(array_keys($threadlist));
checkreasonpm();
if($operation == 'delete') {
$stickmodify = 0;
foreach($threadlist as $thread) {
if($thread['digest']) {
updatecredits($thread['authorid'], $digestcredits, -$thread['digest'], 'digestposts=digestposts-1');
}
if(in_array($thread['displayorder'], array(2, 3))) {
$stickmodify = 1;
}
}
$losslessdel = $losslessdel > 0 ? $timestamp - $losslessdel * 86400 : 0;
//Update members' credits and post counter
$uidarray = $tuidarray = $ruidarray = array();
$query = $db->query("SELECT first, authorid, dateline FROM {$tablepre}posts WHERE tid IN ($moderatetids)");
while($post = $db->fetch_array($query)) {
if($post['dateline'] < $losslessdel) {
$uidarray[] = $post['authorid'];
} else {
if($post['first']) {
$tuidarray[] = $post['authorid'];
} else {
$ruidarray[] = $post['authorid'];
}
}
}
if($uidarray) {
updatepostcredits('-', $uidarray, array());
}
if($tuidarray) {
updatepostcredits('-', $tuidarray, $postcredits);
}
if($ruidarray) {
updatepostcredits('-', $ruidarray, $replycredits);
}
$modaction = 'DEL';
if($forum['recyclebin']) {
$db->query("UPDATE {$tablepre}threads SET displayorder='-1', digest='0', moderated='1' WHERE tid IN ($moderatetids)");
$db->query("UPDATE {$tablepre}posts SET invisible='-1' WHERE tid IN ($moderatetids)");
} else {
$auidarray = array();
$query = $db->query("SELECT uid, attachment, dateline, thumb, remote FROM {$tablepre}attachments WHERE tid IN ($moderatetids)");
while($attach = $db->fetch_array($query)) {
dunlink($attach['attachment'], $attach['thumb'], $attach['remote']);
if($attach['dateline'] > $losslessdel) {
$auidarray[$attach['uid']] = !empty($auidarray[$attach['uid']]) ? $auidarray[$attach['uid']] + 1 : 1;
}
}
if($auidarray) {
updateattachcredits('-', $auidarray, $postattachcredits);
}
foreach(array('threads', 'threadsmod', 'relatedthreads', 'posts', 'polls', 'polloptions', 'trades', 'activities', 'activityapplies', 'attachments', 'favorites', 'mythreads', 'myposts', 'subscriptions') as $value) {
$db->query("DELETE FROM {$tablepre}$value WHERE tid IN ($moderatetids)", 'UNBUFFERED');
}
}
if($globalstick && $stickmodify) {
require_once DISCUZ_ROOT.'./include/cache.func.php';
updatecache('globalstick');
}
updateforumcount($fid);
} else {
if(isset($expiration) && !empty($expiration) && in_array($operation, array('stick', 'digest', 'highlight', 'close'))) {
$expiration = strtotime($expiration) - $timeoffset * 3600 + date('Z');
if(gmdate('Ymd', $expiration + $timeoffset * 3600) <= gmdate('Ymd', $timestamp + $timeoffset * 3600) || ($expiration > $timestamp + 86400 * 180)) {
showmessage('admin_expiration_invalid');
}
} else {
$expiration = 0;
}
if($operation == 'stick' || $operation == 'digest') {
$level = intval($level);
if($level < 0 || $level > 3 || ( $operation == 'stick' && $level > $allowstickthread)) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -