/** * @return FolderCollection */ function &GetFolders() { $folders = null; if (USE_DB) { if ($this->DbStorage->Connect()) { $folders =& $this->DbStorage->GetFolders(); } } else { if ($this->MailStorage->Connect()) { $folders =& $this->MailStorage->GetFolders(); $folders->SetSyncTypeToAll(FOLDERSYNC_DirectMode); $folders->GetDMFolderCountsToAll($this->MailStorage); $folders->SetDMFolderIds($this->_account->Id); $folders = $folders->SortRootTree(); FolderCollection::SaveToSession($folders); } } if ($folders) { $folders->InitSystemFolders($this->_account); } return $folders; }