public function getInfoPost($tid, $fid)
    {
        Container::get('hooks')->fire('model.post.get_info_post_start', $tid, $fid);

        $cur_posting['where'] = '(fp.read_forum IS NULL OR fp.read_forum=1)';
//            array(
//            array('fp.read_forum' => 'IS NULL'),
//            array('fp.read_forum' => '1')
//        );

        if ($tid) {
            $cur_posting['select'] = ['f.id', 'f.forum_name', 'f.moderators', 'f.redirect_url',
                'fp.post_replies', 'fp.post_topics', 't.subject', 't.closed', 'is_subscribed' => 's.user_id'];

            $cur_posting = DB::forTable('topics')
                            ->table_alias('t')
                            ->select_many($cur_posting['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'
                )
//                            ->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'
                )
                            ->where_raw($cur_posting['where'])
                            ->where('t.id', $tid);
        } else {
            $cur_posting['select'] = ['f.id', 'f.forum_name', 'f.moderators', 'f.redirect_url',
                'fp.post_replies', 'fp.post_topics'];

            $cur_posting = DB::forTable('forums')
                            ->table_alias('f')
                            ->select_many($cur_posting['select'])
//                            ->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_raw($cur_posting['where'])
                            ->where('f.id', $fid);
        }

        $cur_posting = Container::get('hooks')->fireDB('model.post.get_info_post_query', $cur_posting);
        $cur_posting = $cur_posting->find_one();

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

        $cur_posting = Container::get('hooks')->fire('model.post.get_info_post', $cur_posting);

        return $cur_posting;
    }
public function getInfoPost($tid, $fid)
    {
        Container::get('hooks')->fire('model.post.get_info_post_start', $tid, $fid);

        $cur_posting['where'] = '(fp.read_forum IS NULL OR fp.read_forum=1)';
//            array(
//            array('fp.read_forum' => 'IS NULL'),
//            array('fp.read_forum' => '1')
//        );

        if ($tid) {
            $cur_posting['select'] = ['f.id', 'f.forum_name', 'f.moderators', 'f.redirect_url',
                'fp.post_replies', 'fp.post_topics', 't.subject', 't.closed', 'is_subscribed' => 's.user_id'];

            $cur_posting = DB::forTable('topics')
                            ->table_alias('t')
                            ->select_many($cur_posting['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'
                )
//                            ->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'
                )
                            ->where_raw($cur_posting['where'])
                            ->where('t.id', $tid);
        } else {
            $cur_posting['select'] = ['f.id', 'f.forum_name', 'f.moderators', 'f.redirect_url',
                'fp.post_replies', 'fp.post_topics'];

            $cur_posting = DB::forTable('forums')
                            ->table_alias('f')
                            ->select_many($cur_posting['select'])
//                            ->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_raw($cur_posting['where'])
                            ->where('f.id', $fid);
        }

        $cur_posting = Container::get('hooks')->fireDB('model.post.get_info_post_query', $cur_posting);
        $cur_posting = $cur_posting->find_one();

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

        $cur_posting = Container::get('hooks')->fire('model.post.get_info_post', $cur_posting);

        return $cur_posting;
    }
public function getInfoPost ( $ tid , $ fid ) { Container :: get ( 'hooks' ) -> fire ( 'model.post.get_info_post_start' , $ tid , $ fid ) ; $ cur_posting [ 'where' ] = '(fp.read_forum IS NULL OR fp.read_forum=1)' ; //            array( //            array('fp.read_forum' => 'IS NULL'), //            array('fp.read_forum' => '1') //        ); if ( $ tid ) { $ cur_posting [ 'select' ] = [ 'f.id' , 'f.forum_name' , 'f.moderators' , 'f.redirect_url' , 'fp.post_replies' , 'fp.post_topics' , 't.subject' , 't.closed' , 'is_subscribed' => 's.user_id' ] ; $ cur_posting = DB :: forTable ( 'topics' ) -> table_alias ( 't' ) -> select_many ( $ cur_posting [ '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' ) //                            ->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' ) -> where_raw ( $ cur_posting [ 'where' ] ) -> where ( 't.id' , $ tid ) ; } else { $ cur_posting [ 'select' ] = [ 'f.id' , 'f.forum_name' , 'f.moderators' , 'f.redirect_url' , 'fp.post_replies' , 'fp.post_topics' ] ; $ cur_posting = DB :: forTable ( 'forums' ) -> table_alias ( 'f' ) -> select_many ( $ cur_posting [ 'select' ] ) //                            ->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_raw ( $ cur_posting [ 'where' ] ) -> where ( 'f.id' , $ fid ) ; } $ cur_posting = Container :: get ( 'hooks' ) -> fireDB ( 'model.post.get_info_post_query' , $ cur_posting ) ; $ cur_posting = $ cur_posting -> find_one ( ) ; if ( ! $ cur_posting ) { throw new RunBBException ( __ ( 'Bad request' ) , 404 ) ; } $ cur_posting = Container :: get ( 'hooks' ) -> fire ( 'model.post.get_info_post' , $ cur_posting ) ; return $ cur_posting ; }
Get some info about the post
Get some info about the post