diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2012-08-29 22:12:33 +0200 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2012-08-29 22:12:33 +0200 |
| commit | a1e0690b6b25ffd64f6ae2fc2f7b17a04e931690 (patch) | |
| tree | 3a843b117b44d09ad42e1fa8806d930f51beb826 /phpBB/feed.php | |
| parent | 44ed05f5678b36d907555ed040229564b336632f (diff) | |
| download | forums-a1e0690b6b25ffd64f6ae2fc2f7b17a04e931690.tar forums-a1e0690b6b25ffd64f6ae2fc2f7b17a04e931690.tar.gz forums-a1e0690b6b25ffd64f6ae2fc2f7b17a04e931690.tar.bz2 forums-a1e0690b6b25ffd64f6ae2fc2f7b17a04e931690.tar.xz forums-a1e0690b6b25ffd64f6ae2fc2f7b17a04e931690.zip | |
[feature/soft-delete] Simplification part2: user can see all item visibilities
If the user can see all visibilities, we can simply leave out the query part,
instead of adding a bunch of ANDs.
PHPBB3-9657
Diffstat (limited to 'phpBB/feed.php')
| -rw-r--r-- | phpBB/feed.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/phpBB/feed.php b/phpBB/feed.php index 79fedbf575..b6d93a45f8 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -779,6 +779,8 @@ class phpbb_feed_overall extends phpbb_feed_post_base return false; } + $sql_visibility = phpbb_content_visibility::get_visibility_sql('post', array(), 'p.'); + // Get the actual data $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, ' . @@ -795,7 +797,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base ), ), 'WHERE' => $db->sql_in_set('p.topic_id', $topic_ids) . ' - AND ' . phpbb_content_visibility::get_visibility_sql('post', array(), 'p.') . ' + ' . (($sql_visibility) ? ' AND ' . $sql_visibility : '') . ' AND p.post_time >= ' . $min_post_time . ' AND u.user_id = p.poster_id', 'ORDER_BY' => 'p.post_time DESC', @@ -885,14 +887,14 @@ class phpbb_feed_forum extends phpbb_feed_post_base { global $auth, $db; - $m_approve = ($auth->acl_get('m_approve', $this->forum_id)) ? true : false; + $sql_visibility = phpbb_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 - AND ' . phpbb_content_visibility::get_visibility_sql('topic', $this->forum_id) . ' + ' . (($sql_visibility) ? ' AND ' . $sql_visibility : '') . ' ORDER BY topic_last_post_time DESC'; $result = $db->sql_query_limit($sql, $this->num_items); @@ -911,6 +913,8 @@ class phpbb_feed_forum extends phpbb_feed_post_base return false; } + $sql_visibility = phpbb_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', @@ -919,7 +923,7 @@ class phpbb_feed_forum extends phpbb_feed_post_base USERS_TABLE => 'u', ), 'WHERE' => $db->sql_in_set('p.topic_id', $topic_ids) . ' - AND ' . phpbb_content_visibility::get_visibility_sql('post', $this->forum_id, 'p.') . ' + ' . (($sql_visibility) ? ' AND ' . $sql_visibility : '') . ' AND p.post_time >= ' . $min_post_time . ' AND p.poster_id = u.user_id', 'ORDER_BY' => 'p.post_time DESC', @@ -1017,6 +1021,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base { global $auth, $db; + $sql_visibility = phpbb_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', @@ -1025,7 +1030,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base USERS_TABLE => 'u', ), 'WHERE' => 'p.topic_id = ' . $this->topic_id . ' - AND ' . phpbb_content_visibility::get_visibility_sql('post', $this->forum_id, 'p.') . ' + ' . (($sql_visibility) ? ' AND ' . $sql_visibility : '') . ' AND p.poster_id = u.user_id', 'ORDER_BY' => 'p.post_time DESC', ); |
