grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026db = DBManagerFactory::getInstance(); $this->id = null; $this->type = "inbound"; } /** * @param int|string $folderId - (should be string, int type is legacy) * @param bool $encode (legacy, unused) * @param bool $deleted (legacy, unused) * @return null|string (folder ID) * @throws SuiteException */ public function retrieve($folderId = -1) { $isValidator = new SuiteValidator(); if ($isValidator->isValidId($folderId)) { $result = $this->db->query("SELECT * FROM folders WHERE id='" . $folderId . "'"); $row = $this->db->fetchByAssoc($result); // get the root of the tree // is the id of the root node is the same as the inbound email id if (empty($row['parent_folder'])) { // root node (inbound) $this->id = $row['id']; } else { // child node $this->id = $row['parent_folder']; $this->type = $row['folder_type']; $this->mailbox = $row['name']; } } else { throw new SuiteException("Invalid or empty Email Folder ID"); } return $this->id; } /** * @param array $request * @return Folder * @throws SuiteException */ public function retrieveFromRequest($request) { if (isset($request['folders_id']) && !empty($request['folders_id'])) { $foldersId = $request['folders_id']; $this->retrieve($foldersId); } else { $GLOBALS['log']->warn("Empty or undefined Email Folder ID"); } return $this; } /** * @return string */ public function getType() { return $this->type; } /** * @return null|string */ public function getId() { return $this->id; } }