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 or at |
---|
29 | * e-mail address prognus@prognus.com.br.
|
---|
30 | *
|
---|
31 | * Arquivo responsável por extrair do banco de dados informações sobre um |
---|
32 | * determinado arquivo para que o download possa ser feito.
|
---|
33 | *
|
---|
34 | * @package Prototype (Mail)
|
---|
35 | * @license http://www.gnu.org/copyleft/gpl.html GPL
|
---|
36 | * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
|
---|
37 | * @version 2.4
|
---|
38 | * @sponsor Caixa Econômica Federal
|
---|
39 | * @since Arquivo disponibilizado na versão 2.4
|
---|
40 | */ |
---|
41 | |
---|
42 | $data = $_GET; |
---|
43 | //TODO implementar suporte a download de varios arquivos! |
---|
44 | if( isset($data) ) |
---|
45 | { |
---|
46 | require_once "api/controller.php"; |
---|
47 | |
---|
48 | foreach($data as $concept => $value){ |
---|
49 | |
---|
50 | $arquive = Controller::find( array( 'concept' => $concept ) , false ,array( 'filter' => array('=', 'id' , $data[$concept]) )); |
---|
51 | |
---|
52 | foreach($arquive as $key => $arq){ |
---|
53 | header("Content-type: ".$arq['type']); |
---|
54 | header("Expires: 0"); |
---|
55 | header("Content-length: ".$arq['size']); |
---|
56 | header("Content-Disposition: attachment; filename=".$arq['name']); |
---|
57 | header("Content-Description: Downlaod de anexos:"); |
---|
58 | echo base64_decode($arq['source']); |
---|
59 | } |
---|
60 | } |
---|
61 | }else return"false"; |
---|