public function getInfoTopic($id)
    {
        $where = '(fp.read_forum IS NULL OR fp.read_forum=1)';
//            array(
//            array('fp.read_forum' => 'IS NULL'),
//            array('fp.read_forum' => '1')
//        );

        if (!User::get()->is_guest) {
            $select_get_info_topic = [
                't.subject', 't.closed', 't.num_replies', 't.sticky',
                't.first_post_id', 'forum_id' => 'f.id', 'f.forum_name', 'f.moderators',
                'fp.post_replies', 'is_subscribed' => 's.user_id'
            ];

            $cur_topic = DB::forTable('topics')
                ->table_alias('t')
                ->select_many($select_get_info_topic)
                ->inner_join(DB::prefix().'forums', ['f.id', '=', 't.forum_id'], 'f')
//                ->left_outer_join('topic_subscriptions', array('t.id', '=', 's.topic_id'), 's')
//                ->left_outer_join('topic_subscriptions', array('s.user_id', '=', User::get()->id), null, true)
                ->left_outer_join(
                    DB::prefix().'topic_subscriptions',
                    '(t.id=s.topic_id AND s.user_id= '.User::get()->id.')',
                    's'
                )
//                ->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($where)
                ->where('t.id', $id)
                ->where_null('t.moved_to');
        } else {
            $select_get_info_topic = ['t.subject', 't.closed', 't.num_replies', 't.sticky', 't.first_post_id',
                'forum_id' => 'f.id', 'f.forum_name', 'f.moderators', 'fp.post_replies'];

            $cur_topic = DB::forTable('topics')
                ->table_alias('t')
                ->select_many($select_get_info_topic)
                ->select_expr(0, 'is_subscribed')
                ->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($where)
                ->where('t.id', $id)
                ->where_null('t.moved_to');
        }

        $cur_topic = Container::get('hooks')->fireDB('model.topic.get_info_topic_query', $cur_topic);
        $cur_topic = $cur_topic->find_one();

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

        $cur_topic = Container::get('hooks')->fire('model.topic.get_info_topic', $cur_topic);

        return $cur_topic;
    }