public function dir_opendir($path, $options) { // Reset self::$attachmentsMetadata = null; $st = ''; $stream = $this->stream_open($path, 'np', $options, $st); if (!$stream) { return false; } if (empty($this->mailbox)) { // We are browsing root, we want the list of mailboxes $this->mailboxes = imap_getmailboxes($this->ih, self::$currentRef, "*"); $this->dir = count($this->mailboxes); self::$currentCount = count($this->mailboxes); $this->pos = $this->dir - 1; } else { if ($this->fragment == "attachments") { require_once AJXP_INSTALL_PATH . '/plugins/editor.eml/class.EmlParser.php'; $parser = new EmlParser("", ""); $ar = explode("#", $path); $path = array_shift($ar); // remove fragment self::$attachmentsMetadata = array(); $parser->listAttachments($path, true, self::$attachmentsMetadata); $this->dir = count(self::$attachmentsMetadata); $this->pos = $this->dir - 1; self::$currentCount = $this->dir; } else { // We are in a mailbox, we want the messages number $this->dir = imap_num_msg($this->ih); self::$currentCount = $this->dir; $this->pos = $this->dir; } } $this->stream_close(); return true; }