屏蔽版块';
}
function deletemember($p){
global $_G;
if( !empty($p['param'][0]) ){
C::t('#thread_across#across_pbforums')->delete( $p['param'][0] );
}
}
protected function __thread_edit(){
global $_G, $thread, $isfirstpost;
if( !$_G['cache']['plugin']['thread_across']['open'] || !$_G['uid'] ) return;
$_G['cache']['plugin']['thread_across']['groupids'] = dunserialize($_G['cache']['plugin']['thread_across']['groupids']);
if( ! in_array($_G['groupid'], $_G['cache']['plugin']['thread_across']['groupids']) ) return;
if( $_GET['action'] == 'reply' ) return;
if( $_GET['action'] == 'edit' && !$isfirstpost ) return;
include_once libfile('function/forumlist');
$thread['across_fids'] = array_filter(explode(',', $thread['across_fids']));
$forums = forumselect(false, 0, $thread['across_fids']);
include template('thread_across:block_thread_edit');
return $return;
}
protected function __thread_save($param){
global $_G , $isfirstpost;
$pvars = $_G['cache']['plugin']['thread_across'];
$isfirstpost = in_array($param['param'][0] , array('post_newthread_succeed','post_newthread_mod_succeed')) ? 1 : $isfirstpost;
if( !$isfirstpost || !$pvars['open'] ) return;
if(!empty($param['param'][2]['tid'])){
C::t('forum_thread')->update($param['param'][2]['tid'], array(
'across_fids' => $_GET['across_fids'] ? (','. implode(',', $_GET['across_fids']) . ',') : ''
));
}
}
protected function __forumdisplay_lists(){
global $_G;
if( !$_G['cache']['plugin']['thread_across']['open'] || !$_G['uid'] ) return;
$this->__pbforums = $pbforums = C::t('#thread_across#across_pbforums')->fetch_by_uid( $_G['uid'] );
if($_G['forum_threadlist']){
$dblastposts = array_column($_G['forum_threadlist'], 'dblastpost');
$lastpost_end = current($dblastposts);
$lastpost_start = end($dblastposts);
}
foreach($_G['forum_threadlist'] as $key => $thread){
if( !empty($thread['across_fids']) ){
$thread['across_fids'] = array_filter(explode(',', $thread['across_fids']));
if( in_array($thread['fid'], $pbforums['fids']) ){//帖子发布的原版块也在屏蔽板块中时也不显示
unset($_G['forum_threadlist'][$key]);
$_G['forum_threadcount']--;
$this->__pbthreads++;
}
if( array_intersect($thread['across_fids'], $pbforums['fids']) ){//帖子的跨越版块也在屏蔽板块中时也不显示
unset($_G['forum_threadlist'][$key]);
$_G['forum_threadcount']--;
$this->__pbthreads++;
}
}
}
if( empty($_G['forum_threadlist']) && $_GET['page'] <= 1 ){
$lastpost_end = TIMESTAMP;
$lastpost_start = 0;
}
/*
if($_GET['orderby'] == 'lastpost'){//最新回复
}else if($_GET['orderby'] == 'dateline'){//最新发帖
}else if($_GET['orderby'] == 'heats'){//热门
}else if($_GET['filter'] == 'hot'){//热帖
}else if($_GET['filter'] == 'digest'){//精华
}*/
if( $_GET['page'] <= 1 ){
$sql = 'select * from %t where displayorder=0 and fid!=%d and across_fids like %s and lastpost>=%d order by lastpost desc';
$arg = array('forum_thread', $_G['fid'], "%,{$_G['fid']},%", $lastpost_start);
$across_threads = DB::fetch_all($sql, $arg);
}else{
if($_G['forum_threadlist']){
$sql = 'select * from %t where displayorder=0 and fid!=%d and across_fids like %s and lastpost>=%d and lastpost<%d order by lastpost desc';
$arg = array('forum_thread', $_G['fid'], "%,{$_G['fid']},%", $lastpost_start, $lastpost_end);
$across_threads = DB::fetch_all($sql, $arg);
}
}
$_G['forum']['threads'] += DB::result_first('select count(*) from %t where displayorder=0 and fid!=%d and across_fids like %s limit 1', array('forum_thread', $_G['fid'], "%,{$_G['fid']},%"));
$todaytime = strtotime(dgmdate(TIMESTAMP, 'Ymd'));
foreach($across_threads as $key => $thread){
$thread['across_fids'] = array_filter(explode(',', $thread['across_fids']));
if( in_array($thread['fid'], $pbforums['fids']) ){//帖子发布的原版块也在屏蔽板块中时也不显示
$this->__pbthreads++;
continue;
}
if( array_intersect($thread['across_fids'], $pbforums['fids']) ){//帖子的跨越版块也在屏蔽板块中时也不显示
$this->__pbthreads++;
continue;
}
$thread['allreplies'] = $thread['replies'] + $thread['comments'];
$thread['ordertype'] = getstatus($thread['status'], 4);
if($_G['forum']['picstyle'] && empty($_G['cookie']['forumdefstyle'])) {
$thread['coverpath'] = getthreadcover($thread['tid'], $thread['cover']);
$thread['cover'] = abs($thread['cover']);
}
//$thread['forumstick'] = in_array($thread['tid'], $forumstickytids);
$thread['related_group'] = 0;
$thread['lastposterenc'] = rawurlencode($thread['lastposter']);
if($thread['typeid'] && !empty($_G['forum']['threadtypes']['prefix']) && isset($_G['forum']['threadtypes']['types'][$thread['typeid']])) {
if($_G['forum']['threadtypes']['prefix'] == 1) {
$thread['typehtml'] = '['.$_G['forum']['threadtypes']['types'][$thread['typeid']].']';
} elseif($_G['forum']['threadtypes']['icons'][$thread['typeid']] && $_G['forum']['threadtypes']['prefix'] == 2) {
$thread['typehtml'] = ''.'
';
}
$thread['typename'] = $_G['forum']['threadtypes']['types'][$thread['typeid']];
} else {
$thread['typename'] = $thread['typehtml'] = '';
}
$thread['sorthtml'] = $thread['sortid'] && !empty($_G['forum']['threadsorts']['prefix']) && isset($_G['forum']['threadsorts']['types'][$thread['sortid']]) ?
'['.$_G['forum']['threadsorts']['types'][$thread['sortid']].']' : '';
$thread['multipage'] = '';
//$topicposts = $thread['special'] ? $thread['replies'] : $thread['replies'] + 1;
//$multipate_archive = $_GET['archiveid'] && in_array($_GET['archiveid'], $threadtableids) ? "archiveid={$_GET['archiveid']}" : '';
// if($topicposts > $_G['ppp']) {
// $pagelinks = '';
// $thread['pages'] = ceil($topicposts / $_G['ppp']);
// $realtid = $_G['forum']['status'] != 3 && $thread['isgroup'] == 1 ? $thread['closed'] : $thread['tid'];
// for($i = 2; $i <= 6 && $i <= $thread['pages']; $i++) {
// $pagelinks .= "$i";
// }
// if($thread['pages'] > 6) {
// $pagelinks .= "..$thread[pages]";
// }
// $thread['multipage'] = ' ...'.$pagelinks;
// }
if($thread['highlight']) {
$string = sprintf('%02d', $thread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$thread['highlight'] = ' style="';
$thread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$thread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$thread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$thread['highlight'] .= $string[1] ? 'color: '.$_G['forum_colorarray'][$string[1]].';' : '';
if($thread['bgcolor']) {
$thread['highlight'] .= "background-color: {$thread['bgcolor']};";
}
$thread['highlight'] .= '"';
} else {
$thread['highlight'] = '';
}
$thread['recommendicon'] = '';
if(!empty($_G['setting']['recommendthread']['status']) && $thread['recommends']) {
foreach($_G['setting']['recommendthread']['iconlevels'] as $k => $i) {
if($thread['recommends'] > $i) {
$thread['recommendicon'] = $k+1;
break;
}
}
}
$thread['moved'] = $thread['heatlevel'] = $thread['new'] = 0;
if($_G['forum']['status'] != 3 && ($thread['closed'] || ($_G['forum']['autoclose'] && $thread['fid'] == $_G['fid'] && TIMESTAMP - $thread[$closedby] > $_G['forum']['autoclose']))) {
if($thread['isgroup'] == 1) {
$thread['folder'] = 'common';
$grouptids[] = $thread['closed'];
} else {
if($thread['closed'] > 1) {
$thread['moved'] = $thread['tid'];
$thread['allreplies'] = $thread['replies'] = '-';
$thread['views'] = '-';
}
$thread['folder'] = 'lock';
}
} elseif($_G['forum']['status'] == 3 && $thread['closed'] == 1) {
$thread['folder'] = 'lock';
} else {
$thread['folder'] = 'common';
$thread['weeknew'] = TIMESTAMP - 604800 <= $thread['dateline'];
if($thread['allreplies'] > $thread['views']) {
$thread['views'] = $thread['allreplies'];
}
if($_G['setting']['heatthread']['iconlevels']) {
foreach($_G['setting']['heatthread']['iconlevels'] as $k => $i) {
if($thread['heats'] > $i) {
$thread['heatlevel'] = $k + 1;
break;
}
}
}
}
$thread['icontid'] = $thread['forumstick'] || !$thread['moved'] && $thread['isgroup'] != 1 ? $thread['tid'] : $thread['closed'];
if(!$thread['forumstick'] && ($thread['isgroup'] == 1 || $thread['fid'] != $_G['fid'])) {
$thread['icontid'] = $thread['closed'] > 1 ? $thread['closed'] : $thread['tid'];
}
$thread['istoday'] = $thread['dateline'] > $todaytime ? 1 : 0;
$thread['dbdateline'] = $thread['dateline'];
$thread['dateline'] = dgmdate($thread['dateline'], 'u', '9999', getglobal('setting/dateformat'));
$thread['dblastpost'] = $thread['lastpost'];
$thread['lastpost'] = dgmdate($thread['lastpost'], 'u');
$thread['hidden'] = $_G['setting']['threadhidethreshold'] && $thread['hidden'] >= $_G['setting']['threadhidethreshold'] || in_array($thread['tid'], $thide);
$_G['forum_threadlist'][] = $thread;
$_G['forum_threadcount'] ++;
}
if( $across_threads ){
array_multisort(array_column($_G['forum_threadlist'], 'dblastpost'), SORT_DESC, $_G['forum_threadlist']);
}
}
public function __forumdisplay_bottom_showtip(){
global $_G;
$html = '';
if( $this->__pbthreads > 0 ) {
if( $_G['mobile'] ){
$html = '某些帖子因您的隐私设置无法显示
';
}else{
$html = '某些帖子因您的隐私设置无法显示
';
}
}
return $html;
}
}
class plugin_thread_across_forum extends plugin_thread_across {
public function forumdisplay_forumaction(){
global $_G;
if( !$_G['cache']['plugin']['thread_across']['open'] || !$_G['uid'] ) return;
$pbforums = C::t('#thread_across#across_pbforums')->fetch_by_uid( $_G['uid'] );
$html = '|';
if( in_array($_G['fid'], $pbforums['fids']) ){
$html.= '
已屏蔽此版块';
}else{
$html.= '';
$html.= '
屏蔽此版块';
}
return $html;
}
public function post_middle_output(){
return $this->__thread_edit();
}
public function forumdisplay_top_output(){
$this->__forumdisplay_lists();
}
public function forumdisplay_postbutton_bottom_output(){
return $this->__forumdisplay_bottom_showtip();
}
public function forumdisplay_bottom_output(){
}
public function post_checkreply_message($param){
$this->__thread_save($param);
}
public function index_top_output(){
global $forumlist;
foreach($forumlist as $fid => $forum){
$forumlist[$fid]['threads'] += DB::result_first('select count(*) from %t where displayorder=0 and fid!=%d and across_fids like %s limit 1', array('forum_thread', $forum['fid'], "%,{$forum['fid']},%"));
}
}
}
class mobileplugin_thread_across extends plugin_thread_across {
}
class mobileplugin_thread_across_home extends plugin_thread_across {
public function space_profile_nav_extra_mobile(){
global $_G;
if( !$_G['cache']['plugin']['thread_across']['open'] || !$_G['uid'] ) return;
//return '屏蔽版块';
return '
屏蔽版块
';
}
}
class mobileplugin_thread_across_forum extends plugin_thread_across {
public function forumdisplay_nav_mobile(){
global $_G;
if( !$_G['cache']['plugin']['thread_across']['open'] || !$_G['uid'] ) return;
$pbforums = C::t('#thread_across#across_pbforums')->fetch_by_uid( $_G['uid'] );
$html = '';
if( in_array($_G['fid'], $pbforums['fids']) ){
$html .= '';
}else{
$html .= '';
}
return $html;
}
public function post_middle_mobile_output(){
return $this->__thread_edit();
}
public function forumdisplay_top_mobile_output(){
$this->__forumdisplay_lists();
}
public function forumdisplay_bottom_mobile_output(){
return $this->__forumdisplay_bottom_showtip();
}
public function post_checkreply_message($param){
$this->__thread_save($param);
}
public function index_top_mobile_output(){
global $forumlist;
foreach($forumlist as $fid => $forum){
$forumlist[$fid]['threads'] += DB::result_first('select count(*) from %t where displayorder=0 and fid!=%d and across_fids like %s limit 1', array('forum_thread', $forum['fid'], "%,{$forum['fid']},%"));
}
}
}
?>