diff options
Diffstat (limited to 'phpBB/includes/feed')
-rw-r--r-- | phpBB/includes/feed/base.php | 4 | ||||
-rw-r--r-- | phpBB/includes/feed/forum.php | 8 | ||||
-rw-r--r-- | phpBB/includes/feed/forums.php | 6 | ||||
-rw-r--r-- | phpBB/includes/feed/news.php | 4 | ||||
-rw-r--r-- | phpBB/includes/feed/overall.php | 15 | ||||
-rw-r--r-- | phpBB/includes/feed/post_base.php | 2 | ||||
-rw-r--r-- | phpBB/includes/feed/topic.php | 6 | ||||
-rw-r--r-- | phpBB/includes/feed/topic_base.php | 4 | ||||
-rw-r--r-- | phpBB/includes/feed/topics.php | 4 | ||||
-rw-r--r-- | phpBB/includes/feed/topics_active.php | 4 |
10 files changed, 25 insertions, 32 deletions
diff --git a/phpBB/includes/feed/base.php b/phpBB/includes/feed/base.php index af28ee8dc8..296d830932 100644 --- a/phpBB/includes/feed/base.php +++ b/phpBB/includes/feed/base.php @@ -80,10 +80,11 @@ abstract class phpbb_feed_base * @param phpbb_cache_driver_interface $cache Cache object * @param phpbb_user $user User object * @param phpbb_auth $auth Auth object + * @param phpbb_content_visibility $content_visibility Auth object * @param string $phpEx php file extension * @return null */ - function __construct(phpbb_feed_helper $helper, phpbb_config $config, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, phpbb_user $user, phpbb_auth $auth, $phpEx) + function __construct(phpbb_feed_helper $helper, phpbb_config $config, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, phpbb_user $user, phpbb_auth $auth, phpbb_content_visibility $content_visibility, $phpEx) { $this->config = $config; $this->helper = $helper; @@ -91,6 +92,7 @@ abstract class phpbb_feed_base $this->cache = $cache; $this->user = $user; $this->auth = $auth; + $this->content_visibility = $content_visibility; $this->phpEx = $phpEx; $this->set_keys(); diff --git a/phpBB/includes/feed/forum.php b/phpBB/includes/feed/forum.php index 7670fbeaaa..b5f0dd0f8f 100644 --- a/phpBB/includes/feed/forum.php +++ b/phpBB/includes/feed/forum.php @@ -90,14 +90,12 @@ class phpbb_feed_forum extends phpbb_feed_post_base function get_sql() { - $m_approve = ($this->auth->acl_get('m_approve', $this->forum_id)) ? true : false; - // 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 - ' . ((!$m_approve) ? 'AND topic_approved = 1' : '') . ' + 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); @@ -117,14 +115,14 @@ class phpbb_feed_forum extends phpbb_feed_post_base } $this->sql = array( - 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . + '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', 'FROM' => array( POSTS_TABLE => 'p', USERS_TABLE => 'u', ), 'WHERE' => $this->db->sql_in_set('p.topic_id', $topic_ids) . ' - ' . ((!$m_approve) ? 'AND p.post_approved = 1' : '') . ' + 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', diff --git a/phpBB/includes/feed/forums.php b/phpBB/includes/feed/forums.php index 72f786aa6a..409097a9f3 100644 --- a/phpBB/includes/feed/forums.php +++ b/phpBB/includes/feed/forums.php @@ -49,7 +49,7 @@ class phpbb_feed_forums extends phpbb_feed_base $this->sql = array( 'SELECT' => 'f.forum_id, f.left_id, f.forum_name, f.forum_last_post_time, f.forum_desc, f.forum_desc_bitfield, f.forum_desc_uid, f.forum_desc_options, - f.forum_topics, f.forum_posts', + f.forum_topics_approved, f.forum_posts_approved', 'FROM' => array(FORUMS_TABLE => 'f'), 'WHERE' => 'f.forum_type = ' . FORUM_POST . ' AND ' . $this->db->sql_in_set('f.forum_id', $in_fid_ary), @@ -65,8 +65,8 @@ class phpbb_feed_forums extends phpbb_feed_base if ($this->config['feed_item_statistics']) { - $item_row['statistics'] = $this->user->lang('TOTAL_TOPICS', (int) $row['forum_topics']) - . ' ' . $this->separator_stats . ' ' . $this->user->lang('TOTAL_POSTS_COUNT', (int) $row['forum_posts']); + $item_row['statistics'] = $this->user->lang('TOTAL_TOPICS', (int) $row['forum_topics_approved']) + . ' ' . $this->separator_stats . ' ' . $this->user->lang('TOTAL_POSTS_COUNT', (int) $row['forum_posts_approved']); } } } diff --git a/phpBB/includes/feed/news.php b/phpBB/includes/feed/news.php index 92cc18a3ab..f2d45b5165 100644 --- a/phpBB/includes/feed/news.php +++ b/phpBB/includes/feed/news.php @@ -72,7 +72,7 @@ class phpbb_feed_news extends phpbb_feed_topic_base FROM ' . TOPICS_TABLE . ' WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . ' AND topic_moved_id = 0 - AND topic_approved = 1 + AND topic_visibility = ' . ITEM_APPROVED . ' ORDER BY topic_time DESC'; $result = $this->db->sql_query_limit($sql, $this->num_items); @@ -90,7 +90,7 @@ class phpbb_feed_news extends phpbb_feed_topic_base $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, - t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, t.topic_last_post_time, + t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time, p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url', 'FROM' => array( TOPICS_TABLE => 't', diff --git a/phpBB/includes/feed/overall.php b/phpBB/includes/feed/overall.php index 5fb922f6bb..869df7cde0 100644 --- a/phpBB/includes/feed/overall.php +++ b/phpBB/includes/feed/overall.php @@ -33,17 +33,11 @@ class phpbb_feed_overall extends phpbb_feed_post_base return false; } - // m_approve forums - $fid_m_approve = $this->get_moderator_approve_forums(); - $sql_m_approve = (!empty($fid_m_approve)) ? 'OR ' . $this->db->sql_in_set('forum_id', $fid_m_approve) : ''; - // Determine topics with recent activity $sql = 'SELECT topic_id, topic_last_post_time FROM ' . TOPICS_TABLE . ' - WHERE ' . $this->db->sql_in_set('forum_id', $forum_ids) . ' - AND topic_moved_id = 0 - AND (topic_approved = 1 - ' . $sql_m_approve . ') + WHERE topic_moved_id = 0 + AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $forum_ids) . ' ORDER BY topic_last_post_time DESC'; $result = $this->db->sql_query_limit($sql, $this->num_items); @@ -65,7 +59,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base // Get the actual data $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, ' . - 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . + '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', 'FROM' => array( USERS_TABLE => 'u', @@ -78,8 +72,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base ), ), 'WHERE' => $this->db->sql_in_set('p.topic_id', $topic_ids) . ' - AND (p.post_approved = 1 - ' . str_replace('forum_id', 'p.forum_id', $sql_m_approve) . ') + 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', diff --git a/phpBB/includes/feed/post_base.php b/phpBB/includes/feed/post_base.php index a25ed50263..1f4cb4b5ef 100644 --- a/phpBB/includes/feed/post_base.php +++ b/phpBB/includes/feed/post_base.php @@ -51,7 +51,7 @@ abstract class phpbb_feed_post_base extends phpbb_feed_base { $item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row) . ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')]) - . (($this->is_moderator_approve_forum($row['forum_id']) && !$row['post_approved']) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_UNAPPROVED'] : ''); + . (($this->is_moderator_approve_forum($row['forum_id']) && $row['post_visibility'] !== ITEM_APPROVED) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_UNAPPROVED'] : ''); } } } diff --git a/phpBB/includes/feed/topic.php b/phpBB/includes/feed/topic.php index 7d9a344982..36f958ac60 100644 --- a/phpBB/includes/feed/topic.php +++ b/phpBB/includes/feed/topic.php @@ -43,7 +43,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base function open() { - $sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_approved, t.topic_title, t.topic_time, t.topic_views, t.topic_replies, t.topic_type + $sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_replies, t.topic_type FROM ' . TOPICS_TABLE . ' t LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = t.forum_id) @@ -94,14 +94,14 @@ class phpbb_feed_topic extends phpbb_feed_post_base function get_sql() { $this->sql = array( - 'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . + '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', 'FROM' => array( POSTS_TABLE => 'p', USERS_TABLE => 'u', ), 'WHERE' => 'p.topic_id = ' . $this->topic_id . ' - ' . ($this->forum_id && !$this->auth->acl_get('m_approve', $this->forum_id) ? 'AND p.post_approved = 1' : '') . ' + 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', ); diff --git a/phpBB/includes/feed/topic_base.php b/phpBB/includes/feed/topic_base.php index e6a47b4c86..b104a46631 100644 --- a/phpBB/includes/feed/topic_base.php +++ b/phpBB/includes/feed/topic_base.php @@ -51,9 +51,9 @@ abstract class phpbb_feed_topic_base extends phpbb_feed_base { $item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row) . ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')]) - . ' ' . $this->separator_stats . ' ' . $this->user->lang['REPLIES'] . ' ' . (($this->is_moderator_approve_forum($row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies']) + . ' ' . $this->separator_stats . ' ' . $this->user->lang['REPLIES'] . ' ' . $this->content_visibility->get_count('topic_posts', $row, $row['forum_id']) - 1 . ' ' . $this->separator_stats . ' ' . $this->user->lang['VIEWS'] . ' ' . $row['topic_views'] - . (($this->is_moderator_approve_forum($row['forum_id']) && ($row['topic_replies_real'] != $row['topic_replies'])) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POSTS_UNAPPROVED'] : ''); + . (($this->is_moderator_approve_forum($row['forum_id']) && $row['topic_posts_unapproved']) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POSTS_UNAPPROVED'] : ''); } } } diff --git a/phpBB/includes/feed/topics.php b/phpBB/includes/feed/topics.php index c8761d7176..31f5177773 100644 --- a/phpBB/includes/feed/topics.php +++ b/phpBB/includes/feed/topics.php @@ -44,7 +44,7 @@ class phpbb_feed_topics extends phpbb_feed_topic_base FROM ' . TOPICS_TABLE . ' WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . ' AND topic_moved_id = 0 - AND topic_approved = 1 + AND topic_visibility = ' . ITEM_APPROVED . ' ORDER BY topic_time DESC'; $result = $this->db->sql_query_limit($sql, $this->num_items); @@ -62,7 +62,7 @@ class phpbb_feed_topics extends phpbb_feed_topic_base $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, - t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, t.topic_last_post_time, + t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time, p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url', 'FROM' => array( TOPICS_TABLE => 't', diff --git a/phpBB/includes/feed/topics_active.php b/phpBB/includes/feed/topics_active.php index d1c920c136..249dd1d66a 100644 --- a/phpBB/includes/feed/topics_active.php +++ b/phpBB/includes/feed/topics_active.php @@ -59,7 +59,7 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base FROM ' . TOPICS_TABLE . ' WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . ' AND topic_moved_id = 0 - AND topic_approved = 1 + AND topic_visibility = ' . ITEM_APPROVED . ' ' . $last_post_time_sql . ' ORDER BY topic_last_post_time DESC'; $result = $this->db->sql_query_limit($sql, $this->num_items); @@ -78,7 +78,7 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, - t.topic_id, t.topic_title, t.topic_replies, t.topic_replies_real, t.topic_views, + t.topic_id, t.topic_title, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_post_time, p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url', 'FROM' => array( |