roundcubemail/program/lib/Roundcube/rcube_imap.php
public function list_folders_subscribed($root='', $name='*', $filter=null, $rights=null, $skip_sort=false)
    {
        $cache_key = $root.':'.$name;
        if (!empty($filter)) {
            $cache_key .= ':'.(is_string($filter) ? $filter : serialize($filter));
        }
        $cache_key .= ':'.$rights;
        $cache_key = 'mailboxes.'.md5($cache_key);

        // get cached folder list
        $a_mboxes = $this->get_cache($cache_key);
        if (is_array($a_mboxes)) {
            return $a_mboxes;
        }

        // Give plugins a chance to provide a list of folders
        $data = $this->plugins->exec_hook('storage_folders',
            array('root' => $root, 'name' => $name, 'filter' => $filter, 'mode' => 'LSUB'));

        if (isset($data['folders'])) {
            $a_mboxes = $data['folders'];
        }
        else {
            $a_mboxes = $this->list_folders_subscribed_direct($root, $name);
        }

        if (!is_array($a_mboxes)) {
            return array();
        }

        // filter folders list according to rights requirements
        if ($rights && $this->get_capability('ACL')) {
            $a_mboxes = $this->filter_rights($a_mboxes, $rights);
        }

        // INBOX should always be available
        if (in_array_nocase($root . $name, array('*', '%', 'INBOX', 'INBOX*'))
            && (!$filter || $filter == 'mail') && !in_array('INBOX', $a_mboxes)
        ) {
            array_unshift($a_mboxes, 'INBOX');
        }

        // sort folders (always sort for cache)
        if (!$skip_sort || $this->cache) {
            $a_mboxes = $this->sort_folder_list($a_mboxes);
        }

        // write folders list to cache
        $this->update_cache($cache_key, $a_mboxes);

        return $a_mboxes;
    }
public function list_folders_subscribed($root='', $name='*', $filter=null, $rights=null, $skip_sort=false)
    {
        $cache_key = $root.':'.$name;
        if (!empty($filter)) {
            $cache_key .= ':'.(is_string($filter) ? $filter : serialize($filter));
        }
        $cache_key .= ':'.$rights;
        $cache_key = 'mailboxes.'.md5($cache_key);

        // get cached folder list
        $a_mboxes = $this->get_cache($cache_key);
        if (is_array($a_mboxes)) {
            return $a_mboxes;
        }

        // Give plugins a chance to provide a list of folders
        $data = $this->plugins->exec_hook('storage_folders',
            array('root' => $root, 'name' => $name, 'filter' => $filter, 'mode' => 'LSUB'));

        if (isset($data['folders'])) {
            $a_mboxes = $data['folders'];
        }
        else {
            $a_mboxes = $this->list_folders_subscribed_direct($root, $name);
        }

        if (!is_array($a_mboxes)) {
            return array();
        }

        // filter folders list according to rights requirements
        if ($rights && $this->get_capability('ACL')) {
            $a_mboxes = $this->filter_rights($a_mboxes, $rights);
        }

        // INBOX should always be available
        if (in_array_nocase($root . $name, array('*', '%', 'INBOX', 'INBOX*'))
            && (!$filter || $filter == 'mail') && !in_array('INBOX', $a_mboxes)
        ) {
            array_unshift($a_mboxes, 'INBOX');
        }

        // sort folders (always sort for cache)
        if (!$skip_sort || $this->cache) {
            $a_mboxes = $this->sort_folder_list($a_mboxes);
        }

        // write folders list to cache
        $this->update_cache($cache_key, $a_mboxes);

        return $a_mboxes;
    }
public function list_folders_subscribed ( $ root = '' , $ name = '*' , $ filter = null , $ rights = null , $ skip_sort = false ) { $ cache_key = $ root . ':' . $ name ; if ( ! empty ( $ filter ) ) { $ cache_key .= ':' . ( is_string ( $ filter ) ? $ filter : serialize ( $ filter ) ) ; } $ cache_key .= ':' . $ rights ; $ cache_key = 'mailboxes.' . md5 ( $ cache_key ) ; // get cached folder list $ a_mboxes = $ this -> get_cache ( $ cache_key ) ; if ( is_array ( $ a_mboxes ) ) { return $ a_mboxes ; } // Give plugins a chance to provide a list of folders $ data = $ this -> plugins -> exec_hook ( 'storage_folders' , array ( 'root' => $ root , 'name' => $ name , 'filter' => $ filter , 'mode' => 'LSUB' ) ) ; if ( isset ( $ data [ 'folders' ] ) ) { $ a_mboxes = $ data [ 'folders' ] ; } else { $ a_mboxes = $ this -> list_folders_subscribed_direct ( $ root , $ name ) ; } if ( ! is_array ( $ a_mboxes ) ) { return array ( ) ; } // filter folders list according to rights requirements if ( $ rights && $ this -> get_capability ( 'ACL' ) ) { $ a_mboxes = $ this -> filter_rights ( $ a_mboxes , $ rights ) ; } // INBOX should always be available if ( in_array_nocase ( $ root . $ name , array ( '*' , '%' , 'INBOX' , 'INBOX*' ) ) && ( ! $ filter || $ filter == 'mail' ) && ! in_array ( 'INBOX' , $ a_mboxes ) ) { array_unshift ( $ a_mboxes , 'INBOX' ) ; } // sort folders (always sort for cache) if ( ! $ skip_sort || $ this -> cache ) { $ a_mboxes = $ this -> sort_folder_list ( $ a_mboxes ) ; } // write folders list to cache $ this -> update_cache ( $ cache_key , $ a_mboxes ) ; return $ a_mboxes ; }
Public method for listing subscribed folders.

@param   string  $root      Optional root folder
@param   string  $name      Optional name pattern
@param   string  $filter    Optional filter
@param   string  $rights    Optional ACL requirements
@param   bool    $skip_sort Enable to return unsorted list (for better performance)

@return  array   List of folders
Public method for listing subscribed folders .