File: phpbb/viewonline_helper.php
Unmodified
Added
Modified
Removed
Line 20 | Line 20 |
---|
{ /** @var \phpbb\filesystem\filesystem_interface */ protected $filesystem;
|
{ /** @var \phpbb\filesystem\filesystem_interface */ protected $filesystem;
|
| /** @var \phpbb\db\driver\driver_interface */ protected $db;
|
/** * @param \phpbb\filesystem\filesystem_interface $filesystem phpBB's filesystem service
|
/** * @param \phpbb\filesystem\filesystem_interface $filesystem phpBB's filesystem service
|
| * @param \phpbb\db\driver\driver_interface $db
|
*/
|
*/
|
public function __construct(\phpbb\filesystem\filesystem_interface $filesystem)
| public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, \phpbb\db\driver\driver_interface $db)
|
{ $this->filesystem = $filesystem;
|
{ $this->filesystem = $filesystem;
|
| $this->db = $db; }
/** * Get forum IDs for topics * * Retrieve forum IDs and add the data into the session data array * Array structure matches sql_fethrowset() result array * * @param array $session_data_rowset Users' session data array * @return void */ public function get_forum_ids(array &$session_data_rowset): void { $topic_ids = $match = []; foreach ($session_data_rowset as $number => $row) { if ($row['session_forum_id'] == 0 && preg_match('#t=([0-9]+)#', $row['session_page'], $match)) { $topic_ids[$number] = (int) $match[1]; } }
if (count($topic_ids = array_unique($topic_ids))) { $sql_ary = [ 'SELECT' => 't.topic_id, t.forum_id', 'FROM' => [ TOPICS_TABLE => 't', ], 'WHERE' => $this->db->sql_in_set('t.topic_id', $topic_ids), 'ORDER_BY' => 't.topic_id', ]; $result = $this->db->sql_query($this->db->sql_build_query('SELECT', $sql_ary)); $forum_ids_rowset = $this->db->sql_fetchrowset($result); $this->db->sql_freeresult($result);
foreach ($forum_ids_rowset as $forum_ids_row) { $session_data_row_number = array_search((int) $forum_ids_row['topic_id'], $topic_ids); $session_data_rowset[$session_data_row_number]['session_forum_id'] = (int) $forum_ids_row['forum_id']; } }
|
}
/**
| }
/**
|