public function getInfoEdit($id)
    {
        $id = Container::get('hooks')->fire('model.post.get_info_edit_start', $id);

        $cur_post['select'] = ['fid' => 'f.id', 'f.forum_name', 'f.moderators', 'f.redirect_url',
            'fp.post_topics', 'tid' => 't.id', 't.subject', 't.posted', 't.first_post_id', 't.sticky',
            't.closed', 'p.poster', 'p.poster_id', 'p.message', 'p.hide_smilies'];
//        $cur_post['where'] = array(
//            array('fp.read_forum' => 'IS NULL'),
//            array('fp.read_forum' => '1')
//        );

        $cur_post = DB::forTable('posts')
                    ->table_alias('p')
                    ->select_many($cur_post['select'])
                    ->inner_join(DB::prefix().'topics', ['t.id', '=', 'p.topic_id'], 't')
                    ->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_post['where'])
                ->where_raw('(fp.read_forum IS NULL OR fp.read_forum=1)')
                    ->where('p.id', $id);

        $cur_post = Container::get('hooks')->fireDB('model.post.get_info_edit_query', $cur_post);

        $cur_post = $cur_post->find_one();

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

        return $cur_post;
    }
public function getInfoEdit($id)
    {
        $id = Container::get('hooks')->fire('model.post.get_info_edit_start', $id);

        $cur_post['select'] = ['fid' => 'f.id', 'f.forum_name', 'f.moderators', 'f.redirect_url',
            'fp.post_topics', 'tid' => 't.id', 't.subject', 't.posted', 't.first_post_id', 't.sticky',
            't.closed', 'p.poster', 'p.poster_id', 'p.message', 'p.hide_smilies'];
//        $cur_post['where'] = array(
//            array('fp.read_forum' => 'IS NULL'),
//            array('fp.read_forum' => '1')
//        );

        $cur_post = DB::forTable('posts')
                    ->table_alias('p')
                    ->select_many($cur_post['select'])
                    ->inner_join(DB::prefix().'topics', ['t.id', '=', 'p.topic_id'], 't')
                    ->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_post['where'])
                ->where_raw('(fp.read_forum IS NULL OR fp.read_forum=1)')
                    ->where('p.id', $id);

        $cur_post = Container::get('hooks')->fireDB('model.post.get_info_edit_query', $cur_post);

        $cur_post = $cur_post->find_one();

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

        return $cur_post;
    }
public function getInfoEdit ( $ id ) { $ id = Container :: get ( 'hooks' ) -> fire ( 'model.post.get_info_edit_start' , $ id ) ; $ cur_post [ 'select' ] = [ 'fid' => 'f.id' , 'f.forum_name' , 'f.moderators' , 'f.redirect_url' , 'fp.post_topics' , 'tid' => 't.id' , 't.subject' , 't.posted' , 't.first_post_id' , 't.sticky' , 't.closed' , 'p.poster' , 'p.poster_id' , 'p.message' , 'p.hide_smilies' ] ; //        $cur_post['where'] = array( //            array('fp.read_forum' => 'IS NULL'), //            array('fp.read_forum' => '1') //        ); $ cur_post = DB :: forTable ( 'posts' ) -> table_alias ( 'p' ) -> select_many ( $ cur_post [ 'select' ] ) -> inner_join ( DB :: prefix ( ) . 'topics' , [ 't.id' , '=' , 'p.topic_id' ] , 't' ) -> 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_post['where']) -> where_raw ( '(fp.read_forum IS NULL OR fp.read_forum=1)' ) -> where ( 'p.id' , $ id ) ; $ cur_post = Container :: get ( 'hooks' ) -> fireDB ( 'model.post.get_info_edit_query' , $ cur_post ) ; $ cur_post = $ cur_post -> find_one ( ) ; if ( ! $ cur_post ) { throw new RunBBException ( __ ( 'Bad request' ) , 400 ) ; } return $ cur_post ; }
Fetch some info about the post, the topic and the forum
Fetch some info about the post the topic and the forum