1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-13 10:04:35 +02:00

fixes #3277 implemented events for:

thread moved, thread updated, post created, post updated
deactivated: thread split
This commit is contained in:
Achim Ennenbach
2018-08-03 20:49:16 +02:00
parent 7a616430de
commit 480ccc20bc
3 changed files with 218 additions and 54 deletions

View File

@@ -930,6 +930,11 @@ class e107forum
$this->forumUpdateLastpost('forum', $oldForumId, false);
$this->forumUpdateLastpost('forum', $newForumId, false);
e107::getEvent()->trigger('user_forum_thread_moved', array(
'old_thread' => $threadInfo,
'new_thread' => $this->threadGet($threadId)
));
}
@@ -952,9 +957,9 @@ class e107forum
e107::getEvent()->trigger('user_forum_topic_updated', $triggerData);
}
function postUpdate($postId, $postInfo)
function postUpdate($postId, $postInfo)
{
$info = array();
$info['data'] = $postInfo;
@@ -968,11 +973,11 @@ class e107forum
$triggerData = $postInfo;
$triggerData['post_id'] = intval($postId);
e107::getEvent()->trigger('user_forum_post_updated', $info);
e107::getEvent()->trigger('user_forum_post_updated', $triggerData);
}
function threadGet($id, $joinForum = true, $uid = USERID)
{
$id = (int)$id;
@@ -1111,7 +1116,7 @@ class e107forum
$threadId = $sql->retrieve('forum_post', 'post_thread', 'post_id = '.$postId);
if($rows = $sql->retrieve('forum_post', 'post_id', 'post_thread = '.$threadId, TRUE))
{
{
$postids = array();
foreach($rows as $row)
@@ -1122,7 +1127,7 @@ class e107forum
if($postId == min($postids))
{
return true;
}
}
}
return false;
}
@@ -1507,6 +1512,7 @@ class e107forum
{
$sql = e107::getDb();
$where = '';
if(!empty($this->permList['view_list']))
{
$where = ($all ? '' : " WHERE forum_id IN ({$this->permList['view_list']}) ");
@@ -2055,8 +2061,11 @@ class e107forum
if ($sql->select('forum_thread', 'thread_id', "thread_lastpost < {$prunedate} AND thread_sticky != 1 AND thread_forum_id IN ({$forumList})"))
{
$threadList = $sql->db_getList();
$thread_count = count($threadList);
$reply_count = 0;
foreach($threadList as $thread)
{
$reply_count += (int)$sql->count('forum_post', '(*)', 'WHERE post_thread = '.$thread['thread_id']);
$this->threadDelete($thread['thread_id'], false);
}
foreach($forumArray as $fid)
@@ -2065,6 +2074,7 @@ class e107forum
$this->forumUpdateCounts($fid);
}
return FORLAN_8." ( ".$thread_count." ".FORLAN_92.", ".$reply_count." ".FORLAN_93." )";
return FORLAN_8." ( ".count($threadList)." ".FORLAN_92.", ".$reply_count." ".FORLAN_93." )";
}
else
{