diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2013-06-06 20:32:47 +0200 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2013-06-06 20:32:47 +0200 |
| commit | 63334514555acea665186f20046a49a5ed41c334 (patch) | |
| tree | 49fb58d9b8bcde36cab13ddae7cfc6230878d06c /phpBB/includes/feed/overall.php | |
| parent | 3efe0eb24687a0e36e316b60887eff3ed45ae9b4 (diff) | |
| download | forums-63334514555acea665186f20046a49a5ed41c334.tar forums-63334514555acea665186f20046a49a5ed41c334.tar.gz forums-63334514555acea665186f20046a49a5ed41c334.tar.bz2 forums-63334514555acea665186f20046a49a5ed41c334.tar.xz forums-63334514555acea665186f20046a49a5ed41c334.zip | |
[ticket/11481] Remove globals and use dependency injection instead
PHPBB3-11481
Diffstat (limited to 'phpBB/includes/feed/overall.php')
| -rw-r--r-- | phpBB/includes/feed/overall.php | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/phpBB/includes/feed/overall.php b/phpBB/includes/feed/overall.php index 630f67660a..5fb922f6bb 100644 --- a/phpBB/includes/feed/overall.php +++ b/phpBB/includes/feed/overall.php @@ -27,8 +27,6 @@ class phpbb_feed_overall extends phpbb_feed_post_base { function get_sql() { - global $auth, $db; - $forum_ids = array_diff($this->get_readable_forums(), $this->get_excluded_forums(), $this->get_passworded_forums()); if (empty($forum_ids)) { @@ -37,27 +35,27 @@ class phpbb_feed_overall extends phpbb_feed_post_base // m_approve forums $fid_m_approve = $this->get_moderator_approve_forums(); - $sql_m_approve = (!empty($fid_m_approve)) ? 'OR ' . $db->sql_in_set('forum_id', $fid_m_approve) : ''; + $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 ' . $db->sql_in_set('forum_id', $forum_ids) . ' + WHERE ' . $this->db->sql_in_set('forum_id', $forum_ids) . ' AND topic_moved_id = 0 AND (topic_approved = 1 ' . $sql_m_approve . ') ORDER BY topic_last_post_time DESC'; - $result = $db->sql_query_limit($sql, $this->num_items); + $result = $this->db->sql_query_limit($sql, $this->num_items); $topic_ids = array(); $min_post_time = 0; - while ($row = $db->sql_fetchrow()) + while ($row = $this->db->sql_fetchrow()) { $topic_ids[] = (int) $row['topic_id']; $min_post_time = (int) $row['topic_last_post_time']; } - $db->sql_freeresult($result); + $this->db->sql_freeresult($result); if (empty($topic_ids)) { @@ -79,7 +77,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base 'ON' => 'f.forum_id = p.forum_id', ), ), - 'WHERE' => $db->sql_in_set('p.topic_id', $topic_ids) . ' + '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 p.post_time >= ' . $min_post_time . ' |
