mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-19 06:51:33 +02:00
[ticket/11481] Remove globals and use dependency injection instead
PHPBB3-11481
This commit is contained in:
@@ -27,8 +27,6 @@ class phpbb_feed_topics extends phpbb_feed_topic_base
|
||||
{
|
||||
function get_sql()
|
||||
{
|
||||
global $db, $config;
|
||||
|
||||
$forum_ids_read = $this->get_readable_forums();
|
||||
if (empty($forum_ids_read))
|
||||
{
|
||||
@@ -44,18 +42,18 @@ class phpbb_feed_topics extends phpbb_feed_topic_base
|
||||
// We really have to get the post ids first!
|
||||
$sql = 'SELECT topic_first_post_id, topic_time
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('forum_id', $in_fid_ary) . '
|
||||
WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . '
|
||||
AND topic_moved_id = 0
|
||||
AND topic_approved = 1
|
||||
ORDER BY topic_time DESC';
|
||||
$result = $db->sql_query_limit($sql, $this->num_items);
|
||||
$result = $this->db->sql_query_limit($sql, $this->num_items);
|
||||
|
||||
$post_ids = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$post_ids[] = (int) $row['topic_first_post_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if (empty($post_ids))
|
||||
{
|
||||
@@ -77,7 +75,7 @@ class phpbb_feed_topics extends phpbb_feed_topic_base
|
||||
),
|
||||
),
|
||||
'WHERE' => 'p.topic_id = t.topic_id
|
||||
AND ' . $db->sql_in_set('p.post_id', $post_ids),
|
||||
AND ' . $this->db->sql_in_set('p.post_id', $post_ids),
|
||||
'ORDER_BY' => 'p.post_time DESC',
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user