同步宝塔上的源码
This commit is contained in:
53
source/plugin/thread_across/admin_across.inc.php
Executable file
53
source/plugin/thread_across/admin_across.inc.php
Executable file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$ident = $plugin['identifier'];
|
||||
$purl = 'action=plugins&operation=config&do='. $plugin['pluginid'] .'&identifier='.$plugin['identifier'].'&pmod='.$_GET['pmod'].'&tmod='.$_GET['tmod'];
|
||||
$curl = ADMINSCRIPT . '?'.$purl;
|
||||
|
||||
$_GET['act'] = $_GET['act'] ? $_GET['act'] : 'lists';
|
||||
$page = max(1, intval($_GET['page']));
|
||||
|
||||
$limit = 20;
|
||||
$start = ($page - 1) * $limit;
|
||||
|
||||
|
||||
switch($_GET['act']){
|
||||
|
||||
case 'delete' :
|
||||
if( !$_GET['tid'] || ($_GET['formhash']!=FORMHASH) ) exit;
|
||||
|
||||
C::t('forum_thread')->update( $_GET['tid'], array(
|
||||
'across_fids' => ''
|
||||
) );
|
||||
|
||||
cpmsg('操作成功',$purl,'succeed');
|
||||
|
||||
break;
|
||||
|
||||
default :
|
||||
loadcache('forums');
|
||||
$page = max(1, intval($_GET['page']));
|
||||
|
||||
$limit = 20;
|
||||
$start = ($page - 1) * $limit;
|
||||
|
||||
$count = DB::result_first("select count(*) from %t where across_fids != ''", array('forum_thread'));
|
||||
$lists = array();
|
||||
if($count){
|
||||
$lists = DB::fetch_all("select tid,fid,subject,authorid,author,across_fids,dateline from %t where across_fids != '' order by tid desc %i", array('forum_thread', DB::limit($start, $limit)));
|
||||
}
|
||||
|
||||
$multipage = multi($count, $limit, $page , $curl);
|
||||
|
||||
include template('thread_across:admin_across');
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
59
source/plugin/thread_across/ajax.inc.php
Executable file
59
source/plugin/thread_across/ajax.inc.php
Executable file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
if( $_GET['formhash'] != FORMHASH || !$_G['uid'] ) exit;
|
||||
|
||||
switch($_GET['op']){
|
||||
case 'pbforum_del':
|
||||
$fid = trim($_GET['fid']);
|
||||
|
||||
$pbforums = C::t('#thread_across#across_pbforums')->fetch_by_uid( $_G['uid'] );
|
||||
|
||||
$fids = array_diff( $pbforums['fids'], array($fid) );
|
||||
|
||||
C::t('#thread_across#across_pbforums')->update( $_G['uid'], array(
|
||||
'fids' => implode(',', $fids)
|
||||
) );
|
||||
|
||||
include template('common/header_ajax');
|
||||
|
||||
include template('common/footer_ajax');
|
||||
exit;
|
||||
break;
|
||||
|
||||
case 'pbforum_add' :
|
||||
$fid = trim($_GET['fid']);
|
||||
|
||||
$pbforums = C::t('#thread_across#across_pbforums')->fetch_by_uid( $_G['uid'] );
|
||||
|
||||
if( $pbforums ){
|
||||
$fids = (array) $pbforums['fids'];
|
||||
$fids[] = $fid;
|
||||
$pbforums['fids'] = array_unique($fids);
|
||||
|
||||
C::t('#thread_across#across_pbforums')->update( $_G['uid'], array(
|
||||
'fids' => implode(',', $pbforums['fids'])
|
||||
) );
|
||||
}else{
|
||||
C::t('#thread_across#across_pbforums')->insert(array(
|
||||
'uid' => $_G['uid'],
|
||||
'fids' => $fid
|
||||
) );
|
||||
}
|
||||
|
||||
if( $_G['mobile'] ){
|
||||
$extrajs = '<script type="text/javascript" reload="1">$("#a_forumpb").html("已屏蔽");setTimeout(() => {location.reload(true);}, 1500);</script>';
|
||||
|
||||
}else{
|
||||
$extrajs = '<script type="text/javascript" reload="1">$("a_forumpb").innerHTML="<img src=\'source/plugin/thread_across/static/icon_pingbi.svg\' style=\'vertical-align:middle;height:15px;margin-top:-2px;padding-right:4px;\'>已屏蔽此版块";setTimeout(() => {location.reload(true);}, 1500);</script>';
|
||||
}
|
||||
showmessage('已屏蔽此版块', dreferer(), array('fid' => $fid), array('showdialog' => true, 'closetime' => true, 'extrajs' => $extrajs));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
?>
|
98
source/plugin/thread_across/discuz_plugin_thread_across.xml
Executable file
98
source/plugin/thread_across/discuz_plugin_thread_across.xml
Executable file
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<root>
|
||||
<item id="Title"><![CDATA[Discuz! Plugin]]></item>
|
||||
<item id="Version"><![CDATA[X3.5]]></item>
|
||||
<item id="Time"><![CDATA[2025-06-19 11:28]]></item>
|
||||
<item id="From"><![CDATA[]]></item>
|
||||
<item id="Data">
|
||||
<item id="plugin">
|
||||
<item id="available"><![CDATA[1]]></item>
|
||||
<item id="adminid"><![CDATA[0]]></item>
|
||||
<item id="name"><![CDATA[跨版块发帖]]></item>
|
||||
<item id="identifier"><![CDATA[thread_across]]></item>
|
||||
<item id="description"><![CDATA[]]></item>
|
||||
<item id="datatables"><![CDATA[]]></item>
|
||||
<item id="directory"><![CDATA[thread_across/]]></item>
|
||||
<item id="copyright"><![CDATA[]]></item>
|
||||
<item id="version"><![CDATA[1.0]]></item>
|
||||
<item id="__modules">
|
||||
<item id="0">
|
||||
<item id="name"><![CDATA[hook]]></item>
|
||||
<item id="param"><![CDATA[]]></item>
|
||||
<item id="menu"><![CDATA[]]></item>
|
||||
<item id="url"><![CDATA[]]></item>
|
||||
<item id="type"><![CDATA[11]]></item>
|
||||
<item id="adminid"><![CDATA[0]]></item>
|
||||
<item id="displayorder"><![CDATA[0]]></item>
|
||||
<item id="navtitle"><![CDATA[]]></item>
|
||||
<item id="navicon"><![CDATA[]]></item>
|
||||
<item id="navsubname"><![CDATA[]]></item>
|
||||
<item id="navsuburl"><![CDATA[]]></item>
|
||||
</item>
|
||||
<item id="1">
|
||||
<item id="name"><![CDATA[hook]]></item>
|
||||
<item id="param"><![CDATA[]]></item>
|
||||
<item id="menu"><![CDATA[]]></item>
|
||||
<item id="url"><![CDATA[]]></item>
|
||||
<item id="type"><![CDATA[28]]></item>
|
||||
<item id="adminid"><![CDATA[0]]></item>
|
||||
<item id="displayorder"><![CDATA[0]]></item>
|
||||
<item id="navtitle"><![CDATA[]]></item>
|
||||
<item id="navicon"><![CDATA[]]></item>
|
||||
<item id="navsubname"><![CDATA[]]></item>
|
||||
<item id="navsuburl"><![CDATA[]]></item>
|
||||
</item>
|
||||
<item id="2">
|
||||
<item id="name"><![CDATA[userpb]]></item>
|
||||
<item id="param"><![CDATA[]]></item>
|
||||
<item id="menu"><![CDATA[屏蔽版块]]></item>
|
||||
<item id="url"><![CDATA[]]></item>
|
||||
<item id="type"><![CDATA[7]]></item>
|
||||
<item id="adminid"><![CDATA[0]]></item>
|
||||
<item id="displayorder"><![CDATA[1]]></item>
|
||||
<item id="navtitle"><![CDATA[]]></item>
|
||||
<item id="navicon"><![CDATA[]]></item>
|
||||
<item id="navsubname"><![CDATA[]]></item>
|
||||
<item id="navsuburl"><![CDATA[]]></item>
|
||||
</item>
|
||||
<item id="3">
|
||||
<item id="name"><![CDATA[admin_across]]></item>
|
||||
<item id="param"><![CDATA[]]></item>
|
||||
<item id="menu"><![CDATA[跨越主题]]></item>
|
||||
<item id="url"><![CDATA[]]></item>
|
||||
<item id="type"><![CDATA[3]]></item>
|
||||
<item id="adminid"><![CDATA[0]]></item>
|
||||
<item id="displayorder"><![CDATA[1]]></item>
|
||||
<item id="navtitle"><![CDATA[]]></item>
|
||||
<item id="navicon"><![CDATA[]]></item>
|
||||
<item id="navsubname"><![CDATA[]]></item>
|
||||
<item id="navsuburl"><![CDATA[]]></item>
|
||||
</item>
|
||||
</item>
|
||||
</item>
|
||||
<item id="version"><![CDATA[X3.5]]></item>
|
||||
<item id="var">
|
||||
<item id="0">
|
||||
<item id="displayorder"><![CDATA[1]]></item>
|
||||
<item id="title"><![CDATA[启用]]></item>
|
||||
<item id="description"><![CDATA[]]></item>
|
||||
<item id="variable"><![CDATA[open]]></item>
|
||||
<item id="type"><![CDATA[radio]]></item>
|
||||
<item id="value"><![CDATA[1]]></item>
|
||||
<item id="extra"><![CDATA[]]></item>
|
||||
</item>
|
||||
<item id="1">
|
||||
<item id="displayorder"><![CDATA[2]]></item>
|
||||
<item id="title"><![CDATA[发布跨版块用户组]]></item>
|
||||
<item id="description"><![CDATA[]]></item>
|
||||
<item id="variable"><![CDATA[groupids]]></item>
|
||||
<item id="type"><![CDATA[groups]]></item>
|
||||
<item id="extra"><![CDATA[]]></item>
|
||||
<item id="__value">
|
||||
<item id="0"><![CDATA[1]]></item>
|
||||
</item>
|
||||
</item>
|
||||
</item>
|
||||
<item id="installfile"><![CDATA[install.php]]></item>
|
||||
</item>
|
||||
</root>
|
378
source/plugin/thread_across/hook.class.php
Executable file
378
source/plugin/thread_across/hook.class.php
Executable file
@@ -0,0 +1,378 @@
|
||||
<?php
|
||||
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class plugin_thread_across {
|
||||
protected $__pbforums = array();
|
||||
protected $__pbthreads = 0;
|
||||
|
||||
public function global_myitem_extra(){
|
||||
global $_G;
|
||||
if( !$_G['cache']['plugin']['thread_across']['open'] ) return;
|
||||
|
||||
return '<li><a href="home.php?mod=spacecp&ac=plugin&id=thread_across:userpb">屏蔽版块</a></li>';
|
||||
}
|
||||
|
||||
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'] = '<em>[<a href="forum.php?mod=forumdisplay&fid='.$_G['fid'].'&filter=typeid&typeid='.$thread['typeid'].'">'.$_G['forum']['threadtypes']['types'][$thread['typeid']].'</a>]</em>';
|
||||
} elseif($_G['forum']['threadtypes']['icons'][$thread['typeid']] && $_G['forum']['threadtypes']['prefix'] == 2) {
|
||||
$thread['typehtml'] = '<em><a title="'.strip_tags($_G['forum']['threadtypes']['types'][$thread['typeid']]).'" href="forum.php?mod=forumdisplay&fid='.$_G['fid'].'&filter=typeid&typeid='.$thread['typeid'].'">'.'<img style="vertical-align: middle;padding-right:4px;" src="'.$_G['forum']['threadtypes']['icons'][$thread['typeid']].'" alt="'.strip_tags($_G['forum']['threadtypes']['types'][$thread['typeid']]).'" /></a></em>';
|
||||
}
|
||||
$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']]) ?
|
||||
'<em>[<a href="forum.php?mod=forumdisplay&fid='.$_G['fid'].'&filter=sortid&sortid='.$thread['sortid'].'">'.$_G['forum']['threadsorts']['types'][$thread['sortid']].'</a>]</em>' : '';
|
||||
$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 .= "<a href=\"forum.php?mod=viewthread&tid=$realtid&".(!empty($multipate_archive) ? "$multipate_archive&" : '')."extra=$extra&page=$i\" onclick=\"atarget(this)\">$i</a>";
|
||||
// }
|
||||
// if($thread['pages'] > 6) {
|
||||
// $pagelinks .= "..<a href=\"forum.php?mod=viewthread&tid=$realtid&".(!empty($multipate_archive) ? "$multipate_archive&" : '')."extra=$extra&page=$thread[pages]\" onclick=\"atarget(this)\">$thread[pages]</a>";
|
||||
// }
|
||||
// $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 = '<div style="font-size:16px;text-align:center;line-height:50px;">某些帖子因您的隐私设置无法显示</div>';
|
||||
}else{
|
||||
$html = '<div style="font-size:16px;text-align:center;line-height:34px;">某些帖子因您的隐私设置无法显示</div>';
|
||||
}
|
||||
}
|
||||
|
||||
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 = '<span class="pipe">|</span>';
|
||||
if( in_array($_G['fid'], $pbforums['fids']) ){
|
||||
$html.= '<img src="source/plugin/thread_across/static/icon_pingbi.svg" style="vertical-align:middle;height:15px;margin-top:-2px;padding-right:4px;">已屏蔽此版块';
|
||||
}else{
|
||||
$html.= '<a href="plugin.php?id=thread_across:ajax&formhash='.FORMHASH.'&op=pbforum_add&fid='.$_G['fid'].'" id="a_forumpb" onclick="showWindow(this.id, this.href, \'get\', 0);">';
|
||||
$html.= '<img src="source/plugin/thread_across/static/icon_pingbi.svg" style="vertical-align:middle;height:15px;margin-top:-2px;padding-right:4px;">屏蔽此版块</a>';
|
||||
}
|
||||
|
||||
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 '<li><a href="home.php?mod=spacecp&ac=plugin&id=thread_across:userpb"><i class="dm-error"></i>屏蔽版块</a></li>';
|
||||
return '<li>
|
||||
<a href="home.php?mod=spacecp&ac=plugin&id=thread_across:userpb">
|
||||
<img src="template/bygsjw_sj/image/bl_liebiao.png" alt="广播">
|
||||
屏蔽版块
|
||||
<img src="template/bygsjw_sj/image/jinru.png" alt="进入" class="myinfo_list_jinru">
|
||||
</a>
|
||||
</li>';
|
||||
}
|
||||
}
|
||||
|
||||
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 = '<style>.forumdisplay-top h2 #a_forumpb {float:right;height:28px;line-height:28px;font-size:12px;padding:0 10px;margin-top:10px;margin-left:5px;background-color:var(--dz-BG-3);color:var(--dz-FC-fff);border-radius:4px;}</style>';
|
||||
if( in_array($_G['fid'], $pbforums['fids']) ){
|
||||
$html .= '<script type="text/javascript" reload="1">$(".forumdisplay_top_y").append(\'<p><a href="javascript:;" id="a_forumpb" style="margin-top:10px">已屏蔽</a></p>\')</script>';
|
||||
}else{
|
||||
|
||||
$html .= '<script type="text/javascript" reload="1">$(".forumdisplay_top_y").append(\'<p><a href="plugin.php?id=thread_across:ajax&formhash='.FORMHASH.'&op=pbforum_add&fid='.$_G['fid'].'" id="a_forumpb" class="dialog" style="margin-top:10px">屏蔽版块</a></p>\')</script>';
|
||||
}
|
||||
|
||||
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']},%"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
0
source/plugin/thread_across/index.html
Executable file
0
source/plugin/thread_across/index.html
Executable file
20
source/plugin/thread_across/install.php
Executable file
20
source/plugin/thread_across/install.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
global $_G;
|
||||
$tablePre = $_G['config']['db'][1]['tablepre'];
|
||||
|
||||
$sql = <<<EOF
|
||||
create table if not exists `pre_across_pbforums`(
|
||||
uid int(11) unsigned primary key AUTO_INCREMENT,
|
||||
fids varchar(600) not null default ''
|
||||
) ENGINE = MYISAM comment '用户屏蔽版块';
|
||||
ALTER TABLE `pre_forum_thread` ADD COLUMN `across_fids` varchar(500) NOT NULL DEFAULT '' COMMENT '跨越版块';
|
||||
EOF;
|
||||
|
||||
runquery($sql);
|
||||
|
||||
$finish = TRUE;
|
||||
?>
|
1
source/plugin/thread_across/static/icon_pingbi.svg
Executable file
1
source/plugin/thread_across/static/icon_pingbi.svg
Executable file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750058107081" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11032" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20"><path d="M512 960.4C264.4 960.4 63.6 759.6 63.6 512S264.4 63.6 512 63.6 960.4 264.4 960.4 512 759.6 960.4 512 960.4z m0-837c-214.3 0-388.6 174.3-388.6 388.6S297.7 900.6 512 900.6 900.6 726.3 900.6 512 726.3 123.4 512 123.4z m180.6 569.1c-5.6 5.6-13.2 8.8-21.1 8.8-7.9 0-15.5-3.2-21.1-8.8l-319-318.8c-11.7-11.7-11.7-30.6 0-42.3 5.6-5.6 13.2-8.8 21.1-8.8 7.9 0 15.5 3.2 21.1 8.8l318.8 318.8c11.8 11.7 11.8 30.6 0.2 42.3z" fill="#BD2636" p-id="11033"></path></svg>
|
After Width: | Height: | Size: 784 B |
37
source/plugin/thread_across/table/table_across_pbforums.php
Executable file
37
source/plugin/thread_across/table/table_across_pbforums.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class table_across_pbforums extends discuz_table
|
||||
{
|
||||
public function __construct() {
|
||||
$this->_table = 'across_pbforums';
|
||||
$this->_pk = 'uid';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
public function fetch_by_uid ($uid = null ){
|
||||
if( empty($uid) ) return array();
|
||||
|
||||
$sql = 'select * from %t where %i limit 1';
|
||||
$arg = array(
|
||||
$this->_table ,
|
||||
DB::field('uid', $uid)
|
||||
);
|
||||
$data = DB::fetch_first($sql , $arg);
|
||||
if($data['fids']){
|
||||
$data['fids'] = array_filter(explode(',', $data['fids']));
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
61
source/plugin/thread_across/template/admin_across.htm
Executable file
61
source/plugin/thread_across/template/admin_across.htm
Executable file
@@ -0,0 +1,61 @@
|
||||
<script type="text/javascript">
|
||||
function delItem(tid){
|
||||
if( confirm('确定删除?') ){
|
||||
var url = '{$curl}&act=delete&formhash={FORMHASH}&tid=' + tid ;
|
||||
ajaxget(url, 'data_'+tid);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<form method="post" action="">
|
||||
<table class="tb tb2">
|
||||
<tbody id="list">
|
||||
<tr class="partition">
|
||||
<th width="">主题</th>
|
||||
<th width="70">发帖者</th>
|
||||
<th width="100">原版块</th>
|
||||
<th width="230">跨越fids</th>
|
||||
<th width="120">发布时间</th>
|
||||
<th width="110"></th>
|
||||
</tr>
|
||||
<!--{loop $lists $thread}-->
|
||||
<tr id="data_{$thread['tid']}">
|
||||
<td>
|
||||
<a href="forum.php?mod=viewthread&tid={$thread['tid']}">
|
||||
$thread['subject']
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="home.php?mod=space&uid={$thread['authorid']}">
|
||||
{$thread['author']}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="forum.php?mod=forumdisplay&fid={$thread['fid']}">
|
||||
{$_G['cache']['forums'][$thread['fid']]['name']}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{eval $across_fids = array_filter(explode(',', $thread['across_fids']));}
|
||||
<!--{loop $across_fids $across_fid}-->
|
||||
<a href="forum.php?mod=forumdisplay&fid={$across_fid}">
|
||||
{$_G['cache']['forums'][$across_fid]['name']}
|
||||
</a>
|
||||
<!--{/loop}-->
|
||||
</td>
|
||||
<td>
|
||||
{eval echo dgmdate($thread['dateline'])}
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="" onclick="delItem( '{$thread['tid']}' )">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
<!--{/loop}-->
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<!--{if $multipage }-->
|
||||
{$multipage}
|
||||
<!--{/if}-->
|
||||
|
17
source/plugin/thread_across/template/block_thread_edit.htm
Executable file
17
source/plugin/thread_across/template/block_thread_edit.htm
Executable file
@@ -0,0 +1,17 @@
|
||||
<!--{block return}-->
|
||||
<div class="exfm cl">
|
||||
<div class="sppoll">
|
||||
<dl class="cl">
|
||||
<dt class="z" style="margin-right: 18px;">
|
||||
<label>选择其它跨越版块:</label>
|
||||
</dt>
|
||||
<dd class="z">
|
||||
<select name="across_fids[]" multiple size="10">
|
||||
{$forums}
|
||||
</select>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--{/block}-->
|
10
source/plugin/thread_across/template/touch/block_thread_edit.htm
Executable file
10
source/plugin/thread_across/template/touch/block_thread_edit.htm
Executable file
@@ -0,0 +1,10 @@
|
||||
<!--{block return}-->
|
||||
<div class="across cl" style="padding: 5px 15px;">
|
||||
<h1 style="font-size: 16px;">选择其它跨越版块:</h1>
|
||||
<div>
|
||||
<select name="across_fids[]" multiple size="10" style="width: 100%;padding: 4px 12px;border-radius: 3px;">
|
||||
{$forums}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!--{/block}-->
|
37
source/plugin/thread_across/template/touch/userpb.htm
Executable file
37
source/plugin/thread_across/template/touch/userpb.htm
Executable file
@@ -0,0 +1,37 @@
|
||||
<style>
|
||||
.forums li{margin-bottom: 10px;padding-bottom: 10px;border-bottom: 1px solid #e0e0e0;}
|
||||
.forums, .forums a{font-size: 16px;}
|
||||
.forums .forumname{vertical-align: middle;}
|
||||
.forums .forumname img, .forums .forumname svg{width:32px;vertical-align: middle;}
|
||||
.forums .btn_del{float: right;background-color: var(--dz-FC-color);color:#fff;padding: 1px 12px;border-radius: 5px;}
|
||||
</style>
|
||||
|
||||
<div class="bodybox forums p10 cl">
|
||||
<ul>
|
||||
<!--{loop $forums $forum}-->
|
||||
<li id="fid_{$forum['fid']}" class="clear">
|
||||
<a href="forum.php?mod=forumdisplay&fid={$forum['fid']}" class="forumname" target="_blank">
|
||||
<!--{if $forum['icon']}-->
|
||||
<img src="data/attachment/common/$forum['icon']">
|
||||
<!--{else}-->
|
||||
<svg width="31" height="27"><path fill="#{if $forum[folder]}fdc910{else}c9c9c9{/if}" d="M31 13c0-7.2-6.9-13-15.5-13S0 5.8 0 13s6.9 13 15.5 13c1.6 0 3.2-.2 4.6-.6L27 28l-1.7-5c3.5-2.4 5.7-6 5.7-10z"/></svg>
|
||||
<!--{/if}-->
|
||||
{$forum['name']}
|
||||
(Fid:{$forum['fid']})
|
||||
</a>
|
||||
|
||||
<a href="javascript:;" class="btn_del" onclick="delfid( {$forum['fid']} )">
|
||||
删除
|
||||
</a>
|
||||
</li>
|
||||
<!--{/loop}-->
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function delfid( fid ){
|
||||
if( confirm('确认解除屏蔽?') ){
|
||||
ajaxget('plugin.php?id=thread_across:ajax&formhash={FORMHASH}&op=pbforum_del&fid='+fid , 'fid_'+fid, 'fid_'+fid, 'fid_'+fid)
|
||||
}
|
||||
}
|
||||
</script>
|
41
source/plugin/thread_across/template/userpb.htm
Executable file
41
source/plugin/thread_across/template/userpb.htm
Executable file
@@ -0,0 +1,41 @@
|
||||
<style>
|
||||
.forums, .forums a{font-size: 16px;}
|
||||
.forums .forumname{vertical-align: middle;}
|
||||
.forums .forumname img, .forums .forumname svg{height: 28px;}
|
||||
</style>
|
||||
<table cellspacing="0" cellpadding="0" class="dt mtm forums">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>屏蔽版块</th>
|
||||
<th width="50">操作</th>
|
||||
</tr>
|
||||
<!--{loop $forums $forum}-->
|
||||
<tr id="fid_{$forum['fid']}">
|
||||
<td>
|
||||
<a href="forum.php?mod=forumdisplay&fid={$forum['fid']}" class="forumname" target="_blank">
|
||||
<!--{if $forum['icon']}-->
|
||||
<img src="data/attachment/common/$forum['icon']">
|
||||
<!--{else}-->
|
||||
<svg width="31" height="29"><path fill="#{if $forum[folder]}fdc910{else}c9c9c9{/if}" d="M31 13c0-7.2-6.9-13-15.5-13S0 5.8 0 13s6.9 13 15.5 13c1.6 0 3.2-.2 4.6-.6L27 28l-1.7-5c3.5-2.4 5.7-6 5.7-10z"/></svg>
|
||||
<!--{/if}-->
|
||||
{$forum['name']}
|
||||
(Fid:{$forum['fid']})
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:;" class="btn_del" onclick="delfid( {$forum['fid']} )">
|
||||
删除
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<!--{/loop}-->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
function delfid( fid ){
|
||||
if( confirm('确认解除屏蔽?') ){
|
||||
ajaxget('plugin.php?id=thread_across:ajax&formhash={FORMHASH}&op=pbforum_del&fid='+fid , 'fid_'+fid, 'fid_'+fid, 'fid_'+fid)
|
||||
}
|
||||
}
|
||||
</script>
|
12
source/plugin/thread_across/userpb.inc.php
Executable file
12
source/plugin/thread_across/userpb.inc.php
Executable file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$pbforums = C::t('#thread_across#across_pbforums')->fetch_by_uid( $_G['uid'] );
|
||||
|
||||
$forums = DB::fetch_all('select f.fid,name,icon from %t as f join %t as ff on f.fid=ff.fid where f.fid in(%n)', array('forum_forum', 'forum_forumfield', $pbforums['fids']), 'fid');
|
||||
|
||||
?>
|
Reference in New Issue
Block a user