-
Notifications
You must be signed in to change notification settings - Fork 4
/
md_pesq_processo_exibe_arquivo.php
83 lines (63 loc) · 2.55 KB
/
md_pesq_processo_exibe_arquivo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?
/**
* CONSELHO ADMINISTRATIVO DE DEFESA ECONÔMICA
*
*
**/
try {
require_once dirname(__FILE__).'/../../SEI.php';
SessaoSEIExterna::getInstance()->validarSessao();
MdPesqConverteURI::converterURI();
MdPesqPesquisaUtil::valiadarLink();
// InfraDebug::getInstance()->setBolLigado(false);
// InfraDebug::getInstance()->setBolDebugInfra(false);
// InfraDebug::getInstance()->limpar();
switch($_GET['acao_externa']){
case 'usuario_externo_exibir_arquivo':
AuditoriaSEI::getInstance()->auditar('usuario_externo_exibir_arquivo', __FILE__);
$infraParametroDTO = new InfraParametroDTO();
$infraParametroDTO->setStrNome('SEI_VERSAO');
$infraParametroDTO->retStrValor();
$infraParametroRN = new InfraParametroRN();
$infraParametroDTO = $infraParametroRN->consultar($infraParametroDTO);
$versaoSei = $infraParametroDTO->getStrValor();
print_r($versaoSei);
if($versaoSei == '2.5.1'){
header("Pragma: public");
header('Pragma: no-cache');
header("Expires: 0");
header("Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private","false");
PaginaSEIExterna::getInstance()->montarHeaderDownload($_GET['nome_arquivo'],'attachment');
$fp = fopen(dirname(__FILE__).'/../../'.DIR_UPLOAD.'/'.$_GET['nome_arquivo'], "rb");
while (!feof($fp)) {
echo fread($fp, TAM_BLOCO_LEITURA_ARQUIVO);
}
fclose($fp);
break;
}else{
header("Pragma: public");
header('Pragma: no-cache');
header("Expires: 0");
header("Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private","false");
$strNomeDownload=$_GET['nome_download'];
if (InfraString::isBolVazia($strNomeDownload)){
$strNomeDownload=$_GET['nome_arquivo'];
}
PaginaSEI::getInstance()->montarHeaderDownload($strNomeDownload,'attachment');
$fp = fopen(DIR_SEI_TEMP.'/'.$_GET['nome_arquivo'], "rb");
while (!feof($fp)) {
echo fread($fp, TAM_BLOCO_LEITURA_ARQUIVO);
}
fclose($fp);
break;
}
default:
throw new InfraException("Ação '".$_GET['acao']."' não reconhecida.");
}
}catch(Exception $e){
try{ LogSEI::getInstance()->gravar(InfraException::inspecionar($e)."\n".'$_GET: '.print_r($_GET,true)); }catch(Exception $e2){}
die('Erro exibindo arquivo em acesso externo.');
}
?>