roundcubemail/program/lib/Roundcube/rcube_imap_generic.php
public function status($mailbox, $items = array())
    {
        if (!strlen($mailbox)) {
            return false;
        }

        if (!in_array('MESSAGES', $items)) {
            $items[] = 'MESSAGES';
        }
        if (!in_array('UNSEEN', $items)) {
            $items[] = 'UNSEEN';
        }

        list($code, $response) = $this->execute('STATUS',
            array($this->escape($mailbox), '(' . implode(' ', $items) . ')'), 0, '/^\* STATUS /i');

        if ($code == self::ERROR_OK && $response) {
            $result   = array();
            $response = substr($response, 9); // remove prefix "* STATUS "

            list($mbox, $items) = $this->tokenizeResponse($response, 2);

            // Fix for #1487859. Some buggy server returns not quoted
            // folder name with spaces. Let's try to handle this situation
            if (!is_array($items) && ($pos = strpos($response, '(')) !== false) {
                $response = substr($response, $pos);
                $items    = $this->tokenizeResponse($response, 1);
            }

            if (!is_array($items)) {
                return $result;
            }

            for ($i=0, $len=count($items); $i<$len; $i += 2) {
                $result[$items[$i]] = $items[$i+1];
            }

            $this->data['STATUS:'.$mailbox] = $result;

            return $result;
        }

        return false;
    }
public function status($mailbox, $items = array())
    {
        if (!strlen($mailbox)) {
            return false;
        }

        if (!in_array('MESSAGES', $items)) {
            $items[] = 'MESSAGES';
        }
        if (!in_array('UNSEEN', $items)) {
            $items[] = 'UNSEEN';
        }

        list($code, $response) = $this->execute('STATUS',
            array($this->escape($mailbox), '(' . implode(' ', $items) . ')'), 0, '/^\* STATUS /i');

        if ($code == self::ERROR_OK && $response) {
            $result   = array();
            $response = substr($response, 9); // remove prefix "* STATUS "

            list($mbox, $items) = $this->tokenizeResponse($response, 2);

            // Fix for #1487859. Some buggy server returns not quoted
            // folder name with spaces. Let's try to handle this situation
            if (!is_array($items) && ($pos = strpos($response, '(')) !== false) {
                $response = substr($response, $pos);
                $items    = $this->tokenizeResponse($response, 1);
            }

            if (!is_array($items)) {
                return $result;
            }

            for ($i=0, $len=count($items); $i<$len; $i += 2) {
                $result[$items[$i]] = $items[$i+1];
            }

            $this->data['STATUS:'.$mailbox] = $result;

            return $result;
        }

        return false;
    }
public function status ( $ mailbox , $ items = array ( ) ) { if ( ! strlen ( $ mailbox ) ) { return false ; } if ( ! in_array ( 'MESSAGES' , $ items ) ) { $ items [ ] = 'MESSAGES' ; } if ( ! in_array ( 'UNSEEN' , $ items ) ) { $ items [ ] = 'UNSEEN' ; } list ( $ code , $ response ) = $ this -> execute ( 'STATUS' , array ( $ this -> escape ( $ mailbox ) , '(' . implode ( ' ' , $ items ) . ')' ) , 0 , '/^\* STATUS /i' ) ; if ( $ code == self :: ERROR_OK && $ response ) { $ result = array ( ) ; $ response = substr ( $ response , 9 ) ; // remove prefix "* STATUS " list ( $ mbox , $ items ) = $ this -> tokenizeResponse ( $ response , 2 ) ; // Fix for #1487859. Some buggy server returns not quoted // folder name with spaces. Let's try to handle this situation if ( ! is_array ( $ items ) && ( $ pos = strpos ( $ response , '(' ) ) !== false ) { $ response = substr ( $ response , $ pos ) ; $ items = $ this -> tokenizeResponse ( $ response , 1 ) ; } if ( ! is_array ( $ items ) ) { return $ result ; } for ( $ i = 0 , $ len = count ( $ items ) ; $ i < $ len ; $ i += 2 ) { $ result [ $ items [ $ i ] ] = $ items [ $ i + 1 ] ; } $ this -> data [ 'STATUS:' . $ mailbox ] = $ result ; return $ result ; } return false ; }
Executes STATUS command

@param string $mailbox Mailbox name
@param array  $items   Additional requested item names. By default
MESSAGES and UNSEEN are requested. Other defined
in RFC3501: UIDNEXT, UIDVALIDITY, RECENT

@return array Status item-value hash
@since 0.5-beta
Executes STATUS command