source: trunk/prototype/modules/mail/interceptors/Attachments.php @ 6130

Revision 6130, 3.3 KB checked in by fernando, 12 years ago (diff)

Ticket #2697 - Inserir informações de copyright em cabeçalho de arquivos

Line 
1<?php
2/**
3*
4* Copyright (C) 2012 Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
5*
6* This program is free software; you can redistribute it and/or modify it under
7* the terms of the GNU Affero General Public License version 3 as published by
8* the Free Software Foundation with the addition of the following permission
9* added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
10* WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE
11* WARRANTY OF NON INFRINGEMENT  OF THIRD PARTY RIGHTS.
12*
13* This program is distributed in the hope that it will be useful, but WITHOUT
14* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15* FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
16* details.
17*
18* You should have received a copy of the GNU Affero General Public License
19* along with this program; if not, see www.gnu.org/licenses or write to
20* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21* MA 02110-1301 USA.
22*
23* This code is based on the OpenXchange Connector and on the Prognus pSync
24* Connector both developed by the community and licensed under the GPL
25* version 2 or above as published by the Free Software Foundation.
26*
27* You can contact Prognus Software Livre headquarters at Av. Tancredo Neves,
28* 6731, PTI, Edifício do Saber, 3º floor, room 306, Foz do Iguaçu - PR - Brasil
29* or at e-mail address prognus@prognus.com.br.
30*
31*
32* @package    Prototype (Mail)
33* @license    http://www.gnu.org/copyleft/gpl.html GPL
34* @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
35* @version    2.4
36* @sponsor    Caixa EconÃŽmica Federal
37* @since      Arquivo disponibilizado na versão 2.4
38*/
39
40/**
41*
42* @package    Prototype (Mail)
43* @license    http://www.gnu.org/copyleft/gpl.html GPL
44* @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
45* @sponsor    Caixa EconÃŽmica Federal
46* @version    2.4
47* @since      Classe disponibilizada na versão 2.4
48*/
49class Attachments {     
50       
51        public function encodeCreateAttachment( &$uri , &$params , &$criteria , $original ){           
52            if(!isset($params['source'])) return false;
53                       
54
55            if(isset($_FILES[$params['source']]))
56                $params =  $_FILES[$params['source']];
57                               
58                                if($params['error'] !== 0){
59                                        switch ($params['error']){
60                                                case 1:
61                                                        throw  new Exception('Tamanho de arquivo nao permitido!!! (php.ini)');
62                                                case 2:
63                                                        throw  new Exception('Tamanho de arquivo nao permitido!!!');
64                                                case 3:
65                                                        throw  new Exception('Ocorreu um erro durante o upload');
66                                                case 4:
67                                                        throw  new Exception('Nao e um arquivo valido');
68                                        }
69                                }
70                               
71                $params['owner'] = Config::me('uidNumber');
72
73                $params['disposition'] = $original['properties']['disposition'];
74                $params['dtstamp'] = time();
75        }
76       
77        public function securityOwner(  &$uri , &$params , &$criteria , $original )
78        {
79            $criteria['filter'] = isset( $criteria['filter'] ) ? array('AND', $criteria['filter'] , array('=' , 'owner', Config::me('uidNumber')) ) :  array('=' , 'owner', Config::me('uidNumber'));   
80        }
81
82}
83
84?>
Note: See TracBrowser for help on using the repository browser.