Revision 7342,
1.1 KB
checked in by alexandrecorreia, 12 years ago
(diff) |
Ticket #3093 - Integrando API Rest(CELEPAR) com o ramo Trunk.
|
Rev | Line | |
---|
[7342] | 1 | <?php |
---|
| 2 | |
---|
| 3 | class DelMessageResource extends MailAdapter { |
---|
| 4 | public function post($request){ |
---|
| 5 | // to Receive POST Params (use $this->params) |
---|
| 6 | parent::post($request); |
---|
| 7 | |
---|
| 8 | if($this-> isLoggedIn()) |
---|
| 9 | { |
---|
| 10 | |
---|
| 11 | $msgID = $this->getParam('msgID'); |
---|
| 12 | $folderID = $this->getParam('folderID'); |
---|
| 13 | |
---|
| 14 | if(!$this->getImap()->folder_exists($folderID)) |
---|
| 15 | Errors::runException("MAIL_INVALID_FOLDER"); |
---|
| 16 | |
---|
| 17 | if ($msgID == "") { |
---|
| 18 | Errors::runException("MAIL_INVALID_MESSAGE"); |
---|
| 19 | } |
---|
| 20 | |
---|
| 21 | if (!$this->messageExists($folderID,$msgID)) { |
---|
| 22 | Errors::runException("MAIL_INVALID_MESSAGE"); |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | $trash_folder = array_search(3,$this->defaultFolders); |
---|
| 26 | $params = array(); |
---|
| 27 | $params['folder'] = $folderID; |
---|
| 28 | $params['msgs_number'] = $msgID; |
---|
| 29 | |
---|
| 30 | if (($folderID != $trash_folder) && ($this->getImap()->prefs['save_deleted_msg'])) { |
---|
| 31 | |
---|
| 32 | if ($trash_folder == "") |
---|
| 33 | Errors::runException("MAIL_TRASH_FOLDER_NOT_EXISTS"); |
---|
| 34 | |
---|
| 35 | $params['new_folder'] = $trash_folder; |
---|
| 36 | $this->getImap()->move_messages($params); |
---|
| 37 | } else { |
---|
| 38 | $this->getImap()->delete_msgs($params); |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | $this->setResult(true); |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | return $this->getResponse(); |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.