foreach ($posts as $k => $post) { if ($warned && !($post['status'] & 2)) { my_post_log('warn', array('pid' => $post['pid'], 'uid' => $post['authorid'])); DB::query("UPDATE " . DB::table($posttable) . " SET status=status|2 WHERE pid='{$post['pid']}'", 'UNBUFFERED'); $reason = cutstr(dhtmlspecialchars($_G['gp_reason']), 40); DB::query("INSERT INTO " . DB::table('forum_warning') . " (pid, operatorid, operator, authorid, author, dateline, reason) VALUES ('{$post['pid']}', '{$_G['uid']}', '{$_G['username']}', '{$post['authorid']}', '" . addslashes($post['author']) . "', '{$_G['timestamp']}', '{$reason}')", 'UNBUFFERED'); $authorwarnings = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_warning') . " WHERE authorid='{$post['authorid']}' AND dateline>={$_G['timestamp']}-" . $_G[setting][warningexpiration] * 86400); if ($authorwarnings >= $_G['setting']['warninglimit']) { $member = DB::fetch_first("SELECT adminid, groupid FROM " . DB::table('common_member') . " WHERE uid='{$post['authorid']}'"); if ($member && $member['groupid'] != 4) { $banexpiry = TIMESTAMP + $_G['setting']['warningexpiration'] * 86400; $groupterms = array(); $groupterms['main'] = array('time' => $banexpiry, 'adminid' => $member['adminid'], 'groupid' => $member['groupid']); $groupterms['ext'][4] = $banexpiry; DB::query("UPDATE " . DB::table('common_member') . " SET groupid='4', groupexpiry='" . groupexpiry($groupterms) . "' WHERE uid='{$post['authorid']}'"); DB::query("UPDATE " . DB::table('common_member_field_forum') . " SET groupterms='" . addslashes(serialize($groupterms)) . "' WHERE uid='{$post['authorid']}'"); } } $pids .= $comma . $post['pid']; $comma = ','; } elseif (!$warned && $post['status'] & 2) { my_post_log('unwarn', array('pid' => $post['pid'], 'uid' => $post['authorid'])); DB::query("UPDATE " . DB::table($posttable) . " SET status=status^2 WHERE pid='{$post['pid']}' AND status=status|2", 'UNBUFFERED'); DB::query("DELETE FROM " . DB::table('forum_warning') . " WHERE pid='{$post['pid']}'", 'UNBUFFERED'); $pids .= $comma . $post['pid']; $comma = ','; } } $resultarray = array('redirect' => "forum.php?mod=viewthread&tid={$_G['tid']}&page={$page}", 'reasonpm' => $sendreasonpm ? array('data' => $posts, 'var' => 'post', 'item' => 'reason_warn_post') : array(), 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => stripslashes($reason), 'warningexpiration' => $_G['setting']['warningexpiration'], 'warninglimit' => $_G['setting']['warninglimit'], 'warningexpiration' => $_G['setting']['warningexpiration'], 'authorwarnings' => $authorwarnings), 'modtids' => 0, 'modlog' => $thread); procreportlog('', $pids); }
updatemembercount($author['authorid'], array($author['extcredits'] => -$author['score'])); $author['score'] = $_G['setting']['extcredits'][$id]['title'] . ' ' . -$author['score'] . ' ' . $_G['setting']['extcredits'][$id]['unit']; $logs[] = dhtmlspecialchars("{$_G['timestamp']}\t{$_G[member][username]}\t{$_G['adminid']}\t{$author['author']}\t{$author['extcredits']}\t{$author['score']}\t{$thread['tid']}\t{$thread['subject']}\t{$delpostsubmit}"); } } } if (!empty($logs)) { writelog('ratelog', $logs); unset($logs); } DB::delete('common_credit_log', "operation='PRC' AND relatedid IN({$pids})"); DB::query("DELETE FROM " . DB::table('forum_ratelog') . " WHERE pid IN ({$pids})"); DB::query("DELETE FROM " . DB::table('forum_attachment') . " WHERE pid IN ({$pids})"); DB::query("DELETE FROM " . DB::table('forum_attachmentfield') . " WHERE pid IN ({$pids})"); DB::query("DELETE FROM " . DB::table('forum_postcomment') . " WHERE pid IN ({$pids})"); DB::query("DELETE FROM " . DB::table($posttable) . " WHERE pid IN ({$pids})"); getstatus($thread['status'], 1) && DB::query("DELETE FROM " . DB::table('forum_postposition') . " WHERE pid IN ({$pids})"); $thread['stickreply'] && DB::query("DELETE FROM " . DB::table('forum_poststick') . " WHERE tid='{$thread['tid']}' AND pid IN ({$pids})"); foreach (explode(',', $pids) as $pid) { my_post_log('delete', array('pid' => $pid)); } if ($thread['special']) { DB::query("DELETE FROM " . DB::table('forum_trade') . " WHERE pid IN ({$pids})"); } updatethreadcount($_G['tid'], 1); updateforumcount($_G['fid']); $_G['forum']['threadcaches'] && deletethreadcaches($thread['tid']); $modaction = 'DLP'; $resultarray = array('redirect' => "forum.php?mod=viewthread&tid={$_G['tid']}&page={$page}", 'reasonpm' => $sendreasonpm ? array('data' => $posts, 'var' => 'post', 'item' => 'reason_delete_post') : array(), 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => stripslashes($reason)), 'modtids' => 0, 'modlog' => $thread); procreportlog('', $pids, TRUE); }
} if ($updatemodlog) { updatemodlog($moderatetids, $modaction, $expiration); } updatemodworks($modaction, $modpostsnum); foreach ($threadlist as $thread) { modlog($thread, $modaction); } if ($sendreasonpm) { include_once language('modactions'); $modaction = $modactioncode[$modaction]; foreach ($threadlist as $thread) { sendreasonpm('thread', $operation == 'move' ? 'reason_move' : 'reason_moderate'); } } procreportlog($moderatetids, '', $operation == 'delete'); if ($stampstatus) { set_stamp($stampstatus); } } showmessage('admin_succeed', $referer); } } function checkexpiration($expiration) { global $operation, $timestamp, $timeoffset; if (!empty($expiration) && in_array($operation, array('recommend', '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'); }