Commit eefe686ae48701ccbee718329fb4493c2a5af26a
1 parent
13b434cf
Exists in
master
and in
7 other branches
Opção de upload de sahpefile no novo sistema de administração
Showing
6 changed files
with
202 additions
and
242 deletions
Show diff stats
admin/php/subirshapefile.php
... | ... | @@ -29,6 +29,8 @@ error_reporting(0); |
29 | 29 | if (isset($_FILES['i3GEOuploadshp']['name'])) |
30 | 30 | { |
31 | 31 | $dirDestino = $_POST["dirDestino"]; |
32 | + $dirDestino = str_replace(".","",$dirDestino); | |
33 | + | |
32 | 34 | if(empty($dirDestino)){ |
33 | 35 | echo "Pasta nao encontrada"; exit; |
34 | 36 | } |
... | ... | @@ -45,8 +47,8 @@ if (isset($_FILES['i3GEOuploadshp']['name'])) |
45 | 47 | flush(); |
46 | 48 | sleep(1); |
47 | 49 | $dirmap = $dirDestino; |
48 | - if(!file_exists($dirmap)){ | |
49 | - echo "<p class='paragrafo' >Pasta não existe no servidor"; | |
50 | + if(!file_exists($dirmap) || $dirmap == dirname ( $locaplic ) || $dirmap == dirname ( $locaplic )."/"){ | |
51 | + echo "<p class='paragrafo' >Pasta não existe no servidor ou não permitido"; | |
50 | 52 | paraAguarde(); |
51 | 53 | exit; |
52 | 54 | } | ... | ... |
admin1/dicionario/uploadshp.js
1 | 1 | i3GEOadmin.uploadshp.dicionario = { |
2 | 2 | 'pastaArmazenamento' : [ { |
3 | - pt : "Pasta no servidor onde os dados serão armazenados (caminho físico completo)", | |
3 | + pt : "Pasta no servidor onde os dados serão armazenados. Apenas pastas localizadas no mesmo local onde o i3Geo está instalado são permitidas. Exemplo, no caso da instalação ser /var/www e existir a pasta /var/www/data, digite apenas data.", | |
4 | 4 | en : "", |
5 | 5 | es : "" |
6 | 6 | } ], | ... | ... |
admin1/upload/arquivo/exec.php
1 | 1 | <?php |
2 | -/* | |
3 | - * Licenca: | |
4 | - * | |
5 | - * GPL2 | |
6 | - * | |
7 | - * i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
8 | - * | |
9 | - * Direitos Autorais Reservados (c) 2006 Edmar Moretti | |
10 | - * Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
11 | - * | |
12 | - * Este programa é software livre; você pode redistribuí-lo | |
13 | - * e/ou modificá-lo sob os termos da Licença Pública Geral | |
14 | - * GNU conforme publicada pela Free Software Foundation; | |
15 | - * | |
16 | - * Este programa é distribuído na expectativa de que seja útil, | |
17 | - * porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
18 | - * de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
19 | - * Consulte a Licença Pública Geral do GNU para mais detalhes. | |
20 | - * Você deve ter recebido uma copia da Licença Pública Geral do | |
21 | - * GNU junto com este programa; se não, escreva para a | |
22 | - * Free Software Foundation, Inc., no endereço | |
23 | - * 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
24 | - */ | |
25 | -error_reporting ( 0 ); | |
26 | -// | |
27 | -// pega as variaveis passadas com get ou post | |
28 | -// | |
29 | - | |
30 | 2 | include_once (dirname ( __FILE__ ) . "/../../../admin/php/login.php"); |
31 | -$funcoesEdicao = array ( | |
32 | - "ADICIONAR", | |
33 | - "ALTERAR", | |
34 | - "EXCLUIR" | |
35 | -); | |
3 | + | |
36 | 4 | if (in_array ( strtoupper ( $funcao ), $funcoesEdicao )) { |
37 | - if (verificaOperacaoSessao ( "admin/html/usuarios" ) === false) { | |
38 | - header ( "HTTP/1.1 403 Vc nao pode realizar essa operacao" ); | |
5 | + if (verificaOperacaoSessao ( "admin/html/subirshapefile" ) == false) { | |
6 | + retornaJSON ( "Vc nao pode realizar essa operacao." ); | |
39 | 7 | exit (); |
40 | 8 | } |
41 | 9 | } |
42 | -include (dirname ( __FILE__ ) . "/../../../admin/php/conexao.php"); | |
43 | -$funcao = strtoupper ( $funcao ); | |
44 | -// converte os parametros de definicao dos papeis em um array | |
45 | -if ($funcao == "ADICIONAR" || $funcao == "ALTERAR") { | |
46 | - $papeis = array (); | |
47 | - foreach ( array_keys ( $_POST ) as $k ) { | |
48 | - $teste = explode ( "-", $k ); | |
49 | - if ($teste[0] == "id_papel") { | |
50 | - $papeis[] = $teste[1] * 1; | |
51 | - } | |
52 | - } | |
53 | - array_unique ( $papeis ); | |
10 | +if (isset ( $_GET ["tipo"] )) { | |
11 | + $tipo = $_GET ["tipo"]; | |
54 | 12 | } |
55 | -switch ($funcao) { | |
56 | - case "ADICIONAR" : | |
57 | - $novo = adicionar( $ativo, $data_cadastro, $email, $login, $nome_usuario, $senha, $papeis, $dbhw ); | |
58 | - if ($novo != false) { | |
59 | - $sql = "SELECT id_usuario, ativo, data_cadastro, email, login, nome_usuario from " . $esquemaadmin . "i3geousr_usuarios WHERE id_usuario = " . $novo; | |
60 | - $dados = pegaDados ( $sql, $dbh ); | |
61 | - if ($dados === false) { | |
62 | - header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | |
63 | - exit (); | |
64 | - } | |
65 | - if(strtolower($enviaSenha) == "on"){ | |
66 | - if($senha == "" || $email == ""){ | |
67 | - $dados = header ( "HTTP/1.1 500 para enviar a senha é necessário preencher o valor de senha e e-mail" ); | |
68 | - } else { | |
69 | - $dados = enviarSenha( $senha, $email ); | |
70 | - } | |
71 | - } | |
72 | - retornaJSON ( $dados ); | |
73 | - } else { | |
74 | - header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | |
75 | - exit (); | |
76 | - } | |
13 | +// locaplic e usado para definir a pasta de destino | |
14 | +if (empty ( $locaplic )) { | |
15 | + exit (); | |
16 | +} | |
17 | +error_reporting ( 0 ); | |
18 | +?> | |
19 | +<html> | |
20 | +<head> | |
21 | +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | |
22 | +<link rel="stylesheet" type="text/css" href="../../../css/input.css" /> | |
23 | +<link rel="stylesheet" type="text/css" href="../../../css/geral.css" /> | |
24 | +<script src="../../../classesjs/classe_util.js"></script> | |
25 | +<title></title> | |
26 | +</head> | |
27 | +<body bgcolor="white" style="background-color: white; text-align: left;"> | |
28 | + <p> | |
29 | +<?php | |
30 | +if (isset ( $_FILES ['i3GEOuploadshp'] ['name'] )) { | |
31 | + $dirDestino = $_POST ["dirDestino"]; | |
32 | + $dirDestino = str_replace(".","",$dirDestino); | |
33 | + if (empty ( $dirDestino )) { | |
34 | + echo "Pasta não encontrada"; | |
77 | 35 | exit (); |
78 | - break; | |
79 | - case "ALTERAR" : | |
80 | - $novo = alterar ( $id_usuario, $ativo, $data_cadastro, $email, $login, $nome_usuario, $senha, $papeis, $dbhw ); | |
81 | - if ($novo === false) { | |
82 | - header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | |
83 | - exit (); | |
84 | - } | |
85 | - $sql = "SELECT * from " . $esquemaadmin . "i3geousr_usuarios WHERE id_usuario = " . $novo; | |
86 | - $dados = pegaDados ( $sql, $dbh ); | |
87 | - if ($dados === false) { | |
88 | - header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | |
89 | - exit (); | |
90 | - } | |
91 | - if(strtolower($enviaSenha) == "on"){ | |
92 | - if($senha == "" || $email == ""){ | |
93 | - $dados = header ( "HTTP/1.1 500 para enviar a senha é necessário preencher o valor de senha e e-mail" ); | |
94 | - } else { | |
95 | - $dados = enviarSenha( $senha, $email ); | |
96 | - } | |
97 | - } | |
98 | - retornaJSON ( $dados ); | |
36 | + } | |
37 | + $checaDestino = dirname ( $locaplic ); | |
38 | + $dirDestino = str_replace ( $checaDestino, "", $dirDestino ); | |
39 | + $dirDestino = $checaDestino . "/" . $dirDestino; | |
40 | + | |
41 | + if (isset ( $logExec ) && $logExec ["upload"] == true) { | |
42 | + i3GeoLog ( "prog: upload filename:" . $_FILES ['i3GEOuploadshp'] ['name'], $dir_tmp ); | |
43 | + } | |
44 | + | |
45 | + echo "<p class='paragrafo' >Carregando o arquivo...</p>"; | |
46 | + ob_flush (); | |
47 | + flush (); | |
48 | + sleep ( 1 ); | |
49 | + $dirmap = $dirDestino; | |
50 | + if (! file_exists ( $dirmap ) || $dirmap == dirname ( $locaplic ) || $dirmap == dirname ( $locaplic )."/") { | |
51 | + echo "<p class='paragrafo' >Pasta não existe no servidor ou o local não é permitido"; | |
99 | 52 | exit (); |
100 | - break; | |
101 | - case "LISTA" : | |
102 | - $usuarios = pegaDados ( "SELECT id_usuario,ativo,data_cadastro,email,login,nome_usuario from " . $esquemaadmin . "i3geousr_usuarios order by nome_usuario", $dbh, false ); | |
103 | - $papeis = pegaDados ( "SELECT P.id_papel, P.nome, P.descricao, UP.id_usuario FROM " . $esquemaadmin . "i3geousr_usuarios AS U JOIN " . $esquemaadmin . "i3geousr_papelusuario AS UP ON U.id_usuario = UP.id_usuario JOIN " . $esquemaadmin . "i3geousr_papeis AS P ON UP.id_papel = P.id_papel ", dbh, false ); | |
104 | - if ($usuarios === false || $papeis === false) { | |
105 | - $dbhw = null; | |
106 | - $dbh = null; | |
107 | - header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | |
108 | - exit (); | |
109 | - } | |
110 | - $o = array (); | |
111 | - foreach ( $usuarios as $usuario ) { | |
112 | - // pega os papeis registrados para cada operacao | |
113 | - $p = array (); | |
114 | - foreach ( $papeis as $papel ) { | |
115 | - if ($papel["id_usuario"] == $usuario["id_usuario"]) { | |
116 | - $p[$papel["id_papel"]] = $papel; | |
117 | - } | |
118 | - } | |
119 | - $usuario["papeis"] = $p; | |
120 | - $o[] = $usuario; | |
121 | - } | |
122 | - $papeis = pegaDados ( "SELECT * from " . $esquemaadmin . "i3geousr_papeis order by nome", $dbh ); | |
123 | - $dbhw = null; | |
124 | - $dbh = null; | |
125 | - if ($papeis === false) { | |
126 | - header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | |
127 | - exit(); | |
128 | - } | |
129 | - retornaJSON ( array ( | |
130 | - "usuarios" => $o, | |
131 | - "papeis" => $papeis | |
132 | - ) ); | |
133 | - break; | |
134 | - case "EXCLUIR" : | |
135 | - $retorna = excluir ( $id_usuario, $dbhw ); | |
136 | - $dbhw = null; | |
137 | - $dbh = null; | |
138 | - if ($retorna === false) { | |
139 | - header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | |
140 | - exit (); | |
141 | - } | |
142 | - retornaJSON ( $id_usuario ); | |
53 | + } | |
54 | + // verifica nomes | |
55 | + verificaNome ( $_FILES ['i3GEOuploadshp'] ['name'] ); | |
56 | + verificaNome ( $_FILES ['i3GEOuploadshx'] ['name'] ); | |
57 | + verificaNome ( $_FILES ['i3GEOuploaddbf'] ['name'] ); | |
58 | + | |
59 | + if ($_FILES ['i3GEOuploadprj'] ['name'] != "") { | |
60 | + verificaNome ( $_FILES ['i3GEOuploadprj'] ['name'] ); | |
61 | + } | |
62 | + | |
63 | + // remove acentos | |
64 | + $nomePrefixo = str_replace ( " ", "_", removeAcentos ( str_replace ( ".shp", "", $_FILES ['i3GEOuploadshp'] ['name'] ) ) ); | |
65 | + | |
66 | + $nomePrefixo = str_replace ( ".", "", $nomePrefixo ); | |
67 | + $nomePrefixo = strip_tags ( $nomePrefixo ); | |
68 | + $nomePrefixo = htmlspecialchars ( $nomePrefixo, ENT_QUOTES ); | |
69 | + | |
70 | + // sobe arquivo | |
71 | + $Arquivo = $_FILES ['i3GEOuploadshp'] ['tmp_name']; | |
72 | + if (file_exists ( $dirmap . "/" . $nomePrefixo . ".shp" )) { | |
73 | + echo "<p class='paragrafo' >Já existe um SHP com o nome "; | |
74 | + paraAguarde (); | |
143 | 75 | exit (); |
144 | - break; | |
145 | - case "ENVIARSENHA" : | |
146 | - if($senha == "" || $email == ""){ | |
147 | - header ( "HTTP/1.1 500 erro ao enviar e-mail. Prrencha o valor de e-mail e senha" ); | |
148 | - exit (); | |
149 | - } | |
150 | - $retorna = enviarSenha ( $senha, $email ); | |
151 | - if ($retorna === false) { | |
152 | - header ( "HTTP/1.1 500 erro ao enviar e-mail $email" ); | |
76 | + } | |
77 | + $status = move_uploaded_file ( $Arquivo, $dirmap . "/" . $nomePrefixo . ".shp" ); | |
78 | + if ($status != 1) { | |
79 | + echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo SHP. Pode ser uma limitação quanto ao tamanho do arquivo ou permissão de escrita na pasta indicada."; | |
80 | + paraAguarde (); | |
81 | + exit (); | |
82 | + } | |
83 | + | |
84 | + $Arquivo = $_FILES ['i3GEOuploadshx'] ['tmp_name']; | |
85 | + $status = move_uploaded_file ( $Arquivo, $dirmap . "/" . $nomePrefixo . ".shx" ); | |
86 | + if ($status != 1) { | |
87 | + echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo SHX"; | |
88 | + paraAguarde (); | |
89 | + exit (); | |
90 | + } | |
91 | + | |
92 | + $Arquivo = $_FILES ['i3GEOuploaddbf'] ['tmp_name']; | |
93 | + $status = move_uploaded_file ( $Arquivo, $dirmap . "/" . $nomePrefixo . ".dbf" ); | |
94 | + if ($status != 1) { | |
95 | + echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo DBF"; | |
96 | + paraAguarde (); | |
97 | + exit (); | |
98 | + } | |
99 | + | |
100 | + if ($_FILES ['i3GEOuploadprj'] ['name'] != "") { | |
101 | + $Arquivo = $_FILES ['i3GEOuploadprj'] ['tmp_name']; | |
102 | + $status = move_uploaded_file ( $Arquivo, $dirmap . "/" . $nomePrefixo . ".prj" ); | |
103 | + if ($status != 1) { | |
104 | + echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo PRJ"; | |
105 | + paraAguarde (); | |
153 | 106 | exit (); |
154 | 107 | } |
155 | - retornaJSON ( true ); | |
108 | + } | |
109 | + | |
110 | + if (! file_exists ( $dirmap . "/" . $nomePrefixo . ".shp" )) { | |
111 | + echo "<p class='paragrafo' >Ocorreu algum problema no envio do arquivo "; | |
112 | + paraAguarde (); | |
156 | 113 | exit (); |
157 | - break; | |
158 | -} | |
159 | -cpjson ( $retorno ); | |
114 | + } | |
160 | 115 | |
161 | -function enviarSenha( $senha, $email ){ | |
162 | - $to = $email; | |
163 | - $subject = 'senha i3geo criada em '. date('l jS \of F Y h:i:s A'); | |
164 | - $message = $senha; | |
165 | - return mail($to, $subject, $message); | |
166 | -} | |
167 | -// $papeis deve ser um array | |
168 | -function adicionar($ativo, $data_cadastro, $email, $login, $nome_usuario, $senha, $papeis, $dbhw) { | |
169 | - global $esquemaadmin; | |
170 | - try { | |
171 | - $dataCol = array( | |
172 | - "nome_usuario" => '', | |
173 | - "login" => '', | |
174 | - "email" => '', | |
175 | - "ativo" => 0, | |
176 | - "data_cadastro" => '', | |
177 | - "senha" => '' | |
178 | - ); | |
179 | - $id_usuario = i3GeoAdminInsertUnico ( $dbhw, "i3geousr_usuarios", $dataCol, "nome_usuario", "id_usuario" ); | |
180 | - $data_cadastro = date('l jS \of F Y h:i:s A'); | |
181 | - $retorna = alterar ( $id_usuario, $ativo, $data_cadastro, $email, $login, $nome_usuario, $senha, $papeis, $dbhw ); | |
182 | - return $retorna; | |
183 | - } catch ( PDOException $e ) { | |
184 | - return false; | |
116 | + $checkphp = fileContemString ( $dirmap . "/" . $nomePrefixo . ".prj", "<?" ); | |
117 | + if ($checkphp == true) { | |
118 | + echo "Arquivo prj invalido"; | |
119 | + unlink ( $dirmap . "/" . $nomePrefixo . ".shp" ); | |
120 | + unlink ( $dirmap . "/" . $nomePrefixo . ".dbf" ); | |
121 | + unlink ( $dirmap . "/" . $nomePrefixo . ".shx" ); | |
122 | + unlink ( $dirmap . "/" . $nomePrefixo . ".prj" ); | |
123 | + exit (); | |
185 | 124 | } |
186 | -} | |
187 | -// $papeis deve ser um array | |
188 | -function alterar($id_usuario, $ativo, $data_cadastro, $email, $login, $nome_usuario, $senha, $papeis, $dbhw) { | |
189 | - global $esquemaadmin; | |
190 | - if ($convUTF) { | |
191 | - $nome_usuario = utf8_encode ( $nome_usuario ); | |
192 | - } | |
193 | - $dataCol = array ( | |
194 | - "nome_usuario" => $nome_usuario, | |
195 | - "login" => $login, | |
196 | - "email" => $email, | |
197 | - "ativo" => $ativo | |
198 | - ); | |
199 | - // se a senha foi enviada, ela sera trocada | |
200 | - if ($senha != "") { | |
201 | - $dataCol ["senha"] = md5 ( $senha ); | |
202 | - } | |
203 | - $resultado = i3GeoAdminUpdate ( $dbhw, "i3geousr_usuarios", $dataCol, "WHERE id_usuario = $id_usuario" ); | |
204 | - if ($resultado === false) { | |
205 | - return false; | |
206 | - } | |
207 | - // apaga todos os papeis | |
208 | - $resultado = excluirPapeis ( $id_usuario, $dbhw ); | |
209 | - if ($resultado === false) { | |
210 | - return false; | |
211 | - } | |
212 | - if (! empty ( $papeis )) { | |
213 | - // atualiza papeis vinculados | |
214 | - foreach ( $papeis as $p ) { | |
215 | - $resultado = adicionaPapel ( $id_usuario, $p, $dbhw ); | |
216 | - if ($resultado === false) { | |
217 | - return false; | |
218 | - } | |
125 | + $checkphp = fileContemString ( $dirmap . "/" . $nomePrefixo . ".shx", "<?" ); | |
126 | + if ($checkphp == true) { | |
127 | + echo "Arquivo shx invalido"; | |
128 | + unlink ( $dirmap . "/" . $nomePrefixo . ".shp" ); | |
129 | + unlink ( $dirmap . "/" . $nomePrefixo . ".dbf" ); | |
130 | + unlink ( $dirmap . "/" . $nomePrefixo . ".shx" ); | |
131 | + unlink ( $dirmap . "/" . $nomePrefixo . ".prj" ); | |
132 | + exit (); | |
133 | + } | |
134 | + $checkphp = fileContemString ( $dirmap . "/" . $nomePrefixo . ".dbf", "<?" ); | |
135 | + if ($checkphp == true) { | |
136 | + echo "Arquivo dbf invalido"; | |
137 | + unlink ( $dirmap . "/" . $nomePrefixo . ".shp" ); | |
138 | + unlink ( $dirmap . "/" . $nomePrefixo . ".dbf" ); | |
139 | + unlink ( $dirmap . "/" . $nomePrefixo . ".shx" ); | |
140 | + unlink ( $dirmap . "/" . $nomePrefixo . ".prj" ); | |
141 | + exit (); | |
142 | + } | |
143 | + echo "<p class='paragrafo' >Arquivo enviado.</p>"; | |
144 | + echo "<p class='paragrafo'></p>"; | |
145 | + if ($i3GEOuploadCriaMapfile == "on") { | |
146 | + // verifica se o usuario marcou a opcao de cria mapfile | |
147 | + // nesse caso o aplicativo de upload esta sendo executado de dentro do sistema de administracao, e o mapfile devera | |
148 | + // ser criado e registrado no sistema | |
149 | + $nome = $nomePrefixo; | |
150 | + $codigo = $nomePrefixo; | |
151 | + $it = $nomePrefixo; | |
152 | + $en = $nomePrefixo; | |
153 | + $es = $nomePrefixo; | |
154 | + $sfileObj = ms_newShapefileObj ( $dirmap . "/" . $nomePrefixo . ".shp", - 1 ); | |
155 | + if (! isset ( $tipo ) || $tipo == "") { | |
156 | + $tipo = $sfileObj->type; | |
157 | + } | |
158 | + if ($tipo == 1) { | |
159 | + $tipoLayer = "point"; | |
160 | + } | |
161 | + if ($tipo == 3) { | |
162 | + $tipoLayer = "line"; | |
219 | 163 | } |
164 | + if ($tipo == 5) { | |
165 | + $tipoLayer = "polygon"; | |
166 | + } | |
167 | + $funcao = "CRIARNOVOMAP"; | |
168 | + $output = "retorno"; | |
169 | + $data = $dirmap . "/" . $nomePrefixo . ".shp"; | |
170 | + include_once ($locaplic . "/admin/php/editormapfile.php"); | |
171 | + echo "<b><p class='paragrafo' >Criado!!!<br>"; | |
172 | + echo "Para editar clique: <a href='../../admin/html/editormapfile.html' target=_blank >editar</a>"; | |
173 | + echo "<script>window.scrollTo(0,10000);i3GEO.util.insereCookie('I3GEOletraAdmin','" . $nomePrefixo . "');</script>"; | |
220 | 174 | } |
221 | - return $id_usuario; | |
222 | -} | |
223 | -function adicionaPapel($id_usuario, $id_papel, $dbhw) { | |
224 | - global $esquemaadmin; | |
225 | - $dataCol = array ( | |
226 | - "id_usuario" => $id_usuario, | |
227 | - "id_papel" => $id_papel | |
228 | - ); | |
229 | - $resultado = i3GeoAdminInsert ( $dbhw, "i3geousr_papelusuario", $dataCol ); | |
230 | - return $resultado; | |
175 | + echo "<p class='paragrafo'>Pode fechar essa janela.</p>"; | |
176 | +} else { | |
177 | + echo "<p class='paragrafo' >Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</p>"; | |
231 | 178 | } |
232 | -function excluir($id_usuario, $dbhw) { | |
233 | - global $esquemaadmin; | |
234 | - $resultado = i3GeoAdminExclui ( $esquemaadmin . "i3geousr_usuarios", "id_usuario", $id_usuario, $dbhw, false ); | |
235 | - if ($resultado === false) { | |
236 | - return false; | |
179 | + | |
180 | +function verificaNome($nome) { | |
181 | + if (strlen ( basename ( $nome ) ) > 200) { | |
182 | + exit (); | |
237 | 183 | } |
238 | - if ($resultado === true) { | |
239 | - $resultado = excluirPapeis ( $id_usuario, $dbhw ); | |
184 | + $nome = strtolower ( $nome ); | |
185 | + $lista = explode ( ".", $nome ); | |
186 | + $extensao = $lista [count ( $lista ) - 1]; | |
187 | + if (($extensao != "dbf") && ($extensao != "shx") && ($extensao != "shp") && ($extensao != "prj")) { | |
188 | + echo "Nome de arquivo inválido. $nome"; | |
189 | + paraAguarde (); | |
190 | + exit (); | |
240 | 191 | } |
241 | - return $resultado; | |
242 | -} | |
243 | -function excluirPapeis($id_usuario, $dbhw) { | |
244 | - global $esquemaadmin; | |
245 | - $resultado = i3GeoAdminExclui ( $esquemaadmin . "i3geousr_papelusuario", "id_usuario", $id_usuario, $dbhw, false ); | |
246 | - return $resultado; | |
247 | 192 | } |
248 | 193 | ?> |
194 | + | |
195 | + | |
196 | +</body> | |
197 | +</html> | ... | ... |
admin1/upload/arquivo/index.js
admin1/upload/arquivo/index.php
... | ... | @@ -42,25 +42,26 @@ include "../../head.php"; |
42 | 42 | </div> |
43 | 43 | </div> |
44 | 44 | <div class="container hidden" id="corpo"> |
45 | - <form style="" action="#" onsubmit="return false;" class="form-horizontal" role="form" | |
46 | - method="post"> | |
45 | + <form style="" target="i3GEOuploadiframe" | |
46 | + action="exec.php" method="post" | |
47 | + ENCTYPE="multipart/form-data" onsubmit="javascript:$('#modalUpload').modal('show');" class="form-horizontal" role="form" method="post"> | |
47 | 48 | <div class="row center-block well"> |
48 | 49 | <div class="col-md-12"> |
49 | 50 | <h4>{{{txtArquivos}}}</h4> |
50 | 51 | <div class="form-group form-group-lg col-md-6"> |
51 | - <input id="i3GEOuploadshp" multiple="" type="file"> <input readonly="" class="form-control" | |
52 | + <input name="i3GEOuploadshp" multiple="" type="file"> <input readonly="" class="form-control" | |
52 | 53 | placeholder="SHP" type="text"> |
53 | 54 | </div> |
54 | 55 | <div class="form-group form-group-lg col-md-6"> |
55 | - <input id="i3GEOuploadshx" multiple="" type="file"> <input readonly="" class="form-control" | |
56 | + <input name="i3GEOuploadshx" multiple="" type="file"> <input readonly="" class="form-control" | |
56 | 57 | placeholder="SHX" type="text"> |
57 | 58 | </div> |
58 | 59 | <div class="form-group form-group-lg col-md-6"> |
59 | - <input id="i3GEOuploaddbf" multiple="" type="file"> <input readonly="" class="form-control" | |
60 | + <input name="i3GEOuploaddbf" multiple="" type="file"> <input readonly="" class="form-control" | |
60 | 61 | placeholder="DBF" type="text"> |
61 | 62 | </div> |
62 | 63 | <div class="form-group form-group-lg col-md-6"> |
63 | - <input id="i3GEOuploadprj" multiple="" type="file"> <input readonly="" class="form-control" | |
64 | + <input name="i3GEOuploadprj" multiple="" type="file"> <input readonly="" class="form-control" | |
64 | 65 | placeholder="PRJ (opcional)" type="text"> |
65 | 66 | </div> |
66 | 67 | </div> |
... | ... | @@ -94,12 +95,11 @@ include "../../head.php"; |
94 | 95 | </div> |
95 | 96 | </div> |
96 | 97 | <div class="form-group form-group-lg"> |
97 | - <label class="col-md-5 control-label" style="margin-top:0px;" for="i3GEOuploadCriaMapfile">{{{criaMapfile}}}</label> | |
98 | + <label class="col-md-5 control-label" style="margin-top: 0px;" for="i3GEOuploadCriaMapfile">{{{criaMapfile}}}</label> | |
98 | 99 | <div class="col-md-7"> |
99 | - <div class=" checkbox"> | |
100 | - <label> | |
101 | - <input title="{{{criaMapfile}}}" name="i3GEOuploadCriaMapfile" type="checkbox"> | |
102 | - </label> | |
100 | + <div class=" checkbox"> | |
101 | + <label> <input title="{{{criaMapfile}}}" name="i3GEOuploadCriaMapfile" type="checkbox"> | |
102 | + </label> | |
103 | 103 | </div> |
104 | 104 | </div> |
105 | 105 | </div> |
... | ... | @@ -115,6 +115,16 @@ include "../../head.php"; |
115 | 115 | |
116 | 116 | </form> |
117 | 117 | </div> |
118 | +<div id="modalUpload" class="modal fade" tabindex="-1"> | |
119 | + <div class="modal-dialog modal-lg"> | |
120 | + <div class="modal-content"> | |
121 | + <div class="modal-body modal-lg"> | |
122 | + <iframe name=i3GEOuploadiframe style="text-align: left; border: 0px solid gray;" width="100%" | |
123 | + height="100%"></iframe> | |
124 | + </div> | |
125 | + </div> | |
126 | + </div> | |
127 | +</div> | |
118 | 128 | <script id="templateProj" type="x-tmpl-mustache"> |
119 | 129 | <option value="{{{codigo}}}">{{{nome}}}</option> |
120 | 130 | </script> | ... | ... |
ferramentas/upload/dicionario.js
1 | 1 | //+$trad(1,i3GEOF.upload.dicionario)+ |
2 | 2 | i3GEOF.upload.dicionario = { |
3 | 3 | 'pastaArmazenamento' : [ { |
4 | - pt : "Pasta no servidor onde os dados serão armazenados", | |
4 | + pt : "Pasta no servidor onde os dados serão armazenados. Apenas pastas localizadas no mesmo local onde o i3Geo está instalado são permitidas. Exemplo, no caso da instalação ser /var/www e existir a pasta /var/www/data, digite apenas data", | |
5 | 5 | en : "", |
6 | 6 | es : "" |
7 | 7 | } ], | ... | ... |