function deletethread($param) { global $_G; if (!$this->_secStatus) { return false; } $step = $param['step']; $param = $param['param']; $ids = $param[0]; if ($_G['gp_formhash'] && $step == 'check') { require_once libfile('function/sec'); updateThreadOperate($ids, 2); if ($_G['gp_module'] == 'security' && $_G['gp_method'] == 'setEvilPost') { return true; } logDeleteThread($ids, $_G['gp_reason']); } return true; }
function undeletethreads($tids) { global $_G; $threadsundel = 0; if ($tids && is_array($tids)) { require_once libfile('function/sec'); updateThreadOperate($tids, 1); foreach ($tids as $t) { my_thread_log('restore', array('tid' => $t)); } $tids = '\'' . implode('\',\'', $tids) . '\''; $tuidarray = $ruidarray = $fidarray = $posttabletids = array(); $query = DB::query('SELECT tid, posttableid FROM ' . DB::table('forum_thread') . " WHERE tid IN ({$tids})"); while ($thread = DB::fetch($query)) { $posttabletids[$thread['posttableid'] ? $thread['posttableid'] : 0][] = $thread['tid']; } foreach ($posttabletids as $posttableid => $ptids) { $query = DB::query('SELECT fid, first, authorid FROM ' . DB::table(getposttable($posttableid)) . " WHERE tid IN (" . dimplode($ptids) . ")"); while ($post = DB::fetch($query)) { if ($post['first']) { $tuidarray[$post['fid']][] = $post['authorid']; } else { $ruidarray[$post['fid']][] = $post['authorid']; } if (!in_array($post['fid'], $fidarray)) { $fidarray[] = $post['fid']; } } updatepost(array('invisible' => '0'), "tid IN (" . dimplode($ptids) . ")", true, $posttableid); } if ($tuidarray) { foreach ($tuidarray as $fid => $tuids) { updatepostcredits('+', $tuids, 'post', $fid); } } if ($ruidarray) { foreach ($ruidarray as $fid => $ruids) { updatepostcredits('+', $ruids, 'reply', $fid); } } DB::query("UPDATE " . DB::table('forum_thread') . " SET displayorder='0', moderated='1' WHERE tid IN ({$tids})"); $threadsundel = DB::affected_rows(); updatemodlog($tids, 'UDL'); updatemodworks('UDL', $threadsundel); foreach ($fidarray as $fid) { updateforumcount($fid); } } return $threadsundel; }