roundcubemail/program/lib/Roundcube/rcube_imap.php
protected function list_folders_update(&$result, $type = null)
    {
        $namespace = $this->get_namespace();
        $search    = array();

        // build list of namespace prefixes
        foreach ((array)$namespace as $ns) {
            if (is_array($ns)) {
                foreach ($ns as $ns_data) {
                    if (strlen($ns_data[0])) {
                        $search[] = $ns_data[0];
                    }
                }
            }
        }

        if (!empty($search)) {
            // go through all folders detecting namespace usage
            foreach ($result as $folder) {
                foreach ($search as $idx => $prefix) {
                    if (strpos($folder, $prefix) === 0) {
                        unset($search[$idx]);
                    }
                }
                if (empty($search)) {
                    break;
                }
            }

            // get folders in hidden namespaces and add to the result
            foreach ($search as $prefix) {
                if ($type == 'ext-subscribed') {
                    $list = $this->conn->listMailboxes('', $prefix . '*', null, array('SUBSCRIBED'));
                }
                else if ($type == 'subscribed') {
                    $list = $this->conn->listSubscribed('', $prefix . '*');
                }
                else {
                    $list = $this->conn->listMailboxes('', $prefix . '*');
                }

                if (!empty($list)) {
                    $result = array_merge($result, $list);
                }
            }
        }
    }
protected function list_folders_update(&$result, $type = null)
    {
        $namespace = $this->get_namespace();
        $search    = array();

        // build list of namespace prefixes
        foreach ((array)$namespace as $ns) {
            if (is_array($ns)) {
                foreach ($ns as $ns_data) {
                    if (strlen($ns_data[0])) {
                        $search[] = $ns_data[0];
                    }
                }
            }
        }

        if (!empty($search)) {
            // go through all folders detecting namespace usage
            foreach ($result as $folder) {
                foreach ($search as $idx => $prefix) {
                    if (strpos($folder, $prefix) === 0) {
                        unset($search[$idx]);
                    }
                }
                if (empty($search)) {
                    break;
                }
            }

            // get folders in hidden namespaces and add to the result
            foreach ($search as $prefix) {
                if ($type == 'ext-subscribed') {
                    $list = $this->conn->listMailboxes('', $prefix . '*', null, array('SUBSCRIBED'));
                }
                else if ($type == 'subscribed') {
                    $list = $this->conn->listSubscribed('', $prefix . '*');
                }
                else {
                    $list = $this->conn->listMailboxes('', $prefix . '*');
                }

                if (!empty($list)) {
                    $result = array_merge($result, $list);
                }
            }
        }
    }
protected function list_folders_update ( & $ result , $ type = null ) { $ namespace = $ this -> get_namespace ( ) ; $ search = array ( ) ; // build list of namespace prefixes foreach ( ( array ) $ namespace as $ ns ) { if ( is_array ( $ ns ) ) { foreach ( $ ns as $ ns_data ) { if ( strlen ( $ ns_data [ 0 ] ) ) { $ search [ ] = $ ns_data [ 0 ] ; } } } } if ( ! empty ( $ search ) ) { // go through all folders detecting namespace usage foreach ( $ result as $ folder ) { foreach ( $ search as $ idx => $ prefix ) { if ( strpos ( $ folder , $ prefix ) === 0 ) { unset ( $ search [ $ idx ] ) ; } } if ( empty ( $ search ) ) { break ; } } // get folders in hidden namespaces and add to the result foreach ( $ search as $ prefix ) { if ( $ type == 'ext-subscribed' ) { $ list = $ this -> conn -> listMailboxes ( '' , $ prefix . '*' , null , array ( 'SUBSCRIBED' ) ) ; } else if ( $ type == 'subscribed' ) { $ list = $ this -> conn -> listSubscribed ( '' , $ prefix . '*' ) ; } else { $ list = $ this -> conn -> listMailboxes ( '' , $ prefix . '*' ) ; } if ( ! empty ( $ list ) ) { $ result = array_merge ( $ result , $ list ) ; } } } }
Fix folders list by adding folders from other namespaces.
Needed on some servers eg. Courier IMAP

@param array  $result Reference to folders list
@param string $type   Listing type (ext-subscribed, subscribed or all)
Fix folders list by adding folders from other namespaces . Needed on some servers eg . Courier IMAP