/** * Validates the given folder id. */ protected function updateFolderID() { $validFolderIDs = array(); // get valid folder id for active message id if ($this->pm->isSender()) { if ($this->pm->isDraft) { $validFolderIDs[] = PMFolderList::FOLDER_DRAFTS; } else { if ($this->pm->saveInOutbox) { $validFolderIDs[] = PMFolderList::FOLDER_OUTBOX; } } } if ($this->pm->recipientID) { if ($this->pm->isDeleted == 1) { $validFolderIDs[] = PMFolderList::FOLDER_TRASH; } else { $validFolderIDs[] = $this->pm->folderID; } } // check active folder id if (!in_array($this->folderID, $validFolderIDs)) { // update folder id $this->folderID = $validFolderIDs[0]; } }