roundcubemail/program/lib/Roundcube/rcube_imap.php
protected function _list_messages($folder='', $page=NULL, $sort_field=NULL, $sort_order=NULL, $slice=0)
    {
        if (!strlen($folder)) {
            return array();
        }

        $this->set_sort_order($sort_field, $sort_order);
        $page = $page ? $page : $this->list_page;

        // use saved message set
        if ($this->search_string) {
            return $this->list_search_messages($folder, $page, $slice);
        }

        if ($this->threading) {
            return $this->list_thread_messages($folder, $page, $slice);
        }

        // get UIDs of all messages in the folder, sorted
        $index = $this->index($folder, $this->sort_field, $this->sort_order);

        if ($index->is_empty()) {
            return array();
        }

        $from = ($page-1) * $this->page_size;
        $to   = $from + $this->page_size;

        $index->slice($from, $to - $from);

        if ($slice) {
            $index->slice(-$slice, $slice);
        }

        // fetch reqested messages headers
        $a_index = $index->get();
        $a_msg_headers = $this->fetch_headers($folder, $a_index);

        return array_values($a_msg_headers);
    }
protected function _list_messages($folder='', $page=NULL, $sort_field=NULL, $sort_order=NULL, $slice=0)
    {
        if (!strlen($folder)) {
            return array();
        }

        $this->set_sort_order($sort_field, $sort_order);
        $page = $page ? $page : $this->list_page;

        // use saved message set
        if ($this->search_string) {
            return $this->list_search_messages($folder, $page, $slice);
        }

        if ($this->threading) {
            return $this->list_thread_messages($folder, $page, $slice);
        }

        // get UIDs of all messages in the folder, sorted
        $index = $this->index($folder, $this->sort_field, $this->sort_order);

        if ($index->is_empty()) {
            return array();
        }

        $from = ($page-1) * $this->page_size;
        $to   = $from + $this->page_size;

        $index->slice($from, $to - $from);

        if ($slice) {
            $index->slice(-$slice, $slice);
        }

        // fetch reqested messages headers
        $a_index = $index->get();
        $a_msg_headers = $this->fetch_headers($folder, $a_index);

        return array_values($a_msg_headers);
    }
protected function _list_messages ( $ folder = '' , $ page = NULL , $ sort_field = NULL , $ sort_order = NULL , $ slice = 0 ) { if ( ! strlen ( $ folder ) ) { return array ( ) ; } $ this -> set_sort_order ( $ sort_field , $ sort_order ) ; $ page = $ page ? $ page : $ this -> list_page ; // use saved message set if ( $ this -> search_string ) { return $ this -> list_search_messages ( $ folder , $ page , $ slice ) ; } if ( $ this -> threading ) { return $ this -> list_thread_messages ( $ folder , $ page , $ slice ) ; } // get UIDs of all messages in the folder, sorted $ index = $ this -> index ( $ folder , $ this -> sort_field , $ this -> sort_order ) ; if ( $ index -> is_empty ( ) ) { return array ( ) ; } $ from = ( $ page - 1 ) * $ this -> page_size ; $ to = $ from + $ this -> page_size ; $ index -> slice ( $ from , $ to - $ from ) ; if ( $ slice ) { $ index -> slice ( - $ slice , $ slice ) ; } // fetch reqested messages headers $ a_index = $ index -> get ( ) ; $ a_msg_headers = $ this -> fetch_headers ( $ folder , $ a_index ) ; return array_values ( $ a_msg_headers ) ; }
protected method for listing message headers

@param   string   $folder     Folder name
@param   int      $page       Current page to list
@param   string   $sort_field Header field to sort by
@param   string   $sort_order Sort order [ASC|DESC]
@param   int      $slice      Number of slice items to extract from result array

@return array Indexed array with message header objects
@see rcube_imap::list_messages
protected method for listing message headers