source: branches/2.4/prototype/rest/mail/AttachmentResource.php @ 7442

Revision 7442, 1.2 KB checked in by eduardow, 11 years ago (diff)

Ticket #3093 - Integrando API Rest (CELEPAR) - commit para o branches.

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                                        $_GET['idx_file']       = $this->getParam('attachmentIndex');
27                                        $_GET['newfilename']= $this->getParam('attachmentName');
28                                        $_GET['encoding']       = $this->getParam('attachmentEncoding');
29                                        include("$dir/gotodownload.php");
30                                }
31                                // Dont modify header of Response Method to 'application/json'
32                                $this->setCannotModifyHeader(true);
33                                return $this->getResponse();
34                        }
35                        else{
36                                Errors::runException("MAIL_ATTACHMENT_NOT_FOUND");
37                        }
38                }
39        }
40}
Note: See TracBrowser for help on using the repository browser.