source: sandbox/webservice/api/rest/mail/AttachmentResource.php @ 6307

Revision 6307, 1.0 KB checked in by niltonneto, 12 years ago (diff)

Ticket #2507 - Implementado AttachmentResource? para permitir download de anexo.

  • Property svn:executable set to *
Line 
1<?php
2
3class AttachmentResource extends MailAdapter { 
4        public function post($request){         
5                // to Receive POST Params (use $this->params)           
6                parent::post($request);                 
7                $folderID               = $this->getParam('folderID');
8                $msgID                  = $this->getParam('msgID');
9                $attachmentID   = $this->getParam('attachmentID');
10               
11                if($this-> isLoggedIn()) {
12                                                               
13                        if( $folderID && $msgID && $attachmentID) {                             
14                                $dir = PHPGW_INCLUDE_ROOT."/expressoMail1_2/inc";
15                               
16                                if($this->getExpressoVersion() != "2.2"){
17                                        $_GET['msgFolder'] = $folderID;
18                                        $_GET['msgNumber'] = $msgID;
19                                        $_GET['indexPart'] = $attachmentID;
20                                        include("$dir/get_archive.php");
21                                       
22                                }else{
23                                        $_GET['msg_folder'] = $folderID;
24                                        $_GET['msg_number'] = $msgID;
25                                        $_GET['msg_part'] = $attachmentID;
26                                        include("$dir/gotodownload.php");
27                                }
28                                // Dont modify header of Response Method to 'application/json'
29                                $this->setCannotModifyHeader(true);
30                                return $this->getResponse();
31                        }
32                        else{
33                                Errors::runException("MAIL_ATTACHMENT_NOT_FOUND");
34                        }
35                }
36        }
37}
Note: See TracBrowser for help on using the repository browser.