mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-05 00:07:44 +02:00
[ticket/9657] Remove sql_visibility as it is always non-empty
PHPBB3-9657
This commit is contained in:
@@ -90,14 +90,12 @@ class phpbb_feed_forum extends phpbb_feed_post_base
|
||||
|
||||
function get_sql()
|
||||
{
|
||||
$sql_visibility = $this->content_visibility->get_visibility_sql('topic', $this->forum_id);
|
||||
|
||||
// Determine topics with recent activity
|
||||
$sql = 'SELECT topic_id, topic_last_post_time
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE forum_id = ' . $this->forum_id . '
|
||||
AND topic_moved_id = 0
|
||||
' . (($sql_visibility) ? ' AND ' . $sql_visibility : '') . '
|
||||
AND ' . $this->content_visibility->get_visibility_sql('topic', $this->forum_id) . '
|
||||
ORDER BY topic_last_post_time DESC';
|
||||
$result = $this->db->sql_query_limit($sql, $this->num_items);
|
||||
|
||||
@@ -116,8 +114,6 @@ class phpbb_feed_forum extends phpbb_feed_post_base
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql_visibility = $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.');
|
||||
|
||||
$this->sql = array(
|
||||
'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
|
||||
'u.username, u.user_id',
|
||||
@@ -127,6 +123,7 @@ class phpbb_feed_forum extends phpbb_feed_post_base
|
||||
),
|
||||
'WHERE' => $this->db->sql_in_set('p.topic_id', $topic_ids) . '
|
||||
' . (($sql_visibility) ? ' AND ' . $sql_visibility : '') . '
|
||||
AND ' . $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.') . '
|
||||
AND p.post_time >= ' . $min_post_time . '
|
||||
AND p.poster_id = u.user_id',
|
||||
'ORDER_BY' => 'p.post_time DESC',
|
||||
|
@@ -56,8 +56,6 @@ class phpbb_feed_overall extends phpbb_feed_post_base
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql_visibility = $this->content_visibility->get_visibility_sql('post', array(), 'p.');
|
||||
|
||||
// Get the actual data
|
||||
$this->sql = array(
|
||||
'SELECT' => 'f.forum_id, f.forum_name, ' .
|
||||
@@ -74,7 +72,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base
|
||||
),
|
||||
),
|
||||
'WHERE' => $this->db->sql_in_set('p.topic_id', $topic_ids) . '
|
||||
' . (($sql_visibility) ? ' AND ' . $sql_visibility : '') . '
|
||||
AND ' . $this->content_visibility->get_visibility_sql('post', array(), 'p.') . '
|
||||
AND p.post_time >= ' . $min_post_time . '
|
||||
AND u.user_id = p.poster_id',
|
||||
'ORDER_BY' => 'p.post_time DESC',
|
||||
|
@@ -93,8 +93,6 @@ class phpbb_feed_topic extends phpbb_feed_post_base
|
||||
|
||||
function get_sql()
|
||||
{
|
||||
$sql_visibility = $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.');
|
||||
|
||||
$this->sql = array(
|
||||
'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
|
||||
'u.username, u.user_id',
|
||||
@@ -103,7 +101,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base
|
||||
USERS_TABLE => 'u',
|
||||
),
|
||||
'WHERE' => 'p.topic_id = ' . $this->topic_id . '
|
||||
' . (($sql_visibility) ? ' AND ' . $sql_visibility : '') . '
|
||||
AND ' . $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.') . '
|
||||
AND p.poster_id = u.user_id',
|
||||
'ORDER_BY' => 'p.post_time DESC',
|
||||
);
|
||||
|
@@ -2000,8 +2000,6 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
|
||||
// Handle update of unapproved topics info.
|
||||
// Only update for moderators having m_approve permission for the forum.
|
||||
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||
$sql_update_unapproved = $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.');
|
||||
$sql_update_unapproved = ($sql_update_unapproved) ? ' AND ' . $sql_update_unapproved : '';
|
||||
|
||||
// Check the forum for any left unread topics.
|
||||
// If there are none, we mark the forum as read.
|
||||
@@ -2021,8 +2019,8 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
|
||||
AND tt.user_id = ' . $user->data['user_id'] . ')
|
||||
WHERE t.forum_id = ' . $forum_id . '
|
||||
AND t.topic_last_post_time > ' . $mark_time_forum . '
|
||||
AND t.topic_moved_id = 0 ' .
|
||||
$sql_update_unapproved . '
|
||||
AND t.topic_moved_id = 0
|
||||
AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.') . '
|
||||
AND (tt.topic_id IS NULL
|
||||
OR tt.mark_time < t.topic_last_post_time)';
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
@@ -2046,8 +2044,8 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
|
||||
FROM ' . TOPICS_TABLE . ' t
|
||||
WHERE t.forum_id = ' . $forum_id . '
|
||||
AND t.topic_last_post_time > ' . $mark_time_forum . '
|
||||
AND t.topic_moved_id = 0 ' .
|
||||
$sql_update_unapproved;
|
||||
AND t.topic_moved_id = 0
|
||||
AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.');
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$check_forum = $tracking_topics['tf'][$forum_id];
|
||||
|
Reference in New Issue
Block a user