public function getTopicInfo($fid, $tid)
    {
        $cur_topic['select'] = [
            'forum_id' => 'f.id',
            'f.forum_name',
            't.subject',
            't.num_replies',
            't.first_post_id'
        ];
        $cur_topic['where'] = [
            ['fp.read_forum' => 'IS NULL'],
            ['fp.read_forum' => '1']
        ];

        $cur_topic = DB::forTable('topics')
            ->table_alias('t')
            ->select_many($cur_topic['select'])
            ->inner_join(DB::prefix().'forums', ['f.id', '=', 't.forum_id'], 'f')
//            ->left_outer_join('forum_perms', array('fp.forum_id', '=', 'f.id'), 'fp')
//            ->left_outer_join('forum_perms', array('fp.group_id', '=', User::get()->g_id), null, true)
            ->left_outer_join(
                DB::prefix().'forum_perms',
                '(fp.forum_id = f.id AND fp.group_id = '.User::get()->g_id.')',
                'fp'
            )
//            ->where_any_is($cur_topic['where'])
            ->where_raw('(fp.read_forum IS NULL OR fp.read_forum=1)')
            ->where('f.id', $fid)
            ->where('t.id', $tid)
            ->where_null('t.moved_to');
        $cur_topic = Container::get('hooks')->fireDB('model.topic.get_topic_info', $cur_topic);
        $cur_topic = $cur_topic->find_one();

        if (!$cur_topic) {
            throw new  RunBBException(__('Bad request'), 404);
        }

        return $cur_topic;
    }
public function getTopicInfo($fid, $tid)
    {
        $cur_topic['select'] = [
            'forum_id' => 'f.id',
            'f.forum_name',
            't.subject',
            't.num_replies',
            't.first_post_id'
        ];
        $cur_topic['where'] = [
            ['fp.read_forum' => 'IS NULL'],
            ['fp.read_forum' => '1']
        ];

        $cur_topic = DB::forTable('topics')
            ->table_alias('t')
            ->select_many($cur_topic['select'])
            ->inner_join(DB::prefix().'forums', ['f.id', '=', 't.forum_id'], 'f')
//            ->left_outer_join('forum_perms', array('fp.forum_id', '=', 'f.id'), 'fp')
//            ->left_outer_join('forum_perms', array('fp.group_id', '=', User::get()->g_id), null, true)
            ->left_outer_join(
                DB::prefix().'forum_perms',
                '(fp.forum_id = f.id AND fp.group_id = '.User::get()->g_id.')',
                'fp'
            )
//            ->where_any_is($cur_topic['where'])
            ->where_raw('(fp.read_forum IS NULL OR fp.read_forum=1)')
            ->where('f.id', $fid)
            ->where('t.id', $tid)
            ->where_null('t.moved_to');
        $cur_topic = Container::get('hooks')->fireDB('model.topic.get_topic_info', $cur_topic);
        $cur_topic = $cur_topic->find_one();

        if (!$cur_topic) {
            throw new  RunBBException(__('Bad request'), 404);
        }

        return $cur_topic;
    }
public function getTopicInfo ( $ fid , $ tid ) { $ cur_topic [ 'select' ] = [ 'forum_id' => 'f.id' , 'f.forum_name' , 't.subject' , 't.num_replies' , 't.first_post_id' ] ; $ cur_topic [ 'where' ] = [ [ 'fp.read_forum' => 'IS NULL' ] , [ 'fp.read_forum' => '1' ] ] ; $ cur_topic = DB :: forTable ( 'topics' ) -> table_alias ( 't' ) -> select_many ( $ cur_topic [ 'select' ] ) -> inner_join ( DB :: prefix ( ) . 'forums' , [ 'f.id' , '=' , 't.forum_id' ] , 'f' ) //            ->left_outer_join('forum_perms', array('fp.forum_id', '=', 'f.id'), 'fp') //            ->left_outer_join('forum_perms', array('fp.group_id', '=', User::get()->g_id), null, true) -> left_outer_join ( DB :: prefix ( ) . 'forum_perms' , '(fp.forum_id = f.id AND fp.group_id = ' . User :: get ( ) -> g_id . ')' , 'fp' ) //            ->where_any_is($cur_topic['where']) -> where_raw ( '(fp.read_forum IS NULL OR fp.read_forum=1)' ) -> where ( 'f.id' , $ fid ) -> where ( 't.id' , $ tid ) -> where_null ( 't.moved_to' ) ; $ cur_topic = Container :: get ( 'hooks' ) -> fireDB ( 'model.topic.get_topic_info' , $ cur_topic ) ; $ cur_topic = $ cur_topic -> find_one ( ) ; if ( ! $ cur_topic ) { throw new RunBBException ( __ ( 'Bad request' ) , 404 ) ; } return $ cur_topic ; }
Fetch some info about the topic
@param $fid
@param $tid
@return \ORM
@throws RunBBException
Fetch some info about the topic