diff --git a/upload/source/admincp/moderate/moderate_reply.php b/upload/source/admincp/moderate/moderate_reply.php
index e9f9b3edbc8ec083cb70b953a01a4add73a43b9f..35f15fdf772061da52927b1c4e2f7bc1fb6535c2 100644
--- a/upload/source/admincp/moderate/moderate_reply.php
+++ b/upload/source/admincp/moderate/moderate_reply.php
@@ -260,12 +260,16 @@ if(!submitcheck('modsubmit') && !$_GET['fast']) {
$postlist[] = $post;
}
$threadlist = C::t('forum_thread')->fetch_all($tids);
-
+ $firsttime_validatepost = [];//首次审核通过帖子
+ $uids = [];
foreach($postlist as $post) {
$post['lastpost'] = $threadlist[$post['tid']]['lastpost'];
$pidarray[] = $post['pid'];
if(getstatus($post['status'], 3) == 0) {
+ $post['subject'] = $threadlist[$post['tid']]['subject'];
+ $firsttime_validatepost[] = $post;
+ $uids[] = $post['authorid'];
updatepostcredits('+', $post['authorid'], 'reply', $post['fid']);
$attachcount = C::t('forum_attachment_n')->count_by_id('tid:'.$post['tid'], 'pid', $post['pid']);
updatecreditbyaction('postattach', $post['authorid'], array(), '', $attachcount, 1, $post['fid']);
@@ -293,6 +297,36 @@ if(!submitcheck('modsubmit') && !$_GET['fast']) {
}
}
unset($postlist, $tids, $threadlist);
+ if($firsttime_validatepost) {//首次审核通过,发布动态
+ require_once libfile('function/post');
+ require_once libfile('function/feed');
+ $forumsinfo = C::t('forum_forum')->fetch_all_info_by_fids($forums);//需要allowfeed信息, 允许推送动态,默认推送广播
+ $users = [];
+ foreach ($uids as $uid) {
+ $space = array('uid'=>$uid);
+ space_merge($space, 'field_home');//需要['privacy']['feed']['newreply']信息
+ $users[$uid] = $space;
+ }
+ foreach ($firsttime_validatepost as $post) {
+ if($forumsinfo[$post['fid']] && $forumsinfo[$post['fid']]['allowfeed'] && $users[$post['authorid']]['privacy']['feed']['newreply'] && !$post['anonymous']) {
+ $feed = array(
+ 'icon' => 'post',
+ 'title_template' => 'feed_reply_title',
+ 'title_data' => array(),
+ 'images' => array()
+ );
+ $post_url = "forum.php?mod=redirect&goto=findpost&pid=".$post['pid']."&ptid=".$post['tid'];
+ $feed['title_data'] = array(
+ 'subject' => "".$post['subject']."",
+ 'author' => "".$post['author'].""
+ );
+ $feed['title_data']['hash_data'] = 'tid'.$post['tid'];
+ $feed['id'] = $post['pid'];
+ $feed['idtype'] = 'pid';
+ feed_add($feed['icon'], $feed['title_template'], $feed['title_data'], $feed['body_template'], $feed['body_data'], '', $feed['images'], $feed['image_links'], '', '', '', 0, $feed['id'], $feed['idtype'],$post['authorid'], $post['author']);
+ }
+ }
+ }
foreach($threads as $tid => $thread) {
C::t('forum_thread')->increase($tid, $thread);
diff --git a/upload/source/admincp/moderate/moderate_thread.php b/upload/source/admincp/moderate/moderate_thread.php
index c5b875fc97fa68a3ea651d18308b76eb8c9eb6e1..2105f33425de38c4afbbace3c344a44f5ff3a949 100644
--- a/upload/source/admincp/moderate/moderate_thread.php
+++ b/upload/source/admincp/moderate/moderate_thread.php
@@ -239,16 +239,22 @@ if(!submitcheck('modsubmit') && !$_GET['fast']) {
require_once libfile('function/forum');
$forums = array();
- $tids = $authoridarray = $moderatedthread = array();
+ $tids = $authoridarray = $moderatedthread = array();
+ $firsttime_validatethread = [];//首次审核通过帖子
+ $uids = [];
foreach(C::t('forum_thread')->fetch_all_by_tid_fid($moderation['validate'], $fidadd['fids']) as $thread) {
if($thread['displayorder'] != -2 && $thread['displayorder']!= -3) {
continue;
}
$poststatus = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
+ $thread['anonymous'] = $poststatus['anonymous'];
+ $thread['message'] = $poststatus['message'];
$poststatus = $poststatus['status'];
$tids[] = $thread['tid'];
if(getstatus($poststatus, 3) == 0) {
+ $firsttime_validatethread[] = $thread;
+ $uids[] = $thread['authorid'];
updatepostcredits('+', $thread['authorid'], 'post', $thread['fid']);
$attachcount = C::t('forum_attachment_n')->count_by_id('tid:'.$thread['tid'], 'tid', $thread['tid']);
updatecreditbyaction('postattach', $thread['authorid'], array(), '', $attachcount, 1, $thread['fid']);
@@ -266,7 +272,41 @@ if(!submitcheck('modsubmit') && !$_GET['fast']) {
);
}
}
-
+ if($firsttime_validatethread) {//首次审核通过,发布动态
+ require_once libfile('function/post');
+ require_once libfile('function/feed');
+ $forumsinfo = C::t('forum_forum')->fetch_all_info_by_fids($forums);//需要allowfeed信息,允许推送动态,默认推送广播
+ $users = [];
+ foreach ($uids as $uid) {
+ $space = array('uid'=>$uid);
+ space_merge($space, 'field_home');//需要['privacy']['feed']['newthread']信息
+ $users[$uid] = $space;
+ }
+ foreach ($firsttime_validatethread as $thread) {
+ if($forumsinfo[$thread['fid']] && $forumsinfo[$thread['fid']]['allowfeed'] && $users[$thread['authorid']]['privacy']['feed']['newthread'] && !$thread['anonymous']) {
+ $feed = array(
+ 'icon' => 'thread',
+ 'title_template' => 'feed_thread_title',
+ 'title_data' => array(),
+ 'body_template' => 'feed_thread_message',
+ 'body_data' => array(),
+ 'title_data' => array(),
+ 'images' => array()
+ );
+
+ $message = !$thread['price'] && !$thread['readperm'] ? $thread['message'] : '';
+ $message = messagesafeclear($message);
+ $feed['body_data'] = array(
+ 'subject' => "{$thread['subject']}",
+ 'message' => messagecutstr($message, 150)
+ );
+ $feed['title_data']['hash_data'] = 'tid'.$thread['tid'];
+ $feed['id'] = $thread['tid'];
+ $feed['idtype'] = 'tid';
+ feed_add($feed['icon'], $feed['title_template'], $feed['title_data'], $feed['body_template'], $feed['body_data'], '', $feed['images'], $feed['image_links'], '', '', '', 0, $feed['id'], $feed['idtype'],$thread['authorid'], $thread['author']);
+ }
+ }
+ }
if($tids) {
$tidstr = dimplode($tids);