phpbb\log\log::get_topic_auth PHP Method

get_topic_auth() protected method

Determine whether the user is allowed to read and/or moderate the forum of the topic
protected get_topic_auth ( array $topic_ids ) : array
$topic_ids array Array with the topic ids
return array Returns an array with two keys 'm_' and 'read_f' which are also an array of topic_id => forum_id sets when the permissions are given. Sample: array( 'permission' => array( topic_id => forum_id ), ),
    protected function get_topic_auth(array $topic_ids)
    {
        $forum_auth = array('f_read' => array(), 'm_' => array());
        $topic_ids = array_unique($topic_ids);
        $sql = 'SELECT topic_id, forum_id
			FROM ' . TOPICS_TABLE . '
			WHERE ' . $this->db->sql_in_set('topic_id', array_map('intval', $topic_ids));
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            $row['topic_id'] = (int) $row['topic_id'];
            $row['forum_id'] = (int) $row['forum_id'];
            if ($this->auth->acl_get('f_read', $row['forum_id'])) {
                $forum_auth['f_read'][$row['topic_id']] = $row['forum_id'];
            }
            if ($this->auth->acl_gets('a_', 'm_', $row['forum_id'])) {
                $forum_auth['m_'][$row['topic_id']] = $row['forum_id'];
            }
        }
        $this->db->sql_freeresult($result);
        return $forum_auth;
    }