[5604] | 1 | <?php |
---|
[6130] | 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 | */ |
---|
[5604] | 39 | |
---|
[6130] | 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 | */ |
---|
[6528] | 49 | |
---|
| 50 | use prototype\api\Config as Config; |
---|
| 51 | |
---|
[5604] | 52 | class Attachments { |
---|
| 53 | |
---|
[5637] | 54 | public function encodeCreateAttachment( &$uri , &$params , &$criteria , $original ){ |
---|
| 55 | if(!isset($params['source'])) return false; |
---|
[6071] | 56 | |
---|
[5637] | 57 | |
---|
| 58 | if(isset($_FILES[$params['source']])) |
---|
| 59 | $params = $_FILES[$params['source']]; |
---|
[6071] | 60 | |
---|
| 61 | if($params['error'] !== 0){ |
---|
| 62 | switch ($params['error']){ |
---|
| 63 | case 1: |
---|
| 64 | throw new Exception('Tamanho de arquivo nao permitido!!! (php.ini)'); |
---|
| 65 | case 2: |
---|
| 66 | throw new Exception('Tamanho de arquivo nao permitido!!!'); |
---|
| 67 | case 3: |
---|
| 68 | throw new Exception('Ocorreu um erro durante o upload'); |
---|
| 69 | case 4: |
---|
| 70 | throw new Exception('Nao e um arquivo valido'); |
---|
| 71 | } |
---|
| 72 | } |
---|
| 73 | |
---|
[5637] | 74 | $params['owner'] = Config::me('uidNumber'); |
---|
| 75 | |
---|
| 76 | $params['disposition'] = $original['properties']['disposition']; |
---|
| 77 | $params['dtstamp'] = time(); |
---|
[5604] | 78 | } |
---|
[5637] | 79 | |
---|
| 80 | public function securityOwner( &$uri , &$params , &$criteria , $original ) |
---|
| 81 | { |
---|
| 82 | $criteria['filter'] = isset( $criteria['filter'] ) ? array('AND', $criteria['filter'] , array('=' , 'owner', Config::me('uidNumber')) ) : array('=' , 'owner', Config::me('uidNumber')); |
---|
| 83 | } |
---|
| 84 | |
---|
[5604] | 85 | } |
---|
| 86 | |
---|
| 87 | ?> |
---|