params) parent::post($request); if($this-> isLoggedIn()) { $parent_id = $this->getParam('parentFolderID'); $parent_id = empty($parent_id) ? 'INBOX' : $parent_id; $new_name = $this->getParam('folderName'); if(empty($new_name) || preg_match('/[\/\\\!\@\#\$\%\&\*\(\)]/', $new_name)) Errors::runException("MAIL_INVALID_NEW_FOLDER_NAME"); $new_id = $parent_id . $this->getImap()->imap_delimiter . $new_name; $params['newp'] = $new_id; $result = $this->getImap()->create_mailbox($params); if($result != 'Ok') Errors::runException("MAIL_FOLDER_NOT_ADDED"); } $this->setResult(array('folderID' => $new_id)); //to Send Response (JSON RPC format) return $this->getResponse(); } }