Esempio n. 1
0
             manage_addnotify('verifythread');
         } elseif (!$isfirstpost && $modnewreplies) {
             DB::query("UPDATE " . DB::table('forum_thread') . " SET replies=replies-'1' WHERE tid='{$_G['tid']}'");
             manage_addnotify('verifypost');
         }
         if ($modnewreplies || $modnewthreads) {
             DB::update('forum_forum', array('modworks' => '1'), "fid='{$_G['fid']}'");
         }
     }
     if ($thread['lastpost'] == $orig['dateline'] && (!$orig['anonymous'] && $thread['lastposter'] == $orig['author'] || $orig['anonymous'] && $thread['lastposter'] == '') && $orig['anonymous'] != $isanonymous) {
         DB::query("UPDATE " . DB::table('forum_thread') . " SET lastposter='" . ($isanonymous ? '' : addslashes($orig['author'])) . "' WHERE tid='{$_G['tid']}'", 'UNBUFFERED');
     }
     if (!$isorigauthor) {
         updatemodworks('EDT', 1);
         require_once libfile('function/misc');
         modlog($thread, 'EDT');
     }
 } else {
     if (!$_G['setting']['editperdel']) {
         showmessage('post_edit_thread_ban_del', NULL);
     }
     if ($isfirstpost && $thread['replies'] > 0) {
         showmessage($thread['special'] == 3 ? 'post_edit_reward_already_reply' : 'post_edit_thread_already_reply', NULL);
     }
     if ($thread['special'] == 3) {
         if ($thread['price'] < 0 && $thread['dateline'] + 1 == $orig['dateline']) {
             showmessage('post_edit_reward_nopermission', NULL);
         }
     }
     if ($rushreply) {
         showmessage('post_edit_delete_rushreply_nopermission', NULL);
Esempio n. 2
0
        $modaction = $banned ? 'BNP' : 'UBN';
        checkreasonpm();
        $db->query("UPDATE {$tablepre}posts SET status='{$banned}' WHERE pid IN ({$banpids}) AND tid='{$tid}'", 'UNBUFFERED');
        $resultarray = array('redirect' => "viewthread.php?tid={$tid}&amp;page={$page}", 'reasonpm' => $sendreasonpm ? array('data' => $posts, 'var' => 'post', 'item' => 'reason_ban_post') : array(), 'modtids' => 0, 'modlog' => $thread);
    }
} else {
    showmessage('undefined_action', NULL, 'HALTED');
}
if ($resultarray) {
    if ($resultarray['modtids']) {
        updatemodlog($resultarray['modtids'], $modaction, $resultarray['expiration']);
    }
    updatemodworks($modaction, $modpostsnum);
    if (is_array($resultarray['modlog'])) {
        if (isset($resultarray['modlog']['tid'])) {
            modlog($resultarray['modlog'], $modaction);
        } else {
            foreach ($resultarray['modlog'] as $thread) {
                modlog($thread, $modaction);
            }
        }
    }
    if ($resultarray['reasonpm']) {
        include language('modactions');
        $modaction = $modactioncode[$modaction];
        foreach ($resultarray['reasonpm']['data'] as ${$resultarray['reasonpm']['var']}) {
            sendreasonpm($resultarray['reasonpm']['var'], $resultarray['reasonpm']['item']);
        }
    }
    showmessage(isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed', $resultarray['redirect']);
}
Esempio n. 3
0
} elseif ($action == 'blog') {
    if (!$discuz_uid || !$thread['blog'] && (!$allowuseblog || !$forum['allowshare'])) {
        showmessage('group_nopermission', NULL, 'NOPERM');
    }
    if ($thread['authorid'] != $discuz_uid) {
        $thread['adminid'] = $db->result_first("SELECT adminid FROM {$tablepre}members WHERE uid='{$thread['authorid']}'");
        if (!$forum['ismoderator'] || in_array($thread['adminid'], array(1, 2, 3)) && $adminid > $thread['adminid']) {
            showmessage('blog_add_illegal');
        }
    }
    $blog = $thread['blog'] ? 0 : 1;
    $db->query("UPDATE {$tablepre}threads SET blog='{$blog}' WHERE tid='{$tid}'", 'UNBUFFERED');
    if ($forum['ismoderator'] && $thread['authorid'] != $discuz_uid && $blog != $thread['blog']) {
        $reason = '';
        require_once DISCUZ_ROOT . './include/misc.func.php';
        modlog($thread, $thread['blog'] ? 'RBL' : 'ABL');
    }
    showmessage('blog_add_succeed', "viewthread.php?tid={$tid}");
} elseif ($action == 'viewthreadmod' && $tid) {
    $loglist = array();
    $query = $db->query("SELECT * FROM {$tablepre}threadsmod WHERE tid='{$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) : '';
        $log['status'] = empty($log['status']) ? 'style="text-decoration: line-through" disabled' : '';
        if ($log['magicid']) {
            require_once DISCUZ_ROOT . './forumdata/cache/cache_magics.php';
            $log['magicname'] = $_DCACHE['magics'][$log['magicid']]['name'];
        }
        $loglist[] = $log;
    }
 private function _adminTopic($fid, $tid, $pid, $act, $type)
 {
     global $_G;
     $errorMsg = '';
     $_GET['topiclist'] = array($_GET['pid']);
     // 在DISCUZ_ROOT/source/module/forum/forum_topicadmin.php基础上进行二次开发
     $_GET['topiclist'] = !empty($_GET['topiclist']) ? is_array($_GET['topiclist']) ? array_unique($_GET['topiclist']) : $_GET['topiclist'] : array();
     loadcache(array('modreasons', 'stamptypeid', 'threadtableids'));
     require_once libfile('function/post');
     require_once libfile('function/misc');
     $modpostsnum = 0;
     $resultarray = $thread = array();
     if ($_G['group']['reasonpm'] == 2 || $_G['group']['reasonpm'] == 3 || !empty($_GET['sendreasonpm'])) {
         $forumname = strip_tags($_G['forum']['name']);
         $sendreasonpm = 1;
     } else {
         $sendreasonpm = 0;
     }
     if ($type == 'topic') {
         if ($act == 'band') {
             $resultarray = $this->_topicAdmin_band($fid, $tid, $pid, $act, $type, array('sendreasonpm' => $sendreasonpm, 'thread' => $_G['forum_thread']));
         } else {
             // 在DISCUZ_ROOT/source/include/topicadmin/topicadmin_moderate.php基础上进行二次开发
             $thread = $_G['forum_thread'];
             $thread['dblastpost'] = $thread['lastpost'];
             $threadlist[$thread['tid']] = $thread;
             $modpostsnum = count($threadlist);
             $stickcheck = $closecheck = $digestcheck = array('', '', '', '', '');
             empty($threadlist[$_G['tid']]['displayorder']) ? $stickcheck[0] = 'selected="selected"' : ($stickcheck[$threadlist[$_G['tid']]['displayorder']] = 'selected="selected"');
             empty($threadlist[$_G['tid']]['digest']) ? $digestcheck[0] = 'selected="selected"' : ($digestcheck[$threadlist[$_G['tid']]['digest']] = 'selected="selected"');
             empty($threadlist[$_G['tid']]['closed']) ? $closecheck[0] = 'checked="checked"' : ($closecheck[1] = 'checked="checked"');
             if (!empty($_POST)) {
                 $tidsarr = array_keys($threadlist);
                 $moderatetids = dimplode($tidsarr);
                 $reason = checkreasonpm();
                 $stampstatus = 0;
                 $stampaction = 'SPA';
                 $operationMap = array('top' => 'stick', 'marrow' => 'digest', 'delete' => 'delete');
                 $operation = $operationMap[$act];
                 $updatemodlog = TRUE;
                 switch ($act) {
                     case 'top':
                         $sticklevel = intval($_GET['sticklevel']);
                         if ($sticklevel < 0 || $sticklevel > 3 || $sticklevel > $_G['group']['allowstickthread']) {
                             // showmessage('no_privilege_stickthread');
                             $this->_exitWithHtmlAlert('no_privilege_stickthread');
                         }
                         $expiration = checkexpiration($_GET['expirationstick'], $operation);
                         $expirationstick = $sticklevel ? $_GET['expirationstick'] : 0;
                         $forumstickthreads = $_G['setting']['forumstickthreads'];
                         $forumstickthreads = isset($forumstickthreads) ? dunserialize($forumstickthreads) : array();
                         C::t('forum_thread')->update($tidsarr, array('displayorder' => $sticklevel, 'moderated' => 1), true);
                         $delkeys = array_keys($threadlist);
                         foreach ($delkeys as $k) {
                             unset($forumstickthreads[$k]);
                         }
                         C::t('common_setting')->update('forumstickthreads', $forumstickthreads);
                         $stickmodify = 0;
                         foreach ($threadlist as $thread) {
                             $stickmodify = (in_array($thread['displayorder'], array(2, 3)) || in_array($sticklevel, array(2, 3))) && $sticklevel != $thread['displayorder'] ? 1 : $stickmodify;
                         }
                         if ($_G['setting']['globalstick'] && $stickmodify) {
                             require_once libfile('function/cache');
                             updatecache('globalstick');
                         }
                         $modaction = $sticklevel ? $expiration ? 'EST' : 'STK' : 'UST';
                         C::t('forum_threadmod')->update_by_tid_action($tidsarr, array('STK', 'UST', 'EST', 'UES'), array('status' => 0));
                         if (!$sticklevel) {
                             $stampaction = 'SPD';
                         }
                         $stampstatus = 1;
                         break;
                     case 'marrow':
                         $digestlevel = intval($_GET['digestlevel']);
                         if ($digestlevel < 0 || $digestlevel > 3 || $digestlevel > $_G['group']['allowdigestthread']) {
                             // showmessage('no_privilege_digestthread');
                             $this->_exitWithHtmlAlert('no_privilege_digestthread');
                         }
                         $expiration = checkexpiration($_GET['expirationdigest'], $operation);
                         $expirationdigest = $digestlevel ? $expirationdigest : 0;
                         C::t('forum_thread')->update($tidsarr, array('digest' => $digestlevel, 'moderated' => 1), true);
                         foreach ($threadlist as $thread) {
                             if ($thread['digest'] != $digestlevel) {
                                 if ($digestlevel == $thread['digest']) {
                                     continue;
                                 }
                                 $extsql = array();
                                 if ($digestlevel > 0 && $thread['digest'] == 0) {
                                     $extsql = array('digestposts' => 1);
                                 }
                                 if ($digestlevel == 0 && $thread['digest'] > 0) {
                                     $extsql = array('digestposts' => -1);
                                 }
                                 if ($digestlevel == 0) {
                                     $stampaction = 'SPD';
                                 }
                                 updatecreditbyaction('digest', $thread['authorid'], $extsql, '', $digestlevel - $thread['digest']);
                             }
                         }
                         $modaction = $digestlevel ? $expiration ? 'EDI' : 'DIG' : 'UDG';
                         C::t('forum_threadmod')->update_by_tid_action($tidsarr, array('DIG', 'UDI', 'EDI', 'UED'), array('status' => 0));
                         $stampstatus = 2;
                         break;
                     case 'delete':
                         if (!$_G['group']['allowdelpost']) {
                             // showmessage('no_privilege_delpost');
                             $this->_exitWithHtmlAlert('no_privilege_delpost');
                         }
                         loadcache('threadtableids');
                         $stickmodify = 0;
                         $deleteredirect = $remarkclosed = array();
                         foreach ($threadlist as $thread) {
                             if ($thread['digest']) {
                                 updatecreditbyaction('digest', $thread['authorid'], array('digestposts' => -1), '', -$thread['digest']);
                             }
                             if (in_array($thread['displayorder'], array(2, 3))) {
                                 $stickmodify = 1;
                             }
                             if ($_G['forum']['status'] == 3 && $thread['closed'] > 1) {
                                 $deleteredirect[] = $thread['closed'];
                             }
                             if ($thread['isgroup'] == 1 && $thread['closed'] > 1) {
                                 $remarkclosed[] = $thread['closed'];
                             }
                         }
                         $modaction = 'DEL';
                         require_once libfile('function/delete');
                         $tids = array_keys($threadlist);
                         if ($_G['forum']['recyclebin']) {
                             deletethread($tids, true, true, true);
                             manage_addnotify('verifyrecycle', $modpostsnum);
                         } else {
                             deletethread($tids, true, true);
                             $updatemodlog = FALSE;
                         }
                         $forumstickthreads = $_G['setting']['forumstickthreads'];
                         $forumstickthreads = !empty($forumstickthreads) ? dunserialize($forumstickthreads) : array();
                         $delkeys = array_keys($threadlist);
                         foreach ($delkeys as $k) {
                             unset($forumstickthreads[$k]);
                         }
                         C::t('common_setting')->update('forumstickthreads', $forumstickthreads);
                         C::t('forum_forum_threadtable')->delete_none_threads();
                         if (!empty($deleteredirect)) {
                             deletethread($deleteredirect);
                         }
                         if (!empty($remarkclosed)) {
                             C::t('forum_thread')->update($remarkclosed, array('closed' => 0));
                         }
                         if ($_G['setting']['globalstick'] && $stickmodify) {
                             require_once libfile('function/cache');
                             updatecache('globalstick');
                         }
                         updateforumcount($_G['fid']);
                         if ($_GET['crimerecord']) {
                             include_once libfile('function/member');
                             foreach ($threadlist as $thread) {
                                 crime('recordaction', $thread['authorid'], 'crime_delpost', lang('forum/misc', 'crime_postreason', array('reason' => $reason, 'tid' => $thread['tid'], 'pid' => 0)));
                             }
                         }
                         break;
                     case 'close':
                         if (!$_G['group']['allowclosethread']) {
                             $this->_exitWithHtmlAlert('no_privilege_closethread');
                         }
                         $expiration = checkexpiration($_GET['expirationclose'], $operation);
                         $modaction = $expiration ? 'ECL' : 'CLS';
                         C::t('forum_thread')->update($tidsarr, array('closed' => 1, 'moderated' => 1), true);
                         C::t('forum_threadmod')->update_by_tid_action($tidsarr, array('CLS', 'OPN', 'ECL', 'UCL', 'EOP', 'UEO'), array('status' => 0));
                         break;
                     case 'open':
                         if (!$_G['group']['allowclosethread']) {
                             $this->_exitWithHtmlAlert('no_privilege_openthread');
                         }
                         $expiration = checkexpiration($_GET['expirationclose'], $operation);
                         $modaction = $expiration ? 'EOP' : 'OPN';
                         C::t('forum_thread')->update($tidsarr, array('closed' => 0, 'moderated' => 1), true);
                         C::t('forum_threadmod')->update_by_tid_action($tidsarr, array('CLS', 'OPN', 'ECL', 'UCL', 'EOP', 'UEO'), array('status' => 0));
                         break;
                     case 'move':
                         if (!$_G['group']['allowmovethread']) {
                             $this->_exitWithHtmlAlert('no_privilege_movethread');
                         }
                         $moveto = $_GET['moveto'];
                         $toforum = C::t('forum_forum')->fetch_info_by_fid($moveto);
                         if (!$toforum || $_G['adminid'] != 1 && $toforum['status'] != 1 || $toforum['type'] == 'group') {
                             // showmessage('admin_move_invalid');
                             $this->_exitWithHtmlAlert('admin_move_invalid');
                         } elseif ($_G['fid'] == $toforum['fid']) {
                             continue;
                         } else {
                             $moveto = $toforum['fid'];
                             $modnewthreads = (!$_G['group']['allowdirectpost'] || $_G['group']['allowdirectpost'] == 1) && $toforum['modnewposts'] ? 1 : 0;
                             $modnewreplies = (!$_G['group']['allowdirectpost'] || $_G['group']['allowdirectpost'] == 2) && $toforum['modnewposts'] ? 1 : 0;
                             if ($modnewthreads || $modnewreplies) {
                                 // showmessage('admin_move_have_mod');
                                 $this->_exitWithHtmlAlert('admin_move_have_mod');
                             }
                         }
                         if ($_G['adminid'] == 3) {
                             $priv = C::t('forum_forumfield')->check_moderator_for_uid($moveto, $_G['uid'], $_G['member']['accessmasks']);
                             if (($priv['postperm'] && !in_array($_G['groupid'], explode("\t", $priv['postperm'])) || $_G['member']['accessmasks'] && ($priv['allowview'] || $priv['allowreply'] || $priv['allowgetattach'] || $priv['allowpostattach']) && !$priv['allowpost']) && !$priv['istargetmod']) {
                                 // showmessage('admin_move_nopermission');
                                 $this->_exitWithHtmlAlert('admin_move_nopermission');
                             }
                         }
                         $moderate = array();
                         $stickmodify = 0;
                         $toforumallowspecial = array(1 => $toforum['allowpostspecial'] & 1, 2 => $toforum['allowpostspecial'] & 2, 3 => isset($_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]) && $toforum['allowpostspecial'] & 4, 4 => $toforum['allowpostspecial'] & 8, 5 => $toforum['allowpostspecial'] & 16, 127 => $_G['setting']['threadplugins'] ? dunserialize($toforum['threadplugin']) : array());
                         foreach ($threadlist as $tid => $thread) {
                             $allowmove = 0;
                             if (!$thread['special']) {
                                 $allowmove = 1;
                             } else {
                                 if ($thread['special'] != 127) {
                                     $allowmove = $toforum['allowpostspecial'] ? $toforumallowspecial[$thread['special']] : 0;
                                 } else {
                                     if ($toforumallowspecial[127]) {
                                         $posttable = getposttablebytid($thread['tid']);
                                         $message = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
                                         $message = $message['message'];
                                         $sppos = strrpos($message, chr(0) . chr(0) . chr(0));
                                         $specialextra = substr($message, $sppos + 3);
                                         $allowmove = in_array($specialextra, $toforumallowspecial[127]);
                                     } else {
                                         $allowmove = 0;
                                     }
                                 }
                             }
                             if ($allowmove) {
                                 $moderate[] = $tid;
                                 if (in_array($thread['displayorder'], array(2, 3))) {
                                     $stickmodify = 1;
                                 }
                                 if ($_GET['appbyme_movetype'] == 'redirect') {
                                     // if($_GET['type'] == 'redirect') {
                                     $insertdata = array('fid' => $thread['fid'], 'readperm' => $thread['readperm'], 'author' => $thread['author'], 'authorid' => $thread['authorid'], 'subject' => $thread['subject'], 'dateline' => $thread['dateline'], 'lastpost' => $thread['dblastpost'], 'lastposter' => $thread['lastposter'], 'views' => 0, 'replies' => 0, 'displayorder' => 0, 'digest' => 0, 'closed' => $thread['tid'], 'special' => 0, 'attachment' => 0, 'typeid' => $_GET['threadtypeid']);
                                     $newtid = C::t('forum_thread')->insert($insertdata, true);
                                     if ($newtid) {
                                         C::t('forum_threadclosed')->insert(array('tid' => $thread['tid'], 'redirect' => $newtid), true, true);
                                     }
                                 }
                             }
                         }
                         if (!($moderatetids = implode(',', $moderate))) {
                             showmessage('admin_moderate_invalid');
                         }
                         $fieldarr = array('fid' => $moveto, 'isgroup' => 0, 'typeid' => $_GET['threadtypeid'], 'moderated' => 1);
                         if ($_G['adminid'] == 3) {
                             $fieldarr['displayorder'] = 0;
                         }
                         C::t('forum_thread')->update($tidsarr, $fieldarr, true);
                         C::t('forum_forumrecommend')->update($tidsarr, array('fid' => $moveto));
                         loadcache('posttableids');
                         $posttableids = $_G['cache']['posttableids'] ? $_G['cache']['posttableids'] : array('0');
                         foreach ($posttableids as $id) {
                             C::t('forum_post')->update_by_tid($id, $tidsarr, array('fid' => $moveto));
                         }
                         $typeoptionvars = C::t('forum_typeoptionvar')->fetch_all_by_tid_optionid($tidsarr);
                         foreach ($typeoptionvars as $typeoptionvar) {
                             C::t('forum_typeoptionvar')->update_by_tid($typeoptionvar['tid'], array('fid' => $moveto));
                             C::t('forum_optionvalue')->update($typeoptionvar['sortid'], $typeoptionvar['tid'], $_G['fid'], "fid='{$moveto}'");
                         }
                         if ($_G['setting']['globalstick'] && $stickmodify) {
                             require_once libfile('function/cache');
                             updatecache('globalstick');
                         }
                         $modaction = 'MOV';
                         $_G['toforum'] = $toforum;
                         updateforumcount($moveto);
                         updateforumcount($_G['fid']);
                         break;
                     default:
                         $errorMsg = '错误的动作参数';
                         break;
                 }
                 if ($errorMsg == '') {
                     if ($updatemodlog) {
                         if ($operation != 'delete') {
                             updatemodlog($moderatetids, $modaction, $expiration);
                         } else {
                             updatemodlog($moderatetids, $modaction, $expiration, 0, $reason);
                         }
                     }
                     updatemodworks($modaction, $modpostsnum);
                     foreach ($threadlist as $thread) {
                         modlog($thread, $modaction);
                     }
                     if ($sendreasonpm) {
                         $modactioncode = lang('forum/modaction');
                         $modtype = $modaction;
                         $modaction = $modactioncode[$modaction];
                         foreach ($threadlist as $thread) {
                             if ($operation == 'move') {
                                 sendreasonpm($thread, 'reason_move', array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => $reason, 'tofid' => $toforum['fid'], 'toname' => $toforum['name'], 'from_id' => 0, 'from_idtype' => 'movethread'));
                             } else {
                                 sendreasonpm($thread, 'reason_moderate', array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => $reason, 'from_id' => 0, 'from_idtype' => 'moderate_' . $modtype));
                             }
                         }
                     }
                     if ($stampstatus) {
                         set_stamp($stampstatus, $stampaction, $threadlist, $expiration);
                     }
                     $this->getController()->redirect(WebUtils::createUrl_oldVersion('index/returnmobileview'));
                 }
             } else {
                 if ($act == 'move') {
                     require_once libfile('function/forumlist');
                     $forumselect = forumselect(FALSE, 0, $threadlist[$_G['tid']]['fid'], $_G['adminid'] == 1 ? TRUE : FALSE);
                 }
             }
         }
     } else {
         if ($type == 'post') {
             if ($act == 'band') {
                 $resultarray = $this->_topicAdmin_band($fid, $tid, $pid, $act, $type, array('sendreasonpm' => $sendreasonpm, 'thread' => $_G['forum_thread']));
             } else {
                 // 在DISCUZ_ROOT/source/include/topicadmin/topicadmin_delpost.php基础上进行二次开发
                 $resultarray = array();
                 $thread = $_G['forum_thread'];
                 $topiclist = array($pid);
                 $modpostsnum = 1;
                 $pids = $posts = $authors = array();
                 $posttable = getposttablebytid($_G['tid']);
                 foreach (C::t('forum_post')->fetch_all('tid:' . $_G['tid'], $topiclist, false) as $post) {
                     if ($post['tid'] != $_G['tid']) {
                         continue;
                     }
                     if ($post['first'] == 1) {
                         dheader("location: {$_G['siteurl']}forum.php?mod=topicadmin&action=moderate&operation=delete&optgroup=3&fid={$_G['fid']}&moderate[]={$thread['tid']}&inajax=yes" . ($_GET['infloat'] ? "&infloat=yes&handlekey={$_GET['handlekey']}" : ''));
                     } else {
                         $authors[$post['authorid']] = 1;
                         $pids[] = $post['pid'];
                         $posts[] = $post;
                     }
                 }
                 if (!empty($_POST)) {
                     $reason = checkreasonpm();
                     $uidarray = $puidarray = $auidarray = array();
                     $losslessdel = $_G['setting']['losslessdel'] > 0 ? TIMESTAMP - $_G['setting']['losslessdel'] * 86400 : 0;
                     if ($pids) {
                         require_once libfile('function/delete');
                         if ($_G['forum']['recyclebin']) {
                             deletepost($pids, 'pid', true, false, true);
                             manage_addnotify('verifyrecyclepost', $modpostsnum);
                         } else {
                             $logs = array();
                             $ratelog = C::t('forum_ratelog')->fetch_all_by_pid($pids);
                             $rposts = C::t('forum_post')->fetch_all('tid:' . $_G['tid'], $pids, false);
                             foreach (C::t('forum_ratelog')->fetch_all_by_pid($pids) as $rpid => $author) {
                                 if ($author['score'] > 0) {
                                     $rpost = $rposts[$rpid];
                                     updatemembercount($rpost['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{$rpost['author']}\t{$author['extcredits']}\t{$author['score']}\t{$thread['tid']}\t{$thread['subject']}\t{$delpostsubmit}");
                                 }
                             }
                             if (!empty($logs)) {
                                 writelog('ratelog', $logs);
                                 unset($logs);
                             }
                             deletepost($pids, 'pid', true);
                         }
                         if ($_GET['crimerecord']) {
                             include_once libfile('function/member');
                             foreach ($posts as $post) {
                                 crime('recordaction', $post['authorid'], 'crime_delpost', lang('forum/misc', 'crime_postreason', array('reason' => $reason, 'tid' => $post['tid'], 'pid' => $post['pid'])));
                             }
                         }
                     }
                     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={$_GET['page']}", 'reasonpm' => $sendreasonpm ? array('data' => $posts, 'var' => 'post', 'item' => 'reason_delete_post', 'notictype' => 'post') : array(), 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => $reason), 'modtids' => 0, 'modlog' => $thread);
                 }
             }
         }
     }
     // 在DISCUZ_ROOT/source/module/forum/forum_topicadmin.php基础上进行二次开发
     if ($resultarray) {
         if ($resultarray['modtids']) {
             updatemodlog($resultarray['modtids'], $modaction, $resultarray['expiration']);
         }
         updatemodworks($modaction, $modpostsnum);
         if (is_array($resultarray['modlog'])) {
             if (isset($resultarray['modlog']['tid'])) {
                 modlog($resultarray['modlog'], $modaction);
             } else {
                 foreach ($resultarray['modlog'] as $thread) {
                     modlog($thread, $modaction);
                 }
             }
         }
         if ($resultarray['reasonpm']) {
             $modactioncode = lang('forum/modaction');
             $modaction = $modactioncode[$modaction];
             foreach ($resultarray['reasonpm']['data'] as $var) {
                 sendreasonpm($var, $resultarray['reasonpm']['item'], $resultarray['reasonvar'], $resultarray['reasonpm']['notictype']);
             }
         }
         // showmessage((isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed'), $resultarray['redirect']);
         $this->getController()->redirect(WebUtils::createUrl_oldVersion('index/returnmobileview'));
     }
     $this->getController()->renderPartial('topicAdmin', array('formUrl' => WebUtils::createUrl_oldVersion('forum/topicadminview', array('fid' => $fid, 'tid' => $tid, 'pid' => $pid, 'act' => $act, 'type' => $type)), 'errorMsg' => $errorMsg, 'action' => $act, '_G' => $_G, 'stickcheck' => $stickcheck, 'digestcheck' => $digestcheck, 'closecheck' => $closecheck, 'forumselect' => WebUtils::u($forumselect)));
 }
 public function editpost($parameters)
 {
     $this->_init_parameters($parameters);
     $isfirstpost = $this->post['first'] ? 1 : 0;
     $isorigauthor = $this->member['uid'] && $this->member['uid'] == $this->post['authorid'];
     $this->param['audit'] = $this->post['invisible'] == -2 || $this->thread['displayorder'] == -2 ? $this->param['audit'] : 0;
     list($this->param['modnewthreads'], $this->param['modnewreplies']) = threadmodstatus($this->param['subject'] . "\t" . $this->param['message'] . $this->param['extramessage']);
     if ($post_invalid = checkpost($this->param['subject'], $this->param['message'], $isfirstpost && ($this->param['special'] || $this->param['sortid']))) {
         showmessage($post_invalid, '', array('minpostsize' => $this->setting['minpostsize'], 'maxpostsize' => $this->setting['maxpostsize']));
     }
     if (!$isorigauthor && !$this->group['allowanonymous']) {
         if ($this->post['anonymous'] && !$this->param['isanonymous']) {
             $this->param['isanonymous'] = 0;
             $this->param['threadupdatearr']['author'] = $this->post['author'];
             $anonymousadd = 0;
         } else {
             $this->param['isanonymous'] = $this->post['anonymous'];
             $anonymousadd = '';
         }
     } else {
         $this->param['threadupdatearr']['author'] = $this->param['isanonymous'] ? '' : $this->post['author'];
         $anonymousadd = $this->param['isanonymous'];
     }
     if ($isfirstpost) {
         if (trim($this->param['subject']) == '' && $this->thread['special'] != 2) {
             showmessage('post_sm_isnull');
         }
         if (!$this->param['sortid'] && !$this->thread['special'] && trim($this->param['message']) == '') {
             showmessage('post_sm_isnull');
         }
         $publishdate = null;
         if ($this->group['allowsetpublishdate'] && $this->thread['displayorder'] == -4) {
             $cron_publish_ids = dunserialize($this->cache('cronpublish'));
             if (!$this->param['cronpublish'] && in_array($this->thread['tid'], $cron_publish_ids) || $this->param['modnewthreads']) {
                 $this->param['threadupdatearr']['dateline'] = $publishdate = TIMESTAMP;
                 unset($cron_publish_ids[$this->thread['tid']]);
                 $cron_publish_ids = serialize($cron_publish_ids);
                 savecache('cronpublish', $cron_publish_ids);
             } elseif ($this->param['cronpublish'] && $this->param['cronpublishdate']) {
                 $this->param['threadupdatearr']['dateline'] = $publishdate = strtotime($this->param['cronpublishdate']);
                 $this->param['save'] = 1;
                 if (!in_array($this->thread['tid'], $cron_publish_ids)) {
                     $cron_publish_ids[$this->thread['tid']] = $this->thread['tid'];
                     $cron_publish_ids = serialize($cron_publish_ids);
                     savecache('cronpublish', $cron_publish_ids);
                 }
             }
         }
         $this->param['readperm'] = $this->group['allowsetreadperm'] ? intval($this->param['readperm']) : ($isorigauthor ? 0 : 'ignore');
         if ($this->thread['special'] != 3) {
             $this->param['price'] = intval($this->param['price']);
             $this->param['price'] = $this->thread['price'] < 0 && !$this->thread['special'] ? $isorigauthor || !$this->param['price'] ? -1 : $this->param['price'] : ($this->group['maxprice'] ? $this->param['price'] <= $this->group['maxprice'] ? $this->param['price'] > 0 ? $this->param['price'] : 0 : $this->group['maxprice'] : ($isorigauthor ? $this->param['price'] : $this->thread['price']));
             if ($this->param['price'] > 0 && floor($this->param['price'] * (1 - $this->setting['creditstax'])) == 0) {
                 return $this->showmessage('post_net_price_iszero');
             }
         }
         $this->thread['status'] = setstatus(4, $this->param['ordertype'], $this->thread['status']);
         $this->thread['status'] = setstatus(15, $this->param['imgcontent'], $this->thread['status']);
         if ($this->param['imgcontent']) {
             stringtopic($this->param['message'], $this->post['tid'], true, $this->param['imgcontentwidth']);
         }
         $this->thread['status'] = setstatus(2, $this->param['hiddenreplies'], $this->thread['status']);
         $this->thread['status'] = setstatus(6, $this->param['allownoticeauthor'] ? 1 : 0, $this->thread['status']);
         $displayorder = empty($this->param['save']) ? $this->thread['displayorder'] == -4 ? -4 : $this->thread['displayorder'] : -4;
         $this->param['threadupdatearr']['typeid'] = $this->param['typeid'];
         $this->param['threadupdatearr']['sortid'] = $this->param['sortid'];
         $this->param['threadupdatearr']['subject'] = $this->param['subject'];
         if ($this->param['readperm'] !== 'ignore') {
             $this->param['threadupdatearr']['readperm'] = $this->param['readperm'];
         }
         $this->param['threadupdatearr']['price'] = $this->param['price'];
         $this->param['threadupdatearr']['status'] = $this->thread['status'];
         if (getglobal('forum_auditstatuson') && $this->param['audit'] == 1) {
             $this->param['threadupdatearr']['displayorder'] = 0;
             $this->param['threadupdatearr']['moderated'] = 1;
         } else {
             $this->param['threadupdatearr']['displayorder'] = $displayorder;
         }
         C::t('forum_thread')->update($this->thread['tid'], $this->param['threadupdatearr'], true);
         if ($this->thread['tid'] > 1) {
             if ($this->thread['closed'] > 1) {
                 C::t('forum_thread')->update($this->thread['closed'], array('subject' => $this->param['subject']), true);
             } elseif (empty($this->thread['isgroup'])) {
                 $threadclosed = C::t('forum_threadclosed')->fetch($thread['tid']);
                 if ($threadclosed['redirect']) {
                     C::t('forum_thread')->update($threadclosed['redirect'], array('subject' => $this->param['subject']), true);
                 }
             }
         }
         $class_tag = new tag();
         $tagstr = $class_tag->update_field($this->param['tags'], $this->thread['tid'], 'tid', $this->thread);
     } else {
         if ($this->param['subject'] == '' && $this->param['message'] == '' && $this->thread['special'] != 2) {
             showmessage('post_sm_isnull');
         }
     }
     $this->param['htmlon'] = $this->group['allowhtml'] && !empty($this->param['htmlon']) ? 1 : 0;
     if ($this->setting['editedby'] && TIMESTAMP - $this->post['dateline'] > 60 && $this->member['adminid'] != 1) {
         $editor = $this->param['isanonymous'] && $isorigauthor ? lang('forum/misc', 'anonymous') : $this->member['username'];
         $edittime = dgmdate(TIMESTAMP);
         $this->param['message'] = lang('forum/misc', $this->param['htmlon'] ? 'post_edithtml' : (!$this->forum['allowbbcode'] || $this->param['bbcodeoff'] ? 'post_editnobbcode' : 'post_edit'), array('editor' => $editor, 'edittime' => $edittime)) . $this->param['message'];
     }
     $this->param['bbcodeoff'] = checkbbcodes($this->param['message'], !empty($this->param['bbcodeoff']));
     $this->param['smileyoff'] = checksmilies($this->param['message'], !empty($this->param['smileyoff']));
     $tagoff = $isfirstpost ? !empty($tagoff) : 0;
     if (getglobal('forum_auditstatuson') && $this->param['audit'] == 1) {
         C::t('forum_post')->update($this->thread['posttableid'], $this->post['pid'], array('status' => 4), false, false, null, -2, null, 0);
         updatepostcredits('+', $this->post['authorid'], $isfirstpost ? 'post' : 'reply', $this->forum['fid']);
         updatemodworks('MOD', 1);
         updatemodlog($this->thread['tid'], 'MOD');
     }
     $displayorder = $pinvisible = 0;
     if ($isfirstpost) {
         $displayorder = $this->param['modnewthreads'] ? -2 : $this->thread['displayorder'];
         $pinvisible = $this->param['modnewthreads'] ? -2 : (empty($this->param['save']) ? 0 : -3);
     } else {
         $pinvisible = $this->param['modnewreplies'] ? -2 : ($this->thread['displayorder'] == -4 ? -3 : 0);
     }
     $this->param['message'] = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $this->param['message']);
     $this->param['parseurloff'] = !empty($this->param['parseurloff']);
     $setarr = array('message' => $this->param['message'], 'usesig' => $this->param['usesig'], 'htmlon' => $this->param['htmlon'], 'bbcodeoff' => $this->param['bbcodeoff'], 'parseurloff' => $this->param['parseurloff'], 'smileyoff' => $this->param['smileyoff'], 'subject' => $this->param['subject'], 'tags' => $tagstr, 'port' => getglobal('remoteport'));
     $setarr['status'] = $this->post['status'];
     if ($this->param['modstatus']) {
         foreach ($this->param['modstatus'] as $modbit => $modvalue) {
             $setarr['status'] = setstatus($modbit, $modvalue, $setarr['status']);
         }
     }
     if ($anonymousadd !== '') {
         $setarr['anonymous'] = $anonymousadd;
     }
     if ($publishdate) {
         $setarr['dateline'] = $publishdate;
     }
     if (getglobal('forum_auditstatuson') && $this->param['audit'] == 1) {
         $setarr['invisible'] = 0;
     } else {
         $setarr['invisible'] = $pinvisible;
     }
     C::t('forum_post')->update('tid:' . $this->thread['tid'], $this->post['pid'], $setarr);
     $this->forum['lastpost'] = explode("\t", $this->forum['lastpost']);
     if ($this->post['dateline'] == $this->forum['lastpost'][2] && ($this->post['author'] == $this->forum['lastpost'][3] || $this->forum['lastpost'][3] == '' && $this->post['anonymous'])) {
         $lastpost = $this->thread['tid'] . "\t" . ($isfirstpost ? $this->param['subject'] : $this->thread['subject']) . "\t" . $this->post['dateline'] . "\t" . ($this->param['isanonymous'] ? '' : $this->post['author']);
         C::t('forum_forum')->update($this->forum['fid'], array('lastpost' => $lastpost));
     }
     if (!getglobal('forum_auditstatuson') || $this->param['audit'] != 1) {
         if ($isfirstpost && $this->param['modnewthreads']) {
             C::t('forum_thread')->update($this->thread['tid'], array('displayorder' => -2));
             manage_addnotify('verifythread');
         } elseif (!$isfirstpost && $this->param['modnewreplies']) {
             C::t('forum_thread')->increase($this->thread['tid'], array('replies' => -1));
             manage_addnotify('verifypost');
         }
         if ($this->param['modnewreplies'] || $this->param['modnewthreads']) {
             C::t('forum_forum')->update($this->forum['fid'], array('modworks' => '1'));
         }
     }
     if ($this->thread['lastpost'] == $this->post['dateline'] && (!$this->post['anonymous'] && $this->thread['lastposter'] == $this->post['author'] || $this->post['anonymous'] && $this->thread['lastposter'] == '') && $this->post['anonymous'] != $this->param['isanonymous']) {
         C::t('forum_thread')->update($this->thread['tid'], array('lastposter' => $this->param['isanonymous'] ? '' : $this->post['author']), true);
     }
     if (!$isorigauthor) {
         updatemodworks('EDT', 1);
         require_once libfile('function/misc');
         modlog($this->thread, 'EDT');
     }
     if ($isfirstpost && $this->thread['displayorder'] == -4 && empty($this->param['save'])) {
         threadpubsave($this->thread['tid']);
     }
 }