Commit f4beda7be151d0695fb67ac8a147626ec6937f04
1 parent
60e38c45
Exists in
master
and in
7 other branches
Remoção de arquivos não utilizados
Showing
32 changed files
with
1 additions
and
8351 deletions
Show diff stats
admin/php/arvore.php
@@ -1,768 +0,0 @@ | @@ -1,768 +0,0 @@ | ||
1 | -<?php | ||
2 | -/* | ||
3 | -Title: arvore.php | ||
4 | - | ||
5 | -Funções utilizadas pelo editor da árvore de menus para processar os nós | ||
6 | - | ||
7 | -É utilizado nas funções em AJAX da interface de edição da árvore de menus | ||
8 | - | ||
9 | -Processa os relacionamentos entre menus, grupos, subgrupos e temas necessário para a hierarquisação dos nós da árvore | ||
10 | - | ||
11 | -Licenca: | ||
12 | - | ||
13 | -GPL2 | ||
14 | - | ||
15 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
16 | - | ||
17 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
18 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
19 | - | ||
20 | -Este programa é software livre; você pode redistribuí-lo | ||
21 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
22 | -GNU conforme publicada pela Free Software Foundation; | ||
23 | - | ||
24 | -Este programa é distribuído na expectativa de que seja útil, | ||
25 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
26 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
27 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
28 | -Você deve ter recebido uma cópia da Licença Pública Geral do | ||
29 | - GNU junto com este programa; se não, escreva para a | ||
30 | -Free Software Foundation, Inc., no endereço | ||
31 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
32 | - | ||
33 | -Arquivo: | ||
34 | - | ||
35 | -i3geo/admin/php/arvore.php | ||
36 | - | ||
37 | -Parametros: | ||
38 | - | ||
39 | -O parâmetro principal é "funcao", que define qual operação será executada, por exemplo, arvore.php?funcao=pegaGrupos. | ||
40 | - | ||
41 | -Cada operação possuí seus próprios parâmetros, que devem ser enviados também na requisição da operação. | ||
42 | - | ||
43 | -*/ | ||
44 | -include_once(dirname(__FILE__)."/login.php"); | ||
45 | -$id = $_GET["id"]; | ||
46 | -testaNumerico([$id]); | ||
47 | - | ||
48 | -$funcoesEdicao = array( | ||
49 | - "ADICIONARTEMARAIZ", | ||
50 | - "ADICIONARTEMARAIZGRUPO", | ||
51 | - "ADICIONARGRUPO", | ||
52 | - "ADICIONARSUBGRUPO", | ||
53 | - "ADICIONARTEMA", | ||
54 | - "ALTERARGRUPO", | ||
55 | - "ALTERARSUBGRUPO", | ||
56 | - "ALTERARTEMA", | ||
57 | - "ALTERARRAIZ", | ||
58 | - "MOVIMENTANO", | ||
59 | - "EXCLUIR" | ||
60 | -); | ||
61 | -if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
62 | - if(verificaOperacaoSessao("admin/html/arvore") == false){ | ||
63 | - retornaJSON("Vc nao pode realizar essa operacao.");exit; | ||
64 | - } | ||
65 | -} | ||
66 | - | ||
67 | -if(!isset($idioma)) | ||
68 | -{ | ||
69 | - $idioma = "pt"; | ||
70 | -} | ||
71 | -if($idioma == "") | ||
72 | -{ | ||
73 | - $idioma = "pt"; | ||
74 | -} | ||
75 | - | ||
76 | -//faz a busca da função que deve ser executada | ||
77 | -switch (strtoupper($funcao)) | ||
78 | -{ | ||
79 | - /* | ||
80 | - Note: | ||
81 | - | ||
82 | - Valores que o parâmetro &funcao pode receber. Os parâmetros devem ser enviados na requisição em AJAX. | ||
83 | - */ | ||
84 | - /* | ||
85 | - Valor: PEGAGRUPOS | ||
86 | - | ||
87 | - Grupos de um menu | ||
88 | - | ||
89 | - Parametro: | ||
90 | - | ||
91 | - id_menu {string} | ||
92 | - | ||
93 | - Retorno: | ||
94 | - | ||
95 | - {JSON} | ||
96 | - */ | ||
97 | - case "PEGAGRUPOS": | ||
98 | - require_once("classe_arvore.php"); | ||
99 | - $arvore = new Arvore($locaplic,$idioma); | ||
100 | - $grupos = $arvore->pegaGruposMenu($id_menu); | ||
101 | - unset($arvore); | ||
102 | - retornaJSON($grupos); | ||
103 | - exit; | ||
104 | - break; | ||
105 | - /* | ||
106 | - Valor: PEGASUBGRUPOS | ||
107 | - | ||
108 | - Subgrupos de um grupo | ||
109 | - | ||
110 | - Parametros: | ||
111 | - | ||
112 | - id_menu {string} | ||
113 | - | ||
114 | - id_n1 {string} - id do gupo | ||
115 | - | ||
116 | - Retorno: | ||
117 | - | ||
118 | - [JSON} | ||
119 | - */ | ||
120 | - case "PEGASUBGRUPOS": | ||
121 | - require_once("classe_arvore.php"); | ||
122 | - $arvore = new Arvore($locaplic,$idioma); | ||
123 | - $sgrupos = $arvore->pegaSubgruposGrupo($id_menu,$id_n1); | ||
124 | - unset($arvore); | ||
125 | - retornaJSON($sgrupos); | ||
126 | - exit; | ||
127 | - break; | ||
128 | - /* | ||
129 | - Valor: PEGATEMAS | ||
130 | - | ||
131 | - Temas de um subgrupo | ||
132 | - | ||
133 | - Parametro: | ||
134 | - | ||
135 | - id_n2 {string} - id do subgupo | ||
136 | - | ||
137 | - Retorno: | ||
138 | - | ||
139 | - {JSON} | ||
140 | - */ | ||
141 | - case "PEGATEMAS": | ||
142 | - require_once("classe_arvore.php"); | ||
143 | - $arvore = new Arvore($locaplic,$idioma); | ||
144 | - $temas = $arvore->pegaTemasSubGrupo($id_n2); | ||
145 | - unset($arvore); | ||
146 | - retornaJSON($temas); | ||
147 | - exit; | ||
148 | - break; | ||
149 | - /* | ||
150 | - Valor: PEGADADOSGRUPO | ||
151 | - | ||
152 | - Dados de um grupo | ||
153 | - | ||
154 | - Parametro: | ||
155 | - | ||
156 | - id {string} - id do grupo | ||
157 | - | ||
158 | - Retorno: | ||
159 | - | ||
160 | - {JSON} | ||
161 | - */ | ||
162 | - case "PEGADADOSGRUPO": | ||
163 | - retornaJSON(pegaDados("select * from ".$esquemaadmin."i3geoadmin_n1 LEFT JOIN ".$esquemaadmin."i3geoadmin_grupos ON i3geoadmin_n1.id_grupo = i3geoadmin_grupos.id_grupo where id_n1 = $id")); | ||
164 | - exit; | ||
165 | - break; | ||
166 | - /* | ||
167 | - Valor: PEGADADOSSUBGRUPO | ||
168 | - | ||
169 | - Dados de um subgrupo | ||
170 | - | ||
171 | - Parametro: | ||
172 | - | ||
173 | - id {string} - id do subgrupo | ||
174 | - | ||
175 | - Retorno: | ||
176 | - | ||
177 | - {JSON} | ||
178 | - */ | ||
179 | - case "PEGADADOSSUBGRUPO": | ||
180 | - retornaJSON(pegaDados("select * from ".$esquemaadmin."i3geoadmin_n2 LEFT JOIN ".$esquemaadmin."i3geoadmin_subgrupos ON i3geoadmin_n2.id_subgrupo = i3geoadmin_subgrupos.id_subgrupo where id_n2 = $id")); | ||
181 | - exit; | ||
182 | - break; | ||
183 | - /* | ||
184 | - Valor: PEGADADOSTEMA | ||
185 | - | ||
186 | - Dados de um tema | ||
187 | - | ||
188 | - Parametro: | ||
189 | - | ||
190 | - id {string} - id do tema | ||
191 | - | ||
192 | - Retorno: | ||
193 | - | ||
194 | - {JSON} | ||
195 | - */ | ||
196 | - case "PEGADADOSTEMA": | ||
197 | - retornaJSON(pegaDados("select * from ".$esquemaadmin."i3geoadmin_n3 LEFT JOIN ".$esquemaadmin."i3geoadmin_temas ON i3geoadmin_n3.id_tema = i3geoadmin_temas.id_tema where id_n3 = $id")); | ||
198 | - exit; | ||
199 | - break; | ||
200 | - /* | ||
201 | - Valor: PEGADADOSRAIZ | ||
202 | - | ||
203 | - Dados dos temas registrados em uma raiz (grupo ou menu) | ||
204 | - | ||
205 | - Parametro: | ||
206 | - | ||
207 | - id {string} - id da raiz | ||
208 | - | ||
209 | - Retorno: | ||
210 | - | ||
211 | - {JSON} | ||
212 | - */ | ||
213 | - case "PEGADADOSRAIZ": | ||
214 | - retornaJSON(pegaDados("select * from ".$esquemaadmin."i3geoadmin_raiz LEFT JOIN ".$esquemaadmin."i3geoadmin_temas ON i3geoadmin_raiz.id_tema = i3geoadmin_temas.id_tema where id_raiz = $id")); | ||
215 | - exit; | ||
216 | - break; | ||
217 | - /* | ||
218 | - Valor: ADICIONARTEMARAIZ | ||
219 | - | ||
220 | - Adiciona tema na raiz de um nó menu | ||
221 | - | ||
222 | - Retorno: | ||
223 | - | ||
224 | - {JSON} | ||
225 | - */ | ||
226 | - case "ADICIONARTEMARAIZ": | ||
227 | - $id_nivel = 0; | ||
228 | - $nivel = 0; | ||
229 | - $id_raiz = alterarRaiz(); | ||
230 | - if($idioma == "pt") | ||
231 | - { | ||
232 | - $coluna = "nome_tema"; | ||
233 | - } | ||
234 | - else | ||
235 | - {$coluna = $idioma; | ||
236 | - } | ||
237 | - $raiz = pegaDados("select i3geoadmin_raiz.id_raiz,$coluna as nome_tema from ".$esquemaadmin."i3geoadmin_raiz LEFT JOIN ".$esquemaadmin."i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema where i3geoadmin_raiz.id_raiz = '$id_raiz'"); | ||
238 | - retornaJSON(array("raiz"=>$raiz,"grupos"=>array())); | ||
239 | - exit; | ||
240 | - break; | ||
241 | - /* | ||
242 | - Valor: ADICIONARTEMARAIZGRUPO | ||
243 | - | ||
244 | - Adiciona tema na raiz de um nó grupo | ||
245 | - | ||
246 | - Parametros: | ||
247 | - | ||
248 | - id_n1 - id do grupo | ||
249 | - | ||
250 | - Retorno: | ||
251 | - | ||
252 | - {JSON} | ||
253 | - */ | ||
254 | - case "ADICIONARTEMARAIZGRUPO": | ||
255 | - $id_nivel = $id_n1; | ||
256 | - $nivel = 1; | ||
257 | - $id_raiz = alterarRaiz(); | ||
258 | - if($idioma == "pt") | ||
259 | - { | ||
260 | - $coluna = "nome_tema"; | ||
261 | - } | ||
262 | - else | ||
263 | - {$coluna = $idioma; | ||
264 | - } | ||
265 | - $raiz = pegaDados("select i3geoadmin_raiz.id_raiz,$coluna as nome_tema from ".$esquemaadmin."i3geoadmin_raiz LEFT JOIN ".$esquemaadmin."i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema where i3geoadmin_raiz.id_raiz = '$id_raiz'"); | ||
266 | - retornaJSON(array("raiz"=>$raiz,"grupos"=>array())); | ||
267 | - exit; | ||
268 | - break; | ||
269 | - /* | ||
270 | - Valor: ADICIONARGRUPO | ||
271 | - | ||
272 | - Adiciona um novo grupo em um nó | ||
273 | - | ||
274 | - Parametros: | ||
275 | - | ||
276 | - id_menu - id do menu | ||
277 | - | ||
278 | - Retorno: | ||
279 | - | ||
280 | - {JSON} | ||
281 | - */ | ||
282 | - case "ADICIONARGRUPO": | ||
283 | - $id_n1 = alteraN1(); | ||
284 | - if($idioma == "pt"){ | ||
285 | - $coluna = "nome_grupo"; | ||
286 | - } | ||
287 | - else{ | ||
288 | - $coluna = $idioma; | ||
289 | - } | ||
290 | - $grupos = pegaDados("select i3geoadmin_grupos.$coluna as nome_grupo,id_n1,i3geoadmin_n1.publicado from ".$esquemaadmin."i3geoadmin_n1 LEFT JOIN ".$esquemaadmin."i3geoadmin_grupos ON i3geoadmin_n1.id_grupo = i3geoadmin_grupos.id_grupo where id_menu='$id_menu' and id_n1 = '$id_n1'"); | ||
291 | - $raiz = array(); | ||
292 | - retornaJSON(array("raiz"=>$raiz,"grupos"=>$grupos)); | ||
293 | - exit; | ||
294 | - break; | ||
295 | - /* | ||
296 | - Valor: ADICIONARSUBGRUPO | ||
297 | - | ||
298 | - Adiciona um novo subgrupo em um nó | ||
299 | - | ||
300 | - Parametros: | ||
301 | - | ||
302 | - id_n2 - id do nó | ||
303 | - | ||
304 | - Retorno: | ||
305 | - | ||
306 | - {JSON} | ||
307 | - */ | ||
308 | - case "ADICIONARSUBGRUPO": | ||
309 | - $id_n2 = alteraN2(); | ||
310 | - if($idioma == "pt") | ||
311 | - { | ||
312 | - $coluna = "nome_subgrupo"; | ||
313 | - } | ||
314 | - else | ||
315 | - {$coluna = $idioma; | ||
316 | - } | ||
317 | - $subgrupos = pegaDados("select i3geoadmin_subgrupos.$coluna as nome_subgrupo,i3geoadmin_n2.id_n2,i3geoadmin_n2.publicado from ".$esquemaadmin."i3geoadmin_n2 LEFT JOIN ".$esquemaadmin."i3geoadmin_subgrupos ON i3geoadmin_n2.id_subgrupo = i3geoadmin_subgrupos.id_subgrupo where i3geoadmin_n2.id_n2='$id_n2'"); | ||
318 | - $raiz = array(); | ||
319 | - retornaJSON(array("raiz"=>$raiz,"subgrupos"=>$subgrupos)); | ||
320 | - exit; | ||
321 | - break; | ||
322 | - /* | ||
323 | - Valor: ADICIONARTEMA | ||
324 | - | ||
325 | - Adiciona um novo tema em um nó de um subgrupo | ||
326 | - | ||
327 | - Parametros: | ||
328 | - | ||
329 | - id_n3 - id do nó | ||
330 | - | ||
331 | - Retorno: | ||
332 | - | ||
333 | - {JSON} | ||
334 | - */ | ||
335 | - case "ADICIONARTEMA": | ||
336 | - $id_n3 = alteraN3(); | ||
337 | - if($idioma == "pt") | ||
338 | - { | ||
339 | - $coluna = "nome_tema"; | ||
340 | - } | ||
341 | - else | ||
342 | - {$coluna = $idioma; | ||
343 | - } | ||
344 | - $temas = pegaDados("select i3geoadmin_temas.$coluna as nome_tema,i3geoadmin_n3.id_n3,i3geoadmin_n3.publicado from ".$esquemaadmin."i3geoadmin_n3 LEFT JOIN ".$esquemaadmin."i3geoadmin_temas ON i3geoadmin_n3.id_tema = i3geoadmin_temas.id_tema where i3geoadmin_n3.id_n3='$id_n3'"); | ||
345 | - $raiz = array(); | ||
346 | - retornaJSON($temas); | ||
347 | - exit; | ||
348 | - break; | ||
349 | - /* | ||
350 | - Valor: ALTERARGRUPO | ||
351 | - | ||
352 | - Altera o registro de um grupo | ||
353 | - | ||
354 | - Parametros: | ||
355 | - | ||
356 | - publicado - status do grupo | ||
357 | - | ||
358 | - n1_perfil | ||
359 | - | ||
360 | - id_grupo | ||
361 | - | ||
362 | - id - código do nó (id_n1) | ||
363 | - | ||
364 | - id_menu | ||
365 | - | ||
366 | - Retorno: | ||
367 | - | ||
368 | - {JSON} | ||
369 | - */ | ||
370 | - case "ALTERARGRUPO": | ||
371 | - //verifica se um novo grupo deve ser adicionado no banco de dados | ||
372 | - if(!empty($nomeNovoGrupo)){ | ||
373 | - include_once(dirname(__FILE__)."/menutemas.php"); | ||
374 | - $id_grupo = ""; | ||
375 | - $nome_grupo = $nomeNovoGrupo; | ||
376 | - $id_grupo = alteraGrupos(); | ||
377 | - } | ||
378 | - retornaJSON(alteraN1()); | ||
379 | - exit; | ||
380 | - break; | ||
381 | - /* | ||
382 | - Valor: ALTERARSUBGRUPO | ||
383 | - | ||
384 | - Altera o registro de um subgrupo | ||
385 | - | ||
386 | - Parametros: | ||
387 | - | ||
388 | - publicado - status do subgrupo | ||
389 | - | ||
390 | - n2_perfil | ||
391 | - | ||
392 | - id_subgrupo | ||
393 | - | ||
394 | - id - código do nó (id_n2) | ||
395 | - | ||
396 | - id_n1 - código do nó (id_n1) | ||
397 | - | ||
398 | - Retorno: | ||
399 | - | ||
400 | - {JSON} | ||
401 | - */ | ||
402 | - case "ALTERARSUBGRUPO": | ||
403 | - //verifica se um novo sub-grupo deve ser adicionado no banco de dados | ||
404 | - if(!empty($nomeNovoSubGrupo)){ | ||
405 | - include_once(dirname(__FILE__)."/menutemas.php"); | ||
406 | - $id_subgrupo = ""; | ||
407 | - $nome_subgrupo = $nomeNovoSubGrupo; | ||
408 | - $id_subgrupo = alteraSubGrupos(); | ||
409 | - } | ||
410 | - retornaJSON(alteraN2()); | ||
411 | - exit; | ||
412 | - break; | ||
413 | - /* | ||
414 | - Valor: ALTERARTEMA | ||
415 | - | ||
416 | - Altera o registro de um tema | ||
417 | - | ||
418 | - Parametros: | ||
419 | - | ||
420 | - publicado - status do tema | ||
421 | - | ||
422 | - n3_perfil | ||
423 | - | ||
424 | - id_tema | ||
425 | - | ||
426 | - id - código do nó (id_n3) | ||
427 | - | ||
428 | - id_n2 - código do nó (id_n2) | ||
429 | - | ||
430 | - Retorno: | ||
431 | - | ||
432 | - {JSON} | ||
433 | - */ | ||
434 | - case "ALTERARTEMA": | ||
435 | - retornaJSON(alteraN3()); | ||
436 | - exit; | ||
437 | - break; | ||
438 | - /* | ||
439 | - Valor: ALTERARRAIZ | ||
440 | - | ||
441 | - Altera o registro de um tema na raiz de um menu ou grupo | ||
442 | - | ||
443 | - Parametros: | ||
444 | - | ||
445 | - publicado - status do tema | ||
446 | - | ||
447 | - perfil | ||
448 | - | ||
449 | - id_tema | ||
450 | - | ||
451 | - id_menu | ||
452 | - | ||
453 | - id - código do nó (id_raiz) | ||
454 | - | ||
455 | - id_nivel | ||
456 | - | ||
457 | - nivel - nível da raiz | ||
458 | - | ||
459 | - Retorno: | ||
460 | - | ||
461 | - {JSON} | ||
462 | - */ | ||
463 | - case "ALTERARRAIZ": | ||
464 | - retornaJSON(alterarRaiz()); | ||
465 | - exit; | ||
466 | - break; | ||
467 | - /* | ||
468 | - Valor: MOVIMENTANO | ||
469 | - | ||
470 | - Muda a ordem de um nó | ||
471 | - | ||
472 | - Parametros: | ||
473 | - | ||
474 | - tipo - tipo de nó grupo|subgrupo|tema|raizgrupo | ||
475 | - | ||
476 | - movimento - sobe|desce | ||
477 | - | ||
478 | - id- id do nó | ||
479 | - | ||
480 | - Retorno: | ||
481 | - | ||
482 | - {JSON} | ||
483 | - */ | ||
484 | - case "MOVIMENTANO": | ||
485 | - movimentaNo(); | ||
486 | - retornaJSON("ok"); | ||
487 | - exit; | ||
488 | - break; | ||
489 | - /* | ||
490 | - Valor: EXCLUIR | ||
491 | - | ||
492 | - Exclui um registro | ||
493 | - | ||
494 | - Parametros: | ||
495 | - | ||
496 | - tabela | ||
497 | - | ||
498 | - coluna | ||
499 | - | ||
500 | - id | ||
501 | - | ||
502 | - Retorno: | ||
503 | - | ||
504 | - {JSON} | ||
505 | - */ | ||
506 | - case "EXCLUIR"; | ||
507 | - if($tabela == "i3geoadmin_raiz") | ||
508 | - { | ||
509 | - $coluna = "id_raiz"; | ||
510 | - } | ||
511 | - if($tabela == "i3geoadmin_n3") | ||
512 | - { | ||
513 | - $coluna = "id_n3"; | ||
514 | - } | ||
515 | - if($tabela == "i3geoadmin_n2") | ||
516 | - { | ||
517 | - $coluna = "id_n2"; | ||
518 | - $f = verificaFilhos(); | ||
519 | - if($f) | ||
520 | - { | ||
521 | - retornaJSON("erro"); | ||
522 | - exit; | ||
523 | - } | ||
524 | - } | ||
525 | - if($tabela == "i3geoadmin_n1") | ||
526 | - { | ||
527 | - $coluna = "id_n1"; | ||
528 | - $f = verificaFilhos(); | ||
529 | - if($f) | ||
530 | - { | ||
531 | - retornaJSON("erro"); | ||
532 | - exit; | ||
533 | - } | ||
534 | - } | ||
535 | - retornaJSON( | ||
536 | - exclui($esquemaadmin.$tabela,$coluna,$id) | ||
537 | - ); | ||
538 | - exit; | ||
539 | - break; | ||
540 | -} | ||
541 | -/* | ||
542 | -Altera o registro de um nível 3 (temas) | ||
543 | -*/ | ||
544 | -function alteraN3(){ | ||
545 | - global $publicado,$id,$id_n2,$id_tema,$ordem,$esquemaadmin; | ||
546 | - $n3_perfil = $_GET["n3_perfil"]; | ||
547 | - try { | ||
548 | - require_once("conexao.php"); | ||
549 | - if($id != ""){ | ||
550 | - $dataCol = array( | ||
551 | - "ordem" => $ordem, | ||
552 | - "publicado" => $publicado, | ||
553 | - "id_tema" => $id_tema, | ||
554 | - "n3_perfil" => $n3_perfil | ||
555 | - ); | ||
556 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_n3",$dataCol,"WHERE id_n3 = $id"); | ||
557 | - $retorna = $id; | ||
558 | - } | ||
559 | - else{ | ||
560 | - $o = $dbh->query("SELECT MAX(ordem) as o FROM ".$esquemaadmin."i3geoadmin_n3 where id_n2 = '$id_n2'"); | ||
561 | - $o = $o->fetchAll(); | ||
562 | - $o = $o[0]['o'] + 1; | ||
563 | - $dataCol = array( | ||
564 | - "id_n2" => $id_n2, | ||
565 | - "publicado" => 'NAO', | ||
566 | - "ordem" => $o, | ||
567 | - "n3_perfil" => '' | ||
568 | - ); | ||
569 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_n3",$dataCol,"n3_perfil","id_n3"); | ||
570 | - } | ||
571 | - $dbhw = null; | ||
572 | - $dbh = null; | ||
573 | - return $retorna; | ||
574 | - } | ||
575 | - catch (PDOException $e){ | ||
576 | - return "Error!: "; | ||
577 | - } | ||
578 | -} | ||
579 | -/* | ||
580 | -Altera o registro de um nível 2 | ||
581 | -*/ | ||
582 | -function alteraN2(){ | ||
583 | - global $publicado,$id,$id_subgrupo,$id_n1,$esquemaadmin; | ||
584 | - $n2_perfil = $_GET["n2_perfil"]; | ||
585 | - try { | ||
586 | - require("conexao.php"); | ||
587 | - if($id != ""){ | ||
588 | - $dataCol = array( | ||
589 | - "publicado" => $publicado, | ||
590 | - "id_subgrupo" => $id_subgrupo, | ||
591 | - "n2_perfil" => $n2_perfil | ||
592 | - ); | ||
593 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_n2",$dataCol,"WHERE id_n2 = $id"); | ||
594 | - $retorna = $id; | ||
595 | - } | ||
596 | - else{ | ||
597 | - $o = $dbh->query("SELECT MAX(ordem) as o FROM ".$esquemaadmin."i3geoadmin_n2 where id_n1 = '$id_n1'"); | ||
598 | - $o = $o->fetchAll(); | ||
599 | - $o = $o[0]['o'] + 1; | ||
600 | - $dataCol = array( | ||
601 | - "id_n1" => $id_n1, | ||
602 | - "publicado" => 'NAO', | ||
603 | - "ordem" => $o, | ||
604 | - "n2_perfil" => '' | ||
605 | - ); | ||
606 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_n2",$dataCol,"n2_perfil","id_n2"); | ||
607 | - } | ||
608 | - $dbhw = null; | ||
609 | - $dbh = null; | ||
610 | - return $retorna; | ||
611 | - } | ||
612 | - catch (PDOException $e){ | ||
613 | - return "Error!: "; | ||
614 | - } | ||
615 | -} | ||
616 | -/* | ||
617 | -Altera o registro de um nível 1 (grupos) | ||
618 | -*/ | ||
619 | -function alteraN1(){ | ||
620 | - global $publicado,$id_grupo,$id,$id_menu,$esquemaadmin; | ||
621 | - $n1_perfil = $_GET["n1_perfil"]; | ||
622 | - try{ | ||
623 | - require("conexao.php"); | ||
624 | - if($id != ""){ | ||
625 | - $dataCol = array( | ||
626 | - "publicado" => $publicado, | ||
627 | - "id_grupo" => $id_grupo, | ||
628 | - "n1_perfil" => $n1_perfil | ||
629 | - ); | ||
630 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_n1",$dataCol,"WHERE id_n1 = $id"); | ||
631 | - $retorna = $id; | ||
632 | - } | ||
633 | - else{ | ||
634 | - $o = $dbh->query("SELECT MAX(ordem) as o FROM ".$esquemaadmin."i3geoadmin_n1 where id_menu = '$id_menu'"); | ||
635 | - $o = $o->fetchAll(); | ||
636 | - $o = $o[0]['o'] + 1; | ||
637 | - $dataCol = array( | ||
638 | - "id_menu" => $id_menu, | ||
639 | - "publicado" => 'NAO', | ||
640 | - "ordem" => $o, | ||
641 | - "n1_perfil" => '' | ||
642 | - ); | ||
643 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_n1",$dataCol,"n1_perfil","id_n1"); | ||
644 | - } | ||
645 | - $dbhw = null; | ||
646 | - $dbh = null; | ||
647 | - return $retorna; | ||
648 | - } | ||
649 | - catch (PDOException $e){ | ||
650 | - return "Error!: "; | ||
651 | - } | ||
652 | -} | ||
653 | -/* | ||
654 | -Altera o registro na raiz de um nível | ||
655 | -*/ | ||
656 | -function alterarRaiz() | ||
657 | -{ | ||
658 | - global $id_nivel,$nivel,$id,$id_menu,$perfil,$id_tema,$esquemaadmin; | ||
659 | - try{ | ||
660 | - include("conexao.php"); | ||
661 | - if($id != ""){ | ||
662 | - $dataCol = array( | ||
663 | - "id_tema" => $id_tema, | ||
664 | - "perfil" => $perfil | ||
665 | - ); | ||
666 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_raiz",$dataCol,"WHERE id_raiz = $id"); | ||
667 | - $retorna = $id; | ||
668 | - } | ||
669 | - else{ | ||
670 | - $o = $dbh->query("SELECT MAX(ordem) as o FROM ".$esquemaadmin."i3geoadmin_raiz where id_menu = '$id_menu' and nivel = '$nivel' and id_nivel = '$id_nivel'"); | ||
671 | - $o = $o->fetchAll(); | ||
672 | - $o = $o[0]['o'] + 1; | ||
673 | - $dataCol = array( | ||
674 | - "id_menu" => $id_menu, | ||
675 | - "id_nivel" => $id_nivel, | ||
676 | - "nivel" => $nivel, | ||
677 | - "ordem" => $o, | ||
678 | - "perfil" => '' | ||
679 | - ); | ||
680 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_raiz",$dataCol,"perfil","id_raiz"); | ||
681 | - } | ||
682 | - $dbhw = null; | ||
683 | - $dbh = null; | ||
684 | - return $retorna; | ||
685 | - } | ||
686 | - catch (PDOException $e) | ||
687 | - { | ||
688 | - return "Error!: "; | ||
689 | - } | ||
690 | -} | ||
691 | -function movimentaNo(){ | ||
692 | - global $tipo,$movimento,$id,$esquemaadmin; | ||
693 | - if($tipo == "raizmenu" || $tipo == "raizgrupo") | ||
694 | - { | ||
695 | - //pega a ordem atual | ||
696 | - $reg = pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_raiz where id_raiz = '$id'"); | ||
697 | - $ordematual = $reg[0]["ordem"]; | ||
698 | - $idmenu = $reg[0]["id_menu"]; | ||
699 | - $nivel = $reg[0]["nivel"]; | ||
700 | - $idnivel = $reg[0]["id_nivel"]; | ||
701 | - $where = "id_menu = '$idmenu' and nivel = '$nivel' and id_nivel = '$idnivel' "; | ||
702 | - $posfixo = "raiz"; | ||
703 | - $tabela = "raiz"; | ||
704 | - } | ||
705 | - | ||
706 | - if($tipo == "grupo") | ||
707 | - { | ||
708 | - //pega a ordem atual | ||
709 | - $reg = pegaDados("SELECT ordem,id_menu from ".$esquemaadmin."i3geoadmin_n1 where id_n1 = '$id'"); | ||
710 | - $ordematual = $reg[0]["ordem"]; | ||
711 | - $idbase = $reg[0]["id_menu"]; | ||
712 | - $colunaBate = "id_menu"; | ||
713 | - $where = "$colunaBate = '$idbase' "; | ||
714 | - $posfixo = "n1"; | ||
715 | - $tabela = "n1"; | ||
716 | - } | ||
717 | - if($tipo == "subgrupo") | ||
718 | - { | ||
719 | - //pega a ordem atual | ||
720 | - $reg = pegaDados("SELECT ordem,id_n1 from ".$esquemaadmin."i3geoadmin_n2 where id_n2 = '$id'"); | ||
721 | - $ordematual = $reg[0]["ordem"]; | ||
722 | - $idbase = $reg[0]["id_n1"]; | ||
723 | - $colunaBate = "id_n1"; | ||
724 | - $where = "$colunaBate = '$idbase' "; | ||
725 | - $posfixo = "n2"; | ||
726 | - $tabela = "n2"; | ||
727 | - } | ||
728 | - if($tipo == "tema") | ||
729 | - { | ||
730 | - //pega a ordem atual | ||
731 | - $reg = pegaDados("SELECT ordem,id_n2 from ".$esquemaadmin."i3geoadmin_n3 where id_n3 = '$id'"); | ||
732 | - $ordematual = $reg[0]["ordem"]; | ||
733 | - $idbase = $reg[0]["id_n2"]; | ||
734 | - $colunaBate = "id_n2"; | ||
735 | - $where = "$colunaBate = '$idbase' "; | ||
736 | - $posfixo = "n3"; | ||
737 | - $tabela = "n3"; | ||
738 | - } | ||
739 | - include("conexao.php"); | ||
740 | - if($movimento == "sobe"){ | ||
741 | - if ($ordematual > 1){ | ||
742 | - $menos = $ordematual - 1; | ||
743 | - $dataCol = array( | ||
744 | - "ordem" => $ordematual | ||
745 | - ); | ||
746 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_".$tabela,$dataCol,"WHERE $where AND ordem = '$menos'"); | ||
747 | - $dataCol = array( | ||
748 | - "ordem" => $menos | ||
749 | - ); | ||
750 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_".$tabela,$dataCol," where id_$posfixo = '$id'"); | ||
751 | - } | ||
752 | - } | ||
753 | - if($movimento == "desce"){ | ||
754 | - $mais = $ordematual + 1; | ||
755 | - $dataCol = array( | ||
756 | - "ordem" => $ordematual | ||
757 | - ); | ||
758 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_".$tabela,$dataCol,"WHERE $where AND ordem = '$mais'"); | ||
759 | - $dataCol = array( | ||
760 | - "ordem" => $mais | ||
761 | - ); | ||
762 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_".$tabela,$dataCol," where id_$posfixo = '$id'"); | ||
763 | - } | ||
764 | - $dbhw = null; | ||
765 | - $dbh = null; | ||
766 | - return "ok"; | ||
767 | -} | ||
768 | -?> | ||
769 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/atlas.php
@@ -1,637 +0,0 @@ | @@ -1,637 +0,0 @@ | ||
1 | -<?php | ||
2 | -/* | ||
3 | - Title: atlas.php | ||
4 | - | ||
5 | -Funções utilizadas pelo editor de Atlas. | ||
6 | - | ||
7 | -É utilizado nas funções em AJAX da interface de edição dos Atlas | ||
8 | - | ||
9 | -Licenca: | ||
10 | - | ||
11 | -GPL2 | ||
12 | - | ||
13 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
14 | - | ||
15 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
16 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
17 | - | ||
18 | -Este programa é software livre; você pode redistribuí-lo | ||
19 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
20 | -GNU conforme publicada pela Free Software Foundation; | ||
21 | - | ||
22 | -Este programa é distribuído na expectativa de que seja útil, | ||
23 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
24 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
25 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
26 | -Você deve ter recebido uma copia da Licença Pública Geral do | ||
27 | - GNU junto com este programa; se não, escreva para a | ||
28 | -Free Software Foundation, Inc., no endereço | ||
29 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
30 | - | ||
31 | -Arquivo: | ||
32 | - | ||
33 | -i3geo/admin/php/atlas.php | ||
34 | - | ||
35 | -Parametros: | ||
36 | - | ||
37 | -O parâmetro principal é "funcao", que define qual operação será executada, por exemplo, atlas.php?funcao=pegaAtlas | ||
38 | - | ||
39 | -Cada operação possuí seus proprios parâmetros, que devem ser enviados também na requisição da operação. | ||
40 | - | ||
41 | -*/ | ||
42 | -include_once(dirname(__FILE__)."/login.php"); | ||
43 | - | ||
44 | -$id = $_GET["id"]; | ||
45 | -$id_atlas = $_GET["id_atlas"]; | ||
46 | -$id_prancha = $_GET["id_prancha"]; | ||
47 | - | ||
48 | -testaSafeNumerico([$id,$id_atlas,$id_prancha]); | ||
49 | - | ||
50 | -$funcoesEdicao = array( | ||
51 | - "ALTERARATLAS", | ||
52 | - "ALTERARPRANCHA", | ||
53 | - "ALTERARTEMA", | ||
54 | - "EXCLUIRATLAS", | ||
55 | - "EXCLUIRPRANCHA", | ||
56 | - "EXCLUIRTEMA" | ||
57 | -); | ||
58 | -if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
59 | - if(verificaOperacaoSessao("admin/html/atlas") == false){ | ||
60 | - retornaJSON("Vc nao pode realizar essa operacao.");exit; | ||
61 | - } | ||
62 | -} | ||
63 | -//faz a busca da função que deve ser executada | ||
64 | -switch (strtoupper($funcao)) | ||
65 | -{ | ||
66 | - /* | ||
67 | - Note: | ||
68 | - | ||
69 | - Valores que o parâmetro &funcao pode receber. Os parâmetros devem ser enviados na requisição em AJAX. | ||
70 | - */ | ||
71 | - /* | ||
72 | - Valor: PEGAATLAS | ||
73 | - | ||
74 | - Lista todos os Atlas | ||
75 | - | ||
76 | - Retorno: | ||
77 | - | ||
78 | - {JSON} | ||
79 | - */ | ||
80 | - case "PEGAATLAS": | ||
81 | - retornaJSON(pegaDados("SELECT id_atlas,titulo_atlas from ".$esquemaadmin."i3geoadmin_atlas order by ordem_atlas")); | ||
82 | - exit; | ||
83 | - break; | ||
84 | - /* | ||
85 | - Valor: PEGAPRANCHAS | ||
86 | - | ||
87 | - Lista de pranchas de um Atlas | ||
88 | - | ||
89 | - Parametros: | ||
90 | - | ||
91 | - id_atlas | ||
92 | - | ||
93 | - Retorno: | ||
94 | - | ||
95 | - {JSON} | ||
96 | - */ | ||
97 | - case "PEGAPRANCHAS": | ||
98 | - retornaJSON(pegaDados("SELECT id_prancha,titulo_prancha from ".$esquemaadmin."i3geoadmin_atlasp where id_atlas='$id_atlas' order by ordem_prancha")); | ||
99 | - exit; | ||
100 | - break; | ||
101 | - /* | ||
102 | - Valor: PEGATEMAS | ||
103 | - | ||
104 | - Lista os temas de uma prancha | ||
105 | - | ||
106 | - Parametros: | ||
107 | - | ||
108 | - id_prancha | ||
109 | - | ||
110 | - Retorno: | ||
111 | - | ||
112 | - {JSON} | ||
113 | - */ | ||
114 | - case "PEGATEMAS": | ||
115 | - retornaJSON(pegaDados("SELECT i3geoadmin_atlast.*,i3geoadmin_temas.nome_tema from ".$esquemaadmin."i3geoadmin_atlast LEFT JOIN ".$esquemaadmin."i3geoadmin_temas ON ( i3geoadmin_atlast.codigo_tema = i3geoadmin_temas.codigo_tema ) where id_prancha = '$id_prancha' order by ordem_tema")); | ||
116 | - exit; | ||
117 | - break; | ||
118 | - /* | ||
119 | - Valor: PEGADADOSATLAS | ||
120 | - | ||
121 | - Lista os dados de um atlas | ||
122 | - | ||
123 | - Parametros: | ||
124 | - | ||
125 | - id_atlas | ||
126 | - | ||
127 | - Retorno: | ||
128 | - | ||
129 | - {JSON} | ||
130 | - */ | ||
131 | - case "PEGADADOSATLAS": | ||
132 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_atlas where id_atlas =".$id_atlas)); | ||
133 | - exit; | ||
134 | - break; | ||
135 | - /* | ||
136 | - Valor: PEGADADOSPRANCHA | ||
137 | - | ||
138 | - Lista os dados de uma prancha | ||
139 | - | ||
140 | - Parametros: | ||
141 | - | ||
142 | - id_prancha | ||
143 | - | ||
144 | - Retorno: | ||
145 | - | ||
146 | - {JSON} | ||
147 | - */ | ||
148 | - case "PEGADADOSPRANCHA": | ||
149 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_atlasp where id_prancha =".$id_prancha)); | ||
150 | - exit; | ||
151 | - break; | ||
152 | - /* | ||
153 | - Valor: PEGADADOSTEMA | ||
154 | - | ||
155 | - Lista os dados de um tema | ||
156 | - | ||
157 | - Parametros: | ||
158 | - | ||
159 | - id_tema | ||
160 | - | ||
161 | - Retorno: | ||
162 | - | ||
163 | - {JSON} | ||
164 | - */ | ||
165 | - case "PEGADADOSTEMA": | ||
166 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_atlast where id_tema = '$id_tema'")); | ||
167 | - exit; | ||
168 | - break; | ||
169 | - /* | ||
170 | - Valor: ALTERARATLAS | ||
171 | - | ||
172 | - Altera os dados de um atlas | ||
173 | - | ||
174 | - Parametros: | ||
175 | - | ||
176 | - publicado_atlas | ||
177 | - | ||
178 | - id_atlas | ||
179 | - | ||
180 | - basemapfile_atlas | ||
181 | - | ||
182 | - desc_atlas | ||
183 | - | ||
184 | - h_atlas | ||
185 | - | ||
186 | - w_atlas | ||
187 | - | ||
188 | - icone_atlas | ||
189 | - | ||
190 | - link_atlas | ||
191 | - | ||
192 | - pranchadefault_atlas | ||
193 | - | ||
194 | - template_atlas | ||
195 | - | ||
196 | - tipoguias_atlas | ||
197 | - | ||
198 | - titulo_atlas | ||
199 | - | ||
200 | - ordem_atlas | ||
201 | - | ||
202 | - Retorno: | ||
203 | - | ||
204 | - {JSON} | ||
205 | - */ | ||
206 | - case "ALTERARATLAS": | ||
207 | - $novo = alterarAtlas(); | ||
208 | - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_atlas WHERE id_atlas = '".$novo."'"; | ||
209 | - retornaJSON(pegaDados($sql)); | ||
210 | - exit; | ||
211 | - break; | ||
212 | - /* | ||
213 | - Valor: ALTERARPRANCHA | ||
214 | - | ||
215 | - Altera os dados de uma prancha | ||
216 | - | ||
217 | - Parametros: | ||
218 | - | ||
219 | - mapext_prancha | ||
220 | - | ||
221 | - id_atlas | ||
222 | - | ||
223 | - id_prancha | ||
224 | - | ||
225 | - desc_prancha | ||
226 | - | ||
227 | - h_prancha | ||
228 | - | ||
229 | - w_prancha | ||
230 | - | ||
231 | - icone_prancha | ||
232 | - | ||
233 | - link_prancha | ||
234 | - | ||
235 | - titulo_prancha | ||
236 | - | ||
237 | - ordem_prancha | ||
238 | - | ||
239 | - Retorno: | ||
240 | - | ||
241 | - {JSON} | ||
242 | - */ | ||
243 | - case "ALTERARPRANCHA": | ||
244 | - $novo = alterarPrancha(); | ||
245 | - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_atlasp WHERE id_prancha = '".$novo."'"; | ||
246 | - retornaJSON(pegaDados($sql)); | ||
247 | - exit; | ||
248 | - break; | ||
249 | - /* | ||
250 | - Valor: ALTERARTEMA | ||
251 | - | ||
252 | - Altera os dados de um tema | ||
253 | - | ||
254 | - Parametros: | ||
255 | - | ||
256 | - id_tema | ||
257 | - | ||
258 | - id_prancha | ||
259 | - | ||
260 | - codigo_tema | ||
261 | - | ||
262 | - ligado_tema | ||
263 | - | ||
264 | - ordem_tema | ||
265 | - | ||
266 | - Retorno: | ||
267 | - | ||
268 | - {JSON} | ||
269 | - */ | ||
270 | - case "ALTERARTEMA": | ||
271 | - $novo = alterarTema(); | ||
272 | - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_atlast WHERE id_tema = '".$novo."'"; | ||
273 | - retornaJSON(pegaDados($sql)); | ||
274 | - break; | ||
275 | - /* | ||
276 | - Valor: EXCLUIRATLAS | ||
277 | - | ||
278 | - Exclui um Atlas | ||
279 | - | ||
280 | - Parametros: | ||
281 | - | ||
282 | - id | ||
283 | - | ||
284 | - Retorno: | ||
285 | - | ||
286 | - {JSON} | ||
287 | - */ | ||
288 | - case "EXCLUIRATLAS": | ||
289 | - $tabela = "i3geoadmin_atlas"; | ||
290 | - $f = verificaFilhos(); | ||
291 | - if(!$f) | ||
292 | - retornaJSON(excluirAtlas()); | ||
293 | - else | ||
294 | - retornaJSON("erro"); | ||
295 | - exit; | ||
296 | - break; | ||
297 | - /* | ||
298 | - Valor: EXCLUIRPRANCHA | ||
299 | - | ||
300 | - Exclui uma prancha | ||
301 | - | ||
302 | - Parametros: | ||
303 | - | ||
304 | - id | ||
305 | - | ||
306 | - Retorno: | ||
307 | - | ||
308 | - {JSON} | ||
309 | - */ | ||
310 | - case "EXCLUIRPRANCHA": | ||
311 | - $tabela = "i3geoadmin_atlasp"; | ||
312 | - $f = verificaFilhos(); | ||
313 | - if(!$f) | ||
314 | - retornaJSON(excluirPrancha()); | ||
315 | - else | ||
316 | - retornaJSON("erro"); | ||
317 | - exit; | ||
318 | - break; | ||
319 | - /* | ||
320 | - Valor: EXCLUIRTEMA | ||
321 | - | ||
322 | - Exclui um tema de uma prancha | ||
323 | - | ||
324 | - Parametros: | ||
325 | - | ||
326 | - id | ||
327 | - | ||
328 | - Retorno: | ||
329 | - | ||
330 | - {JSON} | ||
331 | - */ | ||
332 | - case "EXCLUIRTEMA": | ||
333 | - retornaJSON(excluirTema()); | ||
334 | - exit; | ||
335 | - break; | ||
336 | - /* | ||
337 | - Valor: MOVIMENTANO | ||
338 | - | ||
339 | - Muda a ordem de um n� | ||
340 | - | ||
341 | - Parametros: | ||
342 | - | ||
343 | - tipo - tipo de n� tema|prancha|atlas | ||
344 | - | ||
345 | - movimento - sobe|desce | ||
346 | - | ||
347 | - id- id do n� | ||
348 | - | ||
349 | - Retorno: | ||
350 | - | ||
351 | - {JSON} | ||
352 | - */ | ||
353 | - case "MOVIMENTANO": | ||
354 | - movimentaNo(); | ||
355 | - retornaJSON("ok"); | ||
356 | - exit; | ||
357 | - break; | ||
358 | -} | ||
359 | -function movimentaNo() | ||
360 | -{ | ||
361 | - global $tipo,$movimento,$id,$esquemaadmin; | ||
362 | - if($tipo == "tema") | ||
363 | - { | ||
364 | - //pega a ordem atual | ||
365 | - $reg = pegaDados("SELECT ordem_tema,id_prancha from ".$esquemaadmin."i3geoadmin_atlast where id_tema = '$id'"); | ||
366 | - $ordematual = $reg[0]["ordem_tema"]; | ||
367 | - $prancha = $reg[0]["id_prancha"]; | ||
368 | - $where = " id_prancha = '$prancha' and"; | ||
369 | - $posfixo = "tema"; | ||
370 | - $tabela = "atlast"; | ||
371 | - } | ||
372 | - if($tipo == "prancha") | ||
373 | - { | ||
374 | - //pega a ordem atual | ||
375 | - $reg = pegaDados("SELECT ordem_prancha,id_atlas from ".$esquemaadmin."i3geoadmin_atlasp where id_prancha = '$id'"); | ||
376 | - $ordematual = $reg[0]["ordem_prancha"]; | ||
377 | - $atlas = $reg[0]["id_atlas"]; | ||
378 | - $where = "id_atlas = '$atlas' and "; | ||
379 | - $posfixo = "prancha"; | ||
380 | - $tabela = "atlasp"; | ||
381 | - } | ||
382 | - if($tipo == "atlas") | ||
383 | - { | ||
384 | - //pega a ordem atual | ||
385 | - $ordematual = pegaDados("SELECT ordem_atlas from ".$esquemaadmin."i3geoadmin_atlas where id_atlas = '$id'"); | ||
386 | - $ordematual = $ordematual[0]["ordem_atlas"]; | ||
387 | - $where = ""; | ||
388 | - $posfixo = "atlas"; | ||
389 | - $tabela = "atlas"; | ||
390 | - } | ||
391 | - include("conexao.php"); | ||
392 | - if($movimento == "sobe") | ||
393 | - { | ||
394 | - $menos = $ordematual - 1; | ||
395 | - $dataCol = array( | ||
396 | - "ordem_".$posfixo=>$ordematual | ||
397 | - ); | ||
398 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_".$tabela,$dataCol,"WHERE $where ordem_$posfixo = '$menos'"); | ||
399 | - $dataCol = array( | ||
400 | - "ordem_".$posfixo=>$menos | ||
401 | - ); | ||
402 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_".$tabela,$dataCol,"WHERE $where id_$posfixo = '$id'"); | ||
403 | - } | ||
404 | - if($movimento == "desce") | ||
405 | - { | ||
406 | - $mais = $ordematual + 1; | ||
407 | - $dataCol = array( | ||
408 | - "ordem_".$posfixo=>$ordematual | ||
409 | - ); | ||
410 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_".$tabela,$dataCol,"WHERE $where ordem_$posfixo = '$mais'"); | ||
411 | - $dataCol = array( | ||
412 | - "ordem_".$posfixo=>$mais | ||
413 | - ); | ||
414 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_".$tabela,$dataCol,"WHERE $where id_$posfixo = '$id'"); | ||
415 | - } | ||
416 | - $dbhw = null; | ||
417 | - $dbh = null; | ||
418 | - return "ok"; | ||
419 | -} | ||
420 | -function dadosAtlas() | ||
421 | -{ | ||
422 | - global $id_atlas,$esquemaadmin; | ||
423 | - if($id_atlas == "") | ||
424 | - $sis = pegaDados('SELECT * from '.$esquemaadmin.'i3geoadmin_atlas order by titulo_atlas'); | ||
425 | - else | ||
426 | - $sis = pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_atlas where id_atlas = '$id_atlas' "); | ||
427 | - for($i=0;$i<count($sis);++$i) | ||
428 | - { | ||
429 | - $pranchas = pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_atlasp where id_atlas =".($sis[$i]["id_atlas"])); | ||
430 | - for($j=0;$j<count($pranchas);++$j) | ||
431 | - { | ||
432 | - $temas = pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_atlast where id_prancha =".($pranchas[$j]["id_prancha"])); | ||
433 | - if(count($temas) > 0) | ||
434 | - $pranchas[$j]["temas"] = $temas; | ||
435 | - else | ||
436 | - $pranchas[$j]["temas"] = ""; | ||
437 | - } | ||
438 | - if(count($pranchas) > 0) | ||
439 | - $sis[$i]["pranchas"] = $pranchas; | ||
440 | - else | ||
441 | - $sis[$i]["pranchas"] = ""; | ||
442 | - } | ||
443 | - return $sis; | ||
444 | -} | ||
445 | -function alterarAtlas() | ||
446 | -{ | ||
447 | - global $esquemaadmin,$id_atlas; | ||
448 | - try{ | ||
449 | - include("conexao.php"); | ||
450 | - if($id_atlas != ""){ | ||
451 | - if($convUTF){ | ||
452 | - $_GET["desc_atlas"] = utf8_encode($_GET["desc_atlas"]); | ||
453 | - $_GET["titulo_atlas"] = utf8_encode($_GET["titulo_atlas"]); | ||
454 | - } | ||
455 | - $dataCol = array( | ||
456 | - "publicado_atlas"=>$_GET["publicado_atlas"], | ||
457 | - "ordem_atlas"=>$_GET["ordem_atlas"] == "" ? 0 : $_GET["ordem_atlas"], | ||
458 | - "basemapfile_atlas"=>$_GET["basemapfile_atlas"], | ||
459 | - "desc_atlas"=>$_GET["desc_atlas"], | ||
460 | - "h_atlas"=>$_GET["h_atlas"] == "" ? 0 : $_GET["h_atlas"], | ||
461 | - "w_atlas"=>$_GET["w_atlas"] == "" ? 0 : $_GET["w_atlas"], | ||
462 | - "icone_atlas"=>$_GET["icone_atlas"], | ||
463 | - "link_atlas"=>$_GET["link_atlas"], | ||
464 | - "pranchadefault_atlas"=>$_GET["pranchadefault_atlas"], | ||
465 | - "template_atlas"=>$_GET["template_atlas"], | ||
466 | - "tipoguias_atlas"=>$_GET["tipoguias_atlas"], | ||
467 | - "titulo_atlas"=>$_GET["titulo_atlas"] | ||
468 | - ); | ||
469 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_atlas",$dataCol,"WHERE id_atlas = $id_atlas"); | ||
470 | - $retorna = $id_atlas; | ||
471 | - } | ||
472 | - else{ | ||
473 | - $o = $dbh->query("SELECT MAX(ordem_atlas) as o FROM ".$esquemaadmin."i3geoadmin_atlas"); | ||
474 | - $o = $o->fetchAll(); | ||
475 | - $o = $o[0]['o'] + 1; | ||
476 | - $dataCol = array( | ||
477 | - "publicado_atlas"=>'', | ||
478 | - "basemapfile_atlas"=>'', | ||
479 | - "desc_atlas"=>'', | ||
480 | - "h_atlas"=>null, | ||
481 | - "w_atlas"=>null, | ||
482 | - "icone_atlas"=>'', | ||
483 | - "link_atlas"=>'', | ||
484 | - "pranchadefault_atlas"=>'', | ||
485 | - "template_atlas"=>'', | ||
486 | - "tipoguias_atlas"=>'', | ||
487 | - "ordem_atlas"=>$o, | ||
488 | - "titulo_atlas"=>'' | ||
489 | - ); | ||
490 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_atlas",$dataCol,"titulo_atlas","id_atlas"); | ||
491 | - } | ||
492 | - $dbhw = null; | ||
493 | - $dbh = null; | ||
494 | - return $retorna; | ||
495 | - } | ||
496 | - catch (PDOException $e){ | ||
497 | - return "Error!: "; | ||
498 | - } | ||
499 | -} | ||
500 | -function alterarPrancha() | ||
501 | -{ | ||
502 | - global $esquemaadmin,$id_atlas,$id_prancha; | ||
503 | - | ||
504 | - try{ | ||
505 | - include("conexao.php"); | ||
506 | - if($id_prancha != ""){ | ||
507 | - if($convUTF){ | ||
508 | - $_GET["desc_prancha"] = utf8_encode($_GET["desc_prancha"]); | ||
509 | - $_GET["titulo_prancha"] = utf8_encode($_GET["titulo_prancha"]); | ||
510 | - } | ||
511 | - $dataCol = array( | ||
512 | - "ordem_prancha"=>$_GET["ordem_prancha"], | ||
513 | - "mapext_prancha"=>$_GET["mapext_prancha"], | ||
514 | - "desc_prancha"=>$_GET["desc_prancha"], | ||
515 | - "h_prancha"=>$_GET["h_prancha"] == "" ? 0 : $_GET["h_prancha"], | ||
516 | - "w_prancha"=>$_GET["w_prancha"] == "" ? 0 : $_GET["w_prancha"], | ||
517 | - "icone_prancha"=>$_GET["icone_prancha"], | ||
518 | - "link_prancha"=>$_GET["link_prancha"], | ||
519 | - "titulo_prancha"=>$_GET["titulo_prancha"] | ||
520 | - ); | ||
521 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_atlasp",$dataCol,"WHERE id_prancha = $id_prancha"); | ||
522 | - $retorna = $id_prancha; | ||
523 | - } | ||
524 | - else{ | ||
525 | - $o = $dbh->query("SELECT MAX(ordem_prancha) as o FROM ".$esquemaadmin."i3geoadmin_atlasp WHERE id_atlas = '$id_atlas'"); | ||
526 | - $o = $o->fetchAll(); | ||
527 | - $o = $o[0]['o'] + 1; | ||
528 | - | ||
529 | - $dataCol = array( | ||
530 | - "ordem_prancha"=>$o, | ||
531 | - "mapext_prancha"=>'', | ||
532 | - "desc_prancha"=>'', | ||
533 | - "h_prancha"=>$_GET["h_prancha"] == "" ? 0 : $_GET["h_prancha"], | ||
534 | - "w_prancha"=>$_GET["w_prancha"] == "" ? 0 : $_GET["w_prancha"], | ||
535 | - "icone_prancha"=>'', | ||
536 | - "link_prancha"=>'', | ||
537 | - "titulo_prancha"=>'', | ||
538 | - "id_atlas"=>$id_atlas | ||
539 | - ); | ||
540 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_atlasp",$dataCol,"titulo_prancha","id_prancha"); | ||
541 | - } | ||
542 | - $dbhw = null; | ||
543 | - $dbh = null; | ||
544 | - return $retorna; | ||
545 | - } | ||
546 | - catch (PDOException $e){ | ||
547 | - return "Error!: "; | ||
548 | - } | ||
549 | -} | ||
550 | -function alterarTema(){ | ||
551 | - global $esquemaadmin,$id_tema,$id_prancha; | ||
552 | - try{ | ||
553 | - include("conexao.php"); | ||
554 | - if($id_tema != ""){ | ||
555 | - $dataCol = array( | ||
556 | - "ordem_tema"=>$_GET["ordem_tema"], | ||
557 | - "codigo_tema"=>$_GET["codigo_tema"], | ||
558 | - "ligado_tema"=>$_GET["ligado_tema"] | ||
559 | - ); | ||
560 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_atlast",$dataCol,"WHERE id_tema = $id_tema"); | ||
561 | - $retorna = $id_tema; | ||
562 | - } | ||
563 | - else{ | ||
564 | - $o = $dbh->query("SELECT MAX(ordem_tema) as o FROM ".$esquemaadmin."i3geoadmin_atlast where id_prancha = '$id_prancha'"); | ||
565 | - $o = $o->fetchAll(); | ||
566 | - $o = $o[0]['o'] + 1; | ||
567 | - $dataCol = array( | ||
568 | - "ordem_tema"=>$o, | ||
569 | - "codigo_tema"=>$_GET["codigo_tema"], | ||
570 | - "ligado_tema"=>$_GET["ligado_tema"], | ||
571 | - "id_prancha"=>$id_prancha | ||
572 | - ); | ||
573 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_atlast",$dataCol,"codigo_tema","id_tema"); | ||
574 | - } | ||
575 | - $dbhw = null; | ||
576 | - $dbh = null; | ||
577 | - return $retorna; | ||
578 | - } | ||
579 | - catch (PDOException $e){ | ||
580 | - return "Error!: "; | ||
581 | - } | ||
582 | -} | ||
583 | -function excluirPrancha() | ||
584 | -{ | ||
585 | - global $esquemaadmin,$id; | ||
586 | - try | ||
587 | - { | ||
588 | - include("conexao.php"); | ||
589 | - $sql = "DELETE from ".$esquemaadmin."i3geoadmin_atlasp WHERE id_prancha = $id"; | ||
590 | - $dbhw->query($sql); | ||
591 | - i3GeoAdminInsertLog($dbhw,$sql); | ||
592 | - $dbhw = null; | ||
593 | - $dbh = null; | ||
594 | - return "ok"; | ||
595 | - } | ||
596 | - catch (PDOException $e) | ||
597 | - { | ||
598 | - return "Error!: "; | ||
599 | - } | ||
600 | -} | ||
601 | -function excluirTema() | ||
602 | -{ | ||
603 | - global $esquemaadmin,$id; | ||
604 | - try | ||
605 | - { | ||
606 | - include("conexao.php"); | ||
607 | - $sql = "DELETE from ".$esquemaadmin."i3geoadmin_atlast WHERE id_tema = $id"; | ||
608 | - $dbhw->query($sql); | ||
609 | - i3GeoAdminInsertLog($dbhw,$sql); | ||
610 | - $dbhw = null; | ||
611 | - $dbh = null; | ||
612 | - return "ok"; | ||
613 | - } | ||
614 | - catch (PDOException $e) | ||
615 | - { | ||
616 | - return "Error!: "; | ||
617 | - } | ||
618 | -} | ||
619 | -function excluirAtlas() | ||
620 | -{ | ||
621 | - global $esquemaadmin,$id; | ||
622 | - try | ||
623 | - { | ||
624 | - include("conexao.php"); | ||
625 | - $sql = "DELETE from ".$esquemaadmin."i3geoadmin_atlas WHERE id_atlas = $id"; | ||
626 | - $dbhw->query($sql); | ||
627 | - i3GeoAdminInsertLog($dbhw,$sql); | ||
628 | - $dbhw = null; | ||
629 | - $dbh = null; | ||
630 | - return "ok"; | ||
631 | - } | ||
632 | - catch (PDOException $e) | ||
633 | - { | ||
634 | - return "Error!: "; | ||
635 | - } | ||
636 | -} | ||
637 | -?> | ||
638 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/criabanco.php
@@ -1,332 +0,0 @@ | @@ -1,332 +0,0 @@ | ||
1 | -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | ||
2 | -<html> | ||
3 | -<head> | ||
4 | -<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | ||
5 | -<link rel="stylesheet" type="text/css" href="../html/admin.css"> | ||
6 | -</head> | ||
7 | -<body class="yui-skin-sam fundoPonto"> | ||
8 | - <div class="bordaSuperior"> </div> | ||
9 | - <div class="mascaraPrincipal" id="divGeral" style="text-align: left"> | ||
10 | - Criação do banco de administração<br> <br> | ||
11 | - <?php | ||
12 | - /* | ||
13 | - Title: criabanco.php | ||
14 | - | ||
15 | - Cria um novo banco de dados de administração. | ||
16 | - | ||
17 | - Se vc quiser recriar o banco de dados default, apague o arquivo | ||
18 | - i3geo/admin/admin.db ou faça uma cópia. Depois é só executar esse programa. | ||
19 | - | ||
20 | - Se a configuração do arquivo de conexão foi alterada (veja ms_configura.php), o novo | ||
21 | - banco irá ser criado conforme a nova string de conexão. | ||
22 | - | ||
23 | - Licenca: | ||
24 | - | ||
25 | - GPL2 | ||
26 | - | ||
27 | - i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
28 | - | ||
29 | - Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
30 | - Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
31 | - | ||
32 | - Este programa é software livre; você pode redistribuí-lo | ||
33 | - e/ou modificá-lo sob os termos da Licença Pública Geral | ||
34 | - GNU conforme publicada pela Free Software Foundation; | ||
35 | - | ||
36 | - Este programa é distribuído na expectativa de que seja útil, | ||
37 | - porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
38 | - de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
39 | - Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
40 | - Você deve ter recebido uma cópia da Licença Pública Geral do | ||
41 | - GNU junto com este programa; se não, escreva para a | ||
42 | - Free Software Foundation, Inc., no endereço | ||
43 | - 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
44 | - | ||
45 | - Arquivo: | ||
46 | - | ||
47 | - i3geo/admin/php/criabanco.php | ||
48 | - */ | ||
49 | - $funcao = ""; | ||
50 | - //echo dirname(__FILE__); | ||
51 | - $esquemaadmin = ""; | ||
52 | - include("admin.php"); | ||
53 | - //verifica se o login pode ser realizado | ||
54 | - if(isset($i3geoPermiteLogin) && $i3geoPermiteLogin == false){ | ||
55 | - header ( "HTTP/1.1 403 Login desativado" ); | ||
56 | - exit (); | ||
57 | - } | ||
58 | - //$i3geoPermiteLoginIp vem de ms_configura.php | ||
59 | - if(isset($i3geoPermiteLoginIp)){ | ||
60 | - checaLoginIp($i3geoPermiteLoginIp); | ||
61 | - } | ||
62 | - //error_reporting(0); | ||
63 | - $tabelas = array( | ||
64 | - //tabelas gerais do sistema de administracao | ||
65 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_grupos (desc_grupo TEXT, id_grupo INTEGER PRIMARY KEY, nome_grupo TEXT, it TEXT, es TEXT, en TEXT)", | ||
66 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_sistemasf (abrir_funcao TEXT, h_funcao NUMERIC, id_funcao INTEGER PRIMARY KEY, id_sistema NUMERIC, nome_funcao TEXT, perfil_funcao TEXT, w_funcao NUMERIC)", | ||
67 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_subgrupos (desc_subgrupo TEXT, id_subgrupo INTEGER PRIMARY KEY, nome_subgrupo TEXT, it TEXT, es TEXT, en TEXT)", | ||
68 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_temas (id_tema INTEGER PRIMARY KEY, nacessos INTEGER, kml_tema TEXT, kmz_tema TEXT, ogc_tema TEXT, download_tema TEXT, tags_tema TEXT, tipoa_tema TEXT, link_tema TEXT, desc_tema TEXT, nome_tema TEXT, codigo_tema TEXT, it TEXT, es TEXT, en TEXT)", | ||
69 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_ws (nacessos INTEGER, nacessosok INTEGER, autor_ws TEXT, desc_ws TEXT, id_ws INTEGER PRIMARY KEY, link_ws TEXT, nome_ws TEXT, tipo_ws TEXT)", | ||
70 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_tags (id_tag INTEGER PRIMARY KEY, nome TEXT)", | ||
71 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_perfis (id_perfil INTEGER PRIMARY KEY, perfil TEXT)", | ||
72 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_atlasp (ordem_prancha NUMERIC, desc_prancha TEXT, h_prancha NUMERIC, icone_prancha TEXT, id_atlas NUMERIC, id_prancha INTEGER PRIMARY KEY, link_prancha TEXT, mapext_prancha TEXT, titulo_prancha TEXT, w_prancha NUMERIC)", | ||
73 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_atlast (ordem_tema NUMERIC, codigo_tema TEXT, id_prancha TEXT, id_tema INTEGER PRIMARY KEY, ligado_tema TEXT)", | ||
74 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_menus (publicado_menu TEXT, perfil_menu TEXT, aberto TEXT, desc_menu TEXT, id_menu INTEGER PRIMARY KEY, nome_menu TEXT, it TEXT, es TEXT, en TEXT)", | ||
75 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_mapas (publicado_mapa TEXT, ordem_mapa NUMERIC, perfil_mapa TEXT, ligados_mapa TEXT, temas_mapa TEXT, desc_mapa TEXT, ext_mapa TEXT, id_mapa INTEGER PRIMARY KEY, imagem_mapa TEXT, linkdireto_mapa TEXT, nome_mapa TEXT, outros_mapa TEXT, mapfile TEXT)", | ||
76 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_atlas (publicado_atlas TEXT, ordem_atlas NUMERIC, basemapfile_atlas TEXT, desc_atlas TEXT, h_atlas NUMERIC, icone_atlas TEXT, id_atlas INTEGER PRIMARY KEY, link_atlas TEXT, pranchadefault_atlas TEXT, template_atlas TEXT, tipoguias_atlas TEXT, titulo_atlas TEXT, w_atlas NUMERIC)", | ||
77 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_sistemas (publicado_sistema TEXT, id_sistema INTEGER PRIMARY KEY, nome_sistema TEXT, perfil_sistema TEXT)", | ||
78 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_identifica (publicado_i TEXT, abrir_i TEXT, id_i INTEGER PRIMARY KEY, nome_i TEXT, target_i TEXT)", | ||
79 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_raiz (ordem NUMERIC, id_tema NUMERIC, id_menu NUMERIC, id_nivel NUMERIC, id_raiz INTEGER PRIMARY KEY, nivel NUMERIC, perfil TEXT)", | ||
80 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_n1 (publicado TEXT, ordem NUMERIC, id_menu NUMERIC, id_grupo NUMERIC, id_n1 INTEGER PRIMARY KEY, n1_perfil TEXT)", | ||
81 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_n2 (publicado TEXT, ordem NUMERIC, id_n1 NUMERIC, id_n2 INTEGER PRIMARY KEY, id_subgrupo NUMERIC, n2_perfil TEXT)", | ||
82 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_n3 (publicado TEXT, ordem NUMERIC, id_n2 NUMERIC, id_n3 INTEGER PRIMARY KEY, id_tema NUMERIC, n3_perfil TEXT)", | ||
83 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_comentarios (comentario TEXT, data TEXT, openidnome TEXT, openidimagem TEXT, openidservico TEXT, openidusuario TEXT, openidurl TEXT, id_tema NUMERIC)", | ||
84 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_acessostema (codigo_tema TEXT, nacessos NUMERIC,dia NUMERIC, mes NUMERIC, ano NUMERIC)", | ||
85 | - "CREATE TABLE ".$esquemaadmin."i3geoadmin_log (id_log INTEGER PRIMARY KEY,sql TEXT,serializedata TEXT,usuario TEXT,ip TEXT,timestamp TEXT,outros TEXT)", | ||
86 | - //tabelas do sistema de controle de usuarios | ||
87 | - "CREATE TABLE ".$esquemaadmin."i3geousr_usuarios (ativo NUMERIC, data_cadastro TEXT, email TEXT, id_usuario INTEGER PRIMARY KEY, login TEXT, nome_usuario TEXT, senha TEXT)", | ||
88 | - "CREATE TABLE ".$esquemaadmin."i3geousr_papelusuario (id_papel NUMERIC, id_usuario NUMERIC)", | ||
89 | - "CREATE TABLE ".$esquemaadmin."i3geousr_papeis (descricao TEXT, id_papel INTEGER PRIMARY KEY, nome TEXT)", | ||
90 | - "CREATE TABLE ".$esquemaadmin."i3geousr_operacoes (id_operacao INTEGER PRIMARY KEY, codigo TEXT, descricao TEXT)", | ||
91 | - "CREATE TABLE ".$esquemaadmin."i3geousr_operacoespapeis (id_operacao NUMERIC, id_papel NUMERIC)", | ||
92 | - "CREATE TABLE ".$esquemaadmin."i3geousr_grupousuario (id_usuario NUMERIC, id_grupo NUMERIC)", | ||
93 | - "CREATE TABLE ".$esquemaadmin."i3geousr_grupotema (id_grupo NUMERIC, id_tema NUMERIC)", | ||
94 | - "CREATE TABLE ".$esquemaadmin."i3geousr_grupos (id_grupo INTEGER PRIMARY KEY, nome TEXT, descricao TEXT)", | ||
95 | - //tabelas do sistema metaestat | ||
96 | - "create table ".$esquemaadmin."i3geoestat_conexao (codigo_estat_conexao INTEGER PRIMARY KEY,bancodedados text,host text,porta text,usuario text,senha text)", | ||
97 | - "create table ".$esquemaadmin."i3geoestat_tipo_regiao(codigo_tipo_regiao INTEGER PRIMARY KEY,nome_tipo_regiao text,descricao_tipo_regiao text,codigo_estat_conexao integer,esquemadb text,tabela text,colunageo text,data text,identificador text,colunanomeregiao text,srid text,colunacentroide text, colunasvisiveis text, apelidos text)", | ||
98 | - "create table ".$esquemaadmin."i3geoestat_agregaregiao(id_agregaregiao INTEGER PRIMARY KEY,codigo_tipo_regiao integer,codigo_tipo_regiao_pai integer,colunaligacao_regiaopai text)", | ||
99 | - "create table ".$esquemaadmin."i3geoestat_tipo_periodo(codigo_tipo_periodo INTEGER PRIMARY KEY,nome text,descricao text)", | ||
100 | - "create table ".$esquemaadmin."i3geoestat_unidade_medida(codigo_unidade_medida INTEGER PRIMARY KEY,nome text,sigla text,permitesoma integer default 0,permitemedia integer default 0)", | ||
101 | - "create table ".$esquemaadmin."i3geoestat_variavel(codigo_variavel INTEGER PRIMARY KEY,nome text,descricao text)", | ||
102 | - "create table ".$esquemaadmin."i3geoestat_medida_variavel(id_medida_variavel INTEGER PRIMARY KEY,codigo_unidade_medida integer,codigo_tipo_periodo integer,codigo_variavel integer,codigo_tipo_regiao integer,codigo_estat_conexao integer,esquemadb text,tabela text,colunavalor text,colunaidgeo text,filtro text,nomemedida text,colunaidunico text)", | ||
103 | - "create table ".$esquemaadmin."i3geoestat_classificacao(id_classificacao INTEGER PRIMARY KEY,nome text,id_medida_variavel integer,observacao text)", | ||
104 | - "create table ".$esquemaadmin."i3geoestat_classes(id_classe INTEGER PRIMARY KEY,expressao text,titulo text,vermelho text,verde text,azul text,id_classificacao integer,tamanho text,simbolo text,overmelho text,overde text,oazul text,otamanho text)", | ||
105 | - "create table ".$esquemaadmin."i3geoestat_fonteinfo(id_fonteinfo INTEGER PRIMARY KEY,titulo text unique,link text)", | ||
106 | - "create table ".$esquemaadmin."i3geoestat_fonteinfo_medida(id_medida_variavel integer not null,id_fonteinfo integer not null)", | ||
107 | - "create table ".$esquemaadmin."i3geoestat_medida_variavel_link(link text,id_medida_variavel integer,nome text,id_link INTEGER PRIMARY KEY)", | ||
108 | - "create table ".$esquemaadmin."i3geoestat_parametro_medida(id_parametro_medida INTEGER PRIMARY KEY,coluna text,nome text,descricao text,id_pai integer default 0,id_medida_variavel integer, tipo integer default 0)", | ||
109 | - "create table ".$esquemaadmin."i3geoestat_mapa(id_mapa INTEGER PRIMARY KEY,titulo text,template text,logoesquerdo text,logodireito text,publicado integer)", | ||
110 | - "create table ".$esquemaadmin."i3geoestat_mapa_grupo(id_mapa_grupo INTEGER PRIMARY KEY,id_mapa integer,titulo text)", | ||
111 | - "create table ".$esquemaadmin."i3geoestat_mapa_tema (id_mapa_tema INTEGER PRIMARY KEY,id_mapa_grupo integer,titulo text,id_medida_variavel integer)" | ||
112 | - ); | ||
113 | - //valida o usuario e aplica | ||
114 | - $exts = get_loaded_extensions(); | ||
115 | - | ||
116 | - if(empty($_POST["senha"]) || empty($_POST["usuario"])){ | ||
117 | - criabancoformularioLoginMaster("criabanco.php"); | ||
118 | - echo "<br><br><input type=checkbox name=mostraSoSQL /> Mostra apenas o SQL"; | ||
119 | - exit; | ||
120 | - } | ||
121 | - else{ | ||
122 | - $continua = verificaMaster($_POST["usuario"],$_POST["senha"],$i3geomaster); | ||
123 | - if($continua == false){ | ||
124 | - echo "Usuário não registrado em i3geo/ms_configura.php na variável i3geomaster"; | ||
125 | - exit; | ||
126 | - } | ||
127 | - } | ||
128 | - if($conexaoadmin == ""){ | ||
129 | - if($_POST["mostraSoSQL"] != "on"){ | ||
130 | - if(file_exists("../admin.db")) { | ||
131 | - echo "<br>Arquivo admin/admin.db ja existe. Vc deve apagá-lo para poder criá-lo novamente caso precise"; | ||
132 | - } | ||
133 | - else{ | ||
134 | - //TODO verificar ao fechar versao - caso tenha havido alteracoes no banco, gerar banco vazio | ||
135 | - copy("../admin_vazio.db","../admin.db"); | ||
136 | - chmod("../admin.db",0777); | ||
137 | - if(file_exists("../admin.db")){ | ||
138 | - echo "Banco copiado ../admin.db !!!"; | ||
139 | - $dbhw = new PDO('sqlite:../admin.db'); | ||
140 | - } | ||
141 | - else{ | ||
142 | - echo "erro"; | ||
143 | - } | ||
144 | - } | ||
145 | - } | ||
146 | - else{ | ||
147 | - $dbhw = new PDO('sqlite:../admin.db'); | ||
148 | - } | ||
149 | - } | ||
150 | - else{ | ||
151 | - include($conexaoadmin); | ||
152 | - } | ||
153 | - if(empty($dbhw)){ | ||
154 | - echo "<br>Conexao com o banco nao estabelecida";exit; | ||
155 | - } | ||
156 | - $drivename = $dbhw->getAttribute(PDO::ATTR_DRIVER_NAME); | ||
157 | - if($_POST["mostraSoSQL"] != "on"){ | ||
158 | - foreach($tabelas as $tabela){ | ||
159 | - if($drivename == "pgsql"){ | ||
160 | - $tabela = str_replace("INTEGER PRIMARY KEY","SERIAL PRIMARY KEY NOT NULL",$tabela); | ||
161 | - } | ||
162 | - $q = $dbhw->query($tabela); | ||
163 | - } | ||
164 | - } | ||
165 | - echo "Tabelas:<br><br>"; | ||
166 | - foreach($tabelas as $tabela){ | ||
167 | - if($drivename == "pgsql"){ | ||
168 | - $tabela = str_replace("INTEGER PRIMARY KEY","SERIAL PRIMARY KEY NOT NULL",$tabela); | ||
169 | - } | ||
170 | - echo $tabela.";<br>"; | ||
171 | - } | ||
172 | - echo "<br><br>Inserindo os registros default<br><br>"; | ||
173 | - if($_POST["mostraSoSQL"] != "on"){ | ||
174 | - $teste = lista("select * from ".$esquemaadmin."i3geousr_papeis","id_papel"); | ||
175 | - } | ||
176 | - else{ | ||
177 | - $teste = array(); | ||
178 | - } | ||
179 | - $sql = array(); | ||
180 | - | ||
181 | - | ||
182 | - if(!in_array(1,$teste) || $_POST["mostraSoSQL"] == "on") | ||
183 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem executar qualquer tarefa, inclusive cadastrar novos administradores',1,'admin')"; | ||
184 | - | ||
185 | - if(!in_array(2,$teste) || $_POST["mostraSoSQL"] == "on") | ||
186 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem criar/editar qualquer tema (mapfile) mas nao podem editar a arvore do catalogo de temas',2,'editores')"; | ||
187 | - if(!in_array(3,$teste) || $_POST["mostraSoSQL"] == "on") | ||
188 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem alterar a arvore do catalogo e dos atlas',3,'publicadores')"; | ||
189 | - if(!in_array(4,$teste) || $_POST["mostraSoSQL"] == "on") | ||
190 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem editar dados geograficos',4,'editoresgeo')"; | ||
191 | - if(!in_array(5,$teste) || $_POST["mostraSoSQL"] == "on") | ||
192 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES ('Podem administrar o sistema METAESTAT','5', 'adminmetaestat')"; | ||
193 | - | ||
194 | - if($_POST["mostraSoSQL"] != "on"){ | ||
195 | - $teste = lista("select * from ".$esquemaadmin."i3geousr_usuarios","id_usuario"); | ||
196 | - } | ||
197 | - else{ | ||
198 | - $teste = array(); | ||
199 | - } | ||
200 | - | ||
201 | - if(!in_array(1,$teste) || $_POST["mostraSoSQL"] == "on") | ||
202 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_usuarios VALUES(1,'','',0,'admingeral','admingeral','admingeral')"; | ||
203 | - | ||
204 | - if($_POST["mostraSoSQL"] != "on"){ | ||
205 | - $teste = lista("select * from ".$esquemaadmin."i3geousr_papelusuario","id_usuario","id_papel"); | ||
206 | - } | ||
207 | - else{ | ||
208 | - $teste = array(); | ||
209 | - } | ||
210 | - if(!in_array("1-1",$teste) || $_POST["mostraSoSQL"] == "on") | ||
211 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papelusuario VALUES(1,1)"; | ||
212 | - | ||
213 | - if($_POST["mostraSoSQL"] != "on"){ | ||
214 | - $teste = lista("select * from ".$esquemaadmin."i3geousr_operacoes","id_operacao"); | ||
215 | - } | ||
216 | - else{ | ||
217 | - $teste = array(); | ||
218 | - } | ||
219 | - | ||
220 | - if(!in_array(1,$teste) || $_POST["mostraSoSQL"] == "on") | ||
221 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(1,'admin/html/editormapfile','editor de mapfiles do sistema de administracao')"; | ||
222 | - if(!in_array(2,$teste) || $_POST["mostraSoSQL"] == "on") | ||
223 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(2,'admin/html/operacoes','abre o editor de operacoes')"; | ||
224 | - if(!in_array(3,$teste)) | ||
225 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(3,'teste/','teste')"; | ||
226 | - if(!in_array(4,$teste) || $_POST["mostraSoSQL"] == "on") | ||
227 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(4,'admin/html/arvore','edicao da arvore do catalogo de temas')"; | ||
228 | - if(!in_array(5,$teste) || $_POST["mostraSoSQL"] == "on") | ||
229 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(5,'admin/html/menus','edicao da lista de menus')"; | ||
230 | - if(!in_array(6,$teste) || $_POST["mostraSoSQL"] == "on") | ||
231 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(6,'admin/html/ogcws','edicao das preferencias do servico WMS')"; | ||
232 | - if(!in_array(7,$teste) || $_POST["mostraSoSQL"] == "on") | ||
233 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(7,'admin/html/atlas','edicao de atlas')"; | ||
234 | - if(!in_array(8,$teste) || $_POST["mostraSoSQL"] == "on") | ||
235 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(8,'admin/html/identifica','lista de sistemas incluidos na ferramenta de identificacao')"; | ||
236 | - if(!in_array(9,$teste) || $_POST["mostraSoSQL"] == "on") | ||
237 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(9,'admin/html/incluimap','adapta mapfiles antigos para versoes novas do Mapserver')"; | ||
238 | - if(!in_array(10,$teste) || $_POST["mostraSoSQL"] == "on") | ||
239 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(10,'admin/html/mapas','lista de links para mapas')"; | ||
240 | - if(!in_array(11,$teste) || $_POST["mostraSoSQL"] == "on") | ||
241 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(11,'admin/html/perfis','lista controlada de perfis')"; | ||
242 | - if(!in_array(12,$teste) || $_POST["mostraSoSQL"] == "on") | ||
243 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(12,'admin/html/sistemas','lista de sistemas complementares que sao mostrados no catalogo')"; | ||
244 | - if(!in_array(13,$teste) || $_POST["mostraSoSQL"] == "on") | ||
245 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(13,'admin/html/subirshapefile','upload de shapefile para uma pasta especifica no servidor')"; | ||
246 | - if(!in_array(14,$teste)) | ||
247 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(14,'admin/html/tags','edicao da lista controlada de tags')"; | ||
248 | - if(!in_array(15,$teste) || $_POST["mostraSoSQL"] == "on") | ||
249 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(15,'admin/html/webservices','cadastro de links para webservices')"; | ||
250 | - if(!in_array(16,$teste)) | ||
251 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(16,'admin/php/editortexto','editor de texto para mapfiles')"; | ||
252 | - if(!in_array(17,$teste) || $_POST["mostraSoSQL"] == "on") | ||
253 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('17', 'admin/html/usuarios', 'cadastro de usuarios')"; | ||
254 | - if(!in_array(18,$teste) || $_POST["mostraSoSQL"] == "on") | ||
255 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('18', 'admin/metaestat/geral', 'permite edicoes mais comuns do sistema de metadados estatisticos')"; | ||
256 | - if(!in_array(19,$teste) || $_POST["mostraSoSQL"] == "on") | ||
257 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('19', 'admin/metaestat/editorbanco', 'permite gerenciar as tabelas do banco')"; | ||
258 | - | ||
259 | - if($_POST["mostraSoSQL"] != "on"){ | ||
260 | - $teste = lista("select * from ".$esquemaadmin."i3geousr_operacoespapeis","id_operacao","id_papel"); | ||
261 | - } | ||
262 | - else{ | ||
263 | - $teste = array(); | ||
264 | - } | ||
265 | - if(!in_array('1-2',$teste) || $_POST["mostraSoSQL"] == "on") | ||
266 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(1,2)"; | ||
267 | - if(!in_array('1-3',$teste) || $_POST["mostraSoSQL"] == "on") | ||
268 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(1,3)"; | ||
269 | - if(!in_array('4-3',$teste) || $_POST["mostraSoSQL"] == "on") | ||
270 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(4,3)"; | ||
271 | - if(!in_array('5-3',$teste) || $_POST["mostraSoSQL"] == "on") | ||
272 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(5,3)"; | ||
273 | - if(!in_array('7-3',$teste) || $_POST["mostraSoSQL"] == "on") | ||
274 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(7,3)"; | ||
275 | - if(!in_array('10-3',$teste) || $_POST["mostraSoSQL"] == "on") | ||
276 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(10,3)"; | ||
277 | - if(!in_array('13-2',$teste) || $_POST["mostraSoSQL"] == "on") | ||
278 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(13,2)"; | ||
279 | - if(!in_array('13-4',$teste) || $_POST["mostraSoSQL"] == "on") | ||
280 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(13,4)"; | ||
281 | - if(!in_array('15-3',$teste) || $_POST["mostraSoSQL"] == "on") | ||
282 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(15,3)"; | ||
283 | - if(!in_array('16-2',$teste) || $_POST["mostraSoSQL"] == "on") | ||
284 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(16,2)"; | ||
285 | - if(!in_array('18-1',$teste) || $_POST["mostraSoSQL"] == "on") | ||
286 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(18,1)"; | ||
287 | - if(!in_array('18-5',$teste) || $_POST["mostraSoSQL"] == "on") | ||
288 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES (18,5)"; | ||
289 | - | ||
290 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('1', 'Anual', '')"; | ||
291 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('2', 'Mensal', '')"; | ||
292 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('3', 'Diário', '')"; | ||
293 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('4', 'Horário', '')"; | ||
294 | - | ||
295 | - | ||
296 | - | ||
297 | - echo "<br>Inserts:<br><br>"; | ||
298 | - foreach($sql as $s){ | ||
299 | - if($_POST["mostraSoSQL"] != "on"){ | ||
300 | - $dbhw->query($s); | ||
301 | - } | ||
302 | - echo $s.";<br>"; | ||
303 | - } | ||
304 | - | ||
305 | - echo "<br>Feito!"; | ||
306 | - | ||
307 | - | ||
308 | - function criabancoformularioLoginMaster($action){ | ||
309 | - echo "<form method=post action=$action >"; | ||
310 | - echo "<br>Essa conexão pode não ser segura e os dados de usuário/senha podem ser descobertos<br><br>"; | ||
311 | - echo "Nome do usuário master cadastrado em ms_configura.php:<br> <input type=text name=usuario /><br>"; | ||
312 | - echo "Senha:<br> <input type=password name=senha /><br>"; | ||
313 | - echo "<input type=submit />"; | ||
314 | - } | ||
315 | - function lista($sql,$coluna,$coluna1=""){ | ||
316 | - global $dbh; | ||
317 | - $lista = array(); | ||
318 | - $q = $dbh->query($sql,PDO::FETCH_ASSOC); | ||
319 | - if($q) | ||
320 | - { | ||
321 | - $resultado = $q->fetchAll(); | ||
322 | - foreach($resultado as $r){ | ||
323 | - if($coluna1 == "") | ||
324 | - $lista[] = $r[$coluna]; | ||
325 | - else | ||
326 | - $lista[] = $r[$coluna]."-".$r[$coluna1]; | ||
327 | - } | ||
328 | - } | ||
329 | - return $lista; | ||
330 | - } | ||
331 | - ?> | ||
332 | - </div> | ||
333 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/editortexto.php
@@ -1,376 +0,0 @@ | @@ -1,376 +0,0 @@ | ||
1 | -<?php | ||
2 | -// TODO incluir autocomplete no editor (eh possivel?) | ||
3 | -// TODO incluir a lista de itens que podem ser usados em METADATA | ||
4 | -?> | ||
5 | -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | ||
6 | -<html> | ||
7 | -<head> | ||
8 | -<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> | ||
9 | -<title>Editor texto</title> | ||
10 | - | ||
11 | -<script src="../../pacotes/codemirror/lib/codemirror.js"></script> | ||
12 | -<script src="../../pacotes/codemirror/mode/scribe/scribe.js"></script> | ||
13 | -<link rel=stylesheet href="../../pacotes/codemirror/doc/docs.css"> | ||
14 | -<link rel="stylesheet" href="../../pacotes/codemirror/lib/codemirror.css"> | ||
15 | -<link rel="stylesheet" href="../../pacotes/codemirror/theme/ambiance.css"> | ||
16 | -<link rel="stylesheet" href="../../pacotes/codemirror/theme/cobalt.css"> | ||
17 | -<link rel="stylesheet" href="../../pacotes/codemirror/theme/night.css"> | ||
18 | -<link rel="stylesheet" href="../../pacotes/codemirror/theme/neo.css"> | ||
19 | -<link rel="stylesheet" href="../../pacotes/codemirror/theme/elegant.css"> | ||
20 | -<link rel="stylesheet" type="text/css" href="../html/admin.css"> | ||
21 | -<style type="text/css"> | ||
22 | -body { | ||
23 | - margin-left: 10px; | ||
24 | - font-size: 14px; | ||
25 | - margin: auto; | ||
26 | - background: white; | ||
27 | - min-width: 1000px; | ||
28 | -} | ||
29 | - | ||
30 | -.CodeMirror { | ||
31 | - height: 600px; | ||
32 | - float: left; | ||
33 | - width: 100%; | ||
34 | -} | ||
35 | - | ||
36 | -#selectComboMapfile { | ||
37 | - width: 100%; | ||
38 | - text-overflow: ellipsis; | ||
39 | - font-size: 14px; | ||
40 | -} | ||
41 | - | ||
42 | -.cm-s-elegant span.cm-builtin { | ||
43 | - color: red; | ||
44 | -} | ||
45 | - | ||
46 | -.cm-s-elegant span.cm-keyword.cm-block { | ||
47 | - color: blue; | ||
48 | -} | ||
49 | -</style> | ||
50 | -</head> | ||
51 | -<body class=" yui-skin-sam "> | ||
52 | - <div class="" id="divGeral" style="width: 100%;"> | ||
53 | - <div id=cabecalhoPrincipal style="min-height: 85px;"></div> | ||
54 | - <form onsubmit="atualizaTextArea()" action="editortexto.php?mapfile=<?php echo $_GET["mapfile"];?>" method=post> | ||
55 | - <fieldset style="position: relative; float: left; width: 48%; padding: 5px;"> | ||
56 | - <legend>Editor</legend> | ||
57 | - <input type=submit value="Salvar" /> <input type=button value="Testar" onclick="testar()" /> <input type=button value="Testar no i3Geo" onclick="abrirI3geo()" /> <input type=button value="Tabela" onclick="abrirTabela()" /> (Salve antes de testar) Mais detalhes sobre a edição de | ||
58 | - mapfiles: <a href="http://mapserver.org/mapfile/index.html#mapfile" target="_new">Documentação do Mapserver</a> <br> <br> | ||
59 | - | ||
60 | - <?php | ||
61 | - // evita erros removendo caracteres PHP | ||
62 | - if (isset ( $_POST ["texto"] )) { | ||
63 | - $gravarTexto = $_POST ["texto"]; | ||
64 | - $_POST ["texto"] = ""; | ||
65 | - } | ||
66 | - include_once (dirname ( __FILE__ ) . "/login.php"); | ||
67 | - $versao = versao (); | ||
68 | - $versao = $versao ["principal"]; | ||
69 | - // pega a extensao geografica | ||
70 | - if (isset ( $base ) && $base != "") { | ||
71 | - if (file_exists ( $base )) { | ||
72 | - $f = $base; | ||
73 | - } else { | ||
74 | - $f = $locaplic . "/aplicmap/" . $base . ".map"; | ||
75 | - } | ||
76 | - } else { | ||
77 | - $f = ""; | ||
78 | - if (strtoupper ( substr ( PHP_OS, 0, 3 ) == 'WIN' )) { | ||
79 | - $f = $locaplic . "/aplicmap/geral1windowsv" . $versao . ".map"; | ||
80 | - } else { | ||
81 | - if ($f == "" && file_exists ( '/var/www/i3geo/aplicmap/geral1debianv' . $versao . '.map' )) { | ||
82 | - $f = "/var/www/i3geo/aplicmap/geral1debianv" . $versao . ".map"; | ||
83 | - } | ||
84 | - if ($f == "" && file_exists ( '/var/www/html/i3geo/aplicmap/geral1fedorav' . $versao . '.map' )) { | ||
85 | - $f = "/var/www/html/i3geo/aplicmap/geral1fedorav" . $versao . ".map"; | ||
86 | - } | ||
87 | - if ($f == "" && file_exists ( '/opt/www/html/i3geo/aplicmap/geral1fedorav' . $versao . '.map' )) { | ||
88 | - $f = "/opt/www/html/i3geo/aplicmap/geral1v" . $versao . ".map"; | ||
89 | - } | ||
90 | - if ($f == "") { | ||
91 | - $f = $locaplic . "/aplicmap/geral1v" . $versao . ".map"; | ||
92 | - } | ||
93 | - } | ||
94 | - } | ||
95 | - if (@ms_newMapObj ( $f )) { | ||
96 | - $mapa = ms_newMapObj ( $f ); | ||
97 | - $c = $mapa->extent; | ||
98 | - $extensao = $c->minx . "," . $c->miny . "," . $c->maxx . "," . $c->maxy; | ||
99 | - } | ||
100 | - | ||
101 | - if (verificaOperacaoSessao ( "admin/php/editortexto" ) == false) { | ||
102 | - echo "Vc nao pode realizar essa operacao."; | ||
103 | - exit (); | ||
104 | - } | ||
105 | - //error_reporting ( 0 ); | ||
106 | - $mapfile = $locaplic . "/temas/" . $_GET ["mapfile"] . ".map"; | ||
107 | - if (! file_exists ( $mapfile )) { | ||
108 | - echo "Arquivo $mapfile não existe."; | ||
109 | - exit (); | ||
110 | - } | ||
111 | - // remove o cache OGC | ||
112 | - $agora = intval ( time () / 1000 ); | ||
113 | - $nomeMapfileTmp = $dir_tmp . "/ogc_" . md5 ( $mapfile ) . "_" . $agora . ".map"; | ||
114 | - $nomeMapfileTmp = str_replace ( ",", "", $nomeMapfileTmp ); | ||
115 | - $nomeMapfileTmp = str_replace ( " ", "", $nomeMapfileTmp ); | ||
116 | - chmod ( $nomeMapfileTmp, 0777 ); | ||
117 | - unlink ( $nomeMapfileTmp ); | ||
118 | - // | ||
119 | - if ($_POST ["tipo"] == "gravar") { | ||
120 | - $fp = fopen ( $mapfile, "w" ); | ||
121 | - if ($fp == false) { | ||
122 | - echo "<span style=color:red <b>Não foi possível salvar o arquivo. Verifique as permissões ou se há algum erro no mapfile</b></span><br><br>"; | ||
123 | - } else { | ||
124 | - // remove itens vazios | ||
125 | - $novoTexto = array (); | ||
126 | - $testar = array ( | ||
127 | - "TEMPORIZADOR", | ||
128 | - "PALLETESTEP", | ||
129 | - "LTEMPOITEMIMAGEM", | ||
130 | - "METAESTAT_ID_MEDIDA_VARIAVEL", | ||
131 | - "GMOPACITY", | ||
132 | - "GMSTATUS", | ||
133 | - "ICONETEMA", | ||
134 | - "LTEMPOITEMTITULO", | ||
135 | - "DESCRIPTION_TEMPLATE", | ||
136 | - "LTEMPOITEMLINK", | ||
137 | - "TILES", | ||
138 | - "METAESTAT_CODIGO_TIPO_REGIAO", | ||
139 | - "ARQUIVOTEMAORIGINAL", | ||
140 | - "PALLETEFILE", | ||
141 | - "NOMEORIGINAL", | ||
142 | - "OLSTATUS", | ||
143 | - "PERMITEDOWNLOAD", | ||
144 | - "LTEMPOFORMATODATA", | ||
145 | - "FILTROORIGINAL", | ||
146 | - "PERMITECOMENTARIO", | ||
147 | - "LTEMPOITEMICONE", | ||
148 | - "DATAORIGINAL", | ||
149 | - "PLUGINI3GEO", | ||
150 | - "METAESTAT", | ||
151 | - "ITEMBUSCARAPIDA", | ||
152 | - "ARQUIVODOWNLOAD", | ||
153 | - "ARQUIVOKMZ", | ||
154 | - "PERMITEKML", | ||
155 | - "PERMITEOGC", | ||
156 | - "CONVCARACTER", | ||
157 | - "CORTEPIXELS", | ||
158 | - "EDITORSQL", | ||
159 | - "LTEMPOCONVENCODE", | ||
160 | - "LTEMPOITEMFIM", | ||
161 | - "OLOPACITY", | ||
162 | - "LEGENDAWMS", | ||
163 | - "LEGENDAIMG", | ||
164 | - "KEYIMAGE", | ||
165 | - "TILEINDEX", | ||
166 | - "TILEITEM", | ||
167 | - "SYMBOL", | ||
168 | - "LABELITEM", | ||
169 | - "FILTERITEM", | ||
170 | - "GROUP", | ||
171 | - "ENCODING", | ||
172 | - "TIP", | ||
173 | - "CLASSE", | ||
174 | - "ITENSDESC", | ||
175 | - "CLASSESNOME", | ||
176 | - "ITENSLINK", | ||
177 | - "ESCALA", | ||
178 | - "CLASSESSIMBOLO", | ||
179 | - "MENSAGEM", | ||
180 | - "EXTENSAO", | ||
181 | - "CLASSESITEM", | ||
182 | - "ESCONDIDO", | ||
183 | - "CLASSESCOR", | ||
184 | - "DOWNLOAD", | ||
185 | - "CLASSESTAMANHO", | ||
186 | - "ITENS", | ||
187 | - "TEMA", | ||
188 | - "APLICAEXTENSAO", | ||
189 | - "IDENTIFICA", | ||
190 | - "TRANSITIONEFFECT" | ||
191 | - ); | ||
192 | - foreach ( preg_split ( '~[\r\n]+~', $gravarTexto ) as $line ) { | ||
193 | - $teste = strtoupper ( $line ); | ||
194 | - $teste = trim ( $teste ); | ||
195 | - $teste = str_replace ( array ( | ||
196 | - " ", | ||
197 | - "'", | ||
198 | - '"' | ||
199 | - ), "", $teste ); | ||
200 | - $teste = preg_replace ( '/[\n\r\t ]*/', '', $teste ); | ||
201 | - $passou = true; | ||
202 | - foreach ( $testar as $t ) { | ||
203 | - if ($teste == $t) { | ||
204 | - $passou = false; | ||
205 | - } | ||
206 | - } | ||
207 | - if ($passou == true) { | ||
208 | - $novoTexto [] = $line; | ||
209 | - } | ||
210 | - } | ||
211 | - fwrite ( $fp, implode ( "\r\n", $novoTexto ) ); | ||
212 | - } | ||
213 | - fclose ( $fp ); | ||
214 | - // verifica os metadata que sao armazenados tambem no banco de dados de administracao | ||
215 | - // isso e necessario para manter a consistencia caso o usuario altere manualmente os valores | ||
216 | - | ||
217 | - // cria o objeto map | ||
218 | - $mapa = ms_newMapObj ( $mapfile ); | ||
219 | - $codigo_tema = $_GET ["mapfile"]; | ||
220 | - $layer = $mapa->getlayerbyname ( $codigo_tema ); | ||
221 | - if ($layer == "") { | ||
222 | - echo "<br><span style='color:red;'>Atenção: não existe nenhum LAYER com NAME igual a " . $codigo_tema . "</span><br>"; | ||
223 | - } else { | ||
224 | - include ("conexao.php"); | ||
225 | - // pega o metadata | ||
226 | - $meta = $layer->getmetadata ( "permitedownload" ); | ||
227 | - $meta = strtoupper ( $meta ); | ||
228 | - if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) { | ||
229 | - // grava no banco | ||
230 | - $dbhw->query ( "UPDATE " . $esquemaadmin . "i3geoadmin_temas SET download_tema='$meta' WHERE codigo_tema = '$codigo_tema'" ); | ||
231 | - } | ||
232 | - $meta = $layer->getmetadata ( "permiteogc" ); | ||
233 | - $meta = strtoupper ( $meta ); | ||
234 | - if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) { | ||
235 | - $dbhw->query ( "UPDATE " . $esquemaadmin . "i3geoadmin_temas SET ogc_tema='$meta' WHERE codigo_tema = '$codigo_tema'" ); | ||
236 | - } | ||
237 | - $meta = $layer->getmetadata ( "permitekml" ); | ||
238 | - $meta = strtoupper ( $meta ); | ||
239 | - if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) { | ||
240 | - $dbhw->query ( "UPDATE " . $esquemaadmin . "i3geoadmin_temas SET kml_tema='$meta' WHERE codigo_tema = '$codigo_tema'" ); | ||
241 | - } | ||
242 | - $meta = $layer->getmetadata ( "permitekmz" ); | ||
243 | - $meta = strtoupper ( $meta ); | ||
244 | - if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) { | ||
245 | - $dbhw->query ( "UPDATE " . $esquemaadmin . "i3geoadmin_temas SET kmz_tema='$meta' WHERE codigo_tema = '$codigo_tema'" ); | ||
246 | - } | ||
247 | - $dbhw = null; | ||
248 | - $dbh = null; | ||
249 | - } | ||
250 | - } | ||
251 | - ?> | ||
252 | - <div style="float: left;"> | ||
253 | - Estilo: <select onchange="mudaEstilo(this.value)"> | ||
254 | - <option value=elegant>Elegant</option> | ||
255 | - <option value=ambiance>Ambiance</option> | ||
256 | - <option value=cobalt>Cobalt</option> | ||
257 | - <option value=night>Night</option> | ||
258 | - <option value=neo>Neo</option> | ||
259 | - </select> <input type=button value="+ extender" onclick="editorCM.setSize('1100px')" /> <input type=button value="- reduzir" onclick="editorCM.setSize('')" /> | ||
260 | - </div> | ||
261 | - | ||
262 | - <br> <br> | ||
263 | - <?php | ||
264 | - echo "<TEXTAREA id=editor name=texto cols=100 rows=20 style='width:100%;float:left;height:600px'>"; | ||
265 | - echo file_get_contents ( $mapfile ); | ||
266 | - echo "</TEXTAREA>"; | ||
267 | - ?> | ||
268 | - <p> </p> | ||
269 | - <p style="font-size:10px;">Ctrl+a - Seleciona tudo<br> | ||
270 | - Ctrl+d - Apaga a linha<br> | ||
271 | - Ctrl-z - Desfazer<br> | ||
272 | - Ctrl-Up - Sobe<br> | ||
273 | - Alt-left - Início da linha</p> | ||
274 | - </fieldset> | ||
275 | - | ||
276 | - <fieldset style="top: 5px; position: relative; width: 48%; padding: 10px;"> | ||
277 | - <legend>Mapfile em edição</legend> | ||
278 | - <div id=filtroDeLetras></div> | ||
279 | - <div id="comboMapfiles" style="height:160px;">Aguarde...</div> | ||
280 | - <?php | ||
281 | - $mapfile = str_replace ( "\\", "/", $mapfile ); | ||
282 | - $servidor = "http://".$_SERVER ["SERVER_NAME"].":".$_SERVER ["SERVER_PORT"]."/".basename($locaplic)."/admin/php/preview.php"; | ||
283 | - if (! empty ( $extensao )) { | ||
284 | - echo "<iframe id='mapaPreview' src='../../mashups/openlayers3.php?mapext=" . $extensao . "&servidor=". $servidor . "&fundo=e_wsm&nocache=sim&DESLIGACACHE=sim&controles=navigation,panzoombar,scaleline,mouseposition&botoes=identifica&largura=550&altura=400&temas=" . $mapfile . "' style='position:relative;top:2px;overflow:hidden;width:100%;height:450px;border:0px solid gray;'>"; | ||
285 | - } else { | ||
286 | - echo "<iframe id='mapaPreview' src='../../mashups/openlayers3.php?servidor=". $servidor . "&fundo=e_wsm&nocache=sim&DESLIGACACHE=sim&controles=navigation,panzoombar,scaleline,mouseposition&botoes=identifica&largura=550&altura=400&temas=" . $mapfile . "' style='position:relative;top:2px;overflow:hidden;width:100%;height:450px;border:0px solid gray;'>"; | ||
287 | - } | ||
288 | - echo "</iframe>"; | ||
289 | - echo "<input type=hidden name=tipo value=gravar />"; | ||
290 | - | ||
291 | - if (! @ms_newMapObj ( $mapfile )) { | ||
292 | - echo "<span style=color:red <b>Não foi possível criar o mapa. Verifique as permissões ou se há algum erro no mapfile</b></span><br><br>"; | ||
293 | - } else { | ||
294 | - $mapa = ms_newMapObj ( $mapfile ); | ||
295 | - $n = $mapa->numlayers; | ||
296 | - echo "<br>Obs.: o corte de imagens não é considerado no preview"; | ||
297 | - echo "<br>Ajudante de cores RGB: <input type=text value='clique' size=10 id='corrgb' onclick=\"i3GEO.util.abreCor('','corrgb','rgbSep')\" />"; | ||
298 | - echo "<br><br>Colunas dos layers:<br><br>"; | ||
299 | - for($i = 0; $i < $n; $i ++) { | ||
300 | - if (@$mapa->getlayer ( $i )) { | ||
301 | - $l = $mapa->getlayer ( $i ); | ||
302 | - echo $l->name . ": " . (implode ( ",", pegaItens ( $l ) )) . "<br><br>"; | ||
303 | - } else { | ||
304 | - echo "<span style=color:red <b>Não foi possível criar o LAYER {$l->name}. Verifique as permissões ou se há algum erro no mapfile</b></span><br><br>"; | ||
305 | - } | ||
306 | - } | ||
307 | - } | ||
308 | - ?> | ||
309 | - </fieldset> | ||
310 | - </form> | ||
311 | - </div> | ||
312 | - | ||
313 | - <script type="text/javascript" src="../js/core.js"></script> | ||
314 | - <script type="text/javascript" src="../dicionario/core.js"></script> | ||
315 | - <script src="../../classesjs/classe_util.js" type="text/javascript"></script> | ||
316 | - <script> | ||
317 | -i3GEO.configura = {locaplic: "../../"}; | ||
318 | - | ||
319 | -cabecalhoGeral("cabecalhoPrincipal","","../html/"); | ||
320 | -core_listaDeLetras("filtroDeLetras","filtraLetra",true); | ||
321 | - | ||
322 | -var editorCM = CodeMirror.fromTextArea(document.getElementById("editor"), { | ||
323 | - mode: 'scribe', | ||
324 | - tabMode: 'indent', | ||
325 | - lineNumbers: true, | ||
326 | - theme: "elegant" | ||
327 | -}); | ||
328 | - | ||
329 | -function getSelectedRange() { | ||
330 | - return { from: editorCM.getCursor(true), to: editorCM.getCursor(false) }; | ||
331 | -} | ||
332 | - | ||
333 | -function mudaEstilo(novo){ | ||
334 | - editorCM.setOption('theme',novo); | ||
335 | -} | ||
336 | - | ||
337 | -function atualizaTextArea(){ | ||
338 | - document.getElementById("editor").value = editorCM.getValue(); | ||
339 | -} | ||
340 | -function filtraLetra(letra) { | ||
341 | - letraAtual = letra; | ||
342 | - if (letra == "Todos") { | ||
343 | - letra = ""; | ||
344 | - } | ||
345 | - i3GEO.util.insereCookie("I3GEOletraAdmin", letra); | ||
346 | - core_pegaMapfiles("comboMapfiles()", letra); | ||
347 | -} | ||
348 | -function comboMapfiles(){ | ||
349 | - var n = $mapfiles.length, | ||
350 | - i,ins; | ||
351 | - ins = "<select size=8 id='selectComboMapfile' onchange='mudaMapfile(this)'><option value=''>Edite outro mapfile</option>"; | ||
352 | - for(i=0;i<n;i++){ | ||
353 | - if($mapfiles[i].extensao === "map"){ | ||
354 | - ins += "<option title='"+$mapfiles[i].nome+"' value='"+$mapfiles[i].codigo+"'>"+$mapfiles[i].codigo+" - "+$mapfiles[i].nome+"</optiona>"; | ||
355 | - } | ||
356 | - } | ||
357 | - ins += "</select>"; | ||
358 | - $i("comboMapfiles").innerHTML = ins; | ||
359 | - $i("selectComboMapfile").value = "<?php echo $_GET["mapfile"];?>"; | ||
360 | -}; | ||
361 | -core_pegaMapfiles("comboMapfiles()","",""); | ||
362 | -function mudaMapfile(obj){ | ||
363 | - if(obj.value != ""){ | ||
364 | - window.location.href = "editortexto.php?mapfile="+obj.value; | ||
365 | - } | ||
366 | -} | ||
367 | -function testar(){ | ||
368 | - window.open("../../testamapfile.php?map=<?php echo $_GET["mapfile"]; ?>"); | ||
369 | -} | ||
370 | -function abrirI3geo(){ | ||
371 | - window.open("../../ms_criamapa.php?layers=<?php echo $_GET["mapfile"]; ?>"); | ||
372 | -} | ||
373 | -function abrirTabela(){ | ||
374 | - window.open("../../ferramentas/recline/default.php?tema=<?php echo $_GET["mapfile"]; ?>"); | ||
375 | -} | ||
376 | -</script> | ||
377 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/estat_mapa_upload.php
@@ -1,59 +0,0 @@ | @@ -1,59 +0,0 @@ | ||
1 | -<?php | ||
2 | -include_once("admin.php"); | ||
3 | -include_once("login.php"); | ||
4 | -if(verificaOperacaoSessao("admin/metaestat/geral") == false){ | ||
5 | - echo "Vc nao pode realizar essa operacao.";exit; | ||
6 | -} | ||
7 | -//error_reporting(0); | ||
8 | -?> | ||
9 | -<html> | ||
10 | -<head> | ||
11 | -<link rel="stylesheet" type="text/css" href="../../css/input.css" /> | ||
12 | -<link rel="stylesheet" type="text/css" href="../../css/geral.css" /> | ||
13 | -<title></title> | ||
14 | -</head> | ||
15 | -<body bgcolor="white" style="background-color:white;text-align:left;"> | ||
16 | -<p> | ||
17 | -<?php | ||
18 | -if (isset($_FILES['uploadimagem']['name'])){ | ||
19 | - require_once (dirname(__FILE__)."/../../ms_configura.php"); | ||
20 | - echo "<p class='paragrafo' >Carregando o arquivo...</p>"; | ||
21 | - $arq = $metaestatTemplates."/logos/".$_FILES['uploadimagem']['name']; | ||
22 | - //verifica nomes | ||
23 | - verificaNome($_FILES['uploadimagem']['name']); | ||
24 | - //chmod($metaestatTemplates."/logos",777); | ||
25 | - if(file_exists($arq)){ | ||
26 | - unlink($arq); | ||
27 | - } | ||
28 | - //sobe arquivo | ||
29 | - $Arquivo = $_FILES['uploadimagem']['tmp_name']; | ||
30 | - //echo $Arquivo; | ||
31 | - $status = move_uploaded_file($Arquivo,str_replace(".png","",$arq).".png"); | ||
32 | - if($status != 1) | ||
33 | - {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo. Verifique as permissoes de escrita";exit;} | ||
34 | - if($status == 1){ | ||
35 | - echo "<p class='paragrafo' >Arquivo enviado.</p>"; | ||
36 | - chmod($arq,0777); | ||
37 | - } | ||
38 | - else{ | ||
39 | - echo "<p class='paragrafo' >Erro ao enviar o arquivo.</p>"; | ||
40 | - exit; | ||
41 | - } | ||
42 | -} | ||
43 | -else{ | ||
44 | - echo "<p class='paragrafo' >Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</p>"; | ||
45 | -} | ||
46 | -function verificaNome($nome) | ||
47 | -{ | ||
48 | - $nome = strtolower($nome); | ||
49 | - $lista = explode(".",$nome); | ||
50 | - $extensao = $lista[count($lista) - 1]; | ||
51 | - if($extensao != "png" && $extensao != "jpg") | ||
52 | - { | ||
53 | - echo "Nome de arquivo inválido."; | ||
54 | - exit; | ||
55 | - } | ||
56 | -} | ||
57 | -?> | ||
58 | -</body> | ||
59 | -</html> | ||
60 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/estatisticas.php
@@ -1,163 +0,0 @@ | @@ -1,163 +0,0 @@ | ||
1 | -<html> | ||
2 | -<head> | ||
3 | -<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | ||
4 | -<link rel="stylesheet" type="text/css" | ||
5 | - href="../../css/i3geo_ferramentas45.css"> | ||
6 | -<title></title> | ||
7 | -<style> | ||
8 | -td { | ||
9 | - text-align: left; | ||
10 | - min-width: 200px; | ||
11 | -} | ||
12 | -</style> | ||
13 | -</head> | ||
14 | -<body style="overflow: auto;"> | ||
15 | - <div style="text-align: center; width: 800px"> | ||
16 | - <p> | ||
17 | - <img src="../../imagens/i3geo1.jpg" /> | ||
18 | - </p> | ||
19 | - <p style='font-size: 16px'>Estatística do sistema de administração</p> | ||
20 | - </div> | ||
21 | - <div style="text-align: left; width: 800px"> | ||
22 | - <?php | ||
23 | - /* | ||
24 | - Title: Estatísticas do banco de dados de administração | ||
25 | - | ||
26 | - Gera uma página HTML com dados que descrevem a situação atual do banco de dados de administração. | ||
27 | - | ||
28 | - Licenca: | ||
29 | - | ||
30 | - GPL2 | ||
31 | - | ||
32 | - i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
33 | - | ||
34 | - Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
35 | - Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
36 | - | ||
37 | - Este programa é software livre; você pode redistribuí-lo | ||
38 | - e/ou modificá-lo sob os termos da Licença Pública Geral | ||
39 | - GNU conforme publicada pela Free Software Foundation; | ||
40 | - | ||
41 | - Este programa é distribuído na expectativa de que seja útil, | ||
42 | - porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
43 | - de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
44 | - Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
45 | - Você deve ter recebido uma c�pia da Licença Pública Geral do | ||
46 | - GNU junto com este programa; se não, escreva para a | ||
47 | - Free Software Foundation, Inc., no endereço | ||
48 | - 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
49 | - | ||
50 | - Arquivo: | ||
51 | - | ||
52 | - i3geo/admin/php/estatisticas.php | ||
53 | - | ||
54 | - */ | ||
55 | - include_once("admin.php"); | ||
56 | - $totaltemas = count(pegaDados("select * from ".$esquemaadmin."i3geoadmin_temas")); | ||
57 | - $temasvalidos = pegaDados("select codigo_tema,nome_tema,download_tema,kml_tema,ogc_tema,link_tema,tags_tema from ".$esquemaadmin."i3geoadmin_temas where codigo_tema <> ''"); | ||
58 | - $temasassocsubgrupos = pegaDados("select id_tema from ".$esquemaadmin."i3geoadmin_n3 group by id_tema"); | ||
59 | - $nacessostema = pegaDados("select b.nome_tema,sum(a.nacessos) as soma,a.codigo_tema from ".$esquemaadmin."i3geoadmin_acessostema as a,".$esquemaadmin."i3geoadmin_temas as b where a.codigo_tema = b.codigo_tema and a.nacessos > 0 group by a.codigo_tema,b.nome_tema"); | ||
60 | - $ntags = pegaDados("select nome from ".$esquemaadmin."i3geoadmin_tags"); | ||
61 | - $totaltemasvalidos = count($temasvalidos); | ||
62 | - $codigostemas = array(); | ||
63 | - $ncodigostemas = array(); | ||
64 | - $nnomestemas = array(); | ||
65 | - $ndownloadtemas = 0; | ||
66 | - $nkmltemas = 0; | ||
67 | - $nogctemas = 0; | ||
68 | - $nsemlinktemas = 0; | ||
69 | - $nsemtagstemas = 0; | ||
70 | - $nacessosmaiorqueum = count(pegaDados("select sum(nacessos) as soma from ".$esquemaadmin."i3geoadmin_acessostema where nacessos > 0 group by codigo_tema")); | ||
71 | - $nacessosmaiorquedez = count(pegaDados("select soma from (select sum(nacessos) as soma from ".$esquemaadmin."i3geoadmin_acessostema where nacessos > 0 group by codigo_tema) as soma where soma > 10")); | ||
72 | - $nacessosmaiorquecem = count(pegaDados("select soma from (select sum(nacessos) as soma from ".$esquemaadmin."i3geoadmin_acessostema where nacessos > 0 group by codigo_tema) as soma where soma > 100")); | ||
73 | - $temasacessos = array(); | ||
74 | - //error_reporting(0); | ||
75 | - foreach($temasvalidos as $tema){ | ||
76 | - $ncodigostemas[$tema["codigo_tema"]]++; | ||
77 | - $nnomestemas[$tema["nome_tema"]]++; | ||
78 | - if(strtolower($tema["download_tema"]) == "sim") | ||
79 | - { | ||
80 | - $ndownloadtemas++; | ||
81 | - } | ||
82 | - if(strtolower($tema["kml_tema"]) != "nao") | ||
83 | - { | ||
84 | - $nkmltemas++; | ||
85 | - } | ||
86 | - if(strtolower($tema["ogc_tema"]) != "nao") | ||
87 | - { | ||
88 | - $nogctemas++; | ||
89 | - } | ||
90 | - if(strtolower($tema["link_tema"]) == "") | ||
91 | - { | ||
92 | - $nsemlinktemas++; | ||
93 | - } | ||
94 | - if($tema["tags_tema"] == "") | ||
95 | - { | ||
96 | - $nsemtagstemas++; | ||
97 | - } | ||
98 | - /* | ||
99 | - if($tema["nacessos"] > 0) | ||
100 | - {$nacessosmaiorqueum++;} | ||
101 | - if($tema["nacessos"] > 10) | ||
102 | - {$nacessosmaiorquedez++;} | ||
103 | - if($tema["nacessos"] > 100) | ||
104 | - { | ||
105 | - $nacessosmaiorquecem++; | ||
106 | - //$temasmaisdecem[] = $tema[nome_tema]; | ||
107 | - } | ||
108 | - $temasacessos[$tema[nome_tema]] = $tema["nacessos"]; | ||
109 | - */ | ||
110 | - } | ||
111 | - foreach($nacessostema as $tema){ | ||
112 | - $temasacessos[$tema["nome_tema"]] = $tema["soma"]; | ||
113 | - } | ||
114 | - $temasmaisdeum = array(); | ||
115 | - foreach ($ncodigostemas as $n) | ||
116 | - { | ||
117 | - if($n > 1) | ||
118 | - $temasmaisdeum[] = $n; | ||
119 | - } | ||
120 | - $nomestemasmaisdeum = array(); | ||
121 | - foreach ($nnomestemas as $n) | ||
122 | - { | ||
123 | - if($n > 1) | ||
124 | - $nomestemasmaisdeum[] = $n; | ||
125 | - } | ||
126 | - echo "<table>"; | ||
127 | - echo "<tr><td><b>Número total de temas cadastrados: </b></td><td>$totaltemas</td><td></td></tr>"; | ||
128 | - echo "<tr><td><b>Número total de temas válidos (código diferente de vazio): </b></td><td>$totaltemasvalidos</td><td></td></tr>"; | ||
129 | - echo "<tr><td><b>Temas válidos com códigos duplicados: </b></td><td>".count($temasmaisdeum)."</td><td></td></tr>"; | ||
130 | - echo "<tr><td><b>Temas válidos com nomes duplicados: </b></td><td>".count($nomestemasmaisdeum)."</td><td></td></tr>"; | ||
131 | - echo "<tr><td><b>Temas associados a algum sub-grupo: </b></td><td>".count($temasassocsubgrupos)."</td><td></td></tr>"; | ||
132 | - echo "<tr><td></td><td></td><td></td></tr>"; | ||
133 | - echo "<tr><td><b>Dos temas válidos:</b></td><td> </td><td></td></tr>"; | ||
134 | - echo "<tr><td><b>Número de temas sem link: </b></td><td>".$nsemlinktemas."</td><td> ".round(($nsemlinktemas * 100) / $totaltemasvalidos,2) ." %</td></tr>"; | ||
135 | - echo "<tr><td><b>Número de temas sem tags: </b></td><td>".$nsemtagstemas."</td><td> ".round(($nsemtagstemas * 100) / $totaltemasvalidos,2) ." %</td></tr>"; | ||
136 | - echo "<tr><td><b>Número de temas disponíveis para download: </b></td><td>".$ndownloadtemas."</td><td> ".round(($ndownloadtemas * 100) / $totaltemasvalidos,2) ." %</td></tr>"; | ||
137 | - echo "<tr><td><b>Número de temas disponíveis como KML: </b></td><td>".$nkmltemas."</td><td> ".round(($nkmltemas * 100) / $totaltemasvalidos,2) ." %</td></tr>"; | ||
138 | - echo "<tr><td><b>Número de temas disponíveis como Web Service OGC: </b></td><td>".$nogctemas."</td><td> ".round(($nogctemas * 100) / $totaltemasvalidos,2) ." %</td></tr>"; | ||
139 | - | ||
140 | - echo "<tr><td> </td><td> </td><td></td></tr>"; | ||
141 | - echo "<tr><td><b>Número de temas com acesso maior que 0: </b></td><td>".$nacessosmaiorqueum."</td><td> ".round(($nacessosmaiorqueum * 100) / $totaltemasvalidos,2) ." %</td></tr>"; | ||
142 | - echo "<tr><td><b>Número de temas com acesso maior que 10: </b></td><td>".$nacessosmaiorquedez."</td><td> ".round(($nacessosmaiorquedez * 100) / $totaltemasvalidos,2) ." %</td></tr>"; | ||
143 | - echo "<tr><td><b>Número de temas com acesso maior que 100: </b></td><td>".$nacessosmaiorquecem."</td><td> ".round(($nacessosmaiorquecem * 100) / $totaltemasvalidos,2) ." %</td></tr>"; | ||
144 | - | ||
145 | - echo "<tr><td> </td><td> </td><td></td></tr>"; | ||
146 | - echo "<tr><td><b>Número de tags: </b></td><td>".count($ntags)."</td><td></td></tr>"; | ||
147 | - | ||
148 | - echo "</table>"; | ||
149 | - echo "<p><b>Acesos por tema</b></p>"; | ||
150 | - arsort($temasacessos); | ||
151 | - $temasacessos2 = array_keys($temasacessos); | ||
152 | - for($i=0;$i<=count($temasacessos2);$i++) | ||
153 | - { | ||
154 | - if(mb_detect_encoding($temasacessos2[$i],'UTF-8, ISO-8859-1') == "UTF-8") | ||
155 | - echo "<p>".utf8_decode($temasacessos2[$i])." - ".$temasacessos[$temasacessos2[$i]]."</p>"; | ||
156 | - else | ||
157 | - echo "<p>".$temasacessos2[$i]." - ".$temasacessos[$temasacessos2[$i]]."</p>"; | ||
158 | - } | ||
159 | - echo "<pre>"; | ||
160 | - echo "<hr>".date('l jS \of F Y h:i:s A'); | ||
161 | - //var_dump($temasacessos); | ||
162 | -?> | ||
163 | - </div> | ||
164 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/gruposusuarios.php
@@ -1,219 +0,0 @@ | @@ -1,219 +0,0 @@ | ||
1 | -<?php | ||
2 | -/* | ||
3 | -Title: gruposusuarios.php | ||
4 | - | ||
5 | -Controle das requisições em Ajax utilizadas para gerenciar grupos de usuário e controle de acesso | ||
6 | - | ||
7 | -Recebe as requisições feitas em JavaScript (AJAX) e retorna o resultado para a interface. | ||
8 | - | ||
9 | -O parâmetro "funcao" define qual a operação que será executada. Esse parâmetro é verificado em um bloco "switch ($funcao)". | ||
10 | - | ||
11 | -Licenca: | ||
12 | - | ||
13 | -GPL2 | ||
14 | - | ||
15 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
16 | - | ||
17 | -Direitos Autorais Reservados (c) 2006 Edmar Moretti | ||
18 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
19 | - | ||
20 | -Este programa é software livre; você pode redistribuí-lo | ||
21 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
22 | -GNU conforme publicada pela Free Software Foundation; | ||
23 | - | ||
24 | -Este programa é distribuído na expectativa de que seja útil, | ||
25 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
26 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
27 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
28 | -Você deve ter recebido uma copia da Licença Pública Geral do | ||
29 | -GNU junto com este programa; se não, escreva para a | ||
30 | -Free Software Foundation, Inc., no endereço | ||
31 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
32 | - | ||
33 | -Arquivo: | ||
34 | - | ||
35 | -i3geo/classesphp/gruposusuarios.php | ||
36 | - | ||
37 | -Parametros: | ||
38 | - | ||
39 | -funcao - opção que será executada (veja abaixo a lista de Valores que esse parâmetro pode assumir). | ||
40 | - | ||
41 | -Retorno: | ||
42 | - | ||
43 | -O resultado da operação será retornado em um objeto CPAINT. | ||
44 | - | ||
45 | -A construção da string JSON é feita preferencialmente pelas funções nativas do PHP. | ||
46 | -Para efeitos de compatibilidade, uma vez que até a versão 4.2 a string JSON era construida pelo CPAINT, | ||
47 | -o objeto CPAINT ainda é definido, porém, a função cpjson verifica se as funções nativas do PHPO (json) | ||
48 | -estão instaladas, se estiverem, utiliza-se a função nativa, se não, utiliza-se o CPAINT para gerar o JSON. | ||
49 | - | ||
50 | -Exemplo de chamada CPAINT (Ajax) do lado do cliente (javascript): | ||
51 | - | ||
52 | -var p = "classesphp/mapa_controle.php?funcao=crialente&resolucao=1.5&g_sid="+g_sid | ||
53 | - | ||
54 | -var cp = new cpaint() | ||
55 | - | ||
56 | -cp.set_response_type("JSON") | ||
57 | - | ||
58 | -cp.call(p,"lente",ajaxabrelente) | ||
59 | - | ||
60 | -*/ | ||
61 | -//error_reporting(0); | ||
62 | -// | ||
63 | -//pega as variaveis passadas com get ou post | ||
64 | -// | ||
65 | -include_once(dirname(__FILE__)."/login.php"); | ||
66 | -$funcoesEdicao = array( | ||
67 | - "ALTERARGRUPOS", | ||
68 | - "EXCLUIRGRUPO" | ||
69 | -); | ||
70 | -if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
71 | - if(verificaOperacaoSessao("admin/html/usuarios") == false){ | ||
72 | - retornaJSON("Vc nao pode realizar essa operacao.");exit; | ||
73 | - } | ||
74 | -} | ||
75 | - | ||
76 | -$id_usuario = $_GET["id_usuario"]; | ||
77 | -testaSafeNumerico([$id_usuario]); | ||
78 | - | ||
79 | -switch (strtoupper($funcao)) | ||
80 | -{ | ||
81 | - case "ALTERARGRUPOS": | ||
82 | - $novo = alterarGrupos(); | ||
83 | - if($novo == false){ | ||
84 | - retornaJSON(array()); | ||
85 | - exit; | ||
86 | - } | ||
87 | - $sql = "SELECT id_grupo,nome,descricao from ".$esquemaadmin."i3geousr_grupos WHERE id_grupo = ".$novo; | ||
88 | - retornaJSON(pegaDados($sql)); | ||
89 | - exit; | ||
90 | - break; | ||
91 | - case "PEGAGRUPOS": | ||
92 | - retornaJSON(pegaDados("SELECT id_grupo,nome,descricao from ".$esquemaadmin."i3geousr_grupos order by nome")); | ||
93 | - exit; | ||
94 | - break; | ||
95 | - case "PEGAUSUARIOSGRUPO": | ||
96 | - $dados = pegaDados("SELECT U.id_usuario, U.login, UP.id_grupo FROM ".$esquemaadmin."i3geousr_usuarios AS U JOIN ".$esquemaadmin."i3geousr_grupousuario AS UP ON U.id_usuario = UP.id_usuario WHERE UP.id_grupo = $id_grupo"); | ||
97 | - retornaJSON($dados); | ||
98 | - exit; | ||
99 | - break; | ||
100 | - case "PEGADADOSGRUPO": | ||
101 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geousr_grupos WHERE id_grupo = $id_grupo")); | ||
102 | - exit; | ||
103 | - break; | ||
104 | - case "EXCLUIRGRUPO": | ||
105 | - $tabela = "i3geousr_grupous"; | ||
106 | - $id = $id_grupo; | ||
107 | - $f = verificaFilhos(); | ||
108 | - if(!$f){ | ||
109 | - excluirGrupo(); | ||
110 | - retornaJSON("ok"); | ||
111 | - } | ||
112 | - else | ||
113 | - retornaJSON("erro"); | ||
114 | - exit; | ||
115 | - break; | ||
116 | - case "ADICIONAUSUARIOGRUPO": | ||
117 | - adicionaUsuarioGrupo(); | ||
118 | - $dados = pegaDados("SELECT U.id_usuario, U.login, UP.id_grupo FROM ".$esquemaadmin."i3geousr_usuarios AS U JOIN ".$esquemaadmin."i3geousr_grupousuario AS UP ON U.id_usuario = UP.id_usuario WHERE UP.id_grupo = $id_grupo AND UP.id_usuario = $id_usuario"); | ||
119 | - retornaJSON($dados); | ||
120 | - exit; | ||
121 | - break; | ||
122 | - case "EXCLUIRUSUARIOGRUPO": | ||
123 | - retornaJSON(excluirUsuarioGrupo()); | ||
124 | - exit; | ||
125 | - break; | ||
126 | - case "LISTAUSUARIOS": | ||
127 | - retornaJSON(pegaDados("Select id_usuario,login,ativo from ".$esquemaadmin."i3geousr_usuarios order by login")); | ||
128 | - exit; | ||
129 | - break; | ||
130 | -} | ||
131 | -cpjson($retorno); | ||
132 | -function alterarGrupos() | ||
133 | -{ | ||
134 | - global $id_grupo; | ||
135 | - try | ||
136 | - { | ||
137 | - $nome = $_GET["nome"]; | ||
138 | - $descricao = $_GET["descricao"]; | ||
139 | - include(dirname(__FILE__)."/conexao.php"); | ||
140 | - if($convUTF){ | ||
141 | - $nome = utf8_encode($nome); | ||
142 | - $descricao = utf8_encode($descricao); | ||
143 | - } | ||
144 | - if($id_grupo != ""){ | ||
145 | - //verifica uniciade de login | ||
146 | - $dados = pegaDados("select nome from ".$esquemaadmin."i3geousr_grupos where nome = '$nome'"); | ||
147 | - if(count($dados) > 0){ | ||
148 | - $retorna = false; | ||
149 | - } | ||
150 | - $dataCol = array( | ||
151 | - "nome" => $nome, | ||
152 | - "descricao" => $descricao | ||
153 | - ); | ||
154 | - i3GeoAdminUpdate($dbhw,"i3geousr_grupos",$dataCol,"WHERE id_grupo = $id_grupo"); | ||
155 | - $retorna = $id_grupo; | ||
156 | - } | ||
157 | - else{ | ||
158 | - $dataCol = array( | ||
159 | - "nome" => '', | ||
160 | - "descricao" => '' | ||
161 | - ); | ||
162 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geousr_grupos",$dataCol,"nome","id_grupo"); | ||
163 | - } | ||
164 | - $dbhw = null; | ||
165 | - $dbh = null; | ||
166 | - return $retorna; | ||
167 | - } | ||
168 | - catch (PDOException $e){ | ||
169 | - return "Error!: "; | ||
170 | - } | ||
171 | -} | ||
172 | -function adicionaUsuarioGrupo(){ | ||
173 | - global $id_usuario,$id_grupo; | ||
174 | - try { | ||
175 | - include(dirname(__FILE__)."/conexao.php"); | ||
176 | - $dataCol = array( | ||
177 | - "id_usuario" => $id_usuario, | ||
178 | - "id_grupo" => $id_grupo | ||
179 | - ); | ||
180 | - i3GeoAdminInsert($dbhw,"i3geousr_grupousuario",$dataCol); | ||
181 | - $dbhw = null; | ||
182 | - $dbh = null; | ||
183 | - return "ok"; | ||
184 | - } | ||
185 | - catch (PDOException $e){ | ||
186 | - return "Error!: "; | ||
187 | - } | ||
188 | -} | ||
189 | -function excluirGrupo() | ||
190 | -{ | ||
191 | - global $id_grupo,$esquemaadmin; | ||
192 | - try{ | ||
193 | - exclui($esquemaadmin."i3geousr_grupos","id_grupo",$id_grupo); | ||
194 | - return "ok"; | ||
195 | - } | ||
196 | - catch (PDOException $e) | ||
197 | - { | ||
198 | - return "Error!: "; | ||
199 | - } | ||
200 | -} | ||
201 | -function excluirUsuarioGrupo() | ||
202 | -{ | ||
203 | - global $id_usuario,$id_grupo; | ||
204 | - try | ||
205 | - { | ||
206 | - include(dirname(__FILE__)."/conexao.php"); | ||
207 | - $sql = "DELETE FROM ".$esquemaadmin."i3geousr_grupousuario WHERE id_usuario = $id_usuario AND id_grupo = $id_grupo "; | ||
208 | - $dbhw->query($sql); | ||
209 | - i3GeoAdminInsertLog($dbhw,$sql); | ||
210 | - $dbhw = null; | ||
211 | - $dbh = null; | ||
212 | - return "ok"; | ||
213 | - } | ||
214 | - catch (PDOException $e) | ||
215 | - { | ||
216 | - return "Error!: "; | ||
217 | - } | ||
218 | -} | ||
219 | -?> | ||
220 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/identifica.php
@@ -1,179 +0,0 @@ | @@ -1,179 +0,0 @@ | ||
1 | -<?php | ||
2 | -/* | ||
3 | -Title: identifica.php | ||
4 | - | ||
5 | -Funções utilizadas pelo editor das opções de identificação | ||
6 | - | ||
7 | -Essas opções são utilizadas na ferramenta de identificação de elementos do mapa | ||
8 | - | ||
9 | -Licenca: | ||
10 | - | ||
11 | -GPL2 | ||
12 | - | ||
13 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
14 | - | ||
15 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
16 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
17 | - | ||
18 | -Este programa é software livre; você pode redistribuí-lo | ||
19 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
20 | -GNU conforme publicada pela Free Software Foundation; | ||
21 | - | ||
22 | -Este programa é distribuído na expectativa de que seja útil, | ||
23 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
24 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
25 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
26 | -Você deve ter recebido uma c�pia da Licença Pública Geral do | ||
27 | - GNU junto com este programa; se não, escreva para a | ||
28 | -Free Software Foundation, Inc., no endereço | ||
29 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
30 | - | ||
31 | -Arquivo: | ||
32 | - | ||
33 | -i3geo/admin/php/identifica.php | ||
34 | - | ||
35 | -Parametros: | ||
36 | - | ||
37 | -O parâmetro principal é "funcao", que define qual operação será executada, por exemplo, identifica.php?funcao=pegafuncoes | ||
38 | - | ||
39 | -Cada operação possuí seus pr�prios parâmetros, que devem ser enviados também na requisição da operação. | ||
40 | - | ||
41 | -*/ | ||
42 | -include_once(dirname(__FILE__)."/login.php"); | ||
43 | -$funcoesEdicao = array( | ||
44 | - "ALTERARFUNCOES", | ||
45 | - "EXCLUIR" | ||
46 | - | ||
47 | -); | ||
48 | -if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
49 | - if(verificaOperacaoSessao("admin/html/identifica") == false){ | ||
50 | - retornaJSON("Vc nao pode realizar essa operacao.");exit; | ||
51 | - } | ||
52 | -} | ||
53 | - | ||
54 | -$id_i = $_GET["id_i"]; | ||
55 | -$id = $_GET["id"]; | ||
56 | -testaSafeNumerico([$id_i,$id]); | ||
57 | - | ||
58 | -//error_reporting(0); | ||
59 | -//faz a busca da função que deve ser executada | ||
60 | -switch (strtoupper($funcao)) | ||
61 | -{ | ||
62 | - /* | ||
63 | - Note: | ||
64 | - | ||
65 | - Valores que o parâmetro &funcao pode receber. Os parâmetros devem ser enviados na requisição em AJAX. | ||
66 | - */ | ||
67 | - /* | ||
68 | - Valor: PEGAFUNCOES | ||
69 | - | ||
70 | - Lista de operações cadastradas | ||
71 | - | ||
72 | - Retorno: | ||
73 | - | ||
74 | - {JSON} | ||
75 | - */ | ||
76 | - case "PEGAFUNCOES": | ||
77 | - if(isset($id_i) && $id_i != ""){ | ||
78 | - $dados = pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_identifica where id_i = $id_i order by nome_i"); | ||
79 | - } | ||
80 | - else{ | ||
81 | - $dados = pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_identifica order by nome_i"); | ||
82 | - } | ||
83 | - retornaJSON($dados); | ||
84 | - exit; | ||
85 | - break; | ||
86 | - /* | ||
87 | - Valor: ALTERARFUNCOES | ||
88 | - | ||
89 | - Altera uma operação cadastrada | ||
90 | - | ||
91 | - Parametros: | ||
92 | - | ||
93 | - id_i - id da opção | ||
94 | - | ||
95 | - abrir_i | ||
96 | - | ||
97 | - nome_i | ||
98 | - | ||
99 | - target_i | ||
100 | - | ||
101 | - publicado_i | ||
102 | - | ||
103 | - Retorno: | ||
104 | - | ||
105 | - {JSON} | ||
106 | - */ | ||
107 | - case "ALTERARFUNCOES": | ||
108 | - $novo = alterarFuncoes(); | ||
109 | - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_identifica WHERE id_i = '".$novo."'"; | ||
110 | - retornaJSON(pegaDados($sql)); | ||
111 | - exit; | ||
112 | - break; | ||
113 | - /* | ||
114 | - Valor: EXCLUIR | ||
115 | - | ||
116 | - Exclui uma operação cadastrada | ||
117 | - | ||
118 | - Parametros: | ||
119 | - | ||
120 | - id - id da opção | ||
121 | - | ||
122 | - Retorno: | ||
123 | - | ||
124 | - {JSON} | ||
125 | - */ | ||
126 | - case "EXCLUIR": | ||
127 | - retornaJSON(excluirFuncoes()); | ||
128 | - exit; | ||
129 | - break; | ||
130 | -} | ||
131 | -/* | ||
132 | -Altera o registro de um WS | ||
133 | -*/ | ||
134 | -function alterarFuncoes(){ | ||
135 | - global $id_i,$esquemaadmin; | ||
136 | - try{ | ||
137 | - //$nome_i = mb_convert_encoding($nome_i,"UTF-8","ISO-8859-1"); | ||
138 | - require_once("conexao.php"); | ||
139 | - if($convUTF){ | ||
140 | - $_GET["nome_i"] = utf8_encode($_GET["nome_i"]); | ||
141 | - } | ||
142 | - if($id_i != ""){ | ||
143 | - $dataCol = array( | ||
144 | - "publicado_i" => $_GET["publicado_i"], | ||
145 | - "nome_i" => $_GET["nome_i"], | ||
146 | - "abrir_i" => $_GET["abrir_i"], | ||
147 | - "target_i" => $_GET["target_i"] | ||
148 | - ); | ||
149 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_identifica",$dataCol,"WHERE id_i = $id_i"); | ||
150 | - $retorna = $id_i; | ||
151 | - } | ||
152 | - else{ | ||
153 | - $dataCol = array( | ||
154 | - "publicado_i" => '', | ||
155 | - "nome_i" => '', | ||
156 | - "abrir_i" => '', | ||
157 | - "target_i" => '' | ||
158 | - ); | ||
159 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_identifica",$dataCol,"nome_i","id_i"); | ||
160 | - } | ||
161 | - $dbhw = null; | ||
162 | - $dbh = null; | ||
163 | - return $retorna; | ||
164 | - } | ||
165 | - catch (PDOException $e){ | ||
166 | - return "Error!: "; | ||
167 | - } | ||
168 | -} | ||
169 | -function excluirFuncoes(){ | ||
170 | - global $id,$esquemaadmin; | ||
171 | - try{ | ||
172 | - exclui($esquemaadmin."i3geoadmin_identifica","id_i",$id); | ||
173 | - return "ok"; | ||
174 | - } | ||
175 | - catch (PDOException $e){ | ||
176 | - return "Error!: "; | ||
177 | - } | ||
178 | -} | ||
179 | -?> | ||
180 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/incluiMAP.php
@@ -1,131 +0,0 @@ | @@ -1,131 +0,0 @@ | ||
1 | -<?php | ||
2 | -/* | ||
3 | - Title: incluiMAP.php | ||
4 | - | ||
5 | -Ajusta mapfiles antigos incluindo a palavra MAP na primeira linha. | ||
6 | - | ||
7 | -Esse ajuste é necessário em versões do Mapserver posteriores à 5.2 | ||
8 | - | ||
9 | -Licenca: | ||
10 | - | ||
11 | -GPL2 | ||
12 | - | ||
13 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
14 | - | ||
15 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
16 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
17 | - | ||
18 | -Este programa é software livre; você pode redistribuí-lo | ||
19 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
20 | -GNU conforme publicada pela Free Software Foundation; | ||
21 | - | ||
22 | -Este programa é distribuído na expectativa de que seja útil, | ||
23 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
24 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
25 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
26 | -Você deve ter recebido uma cópia da Licença Pública Geral do | ||
27 | - GNU junto com este programa; se não, escreva para a | ||
28 | -Free Software Foundation, Inc., no endereço | ||
29 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
30 | - | ||
31 | -Arquivo: | ||
32 | - | ||
33 | -i3geo/admin/php/incluiMAP.php | ||
34 | -*/ | ||
35 | - | ||
36 | -$funcao = ""; | ||
37 | -$locaplic = dirname(__FILE__)."/../.."; | ||
38 | -include_once("admin.php"); | ||
39 | -//verifica se o login pode ser realizado | ||
40 | -if(isset($i3geoPermiteLogin) && $i3geoPermiteLogin == false){ | ||
41 | - header ( "HTTP/1.1 403 Login desativado" ); | ||
42 | - exit (); | ||
43 | -} | ||
44 | -//$i3geoPermiteLoginIp vem de ms_configura.php | ||
45 | -if(isset($i3geoPermiteLoginIp)){ | ||
46 | - checaLoginIp($i3geoPermiteLoginIp); | ||
47 | -} | ||
48 | -include_once("conexao.php"); | ||
49 | -if(empty($_POST["senha"]) || empty($_POST["usuario"])){ | ||
50 | - formularioLoginMaster("incluiMAP.php"); | ||
51 | - exit; | ||
52 | -} | ||
53 | -else{ | ||
54 | - $continua = verificaMaster($_POST["usuario"],$_POST["senha"],$i3geomaster); | ||
55 | - if($continua == false){ | ||
56 | - echo "Usuário não registrado em i3geo/ms_configura.php na variável i3geomaster"; | ||
57 | - exit; | ||
58 | - } | ||
59 | -} | ||
60 | - | ||
61 | -$arquivos = array(); | ||
62 | -if (is_dir($locaplic."/temas")) | ||
63 | -{ | ||
64 | - if ($dh = opendir($locaplic."/temas")) | ||
65 | - { | ||
66 | - while (($file = readdir($dh)) !== false) | ||
67 | - { | ||
68 | - if(!stristr($file, '.map') === FALSE) | ||
69 | - { | ||
70 | - $arquivos[] = $file; | ||
71 | - } | ||
72 | - } | ||
73 | - } | ||
74 | - closedir($dh); | ||
75 | -} | ||
76 | -echo "Arquivos convertidos: <br>"; | ||
77 | -foreach($arquivos as $arquivo) | ||
78 | -{ | ||
79 | - $mapExiste = false; | ||
80 | - $arq = $locaplic."/temas/".$arquivo; | ||
81 | - $abre = fopen($arq, "r"); | ||
82 | - $maparray = array(); | ||
83 | - $maparray[] = "MAP"; | ||
84 | - $maparray[] = "\n"; | ||
85 | - while (!feof($abre)) | ||
86 | - { | ||
87 | - $buffer = fgets($abre); | ||
88 | - $buffer = str_replace(PHP_EOL,"",rtrim($buffer)); | ||
89 | - if(trim($buffer) != "MAP" && $buffer != "") | ||
90 | - { | ||
91 | - $maparray[] = $buffer; | ||
92 | - } | ||
93 | - else | ||
94 | - {$mapExiste = true; | ||
95 | - } | ||
96 | - } | ||
97 | - fclose($abre); | ||
98 | - $search = array( | ||
99 | - "transparency ", | ||
100 | - "LABELANGLEITEM ", | ||
101 | - "LABELMAXSCALE ", | ||
102 | - "LABELMINSCALE ", | ||
103 | - "LABELMINSCALE ", | ||
104 | - "LABELSIZEITEM ", | ||
105 | - "MAXSCALE ", | ||
106 | - "MINSCALE ", | ||
107 | - "SYMBOLSCALE " | ||
108 | - ); | ||
109 | - $replace = array( | ||
110 | - "OPACITY ", | ||
111 | - "#LABELANGLEITEM ", | ||
112 | - "LABELMAXSCALEDENOM ", | ||
113 | - "LABELMINSCALEDENOM ", | ||
114 | - "LABELMINSCALEDENOM ", | ||
115 | - "#LABELSIZEITEM ", | ||
116 | - "MAXSCALEDENOM ", | ||
117 | - "MINSCALEDENOM ", | ||
118 | - "SYMBOLSCALEDENOM " | ||
119 | - ); | ||
120 | - str_ireplace($search,$replace,$maparray); | ||
121 | - $abre = fopen($arq, "wt"); | ||
122 | - foreach($maparray as $linha) | ||
123 | - { | ||
124 | - fwrite ($abre,$linha); | ||
125 | - fwrite ($abre,"\n"); | ||
126 | - } | ||
127 | - $fecha = fclose ($abre); | ||
128 | - echo $arquivo."<br>"; | ||
129 | -} | ||
130 | - | ||
131 | -?> | ||
132 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/listadadostabela.php
@@ -1,36 +0,0 @@ | @@ -1,36 +0,0 @@ | ||
1 | -<?php | ||
2 | -include_once(dirname(__FILE__)."/login.php"); | ||
3 | -$funcoesEdicao = array( | ||
4 | - "OBTEMDADOSTABELADB" | ||
5 | -); | ||
6 | -if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
7 | - if(verificaOperacaoSessao("admin/metaestat/geral") == false){ | ||
8 | - exit; | ||
9 | - } | ||
10 | -} | ||
11 | -?> | ||
12 | -<html> | ||
13 | -<head> | ||
14 | -<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> | ||
15 | -<style type="text/css"> | ||
16 | -body { | ||
17 | - margin: 0; | ||
18 | - padding: 0; | ||
19 | -} | ||
20 | -</style> | ||
21 | -<script type="text/javascript" src="../js/core.js"></script> | ||
22 | -<script type="text/javascript" src="../js/estat_editor.js"></script> | ||
23 | -<link rel="stylesheet" type="text/css" href="admin.css"> | ||
24 | -</head> | ||
25 | -<body> | ||
26 | - <script> | ||
27 | - //necessario para a ferramenta login e outras | ||
28 | - i3GEO.configura = { | ||
29 | - locaplic : "../.." | ||
30 | - }; | ||
31 | - temp = function() { | ||
32 | - <?php echo "i3GEOadmin.editor.tabela.mostrar($nreg, '$nome_tabela', '$nomeEsquema', '$codigo_estat_conexao', window);\n"; ?> | ||
33 | - }; | ||
34 | - i3GEO.login.verificaOperacao("admin/metaestat/geral",i3GEO.configura.locaplic, temp, "sessao",i3GEO.login.dialogo.abreLogin); | ||
35 | - </script> | ||
36 | -</body> |
admin/php/logtransacoes.php
@@ -1,16 +0,0 @@ | @@ -1,16 +0,0 @@ | ||
1 | -<?php | ||
2 | -//para rodar, comente a linha abaixo | ||
3 | -exit; | ||
4 | -include("admin.php"); | ||
5 | -$dados = pegaDados("select * from ".$esquemaadmin."i3geoadmin_log"); | ||
6 | -//["serializedata"]=> string(96) "a:5:{i:0;s:22:"administrador do i3geo";i:1;s:10:"admingeral";i:2;s:0:"";i:3;s:1:"1";i:4;s:0:"";}" ["usuario"]=> string(5) "admin" ["ip"]=> string(9) "127.0.0.1" ["timestamp"]=> string(43) "1458610085(Mon, 21 Mar 2016 22:28:05 -0300)" ["outros"]=> string(0) "" } } | ||
7 | -foreach($dados as $d){ | ||
8 | - echo "<b>id_log:</b> ".$d["id_log"]."<br> \n"; | ||
9 | - echo "timestamp = ".$d["timestamp"] ."<br> \n"; | ||
10 | - echo "usuario = ".$d["usuario"] ."<br> \n"; | ||
11 | - echo "ip = ".$d["ip"] ."<br> \n"; | ||
12 | - echo "sql = ".$d["sql"] ."<br> \n"; | ||
13 | - echo "dados = '".implode("','",unserialize($d["serializedata"])) ."'<br> \n"; | ||
14 | - echo "outros = ".$d["outros"] ."<br><br> \n"; | ||
15 | -} | ||
16 | -?> | ||
17 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/mapfiles.php
@@ -1,157 +0,0 @@ | @@ -1,157 +0,0 @@ | ||
1 | -<?php | ||
2 | -echo "depreciado";exit; | ||
3 | -/* | ||
4 | - Title: mapfiles.php | ||
5 | - | ||
6 | -Funções utilizadas pelo editor dos mapfiles de inicialização | ||
7 | - | ||
8 | -É utilizado nas funções em AJAX da interface de edição que permite alterar os mapfiles geral1.map ou geral1windows.map | ||
9 | - | ||
10 | -O mapfile que deve ser editado é obtido por meio do programa <admin.php> | ||
11 | - | ||
12 | -Licenca: | ||
13 | - | ||
14 | -GPL2 | ||
15 | - | ||
16 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
17 | - | ||
18 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
19 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
20 | - | ||
21 | -Este programa é software livre; você pode redistribuí-lo | ||
22 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
23 | -GNU conforme publicada pela Free Software Foundation; | ||
24 | - | ||
25 | -Este programa é distribuído na expectativa de que seja útil, | ||
26 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
27 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
28 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
29 | -Você deve ter recebido uma cópia da Licença Pública Geral do | ||
30 | - GNU junto com este programa; se não, escreva para a | ||
31 | -Free Software Foundation, Inc., no endereço | ||
32 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
33 | - | ||
34 | -Arquivo: | ||
35 | - | ||
36 | -i3geo/admin/php/mapfiles.php | ||
37 | - | ||
38 | -Parametros: | ||
39 | - | ||
40 | -O parâmetro principal é "funcao", que define qual operação será executada, por exemplo, mapfiles.php?funcao=PEGAPARAMETROSCONFIGURA | ||
41 | - | ||
42 | -Cada operação possuí seus próprios parâmetros, que devem ser enviados também na requisição da operação. | ||
43 | - | ||
44 | -*/ | ||
45 | -require_once("admin.php"); | ||
46 | -/** | ||
47 | - * incluir verificacao de login | ||
48 | - */ | ||
49 | -//faz a busca da função que deve ser executada | ||
50 | -switch (strtoupper($funcao)) | ||
51 | -{ | ||
52 | - /* | ||
53 | - Note: | ||
54 | - | ||
55 | - Valores que o parâmetro &funcao pode receber. Os parâmetros devem ser enviados na requisição em AJAX. | ||
56 | - */ | ||
57 | - /* | ||
58 | - Valor: PEGAPARAMETROSCONFIGURA | ||
59 | - | ||
60 | - Pega os parâmetros principais de configuração do mapfile | ||
61 | - | ||
62 | - Retorno: | ||
63 | - | ||
64 | - {JSON} | ||
65 | - */ | ||
66 | - case "PEGAPARAMETROSCONFIGURA": | ||
67 | - $vs = array( | ||
68 | - "FONTSET ", | ||
69 | - "SYMBOLSET ", | ||
70 | - "SHAPEPATH ", | ||
71 | - "EXTENT ", | ||
72 | - "IMAGE ", | ||
73 | - "IMAGEPATH ", | ||
74 | - "IMAGEURL " | ||
75 | - ); | ||
76 | - $par = array(); | ||
77 | - foreach ($vs as $v) | ||
78 | - { | ||
79 | - $handle = fopen ($mapfile, "r"); | ||
80 | - while (!feof ($handle)) { | ||
81 | - $buffer = fgets($handle); | ||
82 | - if(!(stristr($buffer, $v) === FALSE)) | ||
83 | - { | ||
84 | - $temp = explode(trim($v),$buffer); | ||
85 | - if(trim($temp[0]) != "#") | ||
86 | - { | ||
87 | - $temp = trim($temp[1]); | ||
88 | - $par[trim($v)] = $temp; | ||
89 | - fclose ($handle); | ||
90 | - break; | ||
91 | - } | ||
92 | - } | ||
93 | - } | ||
94 | - } | ||
95 | - $par["mapfile"] = $mapfile; | ||
96 | - retornaJSON($par); | ||
97 | - exit; | ||
98 | - break; | ||
99 | - /* | ||
100 | - Valor: SALVACONFIGURA | ||
101 | - | ||
102 | - Salva o valor de um parâmetro no mapfile em edição | ||
103 | - | ||
104 | - Parametros: | ||
105 | - | ||
106 | - variavel | ||
107 | - | ||
108 | - valor | ||
109 | - | ||
110 | - Retorno: | ||
111 | - | ||
112 | - {JSON} | ||
113 | - */ | ||
114 | - case "SALVACONFIGURA": | ||
115 | - salvaConfigura($variavel,$valor,$mapfile,$locaplic); | ||
116 | - retornaJSON("ok"); | ||
117 | - exit; | ||
118 | - break; | ||
119 | -} | ||
120 | -/* | ||
121 | - Salva um novo valor de uma variável no ms_configura.php | ||
122 | -*/ | ||
123 | -function salvaConfigura($variavel,$valor,$mapfile,$locaplic) | ||
124 | -{ | ||
125 | - $handle = fopen ($mapfile, "r"); | ||
126 | - $linhas = array(); | ||
127 | - $valor = str_replace("\\\"",'"',$valor); | ||
128 | - while (!feof ($handle)) { | ||
129 | - | ||
130 | - $buffer = fgets($handle); | ||
131 | - if(!(stristr($buffer, $variavel) === FALSE)) | ||
132 | - { | ||
133 | - $temp = explode(trim($variavel),$buffer); | ||
134 | - if(trim($temp[0]) != "#") | ||
135 | - { | ||
136 | - $temp = trim($temp[1]); | ||
137 | - $par[trim($variavel)] = $temp; | ||
138 | - $linhas[] = $variavel." ".$valor."\n"; | ||
139 | - $variavel = "______________"; | ||
140 | - } | ||
141 | - else{$linhas[] = $buffer; | ||
142 | - } | ||
143 | - } | ||
144 | - else | ||
145 | - $linhas[] = $buffer; | ||
146 | - } | ||
147 | - fclose ($handle); | ||
148 | - unlink($mapfile); | ||
149 | - $handle = fopen ($mapfile, "w"); | ||
150 | - foreach ($linhas as $linha) | ||
151 | - { | ||
152 | - fwrite($handle, $linha); | ||
153 | - } | ||
154 | - fclose($handle); | ||
155 | -} | ||
156 | - | ||
157 | -?> | ||
158 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/menutemas.php
@@ -1,1569 +0,0 @@ | @@ -1,1569 +0,0 @@ | ||
1 | -<?php | ||
2 | -/* | ||
3 | -Title: menutemas.php | ||
4 | - | ||
5 | -Funções utilizadas nas operações de manutenção de menus, grupo, subgrupos e temas | ||
6 | - | ||
7 | -É utilizado nas funções em AJAX da interface de edição da árvore de menus para edição de cada um de seus componentes | ||
8 | - | ||
9 | -Essas funções complementam <arvore.php> | ||
10 | - | ||
11 | -Licenca: | ||
12 | - | ||
13 | -GPL2 | ||
14 | - | ||
15 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
16 | - | ||
17 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
18 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
19 | - | ||
20 | -Este programa é software livre; você pode redistribuí-lo | ||
21 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
22 | -GNU conforme publicada pela Free Software Foundation; | ||
23 | - | ||
24 | -Este programa é distribuído na expectativa de que seja útil, | ||
25 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
26 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
27 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
28 | -Você deve ter recebido uma da Licença Pública Geral do | ||
29 | - GNU junto com este programa; se não, escreva para a | ||
30 | -Free Software Foundation, Inc., no endereço | ||
31 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
32 | - | ||
33 | -Arquivo: | ||
34 | - | ||
35 | -i3geo/admin/php/menutemas.php | ||
36 | - | ||
37 | -Parametros: | ||
38 | - | ||
39 | -O parâmetro principal é "funcao", que define qual operação será executada, por exemplo, menutemas.php?funcao=pegaMenus | ||
40 | - | ||
41 | -Cada operação possuí seus proprios parâmetros, que devem ser enviados também na requisição da operação. | ||
42 | - | ||
43 | -*/ | ||
44 | -include_once(dirname(__FILE__)."/login.php"); | ||
45 | -$funcoesEdicao = array( | ||
46 | - "ALTERAMENUS", | ||
47 | - "ALTERAGRUPOS", | ||
48 | - "ALTERASUBGRUPOS", | ||
49 | - "ATUALIZAMINIATURA", | ||
50 | - "ALTERATEMAS", | ||
51 | - "ALTERATAGS", | ||
52 | - "ALTERAPERFIS", | ||
53 | - "EXCLUIRREGISTRO" | ||
54 | -); | ||
55 | -if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
56 | - if(verificaOperacaoSessao("admin/html/arvore") == false){ | ||
57 | - retornaJSON("Vc nao pode realizar essa operacao.");exit; | ||
58 | - } | ||
59 | -} | ||
60 | - | ||
61 | -$codigo_tema = $_GET["codigo_tema"]; | ||
62 | -$id = $_GET["id"]; | ||
63 | - | ||
64 | -testaSafeNumerico([$id]); | ||
65 | - | ||
66 | -if(!isset($funcao)) | ||
67 | -{ | ||
68 | - $funcao = ""; | ||
69 | -} | ||
70 | -if(!isset($idioma)) | ||
71 | -{ | ||
72 | - $idioma = "pt"; | ||
73 | -} | ||
74 | -if($idioma == "") | ||
75 | -{ | ||
76 | - $idioma = "pt"; | ||
77 | -} | ||
78 | - | ||
79 | -//faz a busca da função que deve ser executada | ||
80 | -switch (strtoupper($funcao)) | ||
81 | -{ | ||
82 | - /* | ||
83 | - Note: | ||
84 | - | ||
85 | - Valores que o parâmetro &funcao pode receber. Os parâmetros devem ser enviados na requisição em AJAX. | ||
86 | - */ | ||
87 | - | ||
88 | - /* | ||
89 | - Valor: PEGAMENUS | ||
90 | - | ||
91 | - Lista de menus contendo todas as colunas | ||
92 | - | ||
93 | - Retorno: | ||
94 | - | ||
95 | - {JSON} | ||
96 | - */ | ||
97 | - case "PEGAMENUS": | ||
98 | - if(isset($id_menu) && $id_menu != "") | ||
99 | - { | ||
100 | - $dados = pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_menus where id_menu = $id_menu order by nome_menu"); | ||
101 | - } | ||
102 | - else{ | ||
103 | - $dados = pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_menus order by nome_menu"); | ||
104 | - } | ||
105 | - retornaJSON($dados); | ||
106 | - exit; | ||
107 | - break; | ||
108 | - /* | ||
109 | - Valor: PEGAMENUS2 | ||
110 | - | ||
111 | - Lista de menus contendo apenas colunas selecionadas | ||
112 | - | ||
113 | - Retorno: | ||
114 | - | ||
115 | - {JSON} | ||
116 | - */ | ||
117 | - case "PEGAMENUS2": | ||
118 | - if($idioma == "pt") | ||
119 | - { | ||
120 | - $coluna = "nome_menu"; | ||
121 | - } | ||
122 | - else | ||
123 | - {$coluna = $idioma; | ||
124 | - } | ||
125 | - if(isset($id_menu) && $id_menu != "") | ||
126 | - { | ||
127 | - $dados = pegaDados("SELECT publicado_menu,perfil_menu,aberto,desc_menu,id_menu,$coluna as nome_menu from ".$esquemaadmin."i3geoadmin_menus where id_menu = $id_menu order by nome_menu"); | ||
128 | - } | ||
129 | - else | ||
130 | - {$dados = pegaDados("SELECT publicado_menu,perfil_menu,aberto,desc_menu,id_menu,$coluna as nome_menu from ".$esquemaadmin."i3geoadmin_menus order by nome_menu"); | ||
131 | - } | ||
132 | - retornaJSON($dados); | ||
133 | - exit; | ||
134 | - break; | ||
135 | - /* | ||
136 | - Valor: PEGATAGS | ||
137 | - | ||
138 | - Lista de tags | ||
139 | - | ||
140 | - Retorno: | ||
141 | - | ||
142 | - {JSON} | ||
143 | - */ | ||
144 | - case "PEGATAGS": | ||
145 | - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_tags order by nome"; | ||
146 | - retornaJSON(pegaDados($sql)); | ||
147 | - exit; | ||
148 | - break; | ||
149 | - /* | ||
150 | - Valor: PEGATAGSPORMAPFILE | ||
151 | - | ||
152 | - Lista de tags por mapfile | ||
153 | - | ||
154 | - Retorno: | ||
155 | - | ||
156 | - {JSON} | ||
157 | - */ | ||
158 | - case "PEGATAGSPORMAPFILE": | ||
159 | - if($idioma == "pt") | ||
160 | - { | ||
161 | - $coluna = "nome_tema"; | ||
162 | - } | ||
163 | - else | ||
164 | - {$coluna = $idioma; | ||
165 | - } | ||
166 | - | ||
167 | - $q = pegaDados("select link_tema,tags_tema,codigo_tema,$coluna as nome_tema from ".$esquemaadmin."i3geoadmin_temas"); | ||
168 | - $temas = array(); | ||
169 | - $temaExiste = array(); | ||
170 | - foreach($q as $row) | ||
171 | - { | ||
172 | - $ts = html_entity_decode($row['tags_tema']); | ||
173 | - $i = $row['codigo_tema']; | ||
174 | - $nome = $row['nome_tema']; | ||
175 | - $link = $row['link_tema']; | ||
176 | - $tags = explode(" ",$ts); | ||
177 | - foreach($tags as $t) | ||
178 | - { | ||
179 | - if (removeAcentos($t) == $tag) | ||
180 | - { | ||
181 | - if(!isset($temaExiste[$i])) | ||
182 | - { | ||
183 | - $temas[] = array("codigoMap"=>$i,"nome"=>$nome,"link"=>$link); | ||
184 | - $temaExiste[$i] = 0; | ||
185 | - } | ||
186 | - } | ||
187 | - } | ||
188 | - } | ||
189 | - retornaJSON($temas); | ||
190 | - exit; | ||
191 | - break; | ||
192 | - /* | ||
193 | - Valor: PEGAPERFIS | ||
194 | - | ||
195 | - Lista de perfis | ||
196 | - | ||
197 | - Retorno: | ||
198 | - | ||
199 | - {JSON} | ||
200 | - */ | ||
201 | - case "PEGAPERFIS": | ||
202 | - $dados = pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_perfis order by perfil"); | ||
203 | - if(count($dados) == 0){ | ||
204 | - $dados = array("id_perfil"=>"","perfil"=>""); | ||
205 | - } | ||
206 | - retornaJSON($dados); | ||
207 | - exit; | ||
208 | - break; | ||
209 | - /* | ||
210 | - Valor: ALTERAMENUS | ||
211 | - | ||
212 | - Altera os dados de um menu | ||
213 | - | ||
214 | - Parametros: | ||
215 | - | ||
216 | - nome_menu | ||
217 | - | ||
218 | - desc_menu | ||
219 | - | ||
220 | - id_menu | ||
221 | - | ||
222 | - aberto | ||
223 | - | ||
224 | - perfil_menu | ||
225 | - | ||
226 | - publicado_menu | ||
227 | - | ||
228 | - en_menu | ||
229 | - | ||
230 | - es_menu | ||
231 | - | ||
232 | - it_menu | ||
233 | - | ||
234 | - Retorno: | ||
235 | - | ||
236 | - {JSON} | ||
237 | - */ | ||
238 | - case "ALTERAMENUS": | ||
239 | - $retorna = alteraMenus(); | ||
240 | - if(isset($id_menu) && $id_menu != ""){ | ||
241 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_menus where id_menu = $id_menu order by nome_menu")); | ||
242 | - } | ||
243 | - else{ | ||
244 | - retornaJSON($retorna); | ||
245 | - } | ||
246 | - exit; | ||
247 | - break; | ||
248 | - /* | ||
249 | - Valor: PEGAGRUPOS | ||
250 | - | ||
251 | - Lista de grupos com todas as colunas | ||
252 | - | ||
253 | - Retorno: | ||
254 | - | ||
255 | - {JSON} | ||
256 | - */ | ||
257 | - case "PEGAGRUPOS": | ||
258 | - if(isset($id_grupo) && $id_grupo != "") | ||
259 | - { | ||
260 | - $dados = pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_grupos WHERE id_grupo = $id_grupo order by nome_grupo"); | ||
261 | - } | ||
262 | - else{ | ||
263 | - $dados = pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_grupos order by nome_grupo"); | ||
264 | - } | ||
265 | - retornaJSON($dados); | ||
266 | - exit; | ||
267 | - break; | ||
268 | - /* | ||
269 | - Valor: PEGAGRUPOS2 | ||
270 | - | ||
271 | - Lista de grupos contendo as colunas principais | ||
272 | - | ||
273 | - Retorno: | ||
274 | - | ||
275 | - {JSON} | ||
276 | - */ | ||
277 | - case "PEGAGRUPOS2": | ||
278 | - $nome = "nome_grupo"; | ||
279 | - if($idioma != "pt"){ | ||
280 | - $nome = $idioma; | ||
281 | - } | ||
282 | - $dados = pegaDados("SELECT desc_grupo,id_grupo,$nome as 'nome_grupo' from ".$esquemaadmin."i3geoadmin_grupos order by $nome"); | ||
283 | - retornaJSON($dados); | ||
284 | - exit; | ||
285 | - break; | ||
286 | - /* | ||
287 | - Valor: ALTERAGRUPOS | ||
288 | - | ||
289 | - Altera os dados de um grupo | ||
290 | - | ||
291 | - Parametros: | ||
292 | - | ||
293 | - nome | ||
294 | - | ||
295 | - desc | ||
296 | - | ||
297 | - id | ||
298 | - | ||
299 | - en | ||
300 | - | ||
301 | - es | ||
302 | - | ||
303 | - it | ||
304 | - | ||
305 | - Retorno: | ||
306 | - | ||
307 | - {JSON} | ||
308 | - */ | ||
309 | - case "ALTERAGRUPOS": | ||
310 | - alteraGrupos(); | ||
311 | - if(isset($id_grupo) && $id_grupo != "") { | ||
312 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_grupos WHERE id_grupo = $id_grupo")); | ||
313 | - } | ||
314 | - else{ | ||
315 | - retornaJSON("ok"); | ||
316 | - } | ||
317 | - exit; | ||
318 | - break; | ||
319 | - /* | ||
320 | - Valor: PEGASUBGRUPOS | ||
321 | - | ||
322 | - Lista de subgrupos com todas as colunas | ||
323 | - | ||
324 | - Retorno: | ||
325 | - | ||
326 | - {JSON} | ||
327 | - */ | ||
328 | - case "PEGASUBGRUPOS": | ||
329 | - if(isset($id_subgrupo) && $id_subgrupo != ""){ | ||
330 | - $dados = pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_subgrupos WHERE id_subgrupo = $id_subgrupo order by nome_subgrupo"); | ||
331 | - } | ||
332 | - else{ | ||
333 | - $dados = pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_subgrupos order by nome_subgrupo"); | ||
334 | - } | ||
335 | - retornaJSON($dados); | ||
336 | - exit; | ||
337 | - break; | ||
338 | - /* | ||
339 | - Valor: PEGASUBGRUPOS2 | ||
340 | - | ||
341 | - Lista de grupos contendo as colunas principais | ||
342 | - | ||
343 | - Retorno: | ||
344 | - | ||
345 | - {JSON} | ||
346 | - */ | ||
347 | - case "PEGASUBGRUPOS2": | ||
348 | - $nome = "nome_subgrupo"; | ||
349 | - if($idioma != "pt"){ | ||
350 | - $nome = $idioma; | ||
351 | - } | ||
352 | - $dados = pegaDados("SELECT desc_subgrupo,id_subgrupo,$nome as 'nome_subgrupo' from ".$esquemaadmin."i3geoadmin_subgrupos order by nome_subgrupo"); | ||
353 | - retornaJSON($dados); | ||
354 | - exit; | ||
355 | - break; | ||
356 | - /* | ||
357 | - Valor: ALTERASUBGRUPOS | ||
358 | - | ||
359 | - Altera os dados de um subgrupo | ||
360 | - | ||
361 | - Parametros: | ||
362 | - | ||
363 | - nome | ||
364 | - | ||
365 | - desc | ||
366 | - | ||
367 | - id | ||
368 | - | ||
369 | - en | ||
370 | - | ||
371 | - es | ||
372 | - | ||
373 | - it | ||
374 | - | ||
375 | - Retorno: | ||
376 | - | ||
377 | - {JSON} | ||
378 | - */ | ||
379 | - case "ALTERASUBGRUPOS": | ||
380 | - alteraSubGrupos(); | ||
381 | - if(isset($id_subgrupo) && $id_subgrupo != "") { | ||
382 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_subgrupos WHERE id_subgrupo = $id_subgrupo")); | ||
383 | - } | ||
384 | - else{ | ||
385 | - retornaJSON("ok"); | ||
386 | - } | ||
387 | - exit; | ||
388 | - break; | ||
389 | - /* | ||
390 | - Valor: PEGATEMAS | ||
391 | - | ||
392 | - Lista de temas com todas as colunas | ||
393 | - | ||
394 | - Retorno: | ||
395 | - | ||
396 | - {JSON} | ||
397 | - */ | ||
398 | - case "PEGATEMAS": | ||
399 | - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_temas where id_tema = '$id_tema'"; | ||
400 | - retornaJSON(pegaDados($sql)); | ||
401 | - exit; | ||
402 | - break; | ||
403 | - /* | ||
404 | - Valor: PEGATEMAPORMAPFILE | ||
405 | - | ||
406 | - Lista os dados de um tema procurando registros com base no nome do mapfile | ||
407 | - | ||
408 | - Parametro: | ||
409 | - | ||
410 | - codigo_tema - nome do mapfile sem ".map" | ||
411 | - | ||
412 | - Retorno: | ||
413 | - | ||
414 | - {JSON} | ||
415 | - */ | ||
416 | - case "PEGATEMAPORMAPFILE": | ||
417 | - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_temas where codigo_tema = '$codigo_tema'"; | ||
418 | - $dados = pegaDados($sql); | ||
419 | - if(is_array($dados) && count($dados) == 0) | ||
420 | - { | ||
421 | - registraTema(); | ||
422 | - $dados = pegaDados($sql); | ||
423 | - } | ||
424 | - $imagem = ""; | ||
425 | - if(file_exists($locaplic."/temas/miniaturas/".$codigo_tema.".map.grande.png")) | ||
426 | - { | ||
427 | - $imagem = $codigo_tema.".map.grande.png"; | ||
428 | - } | ||
429 | - $dados[0]["imagem"] = $imagem; | ||
430 | - if(is_array($dados) && count($dados) > 1) | ||
431 | - { | ||
432 | - $dados = "erro. Mais de um mapfile com mesmo c�digo registrado no banco"; | ||
433 | - } | ||
434 | - retornaJSON($dados); | ||
435 | - exit; | ||
436 | - break; | ||
437 | - /* | ||
438 | - Valor: PEGATEMAS2 | ||
439 | - | ||
440 | - Lista de temas com as colunas principais | ||
441 | - | ||
442 | - Retorno: | ||
443 | - | ||
444 | - {JSON} | ||
445 | - */ | ||
446 | - case "PEGATEMAS2": | ||
447 | - retornaJSON(pegaTemas2()); | ||
448 | - exit; | ||
449 | - break; | ||
450 | - /* | ||
451 | - Valor: ATUALIZAMINIATURA | ||
452 | - | ||
453 | - Atualiza as imagens das miniaturas de um tema | ||
454 | - | ||
455 | - Retorno: | ||
456 | - | ||
457 | - {JSON} | ||
458 | - */ | ||
459 | - case "ATUALIZAMINIATURA": | ||
460 | - retornaJSON(atualizaMiniatura($_GET["tema"])); | ||
461 | - exit; | ||
462 | - break; | ||
463 | - /* | ||
464 | - Valor: ALTERATEMAS | ||
465 | - | ||
466 | - Altera os dados de um tema | ||
467 | - | ||
468 | - Parametros: | ||
469 | - | ||
470 | - nome | ||
471 | - | ||
472 | - desc | ||
473 | - | ||
474 | - id | ||
475 | - | ||
476 | - codigo | ||
477 | - | ||
478 | - tipoa | ||
479 | - | ||
480 | - download | ||
481 | - | ||
482 | - ogc | ||
483 | - | ||
484 | - kml | ||
485 | - | ||
486 | - link | ||
487 | - | ||
488 | - tags | ||
489 | - | ||
490 | - kmz | ||
491 | - | ||
492 | - locaplic | ||
493 | - | ||
494 | - Retorno: | ||
495 | - | ||
496 | - {JSON} | ||
497 | - */ | ||
498 | - case "ALTERATEMAS": | ||
499 | - //$r será igual ao novo id criado, no caso de inserção de um novo tema | ||
500 | - $r = alteraTemas(); | ||
501 | - if($id == ""){ | ||
502 | - retornaJSON($r); | ||
503 | - } | ||
504 | - else{ | ||
505 | - retornaJSON(pegaDados("select * from ".$esquemaadmin."i3geoadmin_temas where id_tema = $id")); | ||
506 | - } | ||
507 | - exit; | ||
508 | - break; | ||
509 | - /* | ||
510 | - Valor: ALTERATAGS | ||
511 | - | ||
512 | - Altera os dados de um tag | ||
513 | - | ||
514 | - Parametros: | ||
515 | - | ||
516 | - nome | ||
517 | - | ||
518 | - id | ||
519 | - | ||
520 | - Retorno: | ||
521 | - | ||
522 | - {JSON} | ||
523 | - */ | ||
524 | - case "ALTERATAGS": | ||
525 | - $novo = alteraTags(); | ||
526 | - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_tags WHERE id_tag = '".$novo."'"; | ||
527 | - retornaJSON(pegaDados($sql)); | ||
528 | - exit; | ||
529 | - break; | ||
530 | - /* | ||
531 | - Valor: ALTERAPERFIS | ||
532 | - | ||
533 | - Altera os dados de um perfil | ||
534 | - | ||
535 | - Parametros: | ||
536 | - | ||
537 | - perfil | ||
538 | - | ||
539 | - id | ||
540 | - | ||
541 | - Retorno: | ||
542 | - | ||
543 | - {JSON} | ||
544 | - */ | ||
545 | - case "ALTERAPERFIS": | ||
546 | - $novo = alteraPerfis(); | ||
547 | - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_perfis WHERE id_perfil = '".$novo."'"; | ||
548 | - retornaJSON(pegaDados($sql)); | ||
549 | - exit; | ||
550 | - break; | ||
551 | - | ||
552 | - case "EXCLUIRREGISTRO": | ||
553 | - $tabela = $_GET["tabela"]; | ||
554 | - if($tabela == "grupos") | ||
555 | - { | ||
556 | - $tabela = "i3geoadmin_grupos"; | ||
557 | - $coluna = "id_grupo"; | ||
558 | - $filhos = verificaFilhos(); | ||
559 | - if($filhos) | ||
560 | - { | ||
561 | - retornaJSON("erro"); | ||
562 | - exit; | ||
563 | - } | ||
564 | - } | ||
565 | - if($tabela == "tags") | ||
566 | - { | ||
567 | - $tabela = "i3geoadmin_tags"; | ||
568 | - $coluna = "id_tag"; | ||
569 | - //excluiTagTemas($id); | ||
570 | - } | ||
571 | - if($tabela == "perfis") | ||
572 | - { | ||
573 | - $tabela = "i3geoadmin_perfis"; | ||
574 | - $coluna = "id_perfil"; | ||
575 | - excluiPerfil($id); | ||
576 | - } | ||
577 | - if($tabela == "subgrupos") | ||
578 | - { | ||
579 | - $tabela = "i3geoadmin_subgrupos"; | ||
580 | - $coluna = "id_subgrupo"; | ||
581 | - $filhos = verificaFilhos(); | ||
582 | - if($filhos) | ||
583 | - { | ||
584 | - retornaJSON("erro"); | ||
585 | - exit; | ||
586 | - } | ||
587 | - } | ||
588 | - if($tabela == "temas") | ||
589 | - { | ||
590 | - $tabela = "i3geoadmin_temas"; | ||
591 | - $coluna = "id_tema"; | ||
592 | - $filhos = verificaFilhos(); | ||
593 | - if($filhos) | ||
594 | - { | ||
595 | - retornaJSON("erro"); | ||
596 | - exit; | ||
597 | - } | ||
598 | - } | ||
599 | - if($tabela == "menus") | ||
600 | - { | ||
601 | - $tabela = "i3geoadmin_menus"; | ||
602 | - $coluna = "id_menu"; | ||
603 | - $filhos = verificaFilhos(); | ||
604 | - if($filhos){ | ||
605 | - retornaJSON("erro"); | ||
606 | - exit; | ||
607 | - } | ||
608 | - } | ||
609 | - retornaJSON(exclui($esquemaadmin.$tabela,$coluna,$id)); | ||
610 | - exit; | ||
611 | - break; | ||
612 | - | ||
613 | - case "LISTAMAPSTEMAS": | ||
614 | - retornaJSON(listaMapsTemas()); | ||
615 | - exit; | ||
616 | - break; | ||
617 | - /* | ||
618 | - Valor: VERIFICAORFAOS | ||
619 | - | ||
620 | - Verifica se existem temas sem o correspondente mapfile | ||
621 | - | ||
622 | - Retorno: | ||
623 | - | ||
624 | - {JSON} | ||
625 | - */ | ||
626 | - case "VERIFICAORFAOS": | ||
627 | - retornaJSON(verificaOrfaos()); | ||
628 | - exit; | ||
629 | - break; | ||
630 | -} | ||
631 | -function excluiPerfil($id) | ||
632 | -{ | ||
633 | - global $esquemaadmin; | ||
634 | - require_once("conexao.php"); | ||
635 | - $perfil = ""; | ||
636 | - foreach($dbh->query("select * from ".$esquemaadmin."i3geoadmin_perfis where perfil = '$id'") as $row){ | ||
637 | - $perfil = $row["perfil"]; | ||
638 | - } | ||
639 | - if($perfil == ""){ | ||
640 | - return; | ||
641 | - } | ||
642 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_mapas"); | ||
643 | - foreach($q as $row){ | ||
644 | - $t = $row['perfil_mapa']; | ||
645 | - $i = $row['id_mapa']; | ||
646 | - $ts = str_replace($perfil,"",$t); | ||
647 | - if($t != $ts){ | ||
648 | - $dataCol = array( | ||
649 | - "perfil_mapa" => $ts | ||
650 | - ); | ||
651 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_mapas",$dataCol,"WHERE id_mapa = $i"); | ||
652 | - } | ||
653 | - } | ||
654 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_menus"); | ||
655 | - foreach($q as $row){ | ||
656 | - $t = $row['perfil_menu']; | ||
657 | - $i = $row['id_menu']; | ||
658 | - $ts = str_replace($perfil,"",$t); | ||
659 | - if($t != $ts){ | ||
660 | - $dataCol = array( | ||
661 | - "perfil_menu" => $ts | ||
662 | - ); | ||
663 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_menus",$dataCol,"WHERE id_menu = $i"); | ||
664 | - } | ||
665 | - } | ||
666 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_n1"); | ||
667 | - foreach($q as $row){ | ||
668 | - $t = $row['perfil_n1']; | ||
669 | - $i = $row['id_n1']; | ||
670 | - $ts = str_replace($perfil,"",$t); | ||
671 | - if($t != $ts){ | ||
672 | - $dataCol = array( | ||
673 | - "perfil_n1" => $ts | ||
674 | - ); | ||
675 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_n1",$dataCol,"WHERE id_n1 = $i"); | ||
676 | - } | ||
677 | - } | ||
678 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_n2"); | ||
679 | - foreach($q as $row){ | ||
680 | - $t = $row['perfil_n2']; | ||
681 | - $i = $row['id_n2']; | ||
682 | - $ts = str_replace($perfil,"",$t); | ||
683 | - if($t != $ts){ | ||
684 | - $dataCol = array( | ||
685 | - "perfil_n2" => $ts | ||
686 | - ); | ||
687 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_n2",$dataCol,"WHERE id_n2 = $i"); | ||
688 | - } | ||
689 | - } | ||
690 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_n3"); | ||
691 | - foreach($q as $row){ | ||
692 | - $t = $row['perfil_n3']; | ||
693 | - $i = $row['id_n3']; | ||
694 | - $ts = str_replace($perfil,"",$t); | ||
695 | - if($t != $ts){ | ||
696 | - $dataCol = array( | ||
697 | - "perfil_n3" => $ts | ||
698 | - ); | ||
699 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_n3",$dataCol,"WHERE id_n3 = $i"); | ||
700 | - } | ||
701 | - } | ||
702 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_raiz"); | ||
703 | - foreach($q as $row){ | ||
704 | - $t = $row['perfil']; | ||
705 | - $i = $row['id_raiz']; | ||
706 | - $ts = str_replace($perfil,"",$t); | ||
707 | - if($t != $ts){ | ||
708 | - $dataCol = array( | ||
709 | - "perfil" => $ts | ||
710 | - ); | ||
711 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_raiz",$dataCol,"WHERE id_raiz = $i"); | ||
712 | - } | ||
713 | - } | ||
714 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_sistemasf"); | ||
715 | - foreach($q as $row){ | ||
716 | - $t = $row['perfil_funcao']; | ||
717 | - $i = $row['id_funcao']; | ||
718 | - $ts = str_replace($perfil,"",$t); | ||
719 | - if($t != $ts){ | ||
720 | - $dataCol = array( | ||
721 | - "perfil_funcao" => $ts | ||
722 | - ); | ||
723 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_sistemasf",$dataCol,"WHERE id_funcao = $i"); | ||
724 | - } | ||
725 | - } | ||
726 | -} | ||
727 | -function excluiTagTemas($id) | ||
728 | -{ | ||
729 | - global $esquemaadmin; | ||
730 | - require_once("conexao.php"); | ||
731 | - $q1 = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_tags where id_tag = $id"); | ||
732 | - foreach($q1 as $row){ | ||
733 | - $nometag = $row["nome"]; | ||
734 | - } | ||
735 | - if($nometag == ""){ | ||
736 | - return; | ||
737 | - } | ||
738 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_temas"); | ||
739 | - foreach($q as $row){ | ||
740 | - $t = $row['tags_tema']; | ||
741 | - $i = $row['id_tema']; | ||
742 | - $ts = str_replace($nometag,"",$t); | ||
743 | - if($t != $ts){ | ||
744 | - $dataCol = array( | ||
745 | - "tags_tema" => $ts | ||
746 | - ); | ||
747 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE id_tema = $i"); | ||
748 | - } | ||
749 | - } | ||
750 | -} | ||
751 | -/* | ||
752 | -Pega a lista de temas | ||
753 | - | ||
754 | -Parameters: | ||
755 | - | ||
756 | -filtro - texto para filtrar os dados | ||
757 | -*/ | ||
758 | -function pegaTemas() | ||
759 | -{ | ||
760 | - global $esquemaadmin; | ||
761 | - try | ||
762 | - { | ||
763 | - $resultado = array(); | ||
764 | - require_once("conexao.php"); | ||
765 | - foreach($dbh->query("SELECT * from ".$esquemaadmin."i3geoadmin_temas order by nome_tema") as $row) | ||
766 | - { | ||
767 | - $continua = true; | ||
768 | - if(isset($_GET["filtro"]) && $_GET["filtro"] != "") | ||
769 | - { | ||
770 | - $continua = false; | ||
771 | - if ($row['codigo_tema'] == $_GET["filtro"]) | ||
772 | - { | ||
773 | - $continua = true; | ||
774 | - } | ||
775 | - $testanome = mb_convert_encoding($_GET["filtro"],"UTF-8","ISO-8859-1"); | ||
776 | - if (!stristr($row['nome_tema'],$testanome) === FALSE) | ||
777 | - { | ||
778 | - $continua = true; | ||
779 | - } | ||
780 | - if (!stristr($row['tags_tema'],$testanome) === FALSE) | ||
781 | - { | ||
782 | - $continua = true; | ||
783 | - } | ||
784 | - } | ||
785 | - if($row['codigo_tema'] == ""){ | ||
786 | - $continua = true; | ||
787 | - } | ||
788 | - if ($continua) | ||
789 | - $resultado[] = array( | ||
790 | - "nome_tema"=>$row['nome_tema'], | ||
791 | - "codigo_tema"=>$row['codigo_tema'], | ||
792 | - "id_tema"=>$row['id_tema'], | ||
793 | - "desc_tema"=>$row['desc_tema'], | ||
794 | - "link_tema"=>$row['link_tema'], | ||
795 | - "tipoa_tema"=>$row['tipoa_tema'], | ||
796 | - "download_tema"=>$row['download_tema'], | ||
797 | - "ogc_tema"=>$row['ogc_tema'], | ||
798 | - "kml_tema"=>$row['kml_tema'], | ||
799 | - "kmz_tema"=>$row['kmz_tema'], | ||
800 | - "tags_tema"=>$row['tags_tema'] | ||
801 | - ); | ||
802 | - } | ||
803 | - $dbh = null; | ||
804 | - $dbh = null; | ||
805 | - return $resultado; | ||
806 | - } | ||
807 | - catch (PDOException $e) | ||
808 | - { | ||
809 | - return "Error!: "; | ||
810 | - } | ||
811 | -} | ||
812 | -function pegaTemas2() | ||
813 | -{ | ||
814 | - global $esquemaadmin; | ||
815 | - try | ||
816 | - { | ||
817 | - $resultado = array(); | ||
818 | - require_once("conexao.php"); | ||
819 | - foreach($dbh->query("SELECT codigo_tema,nome_tema,id_tema from ".$esquemaadmin."i3geoadmin_temas order by nome_tema") as $row) | ||
820 | - { | ||
821 | - $continua = true; | ||
822 | - if(isset($_GET["filtro"]) && $_GET["filtro"] != "") | ||
823 | - { | ||
824 | - $continua = false; | ||
825 | - if ($row['codigo_tema'] == $_GET["filtro"]) | ||
826 | - { | ||
827 | - $continua = true; | ||
828 | - } | ||
829 | - $testanome = mb_convert_encoding($_GET["filtro"],"UTF-8","ISO-8859-1"); | ||
830 | - if (!stristr($row['nome_tema'],$testanome) === FALSE) | ||
831 | - { | ||
832 | - $continua = true; | ||
833 | - } | ||
834 | - } | ||
835 | - if($row['codigo_tema'] == ""){ | ||
836 | - $continua = true; | ||
837 | - } | ||
838 | - if ($continua) | ||
839 | - $resultado[] = array( | ||
840 | - "nome_tema"=>$row['nome_tema'], | ||
841 | - "codigo_tema"=>$row['codigo_tema'], | ||
842 | - "id_tema"=>$row['id_tema'] | ||
843 | - ); | ||
844 | - } | ||
845 | - $dbh = null; | ||
846 | - $dbh = null; | ||
847 | - return $resultado; | ||
848 | - } | ||
849 | - catch (PDOException $e) | ||
850 | - { | ||
851 | - return "Error!: "; | ||
852 | - } | ||
853 | -} | ||
854 | -/* | ||
855 | -Altera o registro de um menu. Se id for vazio acrescenta o registro | ||
856 | -*/ | ||
857 | -function alteraMenus() | ||
858 | -{ | ||
859 | - global $esquemaadmin,$id_menu; | ||
860 | - $en = $_GET["en"]; | ||
861 | - $es = $_GET["es"]; | ||
862 | - $it = $_GET["it"]; | ||
863 | - try | ||
864 | - { | ||
865 | - $retorna = ""; | ||
866 | - include("conexao.php"); | ||
867 | - if($convUTF){ | ||
868 | - $_GET["nome_menu"] = utf8_encode($_GET["nome_menu"]); | ||
869 | - $_GET["desc_menu"] = utf8_encode($_GET["desc_menu"]); | ||
870 | - $en = utf8_encode($en); | ||
871 | - $es = utf8_encode($es); | ||
872 | - $it = utf8_encode($it); | ||
873 | - } | ||
874 | - if($id_menu != ""){ | ||
875 | - $dataCol = array( | ||
876 | - "en" => $en, | ||
877 | - "es" => $es, | ||
878 | - "it" => $it, | ||
879 | - "publicado_menu" => $_GET["publicado_menu"], | ||
880 | - "aberto" => $_GET["aberto"], | ||
881 | - "nome_menu" => $_GET["nome_menu"], | ||
882 | - "desc_menu" => $_GET["desc_menu"], | ||
883 | - "perfil_menu" => $_GET["perfil_menu"] | ||
884 | - ); | ||
885 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_menus",$dataCol,"WHERE id_menu = $id_menu"); | ||
886 | - $retorna = "ok"; | ||
887 | - } | ||
888 | - else{ | ||
889 | - $dataCol = array( | ||
890 | - "en" => "", | ||
891 | - "es" => "", | ||
892 | - "it" => "", | ||
893 | - "publicado_menu" => "", | ||
894 | - "aberto" => "SIM", | ||
895 | - "nome_menu" => "", | ||
896 | - "desc_menu" => "", | ||
897 | - "perfil_menu" => "" | ||
898 | - ); | ||
899 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_menus",$dataCol,"nome_menu","id_menu"); | ||
900 | - } | ||
901 | - $dbhw = null; | ||
902 | - $dbh = null; | ||
903 | - return $retorna; | ||
904 | - } | ||
905 | - catch (PDOException $e){ | ||
906 | - return "Error!: "; | ||
907 | - } | ||
908 | -} | ||
909 | -function alteraPerfis(){ | ||
910 | - global $perfil,$id,$esquemaadmin; | ||
911 | - try | ||
912 | - { | ||
913 | - $dbh = ""; | ||
914 | - include("conexao.php"); | ||
915 | - if($convUTF) $perfil = utf8_encode($perfil); | ||
916 | - $retorna = ""; | ||
917 | - if($id != ""){ | ||
918 | - $original = ""; | ||
919 | - foreach($dbh->query("select * from ".$esquemaadmin."i3geoadmin_perfis where id_perfil = $id") as $row){ | ||
920 | - $original = $row["perfil"]; | ||
921 | - } | ||
922 | - $dataCol = array( | ||
923 | - "perfil" => $perfil | ||
924 | - ); | ||
925 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_perfis",$dataCol,"WHERE id_perfil = $id"); | ||
926 | - | ||
927 | - if($original != ""){ | ||
928 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_mapas"); | ||
929 | - foreach($q as $row){ | ||
930 | - $t = $row['perfil_mapa']; | ||
931 | - $i = $row['id_mapa']; | ||
932 | - $ts = str_replace($original,$perfil,$t); | ||
933 | - if($t != $ts){ | ||
934 | - $dataCol = array( | ||
935 | - "perfil_mapa" => $ts | ||
936 | - ); | ||
937 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_mapas",$dataCol,"WHERE id_mapa = $i"); | ||
938 | - } | ||
939 | - } | ||
940 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_menus"); | ||
941 | - foreach($q as $row){ | ||
942 | - $t = $row['perfil_menu']; | ||
943 | - $i = $row['id_menu']; | ||
944 | - $ts = str_replace($original,$perfil,$t); | ||
945 | - if($t != $ts){ | ||
946 | - $dataCol = array( | ||
947 | - "perfil_menu" => $ts | ||
948 | - ); | ||
949 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_menus",$dataCol,"WHERE id_menu = $i"); | ||
950 | - } | ||
951 | - } | ||
952 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_n1"); | ||
953 | - foreach($q as $row){ | ||
954 | - $t = $row['n1_perfil']; | ||
955 | - $i = $row['id_n1']; | ||
956 | - $ts = str_replace($original,$perfil,$t); | ||
957 | - if($t != $ts){ | ||
958 | - $dataCol = array( | ||
959 | - "n1_perfil" => $ts | ||
960 | - ); | ||
961 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_n1",$dataCol,"WHERE id_n1 = $i"); | ||
962 | - } | ||
963 | - } | ||
964 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_n2"); | ||
965 | - foreach($q as $row){ | ||
966 | - $t = $row['n2_perfil']; | ||
967 | - $i = $row['id_n2']; | ||
968 | - $ts = str_replace($original,$perfil,$t); | ||
969 | - if($t != $ts){ | ||
970 | - $dataCol = array( | ||
971 | - "n2_perfil" => $ts | ||
972 | - ); | ||
973 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_n2",$dataCol,"WHERE id_n2 = $i"); | ||
974 | - } | ||
975 | - } | ||
976 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_n3"); | ||
977 | - foreach($q as $row){ | ||
978 | - $t = $row['n3_perfil']; | ||
979 | - $i = $row['id_n3']; | ||
980 | - $ts = str_replace($original,$perfil,$t); | ||
981 | - if($t != $ts){ | ||
982 | - $dataCol = array( | ||
983 | - "n3_perfil" => $ts | ||
984 | - ); | ||
985 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_n3",$dataCol,"WHERE id_n3 = $i"); | ||
986 | - } | ||
987 | - } | ||
988 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_raiz"); | ||
989 | - foreach($q as $row){ | ||
990 | - $t = $row['perfil']; | ||
991 | - $i = $row['id_raiz']; | ||
992 | - $ts = str_replace($original,$perfil,$t); | ||
993 | - if($t != $ts){ | ||
994 | - $dataCol = array( | ||
995 | - "perfil" => $ts | ||
996 | - ); | ||
997 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_raiz",$dataCol,"WHERE id_raiz = $i"); | ||
998 | - } | ||
999 | - } | ||
1000 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_sistemas"); | ||
1001 | - foreach($q as $row) | ||
1002 | - { | ||
1003 | - $t = $row['perfil_sistema']; | ||
1004 | - $i = $row['id_sistema']; | ||
1005 | - $ts = str_replace($original,$perfil,$t); | ||
1006 | - if($t != $ts){ | ||
1007 | - $dataCol = array( | ||
1008 | - "perfil_sistema" => $ts | ||
1009 | - ); | ||
1010 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_sistemas",$dataCol,"WHERE id_sistema = $i"); | ||
1011 | - } | ||
1012 | - } | ||
1013 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_sistemasf"); | ||
1014 | - foreach($q as $row){ | ||
1015 | - $t = $row['perfil_funcao']; | ||
1016 | - $i = $row['id_funcao']; | ||
1017 | - $ts = str_replace($original,$perfil,$t); | ||
1018 | - if($t != $ts){ | ||
1019 | - $dataCol = array( | ||
1020 | - "perfil_funcao" => $ts | ||
1021 | - ); | ||
1022 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_sistemasf",$dataCol,"WHERE id_funcao = $i"); | ||
1023 | - } | ||
1024 | - } | ||
1025 | - } | ||
1026 | - $retorna = $id; | ||
1027 | - } | ||
1028 | - else{ | ||
1029 | - $dataCol = array( | ||
1030 | - "perfil" => $perfil | ||
1031 | - ); | ||
1032 | - i3GeoAdminInsert($dbhw,"i3geoadmin_perfis",$dataCol); | ||
1033 | - $id = $dbh->query("SELECT * FROM ".$esquemaadmin."i3geoadmin_perfis"); | ||
1034 | - $id = $id->fetchAll(); | ||
1035 | - $id = intval($id[count($id)-1]['id_perfil']); | ||
1036 | - $retorna = $id; | ||
1037 | - } | ||
1038 | - $dbhw = null; | ||
1039 | - $dbh = null; | ||
1040 | - return $retorna; | ||
1041 | - } | ||
1042 | - catch (PDOException $e){ | ||
1043 | - return "Error!: "; | ||
1044 | - } | ||
1045 | -} | ||
1046 | -function alteraTags(){ | ||
1047 | - global $id,$esquemaadmin; | ||
1048 | - $nome = $_GET["nome"]; | ||
1049 | - try{ | ||
1050 | - $dbh = ""; | ||
1051 | - include("conexao.php"); | ||
1052 | - if($convUTF) $nome = utf8_encode($nome); | ||
1053 | - $retorna = ""; | ||
1054 | - if($id != ""){ | ||
1055 | - if(!verificaDuplicados("select * from ".$esquemaadmin."i3geoadmin_tags where nome = '$nome'",$dbh)){ | ||
1056 | - $original = ""; | ||
1057 | - $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_tags where id_tag = $id"); | ||
1058 | - foreach($q as $row){ | ||
1059 | - $original = $row["nome"]; | ||
1060 | - } | ||
1061 | - $dataCol = array( | ||
1062 | - "nome" => $nome | ||
1063 | - ); | ||
1064 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_tags",$dataCol,"WHERE id_tag = $id"); | ||
1065 | - } | ||
1066 | - $retorna = $id; | ||
1067 | - } | ||
1068 | - else{ | ||
1069 | - $dataCol = array( | ||
1070 | - "nome" => $nome | ||
1071 | - ); | ||
1072 | - i3GeoAdminInsert($dbhw,"i3geoadmin_tags",$dataCol); | ||
1073 | - $id = $dbh->query("SELECT * FROM ".$esquemaadmin."i3geoadmin_tags"); | ||
1074 | - $id = $id->fetchAll(); | ||
1075 | - $id = intval($id[count($id)-1]['id_tag']); | ||
1076 | - $retorna = $id; | ||
1077 | - } | ||
1078 | - $dbhw = null; | ||
1079 | - $dbh = null; | ||
1080 | - return $retorna; | ||
1081 | - } | ||
1082 | - catch (PDOException $e){ | ||
1083 | - return "Error!: "; | ||
1084 | - } | ||
1085 | -} | ||
1086 | -/* | ||
1087 | -Altera o registro de um grupo. Se id for vazio acrescenta o registro | ||
1088 | -*/ | ||
1089 | -function alteraGrupos() | ||
1090 | -{ | ||
1091 | - global $id_grupo,$esquemaadmin; | ||
1092 | - try{ | ||
1093 | - require(dirname(__FILE__)."/conexao.php"); | ||
1094 | - if($convUTF){ | ||
1095 | - $_GET["nome_grupo"] = utf8_encode($_GET["nome_grupo"]); | ||
1096 | - $_GET["desc_grupo"] = utf8_encode($_GET["desc_grupo"]); | ||
1097 | - $_GET["en"] = utf8_encode($_GET["en"]); | ||
1098 | - $_GET["es"] = utf8_encode($_GET["es"]); | ||
1099 | - $_GET["it"] = utf8_encode($_GET["it"]); | ||
1100 | - } | ||
1101 | - if($id_grupo != ""){ | ||
1102 | - $dataCol = array( | ||
1103 | - "en" => $_GET["en"], | ||
1104 | - "es" => $_GET["es"], | ||
1105 | - "it" => $_GET["it"], | ||
1106 | - "nome_grupo" => $_GET["nome_grupo"], | ||
1107 | - "desc_grupo" => $_GET["desc_grupo"] | ||
1108 | - ); | ||
1109 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_grupos",$dataCol,"WHERE id_grupo = $id_grupo"); | ||
1110 | - } | ||
1111 | - else{ | ||
1112 | - $dataCol = array( | ||
1113 | - "nome_grupo" => $_GET["nome_grupo"], | ||
1114 | - "desc_grupo" => "", | ||
1115 | - "en" => "", | ||
1116 | - "es" => "", | ||
1117 | - "it" => "" | ||
1118 | - ); | ||
1119 | - $id_grupo = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_grupos",$dataCol,"nome_grupo","id_grupo"); | ||
1120 | - } | ||
1121 | - $dbhw = null; | ||
1122 | - $dbh = null; | ||
1123 | - return $id_grupo; | ||
1124 | - } | ||
1125 | - catch (PDOException $e){ | ||
1126 | - return "Error!: "; | ||
1127 | - } | ||
1128 | -} | ||
1129 | -/* | ||
1130 | -Altera o registro de um sub-grupo. Se id for vazio acrescenta o registro | ||
1131 | -*/ | ||
1132 | -function alteraSubGrupos() | ||
1133 | -{ | ||
1134 | - global $id_subgrupo,$esquemaadmin; | ||
1135 | - try{ | ||
1136 | - require(dirname(__FILE__)."/conexao.php"); | ||
1137 | - if($convUTF){ | ||
1138 | - $_GET["nome_subgrupo"] = utf8_encode($_GET["nome_subgrupo"]); | ||
1139 | - $_GET["desc_subgrupo"] = utf8_encode($_GET["desc_subgrupo"]); | ||
1140 | - $_GET["en"] = utf8_encode($_GET["en"]); | ||
1141 | - $_GET["es"] = utf8_encode($_GET["es"]); | ||
1142 | - $_GET["it"] = utf8_encode($_GET["it"]); | ||
1143 | - } | ||
1144 | - $retorna = ""; | ||
1145 | - if($id_subgrupo != ""){ | ||
1146 | - $dataCol = array( | ||
1147 | - "en" => $_GET["en"], | ||
1148 | - "es" => $_GET["es"], | ||
1149 | - "it" => $_GET["it"], | ||
1150 | - "nome_subgrupo" => $_GET["nome_subgrupo"], | ||
1151 | - "desc_subgrupo" => $_GET["desc_subgrupo"] | ||
1152 | - ); | ||
1153 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_subgrupos",$dataCol,"WHERE id_subgrupo = $id_subgrupo"); | ||
1154 | - } | ||
1155 | - else{ | ||
1156 | - $dataCol = array( | ||
1157 | - "nome_subgrupo" => $_GET["nome_subgrupo"], | ||
1158 | - "desc_subgrupo" => "", | ||
1159 | - "en" => "", | ||
1160 | - "es" => "", | ||
1161 | - "it" => "" | ||
1162 | - ); | ||
1163 | - $id_subgrupo = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_subgrupos",$dataCol,"nome_subgrupo","id_subgrupo"); | ||
1164 | - } | ||
1165 | - $dbhw = null; | ||
1166 | - $dbh = null; | ||
1167 | - return $id_subgrupo; | ||
1168 | - } | ||
1169 | - catch (PDOException $e) | ||
1170 | - { | ||
1171 | - return "Error!: "; | ||
1172 | - } | ||
1173 | -} | ||
1174 | -/* | ||
1175 | -Registra um mapfile na tabela de temas | ||
1176 | -*/ | ||
1177 | -function registraTema() | ||
1178 | -{ | ||
1179 | - global $codigo_tema,$esquemaadmin; | ||
1180 | - try | ||
1181 | - { | ||
1182 | - $retorna = "ok"; | ||
1183 | - include("conexao.php"); | ||
1184 | - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_temas where codigo_tema = '$codigo_tema'"; | ||
1185 | - $dados = pegaDados($sql); | ||
1186 | - if(count($dados) == 0){ | ||
1187 | - $dataCol = array( | ||
1188 | - "tipoa_tema" => '', | ||
1189 | - "nome_tema" => $codigo_tema, | ||
1190 | - "codigo_tema" => $codigo_tema, | ||
1191 | - "kml_tema" => 'SIM', | ||
1192 | - "kmz_tema" => 'NAO', | ||
1193 | - "ogc_tema" => 'SIM', | ||
1194 | - "download_tema" => 'SIM', | ||
1195 | - "tags_tema" => '', | ||
1196 | - "link_tema" => '', | ||
1197 | - "desc_tema" => '' | ||
1198 | - ); | ||
1199 | - i3GeoAdminInsert($dbhw,"i3geoadmin_temas",$dataCol); | ||
1200 | - } | ||
1201 | - $dbhw = null; | ||
1202 | - $dbh = null; | ||
1203 | - return "ok"; | ||
1204 | - } | ||
1205 | - catch (PDOException $e){ | ||
1206 | - return "Error!: "; | ||
1207 | - } | ||
1208 | -} | ||
1209 | -/* | ||
1210 | -Altera o registro de um tema. Se id for vazio acrescenta o registro | ||
1211 | -*/ | ||
1212 | -function alteraTemas() | ||
1213 | -{ | ||
1214 | - global $esquemaadmin,$id,$locaplic; | ||
1215 | - //error_reporting(0); | ||
1216 | - try{ | ||
1217 | - $retorna = "ok"; | ||
1218 | - include("conexao.php"); | ||
1219 | - $nomeo = $_GET["nome"]; | ||
1220 | - if($convUTF){ | ||
1221 | - $_GET["nome"] = utf8_encode($_GET["nome"]); | ||
1222 | - $_GET["desc"] = utf8_encode($_GET["desc"]); | ||
1223 | - $_GET["tags"] = utf8_encode($_GET["tags"]); | ||
1224 | - $_GET["en"] = utf8_encode($_GET["en"]); | ||
1225 | - $_GET["es"] = utf8_encode($_GET["es"]); | ||
1226 | - $_GET["it"] = utf8_encode($_GET["it"]); | ||
1227 | - } | ||
1228 | - if($id != ""){ | ||
1229 | - $dataCol = array( | ||
1230 | - "en" => $_GET["en"], | ||
1231 | - "es" => $_GET["es"], | ||
1232 | - "it" => $_GET["it"], | ||
1233 | - "tags_tema" => $_GET["tags"], | ||
1234 | - "link_tema" => $_GET["link"], | ||
1235 | - "nome_tema" => $_GET["nome"], | ||
1236 | - "desc_tema" => $_GET["desc"], | ||
1237 | - "codigo_tema" => $_GET["codigo"], | ||
1238 | - "tipoa_tema" => $_GET["tipoa"], | ||
1239 | - "download_tema" => $_GET["download"], | ||
1240 | - "ogc_tema" => $_GET["ogc"], | ||
1241 | - "kml_tema" => $_GET["kml"] | ||
1242 | - ); | ||
1243 | - if(isset($_GET["kmz"])){ | ||
1244 | - $dataCol["kmz_tema"] = $_GET["kmz"]; | ||
1245 | - } | ||
1246 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE id_tema = $id"); | ||
1247 | - | ||
1248 | - $retorna = $id; | ||
1249 | - if(!isset($_GET["kmz"])){ | ||
1250 | - $_GET["kmz"] = "nao"; | ||
1251 | - } | ||
1252 | - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_temas where id_tema = $id"; | ||
1253 | - $q = $dbh->query($sql,PDO::FETCH_ASSOC); | ||
1254 | - $resultado = $q->fetchAll(); | ||
1255 | - $mapfile = $resultado[0]["codigo_tema"]; | ||
1256 | - if(file_exists($locaplic."/temas/".$mapfile.".map")){ | ||
1257 | - $mapfile = $locaplic."/temas/".$mapfile.".map"; | ||
1258 | - if($mapa = @ms_newMapObj($mapfile)){ | ||
1259 | - $mapa = ms_newMapObj($mapfile); | ||
1260 | - $numlayers = $mapa->numlayers; | ||
1261 | - for ($i=0;$i < $numlayers;$i++){ | ||
1262 | - $layer = $mapa->getlayer($i); | ||
1263 | - $layer->setmetadata("permitedownload",strtolower($_GET["download"])); | ||
1264 | - $layer->setmetadata("download",strtolower($_GET["download"])); | ||
1265 | - $layer->setmetadata("permiteogc",strtolower($_GET["ogc"])); | ||
1266 | - $layer->setmetadata("permitekml",strtolower($_GET["kml"])); | ||
1267 | - $layer->setmetadata("permitekmz",strtolower($_GET["kmz"])); | ||
1268 | - //zera os metadados do sistema METAESTAT | ||
1269 | - if($_GET["tipoa"] != "META"){ | ||
1270 | - $layer->setmetadata("METAESTAT_CODIGO_TIPO_REGIAO",""); | ||
1271 | - $layer->setmetadata("METAESTAT_ID_MEDIDA_VARIAVEL",""); | ||
1272 | - $layer->setmetadata("metaestat",""); | ||
1273 | - } | ||
1274 | - if(count($_GET["nomes"]) == 1){ | ||
1275 | - $layer->setmetadata("tema",$nomeo); | ||
1276 | - } | ||
1277 | - } | ||
1278 | - $mapa->save($mapfile); | ||
1279 | - removeCabecalho($mapfile); | ||
1280 | - } | ||
1281 | - } | ||
1282 | - } | ||
1283 | - else{ | ||
1284 | - $dataCol = array( | ||
1285 | - "en" => "", | ||
1286 | - "es" => "", | ||
1287 | - "it" => "", | ||
1288 | - "tags_tema" => "", | ||
1289 | - "link_tema" => "", | ||
1290 | - "nome_tema" => "", | ||
1291 | - "desc_tema" => "", | ||
1292 | - "codigo_tema" => "", | ||
1293 | - "tipoa_tema" => "", | ||
1294 | - "download_tema" => "", | ||
1295 | - "ogc_tema" => "", | ||
1296 | - "kml_tema" => "" | ||
1297 | - ); | ||
1298 | - if(isset($kmz)){ | ||
1299 | - $dataCol["kmz_tema"] = ""; | ||
1300 | - } | ||
1301 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_temas",$dataCol,"nome_tema","id_tema"); | ||
1302 | - } | ||
1303 | - //verifica se é necessário adicionar algum tag novo | ||
1304 | - $_GET["tags"] = explode(" ",$_GET["tags"]); | ||
1305 | - | ||
1306 | - foreach($_GET["tags"] as $tag){ | ||
1307 | - if(!(verificaDuplicados("select * from ".$esquemaadmin."i3geoadmin_tags where nome = '$tag'",$dbh))){ | ||
1308 | - $dataCol = array( | ||
1309 | - "nome" => $tag | ||
1310 | - ); | ||
1311 | - i3GeoAdminInsert($dbhw,"i3geoadmin_tags",$dataCol); | ||
1312 | - } | ||
1313 | - } | ||
1314 | - $dbhw = null; | ||
1315 | - $dbh = null; | ||
1316 | - return $retorna; | ||
1317 | - } | ||
1318 | - catch (PDOException $e){ | ||
1319 | - return "Error!: "; | ||
1320 | - } | ||
1321 | -} | ||
1322 | -/* | ||
1323 | -Retorna a lista de mapfiles do diretorio i3geo/temas | ||
1324 | - | ||
1325 | -*/ | ||
1326 | -function listaMapsTemas() | ||
1327 | -{ | ||
1328 | - global $locaplic,$esquemaadmin; | ||
1329 | - $arquivos = array(); | ||
1330 | - if (is_dir($locaplic."/temas")) | ||
1331 | - { | ||
1332 | - if ($dh = opendir($locaplic."/temas")) | ||
1333 | - { | ||
1334 | - $extensao = ""; | ||
1335 | - while (($file = readdir($dh)) !== false) | ||
1336 | - { | ||
1337 | - $extensao = ""; | ||
1338 | - if(!stristr($file, '.map') === FALSE){ | ||
1339 | - $extensao = "map"; | ||
1340 | - } | ||
1341 | - if(!stristr($file, '.php') === FALSE){ | ||
1342 | - //$extensao = "php"; | ||
1343 | - } | ||
1344 | - if(!stristr($file, '.gvp') === FALSE){ | ||
1345 | - $extensao = "gvp"; | ||
1346 | - } | ||
1347 | - if($extensao != "") | ||
1348 | - { | ||
1349 | - $file = str_replace(".".$extensao,"",$file); | ||
1350 | - if(isset($_GET["letra"]) && $_GET["letra"] != "") | ||
1351 | - { | ||
1352 | - if(strtolower(substr(basename($file),0,strlen($_GET["letra"]))) == strtolower($_GET["letra"])){ | ||
1353 | - $arquivos[] = array("nome"=>$file,"extensao"=>$extensao); | ||
1354 | - } | ||
1355 | - } | ||
1356 | - else | ||
1357 | - {$arquivos[] = array("nome"=>$file,"extensao"=>$extensao); | ||
1358 | - } | ||
1359 | - } | ||
1360 | - $extensao = ""; | ||
1361 | - } | ||
1362 | - } | ||
1363 | - closedir($dh); | ||
1364 | - } | ||
1365 | - sort($arquivos); | ||
1366 | - // | ||
1367 | - //pega o nome de cada tema filtrando a listagem se for o caso | ||
1368 | - // | ||
1369 | - $sql = "select * from ".$esquemaadmin."i3geoadmin_temas "; | ||
1370 | - $filtro = $_GET["filtro"]; | ||
1371 | - if(isset($filtro) && $filtro != ""){ | ||
1372 | - $filtro = explode(",",$filtro); | ||
1373 | - $filtro = $filtro[0]." ".$filtro[1]." '".$filtro[2]."' or ".$filtro[0]." ".$filtro[1]." '".strtoupper($filtro[2])."'"; | ||
1374 | - $sql .= "where $filtro"; | ||
1375 | - } | ||
1376 | - $dbh = ""; | ||
1377 | - include($locaplic."/admin/php/conexao.php"); | ||
1378 | - $q = $dbh->query($sql,PDO::FETCH_ASSOC); | ||
1379 | - $regs = $q->fetchAll(); | ||
1380 | - //pega os grupos de usuarios que podem acessar o tema | ||
1381 | - $grpids = array(); | ||
1382 | - $sql = "select nome,descricao,a.id_grupo,id_tema from ".$esquemaadmin."i3geousr_grupotema as a,".$esquemaadmin."i3geousr_grupos as b where a.id_grupo = b.id_grupo"; | ||
1383 | - $q = $dbh->query($sql,PDO::FETCH_ASSOC); | ||
1384 | - if($q){ | ||
1385 | - $gs = $q->fetchAll(); | ||
1386 | - //agrupa o array | ||
1387 | - foreach($gps as $g){ | ||
1388 | - array_push($grpids[$g["id_tema"]],array("id_grupo"=>$g["id_grupo"],"nome"=>$g["nome"],"descricao"=>$g["descricao"])); | ||
1389 | - } | ||
1390 | - } | ||
1391 | - $nomes = array(); | ||
1392 | - $ids = array(); | ||
1393 | - foreach($regs as $reg){ | ||
1394 | - $nomes[$reg["codigo_tema"]] = $reg["nome_tema"]; | ||
1395 | - $ids[$reg["codigo_tema"]] = $reg["id_tema"]; | ||
1396 | - } | ||
1397 | - $lista = array(); | ||
1398 | - foreach($arquivos as $arq){ | ||
1399 | - $extensao = $arq["extensao"]; | ||
1400 | - $arq = $arq["nome"]; | ||
1401 | - $nT = explode(".",$arq); | ||
1402 | - $n = $nomes[$nT[0]]; | ||
1403 | - if(!$n){ | ||
1404 | - $n = ""; | ||
1405 | - } | ||
1406 | - $id = $ids[$nT[0]]; | ||
1407 | - if(!$id){ | ||
1408 | - $id = ""; | ||
1409 | - } | ||
1410 | - //pega os grupos de usuarios | ||
1411 | - $grupousr = $grpids[$id]; | ||
1412 | - if(!$grupousr){ | ||
1413 | - $grupousr = ""; | ||
1414 | - } | ||
1415 | - $imagem = ""; | ||
1416 | - if(file_exists($locaplic."/temas/miniaturas/".$arq.".map.mini.png")){ | ||
1417 | - $imagem = $arq.".map.mini.png"; | ||
1418 | - } | ||
1419 | - if($_GET["checaNomes"] == "true"){ | ||
1420 | - if($extensao == "map"){ | ||
1421 | - if(file_exists($locaplic."/temas/".$arq.".map")){ | ||
1422 | - $handle = fopen($locaplic."/temas/".$arq.".map", "r"); | ||
1423 | - while (!feof($handle)){ | ||
1424 | - $linha = fgets($handle); | ||
1425 | - if(stripos($linha,"'TEMA'") !== false || stripos($linha,'"TEMA"') !== false){ | ||
1426 | - $ntema = str_replace(array("'TEMA'",'"TEMA"',"'tema'",'"tema"'),"",$linha); | ||
1427 | - $ntema = trim(str_replace(array("'",'"'),"",$ntema)); | ||
1428 | - if($n != $ntema && $n != utf8_encode($ntema) && $n != ""){ | ||
1429 | - $n .= "<span style=color:red;margin-left:5px >".utf8_encode($ntema)."</span>"; | ||
1430 | - } | ||
1431 | - break; | ||
1432 | - } | ||
1433 | - } | ||
1434 | - fclose($handle); | ||
1435 | - } | ||
1436 | - } | ||
1437 | - } | ||
1438 | - if($_GET["checaNames"] == "true"){ | ||
1439 | - if($extensao == "map"){ | ||
1440 | - if(file_exists($locaplic."/temas/".$arq.".map")){ | ||
1441 | - $handle = fopen($locaplic."/temas/".$arq.".map", "r"); | ||
1442 | - //deve buscar dentro de LAYER pois pode haver simbolos antes | ||
1443 | - $elayer = false; | ||
1444 | - while (!feof($handle)){ | ||
1445 | - $linha = trim(fgets($handle)); | ||
1446 | - if(stripos($linha,"LAYER") === 0){ | ||
1447 | - $elayer = true; | ||
1448 | - } | ||
1449 | - if($elayer == true && stripos($linha,"NAME") === 0){ | ||
1450 | - $ntema = ltrim($linha,"NAMEname"); | ||
1451 | - $ntema = trim(str_replace(array("'",'"'),"",$ntema)); | ||
1452 | - if($arq != $ntema){ | ||
1453 | - $n .= "<img style='margin-left:3px;' src='../imagens/face-sad.png' title='Nome do LAYER diferente do nome do arquivo' />"; | ||
1454 | - } | ||
1455 | - break; | ||
1456 | - } | ||
1457 | - } | ||
1458 | - fclose($handle); | ||
1459 | - } | ||
1460 | - } | ||
1461 | - } | ||
1462 | - if(isset($filtro) && $filtro != "" && $n != ""){ | ||
1463 | - $lista[] = array("grupousr"=>$grupousr,"id_tema"=>$id,"nome"=>$n,"codigo"=>$arq,"imagem"=>$imagem,"extensao"=>$extensao); | ||
1464 | - } | ||
1465 | - if(!isset($filtro) || $filtro == ""){ | ||
1466 | - $lista[] = array("grupousr"=>$grupousr,"id_tema"=>$id,"nome"=>$n,"codigo"=>$arq,"imagem"=>$imagem,"extensao"=>$extensao); | ||
1467 | - } | ||
1468 | - } | ||
1469 | - | ||
1470 | - return $lista; | ||
1471 | -} | ||
1472 | -/* | ||
1473 | -Retorna a lista de temas sem mapfiles | ||
1474 | - | ||
1475 | -*/ | ||
1476 | -function verificaOrfaos() | ||
1477 | -{ | ||
1478 | - global $locaplic,$esquemaadmin; | ||
1479 | - $arquivos = array(); | ||
1480 | - // | ||
1481 | - //pega o nome de cada tema | ||
1482 | - // | ||
1483 | - $sql = "select nome_tema,codigo_tema,id_tema from ".$esquemaadmin."i3geoadmin_temas "; | ||
1484 | - $dbh = ""; | ||
1485 | - include($locaplic."/admin/php/conexao.php"); | ||
1486 | - $q = $dbh->query($sql,PDO::FETCH_ASSOC); | ||
1487 | - $regs = $q->fetchAll(); | ||
1488 | - $nomes = array(); | ||
1489 | - foreach($regs as $reg){ | ||
1490 | - if(!file_exists($locaplic."/temas/".$reg["codigo_tema"].".map") && !file_exists($locaplic."/temas/".$reg["codigo_tema"].".php")){ | ||
1491 | - $nomes[] = array("nome_tema"=>$reg["nome_tema"],"codigo_tema"=>$reg["codigo_tema"],"id_tema"=>$reg["id_tema"]); | ||
1492 | - } | ||
1493 | - } | ||
1494 | - sort($nomes); | ||
1495 | - return $nomes; | ||
1496 | -} | ||
1497 | -function removeCabecalho($arq,$symbolset=true) | ||
1498 | -{ | ||
1499 | - $handle = fopen($arq, "r"); | ||
1500 | - if ($handle) | ||
1501 | - { | ||
1502 | - $cabeca = array(); | ||
1503 | - if($symbolset) | ||
1504 | - { | ||
1505 | - $cabeca[] = "MAP\n"; | ||
1506 | - } | ||
1507 | - $grava = false; | ||
1508 | - while (!feof($handle)) | ||
1509 | - { | ||
1510 | - $linha = fgets($handle); | ||
1511 | - if($symbolset) | ||
1512 | - { | ||
1513 | - if(strpos(strtoupper($linha),"SYMBOLSET") !== false) | ||
1514 | - { | ||
1515 | - $cabeca[] = $linha; | ||
1516 | - } | ||
1517 | - if(strpos(strtoupper($linha),"FONTSET") !== false) | ||
1518 | - { | ||
1519 | - $cabeca[] = $linha; | ||
1520 | - } | ||
1521 | - } | ||
1522 | - if(strtoupper(trim($linha)) == "LAYER") | ||
1523 | - { | ||
1524 | - $grava = true; | ||
1525 | - } | ||
1526 | - if($grava) | ||
1527 | - { | ||
1528 | - $final[] = rtrim($linha, "\r\n") . PHP_EOL; | ||
1529 | - } | ||
1530 | - } | ||
1531 | - fclose($handle); | ||
1532 | - } | ||
1533 | - $final = array_merge($cabeca,$final); | ||
1534 | - $handle = fopen($arq, "w+"); | ||
1535 | - foreach ($final as $f) | ||
1536 | - { | ||
1537 | - // | ||
1538 | - //remove resultados em branco | ||
1539 | - //e grava a linha | ||
1540 | - // | ||
1541 | - $teste = strtoupper($f); | ||
1542 | - $teste = trim($teste); | ||
1543 | - $teste = str_replace(" ","",$teste); | ||
1544 | - $teste = str_replace("'","",$teste); | ||
1545 | - $teste = str_replace('"',"",$teste); | ||
1546 | - $teste = preg_replace('/[\n\r\t ]*/', '', $teste); | ||
1547 | - $testar = array("KEYIMAGE","TILEINDEX","TILEITEM","SYMBOL","LABELITEM","FILTERITEM","GROUP","ENCODING","TIP","CLASSE","ITENSDESC","CLASSESNOME","ITENSLINK","ESCALA","CLASSESSIMBOLO","MENSAGEM","EXTENSAO","CLASSESITEM","ESCONDIDO","CLASSESCOR","DOWNLOAD","CLASSESTAMANHO","ITENS","TEMA","APLICAEXTENSAO","IDENTIFICA"); | ||
1548 | - $passou = true; | ||
1549 | - foreach ($testar as $t){ | ||
1550 | - if($teste == $t){ | ||
1551 | - $passou = false; | ||
1552 | - } | ||
1553 | - } | ||
1554 | - if($passou){ | ||
1555 | - fwrite($handle,$f); | ||
1556 | - } | ||
1557 | - } | ||
1558 | - fclose($handle); | ||
1559 | - chmod($arq, 0666); | ||
1560 | -} | ||
1561 | -function atualizaMiniatura(){ | ||
1562 | - global $locaplic; | ||
1563 | - $tipo = "foo"; | ||
1564 | - include_once(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php"); | ||
1565 | - require(dirname(__FILE__)."/../../geraminiatura.php"); | ||
1566 | - verificaMiniatura($_GET["tema"],"todos",true); | ||
1567 | - return "ok"; | ||
1568 | -} | ||
1569 | -?> |
admin/php/metaestat_mapa_uploadimagem.php
@@ -1,61 +0,0 @@ | @@ -1,61 +0,0 @@ | ||
1 | -<?php | ||
2 | -exit; | ||
3 | -/* | ||
4 | - * Faz o upload de imagens para a pasta templates/logos | ||
5 | - * Essas imagens sao utilizadas nos mapas e sao escolhidas pelo usuario no formulario de publicacao dos mapas | ||
6 | - */ | ||
7 | -include_once("login.php"); | ||
8 | -if(verificaOperacaoSessao("admin/metaestat/geral") == false){ | ||
9 | - echo "Vc nao pode realizar essa operacao.";exit; | ||
10 | -} | ||
11 | -//error_reporting(0); | ||
12 | -?> | ||
13 | -<html> | ||
14 | -<head> | ||
15 | -<link rel="stylesheet" type="text/css" href="../../css/input.css" /> | ||
16 | -<link rel="stylesheet" type="text/css" href="../../css/geral.css" /> | ||
17 | -<title></title> | ||
18 | -</head> | ||
19 | -<body bgcolor="white" style="background-color:white;text-align:left;"> | ||
20 | -<p> | ||
21 | -<?php | ||
22 | -if (isset($_FILES['uploadimagem']['name'])){ | ||
23 | - require_once (dirname(__FILE__)."/../../ms_configura.php"); | ||
24 | - echo "<p class='paragrafo' >Carregando o arquivo...</p>"; | ||
25 | - $arq = $locaplic.$metaestatTemplates."/logos/".$_FILES['uploadimagem']['name']; | ||
26 | - //verifica nomes | ||
27 | - verificaNome($_FILES['uploadimagem']['name']); | ||
28 | - //chmod($metaestatTemplates."/logos",777); | ||
29 | - if(file_exists($arq)){ | ||
30 | - unlink($arq); | ||
31 | - } | ||
32 | - //sobe arquivo | ||
33 | - $Arquivo = $_FILES['uploadimagem']['tmp_name']; | ||
34 | - $status = move_uploaded_file($Arquivo,str_replace(".png","",$arq).".png"); | ||
35 | - if($status != 1) | ||
36 | - {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo. Verifique as permissoes de escrita";exit;} | ||
37 | - if($status == 1){ | ||
38 | - echo "<p class='paragrafo' >Arquivo enviado.</p>"; | ||
39 | - } | ||
40 | - else{ | ||
41 | - echo "<p class='paragrafo' >Erro ao enviar o arquivo.</p>"; | ||
42 | - exit; | ||
43 | - } | ||
44 | -} | ||
45 | -else{ | ||
46 | - echo "<p class='paragrafo' >Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</p>"; | ||
47 | -} | ||
48 | -function verificaNome($nome) | ||
49 | -{ | ||
50 | - $nome = strtolower($nome); | ||
51 | - $lista = explode(".",$nome); | ||
52 | - $extensao = $lista[count($lista) - 1]; | ||
53 | - if($extensao != "png" && $extensao != "jpg") | ||
54 | - { | ||
55 | - echo "Nome de arquivo inválido."; | ||
56 | - exit; | ||
57 | - } | ||
58 | -} | ||
59 | -?> | ||
60 | -</body> | ||
61 | -</html> | ||
62 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/metaestat_templates.php
@@ -1,51 +0,0 @@ | @@ -1,51 +0,0 @@ | ||
1 | - <?php | ||
2 | - include_once (dirname(__FILE__)."/../../classesphp/sani_request.php"); | ||
3 | - include(dirname(__FILE__)."/../../ms_configura.php"); | ||
4 | - include(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php"); | ||
5 | - //parser do arquivo para envio como imagem diretamente ao navegador | ||
6 | - if(!empty($_GET)){ | ||
7 | - ob_clean(); | ||
8 | - echoimg($_GET["nomeimg"],$_GET["tipo"]); | ||
9 | - exit; | ||
10 | - } | ||
11 | - ?> | ||
12 | -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | ||
13 | -<html> | ||
14 | -<head> | ||
15 | -<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> | ||
16 | -<title>Lista de templates</title> | ||
17 | -<style type="text/css"> | ||
18 | -body { | ||
19 | - margin: 20; | ||
20 | - padding: 20; | ||
21 | - font-size: 14px; | ||
22 | -} | ||
23 | -</style> | ||
24 | -<link rel="stylesheet" type="text/css" href="../html/admin.css"> | ||
25 | -</head> | ||
26 | -<body class=" yui-skin-sam fundoPonto"> | ||
27 | - <div class="bordaSuperior"> </div> | ||
28 | - <div class="mascaraPrincipal" id="divGeral" style="width: 100%;max-width:95%"> | ||
29 | - <div id=cabecalhoPrincipal></div> | ||
30 | - <h1>Lista de templates para uso em aplicações do sistema de metadados estatísticos</h1> | ||
31 | - <?php | ||
32 | - $arqs = listaArquivos($locaplic.$metaestatTemplates); | ||
33 | - $arqs = $arqs["arquivos"]; | ||
34 | - foreach($arqs as $arq){ | ||
35 | - $nome = explode(".",$arq); | ||
36 | - $nome = $nome[0]; | ||
37 | - $ext = explode(".",$arq); | ||
38 | - $ext = $ext[1]; | ||
39 | - if($ext == "php"){ | ||
40 | - echo "<p>Nome do template: <i>$arq</i></p>"; | ||
41 | - $nomeimg = $locaplic.$metaestatTemplates."/".$nome.".png"; | ||
42 | - if(file_exists($nomeimg)){ | ||
43 | - echo "<img style='border:1px solid gray' src='"; | ||
44 | - echo "metaestat_templates.php?&nomeimg=$nomeimg&tipo=png"; | ||
45 | - echo "' />"; | ||
46 | - } | ||
47 | - } | ||
48 | - } | ||
49 | - ?> | ||
50 | - </div> | ||
51 | -</body> | ||
52 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/metaestat_uploadcsv_submit.php
@@ -1,322 +0,0 @@ | @@ -1,322 +0,0 @@ | ||
1 | -<?php | ||
2 | -/* | ||
3 | - * Faz o upload de csv e insere no banco de dados criando uma nova tabela | ||
4 | -*/ | ||
5 | -include_once("login.php"); | ||
6 | -if(verificaOperacaoSessao("admin/metaestat/editorbanco") == false){ | ||
7 | - echo "Vc nao pode realizar essa operacao.";exit; | ||
8 | -} | ||
9 | -//error_reporting(0); | ||
10 | -if (ob_get_level() == 0) ob_start(); | ||
11 | - | ||
12 | -?> | ||
13 | -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | ||
14 | -<html> | ||
15 | -<head> | ||
16 | -<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> | ||
17 | -<link rel="stylesheet" type="text/css" href="../../css/input.css" /> | ||
18 | -<link rel="stylesheet" type="text/css" href="../../css/geral.css" /> | ||
19 | -<title></title> | ||
20 | -</head> | ||
21 | -<body bgcolor="white" style="background-color: white; text-align: left;"> | ||
22 | - <p> | ||
23 | - <?php | ||
24 | - if($_POST["tabelaDestinocsv"] == ""){ | ||
25 | - echo "Nome da tabela não definido"; | ||
26 | - exit; | ||
27 | - } | ||
28 | - if ($_FILES['i3GEOuploadcsv']['name'] == ""){ | ||
29 | - echo "Arquivo não definido"; | ||
30 | - exit; | ||
31 | - } | ||
32 | - if (isset($_FILES['i3GEOuploadcsv']['name'])){ | ||
33 | - echo "<p class='paragrafo' >Carregando o arquivo...</p>"; | ||
34 | - ob_flush(); | ||
35 | - flush(); | ||
36 | - sleep(1); | ||
37 | - $arqcsv = $_FILES['i3GEOuploadcsv']['tmp_name']; | ||
38 | - $nomePrefixo = str_replace(" ","_",removeAcentos($_FILES['i3GEOuploadcsv']['name'])); | ||
39 | - | ||
40 | - $nomePrefixo = str_replace(".","",$nomePrefixo); | ||
41 | - $nomePrefixo = strip_tags($nomePrefixo); | ||
42 | - $nomePrefixo = htmlspecialchars($nomePrefixo, ENT_QUOTES); | ||
43 | - $nomePrefixo = $nomePrefixo . md5(uniqid(rand(), true)); | ||
44 | - | ||
45 | - $nomePrefixo = $nomePrefixo."_".(nomeRandomico(4)).".csv"; | ||
46 | - | ||
47 | - $Arquivo = $_FILES['i3GEOuploadcsv']['tmp_name']; | ||
48 | - $status = move_uploaded_file($Arquivo,$dir_tmp."/".$nomePrefixo); | ||
49 | - if($status != 1){ | ||
50 | - echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo";exit; | ||
51 | - } | ||
52 | - if(!file_exists($dir_tmp."/".$nomePrefixo)){ | ||
53 | - echo "<p class='paragrafo' >Ocorreu algum problema no envio do arquivo ".$dir_tmp."/".$nomePrefixo;paraAguarde();exit; | ||
54 | - } | ||
55 | - $arqcsv = $dir_tmp."/".$nomePrefixo; | ||
56 | - | ||
57 | - $checkphp = fileContemString($dirmap."/".$nomePrefixo,"<?"); | ||
58 | - if($checkphp == true){ | ||
59 | - unlink($dirmap."/".$nomePrefixo); | ||
60 | - exit; | ||
61 | - } | ||
62 | - | ||
63 | - //pega os parametros de conexao | ||
64 | - include("classe_metaestat.php"); | ||
65 | - $m = new Metaestat(); | ||
66 | - $conexao = $m->listaConexao($_POST["i3GEOuploadcsvcodigoconexao"],true); | ||
67 | - //pega a lista de colunas e identifica o separador utilizado | ||
68 | - $handle = fopen ($arqcsv, "r"); | ||
69 | - $cabecalho = fgets($handle); | ||
70 | - $buffer = str_replace('"','',$cabecalho); | ||
71 | - $buffer = str_replace("'",'',$buffer); | ||
72 | - $buffer = str_replace("\n",'',$buffer); | ||
73 | - $buffer = str_replace("\r",'',$buffer); | ||
74 | - $colunas = explode(";",$buffer); | ||
75 | - $separador = ";"; | ||
76 | - if(count($colunas) == 1){ | ||
77 | - $colunas = explode(",",$buffer); | ||
78 | - $separador = ","; | ||
79 | - } | ||
80 | - echo "<p class='paragrafo' >Separador de colunas identificado: <b>".$separador."</b></p>"; | ||
81 | - echo "<p class='paragrafo' >Total de colunas: <b>".count($colunas)."</b></p>"; | ||
82 | - fclose ($handle); | ||
83 | - //le o csv em um array | ||
84 | - $handle = fopen ($arqcsv, "r"); | ||
85 | - $linhas = array(); | ||
86 | - | ||
87 | - $ncolunas = count($colunas); | ||
88 | - while (!feof($handle)) { | ||
89 | - $buffer = fgets($handle); | ||
90 | - if($buffer != $cabecalho){ | ||
91 | - //$buffer = str_replace('"','',$buffer); | ||
92 | - $buffer = str_replace("'",'',$buffer); | ||
93 | - $buffer = str_replace("\n",'',$buffer); | ||
94 | - $buffer = str_replace("\r",'',$buffer); | ||
95 | - if($buffer != ""){ | ||
96 | - $temp = explode($separador,$buffer); | ||
97 | - if(count($temp) == $ncolunas){ | ||
98 | - $linhas[] = $temp; | ||
99 | - } | ||
100 | - else{ | ||
101 | - echo "<p class='paragrafo' >A linha abaixo apresentou um erro - número de colunas não bate com o cabeçalho</p>"; | ||
102 | - var_dump($temp); | ||
103 | - exit; | ||
104 | - } | ||
105 | - } | ||
106 | - } | ||
107 | - } | ||
108 | - fclose ($handle); | ||
109 | - //decobre o tipo de coluna | ||
110 | - $testar = 50; | ||
111 | - if(count($linhas) < $testar){ | ||
112 | - $testar = count($linhas); | ||
113 | - } | ||
114 | - $tipoColuna = array(); | ||
115 | - for ($j=0; $j<$ncolunas;$j++){ | ||
116 | - $tipo = "numeric"; | ||
117 | - for ($i=0; $i<$testar;$i++){ | ||
118 | - $s = $linhas[$i]; | ||
119 | - $v = $s[$j]; | ||
120 | - if(!empty($v) && !is_numeric($v)){ | ||
121 | - $tipo = "varchar"; | ||
122 | - } | ||
123 | - } | ||
124 | - $tipoColuna[$colunas[$j]] = $tipo; | ||
125 | - } | ||
126 | - echo "<br>Tipos das colunas: <pre>"; | ||
127 | - var_dump($tipoColuna); | ||
128 | - echo "</pre>"; | ||
129 | - ob_flush(); | ||
130 | - flush(); | ||
131 | - sleep(1); | ||
132 | - | ||
133 | - try { | ||
134 | - $dbh = new PDO('pgsql:dbname='.$conexao["bancodedados"].';user='.$conexao["usuario"].';password='.$conexao["senha"].';host='.$conexao["host"].';port='.$conexao["porta"]); | ||
135 | - } catch (PDOException $e) { | ||
136 | - echo 'Connection failed: ' . " "; | ||
137 | - } | ||
138 | - //encoding do banco de dados | ||
139 | - $sql = "SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = '".$conexao["bancodedados"]."'"; | ||
140 | - $res = $dbh->query($sql,PDO::FETCH_ASSOC); | ||
141 | - $encodingdb = $res->fetchAll(); | ||
142 | - $encodingdb = $encodingdb[0]; | ||
143 | - $encodingdb = $encodingdb["pg_encoding_to_char"]; | ||
144 | - if($encodingdb == "UTF8"){ | ||
145 | - $encodingdb = "UTF-8"; | ||
146 | - } | ||
147 | - if($encodingdb == "LATIN1"){ | ||
148 | - $encodingdb = "ISO-8859-1"; | ||
149 | - } | ||
150 | - echo "<p class='paragrafo' >Codificação do banco: <b>".$encodingdb."</b></p>"; | ||
151 | - | ||
152 | - //gera o script para criar a tabela e verifica se ja existe | ||
153 | - $sql = "SELECT table_name FROM information_schema.tables where table_schema = '".$_POST["i3GEOuploadcsvesquema"]."' AND table_name = '".$_POST["tabelaDestinocsv"]."'"; | ||
154 | - $res = $dbh->query($sql,PDO::FETCH_ASSOC); | ||
155 | - if(count($res->fetchAll())>0){ | ||
156 | - $tabelaExiste = true; | ||
157 | - } | ||
158 | - else{ | ||
159 | - $tabelaExiste = false; | ||
160 | - } | ||
161 | - $sqltabela = array(); | ||
162 | - if($tabelaExiste == false && $_POST["tipoOperacao"] == "criar"){ | ||
163 | - $sql = "CREATE TABLE ".$_POST["i3GEOuploadcsvesquema"].".".$_POST["tabelaDestinocsv"]."("; | ||
164 | - $temp = array(); | ||
165 | - foreach($colunas as $coluna){ | ||
166 | - $temp[] = strtolower($coluna)." ".$tipoColuna[$coluna]; | ||
167 | - } | ||
168 | - if($_POST["colunaxcsv"] != "" && $_POST["colunaycsv"] != ""){ | ||
169 | - $temp[] = "the_geom geometry"; | ||
170 | - $colunas[] = "the_geom"; | ||
171 | - } | ||
172 | - $sql .= implode(",",$temp).") WITH(OIDS=FALSE)"; | ||
173 | - $sqltabela[] = $sql; | ||
174 | - $sqltabela[] = "ALTER TABLE ".$_POST["i3GEOuploadcsvesquema"].".".$_POST["tabelaDestinocsv"]." OWNER TO ".$conexao["usuario"]; | ||
175 | - if(!empty($_POST["comentarioCsv"])){ | ||
176 | - $enc = mb_detect_encoding($texto); | ||
177 | - $_POST["comentarioCsv"] = mb_convert_encoding($_POST["comentarioCsv"],$encodingdb,$enc); | ||
178 | - $sqltabela[] = "COMMENT ON TABLE ".$_POST["i3GEOuploadcsvesquema"].".".$_POST["tabelaDestinocsv"]." IS '".addcslashes($_POST["comentarioCsv"])."'"; | ||
179 | - } | ||
180 | - echo "<br>Sql tabela: <pre>"; | ||
181 | - var_dump($sqltabela); | ||
182 | - echo "</pre>"; | ||
183 | - ob_flush(); | ||
184 | - flush(); | ||
185 | - sleep(1); | ||
186 | - } | ||
187 | - if($tabelaExiste == true && $_POST["tipoOperacao"] == "criar"){ | ||
188 | - echo "<span style=color:red >A tabela existe. Não pode ser criada.</span>"; | ||
189 | - exit; | ||
190 | - } | ||
191 | - //se a tabela existe e e para remover os registros | ||
192 | - if($tabelaExiste == true && $_POST["tipoOperacao"] == "apagar"){ | ||
193 | - $sqltabela[] = "delete from ".$_POST["i3GEOuploadcsvesquema"].".".$_POST["tabelaDestinocsv"]; | ||
194 | - } | ||
195 | - if($tabelaExiste == true && $_POST["tipoOperacao"] == "apagar" && $_POST["i3GEOuploadcsvesquema"] != "i3geo_metaestat"){ | ||
196 | - echo "<span style=color:red >Não é possível executar essa operação nesse esquema.</span>"; | ||
197 | - exit; | ||
198 | - } | ||
199 | - //gera o script para inserir os dados | ||
200 | - echo "<br>Preparando inclusão de dados"; | ||
201 | - ob_flush(); | ||
202 | - flush(); | ||
203 | - sleep(1); | ||
204 | - $linhasql = array(); | ||
205 | - $insert = "INSERT INTO ".$_POST["i3GEOuploadcsvesquema"].".".$_POST["tabelaDestinocsv"]."(".strtolower(implode(",",$colunas)).")"; | ||
206 | - $nlinhas = count($linhas); | ||
207 | - $valorX = 0; | ||
208 | - $valorY = 0; | ||
209 | - $escapar = "',<,>,%,#,@,(,)"; | ||
210 | - for ($i=0; $i<$nlinhas;$i++){ | ||
211 | - $s = $linhas[$i]; | ||
212 | - $s = str_replace('"','',$s); | ||
213 | - $enc = mb_detect_encoding($s); | ||
214 | - if($enc != ""){ | ||
215 | - $s = mb_convert_encoding($s,$encodingdb,$enc); | ||
216 | - } | ||
217 | - $vs = array(); | ||
218 | - for ($j=0; $j<$ncolunas;$j++){ | ||
219 | - $escape = ""; | ||
220 | - if($tipoColuna[$coluna] == "varchar"){ | ||
221 | - $texto = $s[$j]; | ||
222 | - $enc = mb_detect_encoding($texto); | ||
223 | - $textosl = addcslashes($texto,$escapar); | ||
224 | - if($textosl != $texto){ | ||
225 | - $escape = "E"; | ||
226 | - } | ||
227 | - if($enc != "" && $enc != $encodingdb){ | ||
228 | - $textosl = "$escape'".mb_convert_encoding($textosl,$encodingdb,$enc)."'"; | ||
229 | - } | ||
230 | - else{ | ||
231 | - $textosl = "$escape'".$textosl."'"; | ||
232 | - } | ||
233 | - if($textosl == "''"){ | ||
234 | - $textosl = 'null'; | ||
235 | - } | ||
236 | - $vs[] = $textosl; | ||
237 | - } | ||
238 | - else{ | ||
239 | - $valor = $s[$j]; | ||
240 | - if($valor == "" || (empty($valor) && $valor != 0)){ | ||
241 | - $valor = 'nulo'; | ||
242 | - } | ||
243 | - $vs[] = $valor; | ||
244 | - } | ||
245 | - if(strtolower($colunas[$j]) == strtolower($_POST["colunaxcsv"])){ | ||
246 | - $valorX = $s[$j]; | ||
247 | - } | ||
248 | - if(strtolower($colunas[$j]) == strtolower($_POST["colunaycsv"])){ | ||
249 | - $valorY = $s[$j]; | ||
250 | - } | ||
251 | - } | ||
252 | - if($_POST["colunaxcsv"] != "" && $_POST["colunaycsv"] != ""){ | ||
253 | - $vs[] = "ST_PointFromText('POINT(". str_replace(",",".",$valorX)." ".str_replace(",",".",$valorY).")',4326)"; | ||
254 | - } | ||
255 | - $str = implode(",",$vs); | ||
256 | - $str = str_replace("nulo",'null',$str); | ||
257 | - $linhasql[] = $insert."VALUES(".$str.")"; | ||
258 | - } | ||
259 | - echo "<pre>"; | ||
260 | - //var_dump($linhasql);exit; | ||
261 | - | ||
262 | - echo "<br>Incluindo dados"; | ||
263 | - echo "<script>window.scrollTo(0,10000);</script>"; | ||
264 | - ob_flush(); | ||
265 | - flush(); | ||
266 | - sleep(1); | ||
267 | - if($_POST["incluiserialcsv"] == "on"){ | ||
268 | - $linhasql[] = "alter table ".$_POST["i3GEOuploadcsvesquema"].".".$_POST["tabelaDestinocsv"]." add gid serial CONSTRAINT ".$_POST["tabelaDestinocsv"]."_gid_pkey PRIMARY KEY"; | ||
269 | - echo "<br>alter table ".$_POST["i3GEOuploadcsvesquema"].".".$_POST["tabelaDestinocsv"]." add gid serial CONSTRAINT ".$_POST["tabelaDestinocsv"]."_gid_pkey PRIMARY KEY"; | ||
270 | - } | ||
271 | - foreach($sqltabela as $linha){ | ||
272 | - try { | ||
273 | - $dbh->query($linha); | ||
274 | - } catch (PDOException $e) { | ||
275 | - echo 'Erro: ' . " "; | ||
276 | - } | ||
277 | - } | ||
278 | - $bdcon = pg_connect('dbname='.$conexao["bancodedados"].' user='.$conexao["usuario"].' password='.$conexao["senha"].' host='.$conexao["host"].' port='.$conexao["porta"]."options='-c client_encoding=LATIN1'"); | ||
279 | - | ||
280 | - foreach($linhasql as $linha){ | ||
281 | - try { | ||
282 | - $res = $dbh->query($linha); | ||
283 | - if($res == false){ | ||
284 | - $res = pg_query($bdcon,$linha); | ||
285 | - if($res == false){ | ||
286 | - $linha = remove_accents($linha); | ||
287 | - $res = $dbh->query($linha); | ||
288 | - if($res == false){ | ||
289 | - $res = pg_query($bdcon,$linha); | ||
290 | - if($res == false){ | ||
291 | - echo "<br><br><span style=color:red >Erro em: </span>".$linha; | ||
292 | - } | ||
293 | - } | ||
294 | - else{ | ||
295 | - echo "<br><br><span style=color:red >Linha com acentos removidos: </span>".$linha; | ||
296 | - } | ||
297 | - } | ||
298 | - } | ||
299 | - } catch (PDOException $e) { | ||
300 | - echo 'Erro: ' . " "; | ||
301 | - } | ||
302 | - } | ||
303 | - $sql = "select * from ".$_POST["i3GEOuploadcsvesquema"].".".$_POST["tabelaDestinocsv"]; | ||
304 | - $q = $dbh->query($sql,PDO::FETCH_ASSOC); | ||
305 | - $r = $q->fetchAll(); | ||
306 | - if($nlinhas != count($r)){ | ||
307 | - echo "<span style='color:red'>"; | ||
308 | - } | ||
309 | - echo "<br>Registros existentes no CSV: ". $nlinhas; | ||
310 | - | ||
311 | - echo "<br>Registros na tabela final: ". count($r); | ||
312 | - echo "<b><br>Feito!!!<br>Faça o reload da página"; | ||
313 | - } | ||
314 | - else{ | ||
315 | - echo "<p class='paragrafo' >Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</p>"; | ||
316 | - } | ||
317 | - | ||
318 | - ?> | ||
319 | - <script>window.scrollTo(0,10000);</script> | ||
320 | - | ||
321 | -</body> | ||
322 | -</html> |
admin/php/metaestat_uploaddados_submit.php
@@ -1,58 +0,0 @@ | @@ -1,58 +0,0 @@ | ||
1 | -<?php | ||
2 | -$colunasarquivo = ""; | ||
3 | -$nomearquivoserv = ""; | ||
4 | -//error_reporting(0); | ||
5 | -include_once(dirname(__FILE__)."/login.php"); | ||
6 | -if (isset($_FILES['i3GEOuploadArquivo']['name'])) | ||
7 | -{ | ||
8 | - $Arquivoup = $_FILES['i3GEOuploadArquivo']['tmp_name']; | ||
9 | - | ||
10 | - $nomePrefixo = str_replace(" ","_",str_replace(".csv","",$_FILES['i3GEOuploadArquivo']['name'])); | ||
11 | - $nomePrefixo = str_replace(".","",$nomePrefixo); | ||
12 | - $nomePrefixo = strip_tags($nomePrefixo); | ||
13 | - $nomePrefixo = htmlspecialchars($nomePrefixo, ENT_QUOTES); | ||
14 | - $nomePrefixo = $nomePrefixo . md5(uniqid(rand(), true)); | ||
15 | - | ||
16 | - $nomearquivoserv = $dir_tmp."/uploaddados".$nomePrefixo.".csv"; | ||
17 | - | ||
18 | - $checkphp = fileContemString($nomearquivoserv,"<?"); | ||
19 | - if($checkphp == true){ | ||
20 | - unlink($nomearquivoserv); | ||
21 | - exit; | ||
22 | - } | ||
23 | - | ||
24 | - //echo $nomearquivoserv; | ||
25 | - if(file_exists($nomearquivoserv)){ | ||
26 | - unlink($nomearquivoserv); | ||
27 | - } | ||
28 | - $status = move_uploaded_file($Arquivoup,$nomearquivoserv); | ||
29 | - if($status == 1){ | ||
30 | - $handle = fopen ($nomearquivoserv, "r"); | ||
31 | - $buffer = fgets($handle); | ||
32 | - $buffer = str_replace('"','',$buffer); | ||
33 | - $buffer = str_replace("'",'',$buffer); | ||
34 | - $buffer = str_replace("\n",'',$buffer); | ||
35 | - $buffer = str_replace("\r",'',$buffer); | ||
36 | - $colunas = explode(";",$buffer); | ||
37 | - if(count($colunas) == 1){ | ||
38 | - $colunas = explode(",",$buffer); | ||
39 | - } | ||
40 | - $colunasarquivo = implode(",",$colunas); | ||
41 | - } | ||
42 | -} | ||
43 | -//echo $colunasarquivo; | ||
44 | -//$colunasarquivo = "ano,codigoregiao,dia,gid,hora,id_medida_variavel,mes,valor_int,valor_num,valor_txt "; | ||
45 | -?> | ||
46 | -<html> | ||
47 | -<script> | ||
48 | - | ||
49 | -<?php echo "c = '$colunasarquivo';";?> | ||
50 | -<?php | ||
51 | -//echo "d = '$nomearquivoserv';"; | ||
52 | -echo "d = '';"; | ||
53 | -?> | ||
54 | -window.parent.i3GEOadmin.uploaddados.COLUNASARQUIVO = c; | ||
55 | -window.parent.i3GEOadmin.uploaddados.NOMEARQUIVOSERV = d; | ||
56 | -window.parent.i3GEOadmin.uploaddados.upload.fimsubmit(); | ||
57 | -</script> | ||
58 | -</html> | ||
59 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/metaestat_uploadshp_submit.php
@@ -1,567 +0,0 @@ | @@ -1,567 +0,0 @@ | ||
1 | -<?php | ||
2 | -/* | ||
3 | - * Faz o upload de shapefile e insere no banco de dados | ||
4 | - */ | ||
5 | -include_once("login.php"); | ||
6 | -set_time_limit(0); | ||
7 | -if(verificaOperacaoSessao("admin/metaestat/editorbanco") == false){ | ||
8 | - echo "Vc nao pode realizar essa operacao.";exit; | ||
9 | -} | ||
10 | -//error_reporting(0); | ||
11 | -if (ob_get_level() == 0) ob_start(); | ||
12 | -?> | ||
13 | -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | ||
14 | -<html> | ||
15 | -<head> | ||
16 | -<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> | ||
17 | -<link rel="stylesheet" type="text/css" href="../../css/input.css" /> | ||
18 | -<link rel="stylesheet" type="text/css" href="../../css/geral.css" /> | ||
19 | -<title></title> | ||
20 | -</head> | ||
21 | -<body bgcolor="white" style="background-color:white;text-align:left;"> | ||
22 | -<p> | ||
23 | - | ||
24 | -<?php | ||
25 | -if($_POST["tabelaDestino"] == ""){ | ||
26 | - echo "Nome da tabela não definido"; | ||
27 | - exit; | ||
28 | -} | ||
29 | -if($_POST["insrid"] == ""){ | ||
30 | - echo "SRID não definido"; | ||
31 | - exit; | ||
32 | -} | ||
33 | -if ($_FILES['i3GEOuploadshp']['name'] == ""){ | ||
34 | - echo "Arquivo não definido"; | ||
35 | - exit; | ||
36 | -} | ||
37 | -if (isset($_FILES['i3GEOuploadshp']['name'])){ | ||
38 | - require_once (dirname(__FILE__)."/../../ms_configura.php"); | ||
39 | - if(isset($logExec) && $logExec["upload"] == true){ | ||
40 | - i3GeoLog("prog: metaestat_uploadshp_submit filename:" . $_FILES['i3GEOuploadshp']['name'],$dir_tmp); | ||
41 | - } | ||
42 | - | ||
43 | - echo "<p class='paragrafo' >Carregando o arquivo...</p>"; | ||
44 | - ob_flush(); | ||
45 | - flush(); | ||
46 | - sleep(1); | ||
47 | - | ||
48 | - | ||
49 | - $arqshp = $_FILES['i3GEOuploadshp']['tmp_name']; | ||
50 | - //verifica nomes e sobe arquivo | ||
51 | - verificaNome($_FILES['i3GEOuploadshp']['name'],"shp"); | ||
52 | - $nomePrefixo = str_replace(" ","_",removeAcentos(str_replace(".shp","",$_FILES['i3GEOuploadshp']['name']))); | ||
53 | - | ||
54 | - $nomePrefixo = str_replace(".","",$nomePrefixo); | ||
55 | - $nomePrefixo = strip_tags($nomePrefixo); | ||
56 | - $nomePrefixo = htmlspecialchars($nomePrefixo, ENT_QUOTES); | ||
57 | - $nomePrefixo = $nomePrefixo . md5(uniqid(rand(), true)); | ||
58 | - | ||
59 | - $Arquivo = $_FILES['i3GEOuploadshp']['tmp_name']; | ||
60 | - $status = move_uploaded_file($Arquivo,$dir_tmp."/".$nomePrefixo.".shp"); | ||
61 | - if($status != 1) | ||
62 | - {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo SHP";exit;} | ||
63 | - | ||
64 | - $Arquivo = $_FILES['i3GEOuploadshx']['tmp_name']; | ||
65 | - $status = move_uploaded_file($Arquivo,$dir_tmp."/".$nomePrefixo.".shx"); | ||
66 | - if($status != 1) | ||
67 | - {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo SHX";exit;} | ||
68 | - | ||
69 | - $Arquivo = $_FILES['i3GEOuploaddbf']['tmp_name']; | ||
70 | - $status = move_uploaded_file($Arquivo,$dir_tmp."/".$nomePrefixo.".dbf"); | ||
71 | - if($status != 1) | ||
72 | - {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo DBF";exit;} | ||
73 | - | ||
74 | - if($_FILES['i3GEOuploadprj']['tmp_name'] != ""){ | ||
75 | - $Arquivo = $_FILES['i3GEOuploadprj']['tmp_name']; | ||
76 | - $status = move_uploaded_file($Arquivo,$dir_tmp."/".$nomePrefixo.".prj"); | ||
77 | - if($status != 1){ | ||
78 | - echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo PRJ";exit; | ||
79 | - } | ||
80 | - } | ||
81 | - if(!file_exists($dir_tmp."/".$nomePrefixo.".shp")){ | ||
82 | - echo "<p class='paragrafo' >Ocorreu algum problema no envio do arquivo ".$dir_tmp."/".$nomePrefixo;paraAguarde(); | ||
83 | - exit; | ||
84 | - } | ||
85 | - | ||
86 | - $checkphp = fileContemString($dirmap."/".$nomePrefixo.".prj","<?"); | ||
87 | - if($checkphp == true){ | ||
88 | - unlink($dirmap."/".$nomePrefixo.".prj"); | ||
89 | - unlink($dirmap."/".$nomePrefixo.".shx"); | ||
90 | - unlink($dirmap."/".$nomePrefixo.".dbf"); | ||
91 | - unlink($dirmap."/".$nomePrefixo.".shp"); | ||
92 | - exit; | ||
93 | - } | ||
94 | - $checkphp = fileContemString($dirmap."/".$nomePrefixo.".shx","<?"); | ||
95 | - if($checkphp == true){ | ||
96 | - unlink($dirmap."/".$nomePrefixo.".prj"); | ||
97 | - unlink($dirmap."/".$nomePrefixo.".shx"); | ||
98 | - unlink($dirmap."/".$nomePrefixo.".dbf"); | ||
99 | - unlink($dirmap."/".$nomePrefixo.".shp"); | ||
100 | - exit; | ||
101 | - } | ||
102 | - $checkphp = fileContemString($dirmap."/".$nomePrefixo.".dbf","<?"); | ||
103 | - if($checkphp == true){ | ||
104 | - unlink($dirmap."/".$nomePrefixo.".prj"); | ||
105 | - unlink($dirmap."/".$nomePrefixo.".shx"); | ||
106 | - unlink($dirmap."/".$nomePrefixo.".dbf"); | ||
107 | - unlink($dirmap."/".$nomePrefixo.".shp"); | ||
108 | - exit; | ||
109 | - } | ||
110 | - | ||
111 | - $arqshp = $dir_tmp."/".$nomePrefixo.".shp"; | ||
112 | - | ||
113 | - //pega os parametros de conexao | ||
114 | - include("classe_metaestat.php"); | ||
115 | - $m = new Metaestat(); | ||
116 | - | ||
117 | - $conexao = $m->listaConexao($_POST["i3GEOuploadcodigoconexao"],true); | ||
118 | - //array(5) { ["codigo_estat_conexao"]=> string(1) "1" ["bancodedados"]=> string(8) "geosaude" ["host"]=> string(9) "localhost" ["porta"]=> string(4) "5432" ["usuario"]=> string(8) "postgres" } | ||
119 | - //pega as colunas do shapefile | ||
120 | - $shapefileObj = ms_newShapefileObj($arqshp,-1); | ||
121 | - $numshapes = $shapefileObj->numshapes; | ||
122 | - $mapObj = ms_newMapObjFromString("MAP END"); | ||
123 | - $layer = ms_newLayerObj($mapObj); | ||
124 | - $layer->set("data",$arqshp); | ||
125 | - if(file_exists($dir_tmp."/".$nomePrefixo.".prj")){ | ||
126 | - $layer->setprojection("AUTO"); | ||
127 | - } | ||
128 | - $layer->open(); | ||
129 | - $colunasTemp = $layer->getItems(); | ||
130 | - $colunas = array(); | ||
131 | - foreach($colunasTemp as $c){ | ||
132 | - //abaixo gid e forcado a entrar | ||
133 | - if(!is_numeric($c) && strtolower($c) != "gid"){ | ||
134 | - $colunas[] = $c; | ||
135 | - } | ||
136 | - } | ||
137 | - echo "<br>Numshapes existentes no SHP: ". $numshapes; | ||
138 | - $tipo = $shapefileObj->type; | ||
139 | - echo "<br>Tipo: ". $tipo; | ||
140 | - echo "<br>Colunas: "; | ||
141 | - var_dump($colunas); | ||
142 | - ob_flush(); | ||
143 | - flush(); | ||
144 | - sleep(1); | ||
145 | - $sqinsert = array(); | ||
146 | - //verifica o tipo de coluna | ||
147 | - $tipoColuna = array(); | ||
148 | - $testar = $numshapes; | ||
149 | - if($numshapes > 50){ | ||
150 | - $testar = 50; | ||
151 | - } | ||
152 | - foreach($colunas as $coluna){ | ||
153 | - $tipo = "numeric"; | ||
154 | - for ($i=0; $i<$testar;$i++){ | ||
155 | - $s = $layer->getShape(new resultObj($i)); | ||
156 | - $v = $s->getValue($layer,$coluna); | ||
157 | - if(!is_numeric($v)){ | ||
158 | - $tipo = "varchar"; | ||
159 | - } | ||
160 | - } | ||
161 | - $tipoColuna[$coluna] = $tipo; | ||
162 | - } | ||
163 | - echo "<br>Tipos das colunas: <pre>"; | ||
164 | - var_dump($tipoColuna); | ||
165 | - echo "</pre>"; | ||
166 | - ob_flush(); | ||
167 | - flush(); | ||
168 | - sleep(1); | ||
169 | - | ||
170 | - try { | ||
171 | - $dbh = new PDO('pgsql:dbname='.$conexao["bancodedados"].';user='.$conexao["usuario"].';password='.$conexao["senha"].';host='.$conexao["host"].';port='.$conexao["porta"]); | ||
172 | - } catch (PDOException $e) { | ||
173 | - echo '<span style=color:red >Connection failed: ' . " "; | ||
174 | - exit; | ||
175 | - } | ||
176 | - | ||
177 | - //gera o script para criar a tabela | ||
178 | - //verifica se a tabela ja existe | ||
179 | - $sql = "SELECT table_name FROM information_schema.tables where table_schema = '".$_POST["i3GEOuploadesquema"]."' AND table_name = '".$_POST["tabelaDestino"]."'"; | ||
180 | - $res = $dbh->query($sql,PDO::FETCH_ASSOC); | ||
181 | - if(count($res->fetchAll())>0){ | ||
182 | - $tabelaExiste = true; | ||
183 | - } | ||
184 | - else{ | ||
185 | - $tabelaExiste = false; | ||
186 | - } | ||
187 | - //encoding do banco de dados | ||
188 | - $sql = "SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = '".$conexao["bancodedados"]."'"; | ||
189 | - $res = $dbh->query($sql,PDO::FETCH_ASSOC); | ||
190 | - $encodingdb = $res->fetchAll(); | ||
191 | - $encodingdb = $encodingdb[0]; | ||
192 | - $encodingdb = $encodingdb["pg_encoding_to_char"]; | ||
193 | - if($encodingdb == "UTF8"){ | ||
194 | - $encodingdb = "UTF-8"; | ||
195 | - } | ||
196 | - if($encodingdb == "LATIN1"){ | ||
197 | - $encodingdb = "ISO-8859-1"; | ||
198 | - } | ||
199 | - //a tabela nao existe e e do tipo create | ||
200 | - $sqltabela = array(); | ||
201 | - if($tabelaExiste == false && $_POST["tipoOperacao"] == "criar"){ | ||
202 | - $sql = "CREATE TABLE ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]."(the_geom geometry"; | ||
203 | - foreach($colunas as $coluna){ | ||
204 | - $sql .= ",".remove_accents(strtolower($coluna))." ".$tipoColuna[$coluna]; | ||
205 | - } | ||
206 | - $sql .= ")WITH(OIDS=FALSE)"; | ||
207 | - $sqltabela[] = $sql; | ||
208 | - $sqltabela[] = "ALTER TABLE ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]." OWNER TO ".$conexao["usuario"]; | ||
209 | - $sqltabela[] = "CREATE INDEX ".$_POST["tabelaDestino"]."_indx_thegeom ON ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]." USING gist (the_geom )"; | ||
210 | - if(!empty($_POST["comentarioShp"])){ | ||
211 | - $enc = mb_detect_encoding($texto); | ||
212 | - $_POST["comentarioShp"] = mb_convert_encoding($_POST["comentarioShp"],$encodingdb,$enc); | ||
213 | - $sqltabela[] = "COMMENT ON TABLE ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]." IS '".$_POST["comentarioShp"]."'"; | ||
214 | - } | ||
215 | - echo "<br>Sql tabela: <pre>"; | ||
216 | - var_dump($sqltabela); | ||
217 | - echo "</pre>"; | ||
218 | - ob_flush(); | ||
219 | - flush(); | ||
220 | - sleep(1); | ||
221 | - } | ||
222 | - | ||
223 | - | ||
224 | - | ||
225 | - | ||
226 | - if($tabelaExiste == true && $_POST["tipoOperacao"] == "criar"){ | ||
227 | - echo "<span style=color:red >A tabela existe. Não pode ser criada.</span>"; | ||
228 | - exit; | ||
229 | - } | ||
230 | - //se a tabela existe e e para remover os registros | ||
231 | - if($tabelaExiste == true && $_POST["tipoOperacao"] == "apagar"){ | ||
232 | - $sqltabela[] = "delete from ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]; | ||
233 | - } | ||
234 | - if($tabelaExiste == true && $_POST["tipoOperacao"] == "apagar" && $_POST["i3GEOuploadesquema"] != "i3geo_metaestat"){ | ||
235 | - echo "<span style=color:red >Não é possível executar essa operação nesse esquema.</span>"; | ||
236 | - exit; | ||
237 | - } | ||
238 | - //gera o script para inserir os dados | ||
239 | - $linhas = array(); | ||
240 | - $insert = "INSERT INTO ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]." (".strtolower(implode(",",$colunas)).",the_geom)"; | ||
241 | - echo "<br>Preparando inclusão de dados"; | ||
242 | - ob_flush(); | ||
243 | - flush(); | ||
244 | - sleep(1); | ||
245 | - | ||
246 | - | ||
247 | - | ||
248 | - | ||
249 | - | ||
250 | - | ||
251 | - $srid = 4326; | ||
252 | - $escapar = "'"; | ||
253 | - $projOutObj = ""; | ||
254 | - $projInObj = ""; | ||
255 | - // | ||
256 | - //caso o usuario tenha definido a projecao de saida, os dados devem ser projetados | ||
257 | - // | ||
258 | - if($_POST["outsrid"] != ""){ | ||
259 | - $mapObj->setProjection("init=epsg:".$_POST["outsrid"]); | ||
260 | - $prjMapa = $mapObj->getProjection(); | ||
261 | - $prjTema = $layer->getProjection(); | ||
262 | - if (($prjTema != "") && ($prjMapa != $prjTema)) | ||
263 | - { | ||
264 | - $projInObj = ms_newprojectionobj($prjTema); | ||
265 | - $projOutObj = ms_newprojectionobj($prjMapa); | ||
266 | - } | ||
267 | - } | ||
268 | - | ||
269 | - for ($i=0; $i<$numshapes;$i++){ | ||
270 | - $s = $layer->getShape(new resultObj($i)); | ||
271 | - //projeta o shape se existir .prj | ||
272 | - if($_FILES['i3GEOuploadprj']['tmp_name'] != "" && $projInObj != ""){ | ||
273 | - $s->project($projInObj, $projOutObj); | ||
274 | - //para nao projetar com postgis | ||
275 | - $_POST["insrid"] = $_POST["outsrid"]; | ||
276 | - } | ||
277 | - $vs = array(); | ||
278 | - | ||
279 | - foreach($colunas as $coluna){ | ||
280 | - $escape = ""; | ||
281 | - if($tipoColuna[$coluna] == "varchar"){ | ||
282 | - $texto = $s->getValue($layer,$coluna); | ||
283 | - //echo $i." - ".mb_detect_encoding($texto)."<br>"; | ||
284 | - //$texto = str_replace("'","",$texto); | ||
285 | - $enc = mb_detect_encoding($texto); | ||
286 | - $textosl = addcslashes($texto,$escapar); | ||
287 | - if($textosl != $texto){ | ||
288 | - $escape = "E"; | ||
289 | - } | ||
290 | - if($enc != "" && $enc != $encodingdb){ | ||
291 | - $textosl = "$escape'".mb_convert_encoding($textosl,$encodingdb,$enc)."'"; | ||
292 | - } | ||
293 | - else{ | ||
294 | - $textosl = "$escape'".$textosl."'"; | ||
295 | - } | ||
296 | - if($textosl == "''"){ | ||
297 | - $textosl = 'null'; | ||
298 | - } | ||
299 | - $vs[] = $textosl; | ||
300 | - } | ||
301 | - else{ | ||
302 | - $valor = $s->getValue($layer,$coluna); | ||
303 | - if($valor == "" || (empty($valor) && $valor != 0)){ | ||
304 | - $valor = 'nulo'; | ||
305 | - } | ||
306 | - $vs[] = $valor; | ||
307 | - } | ||
308 | - } | ||
309 | - if(($_POST["insrid"] == $_POST["outsrid"]) || $_POST["outsrid"] == ""){ | ||
310 | - $vs[] = "st_geomfromtext('".$s->toWkt()."','".$_POST["insrid"]."')"; | ||
311 | - $srid = $_POST["insrid"]; | ||
312 | - } | ||
313 | - else{ | ||
314 | - $vs[] = "st_transform(st_geomfromtext('".$s->toWkt()."','".$_POST["insrid"]."'),'".$_POST["outsrid"]."')"; | ||
315 | - $srid = $_POST["outsrid"]; | ||
316 | - } | ||
317 | - $str = implode(",",$vs); | ||
318 | - $str = str_replace("nulo",'null',$str); | ||
319 | - $linhas[] = $insert."VALUES(".$escape."".$str.")"; | ||
320 | - } | ||
321 | - //echo $linhas[0];exit; | ||
322 | - //echo "<pre>".var_dump($linhas);exit; | ||
323 | - $layer->close(); | ||
324 | - echo "<br>Incluindo dados"; | ||
325 | - echo "<script>window.scrollTo(0,10000);</script>"; | ||
326 | - ob_flush(); | ||
327 | - flush(); | ||
328 | - sleep(1); | ||
329 | - if($_POST["incluiserialshp"] == "on" || $_POST["i3GEOuploadCriaMapfile"] == "on"){ | ||
330 | - $linhas[] = "alter table ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]." add gid serial CONSTRAINT ".$_POST["tabelaDestino"]."_gid_pkey PRIMARY KEY"; | ||
331 | - echo "<br>alter table ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]." add gid serial CONSTRAINT ".$_POST["tabelaDestino"]."_gid_pkey PRIMARY KEY"; | ||
332 | - } | ||
333 | - | ||
334 | - foreach($sqltabela as $linha){ | ||
335 | - try { | ||
336 | - $dbh->query($linha); | ||
337 | - } catch (PDOException $e) { | ||
338 | - echo 'Erro: ' . " "; | ||
339 | - } | ||
340 | - } | ||
341 | - $bdcon = pg_connect('dbname='.$conexao["bancodedados"].' user='.$conexao["usuario"].' password='.$conexao["senha"].' host='.$conexao["host"].' port='.$conexao["porta"]."options='-c client_encoding=LATIN1'"); | ||
342 | - foreach($linhas as $linha){ | ||
343 | - try { | ||
344 | - $res = $dbh->query($linha); | ||
345 | - if($res == false){ | ||
346 | - $res = pg_query($bdcon,$linha); | ||
347 | - if($res == false){ | ||
348 | - $linha = remove_accents($linha); | ||
349 | - $res = $dbh->query($linha); | ||
350 | - if($res == false){ | ||
351 | - $res = pg_query($bdcon,$linha); | ||
352 | - if($res == false){ | ||
353 | - echo "<br><br><span style=color:red >Erro em: </span>".$linha; | ||
354 | - } | ||
355 | - } | ||
356 | - else{ | ||
357 | - echo "<br><br><span style=color:red >Linha com acentos removidos: </span>".$linha; | ||
358 | - } | ||
359 | - } | ||
360 | - } | ||
361 | - } catch (PDOException $e) { | ||
362 | - echo 'Erro: ' . " "; | ||
363 | - } | ||
364 | - } | ||
365 | - $sql = "select * from ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]; | ||
366 | - $q = $dbh->query($sql,PDO::FETCH_ASSOC); | ||
367 | - $r = $q->fetchAll(); | ||
368 | - if($numshapes != count($r)){ | ||
369 | - echo "<span style='color:red'>"; | ||
370 | - } | ||
371 | - echo "<br>Registros existentes no SHP: ". $numshapes; | ||
372 | - | ||
373 | - echo "<br>Registros na tabela final: ". count($r); | ||
374 | - echo "</span><br>Diferenças podem ocorrer em função de caracteres acentuados não suportados pelo banco de dados"; | ||
375 | - echo "<br><b>Feito!!!<br>Faça o reload da página"; | ||
376 | - if($_POST["i3GEOuploadCriaMapfile"] == "on"){ | ||
377 | - //verifica se o usuario marcou a opcao de cria mapfile | ||
378 | - //nesse caso o aplicativo de upload esta sendo executado de dentro do sistema de administracao, e o mapfile devera | ||
379 | - //ser criado e registrado no sistema | ||
380 | - $nome = $_POST["tabelaDestino"]; | ||
381 | - $codigo = $_POST["tabelaDestino"]; | ||
382 | - $it = $_POST["tabelaDestino"]; | ||
383 | - $en = $_POST["tabelaDestino"]; | ||
384 | - $es = $_POST["tabelaDestino"]; | ||
385 | - //descobre o tipo de geometria | ||
386 | - $tipo = "select ST_Dimension(the_geom) as d from ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]." limit 1"; | ||
387 | - $q = $dbh->query($tipo,PDO::FETCH_ASSOC); | ||
388 | - $tipo = $q->fetchAll(); | ||
389 | - $tipo = $tipo[0]["d"]; | ||
390 | - $tipoLayer = "polygon"; | ||
391 | - if ($tipo == 0){ | ||
392 | - $tipoLayer = "point"; | ||
393 | - } | ||
394 | - if ($tipo == 1){ | ||
395 | - $tipoLayer = "line"; | ||
396 | - } | ||
397 | - $funcao = "CRIARNOVOMAP"; | ||
398 | - $output = "retorno"; | ||
399 | - $data = "the_geom from ($sql) as foo using unique gid using srid=$srid "; | ||
400 | - $conexao = 'dbname='.$conexao["bancodedados"].' user='.$conexao["usuario"].' password='.$conexao["senha"].' host='.$conexao["host"].' port='.$conexao["porta"]; | ||
401 | - include_once("editormapfile.php"); | ||
402 | - echo "<b><p class='paragrafo' >Criado o mapfile!!!<br>"; | ||
403 | - echo "Para editar clique: <a href='../../admin/html/editormapfile.html' target=_blank >".$nome."</a>"; | ||
404 | - echo "<script>window.scrollTo(0,10000);i3GEO.util.insereCookie('I3GEOletraAdmin','".$nome."');</script>"; | ||
405 | - } | ||
406 | - echo "<br><br>Fim"; | ||
407 | -} | ||
408 | -else{ | ||
409 | - echo "<p class='paragrafo' >Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</p>"; | ||
410 | -} | ||
411 | -function verificaNome($nome,$ext){ | ||
412 | - if(strlen(basename($nome)) > 200){ | ||
413 | - exit; | ||
414 | - } | ||
415 | - $nome = strtolower($nome); | ||
416 | - $lista = explode(".",$nome); | ||
417 | - $extensao = $lista[count($lista) - 1]; | ||
418 | - if($extensao != $ext){ | ||
419 | - echo "Nome de arquivo inválido."; | ||
420 | - exit; | ||
421 | - } | ||
422 | -} | ||
423 | -function remove_accents($string) { | ||
424 | - if (!preg_match('/[\x80-\xff]/', $string)) | ||
425 | - return $string; | ||
426 | - if (seems_utf8($string)) { | ||
427 | - $chars = array( | ||
428 | - // Decompositions for Latin-1 Supplement | ||
429 | - chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', | ||
430 | - chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', | ||
431 | - chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', | ||
432 | - chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', | ||
433 | - chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', | ||
434 | - chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', | ||
435 | - chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', | ||
436 | - chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', | ||
437 | - chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', | ||
438 | - chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', | ||
439 | - chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', | ||
440 | - chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', | ||
441 | - chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', | ||
442 | - chr(195).chr(159) => 's', chr(195).chr(160) => 'a', | ||
443 | - chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', | ||
444 | - chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', | ||
445 | - chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', | ||
446 | - chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', | ||
447 | - chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', | ||
448 | - chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', | ||
449 | - chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', | ||
450 | - chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', | ||
451 | - chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', | ||
452 | - chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', | ||
453 | - chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', | ||
454 | - chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', | ||
455 | - chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', | ||
456 | - chr(195).chr(191) => 'y', | ||
457 | - // Decompositions for Latin Extended-A | ||
458 | - chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', | ||
459 | - chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', | ||
460 | - chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', | ||
461 | - chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', | ||
462 | - chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', | ||
463 | - chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', | ||
464 | - chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', | ||
465 | - chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', | ||
466 | - chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', | ||
467 | - chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', | ||
468 | - chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', | ||
469 | - chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', | ||
470 | - chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', | ||
471 | - chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', | ||
472 | - chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', | ||
473 | - chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', | ||
474 | - chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', | ||
475 | - chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', | ||
476 | - chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', | ||
477 | - chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', | ||
478 | - chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', | ||
479 | - chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', | ||
480 | - chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', | ||
481 | - chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', | ||
482 | - chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', | ||
483 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', | ||
484 | - chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', | ||
485 | - chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', | ||
486 | - chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', | ||
487 | - chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', | ||
488 | - chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', | ||
489 | - chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', | ||
490 | - chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', | ||
491 | - chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', | ||
492 | - chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', | ||
493 | - chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', | ||
494 | - chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', | ||
495 | - chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', | ||
496 | - chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', | ||
497 | - chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', | ||
498 | - chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', | ||
499 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', | ||
500 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', | ||
501 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', | ||
502 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', | ||
503 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', | ||
504 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', | ||
505 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', | ||
506 | - chr(197).chr(160) => 'S', chr(197).chr(161) => 's', | ||
507 | - chr(197).chr(162) => 'T', chr(197).chr(163) => 't', | ||
508 | - chr(197).chr(164) => 'T', chr(197).chr(165) => 't', | ||
509 | - chr(197).chr(166) => 'T', chr(197).chr(167) => 't', | ||
510 | - chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', | ||
511 | - chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', | ||
512 | - chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', | ||
513 | - chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', | ||
514 | - chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', | ||
515 | - chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', | ||
516 | - chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', | ||
517 | - chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', | ||
518 | - chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', | ||
519 | - chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', | ||
520 | - chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', | ||
521 | - chr(197).chr(190) => 'z', chr(197).chr(191) => 's', | ||
522 | - // Euro Sign | ||
523 | - chr(226).chr(130).chr(172) => 'E', | ||
524 | - // GBP (Pound) Sign | ||
525 | - chr(194).chr(163) => ''); | ||
526 | - $string = strtr($string, $chars); | ||
527 | - } else { | ||
528 | - // Assume ISO-8859-1 if not UTF-8 | ||
529 | - $chars['in'] = chr(128).chr(131).chr(138).chr(142).chr(154).chr(158) | ||
530 | - .chr(159).chr(162).chr(165).chr(181).chr(192).chr(193).chr(194) | ||
531 | - .chr(195).chr(196).chr(197).chr(199).chr(200).chr(201).chr(202) | ||
532 | - .chr(203).chr(204).chr(205).chr(206).chr(207).chr(209).chr(210) | ||
533 | - .chr(211).chr(212).chr(213).chr(214).chr(216).chr(217).chr(218) | ||
534 | - .chr(219).chr(220).chr(221).chr(224).chr(225).chr(226).chr(227) | ||
535 | - .chr(228).chr(229).chr(231).chr(232).chr(233).chr(234).chr(235) | ||
536 | - .chr(236).chr(237).chr(238).chr(239).chr(241).chr(242).chr(243) | ||
537 | - .chr(244).chr(245).chr(246).chr(248).chr(249).chr(250).chr(251) | ||
538 | - .chr(252).chr(253).chr(255); | ||
539 | - $chars['out'] = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy"; | ||
540 | - $string = strtr($string, $chars['in'], $chars['out']); | ||
541 | - $double_chars['in'] = array(chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254)); | ||
542 | - $double_chars['out'] = array('OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th'); | ||
543 | - $string = str_replace($double_chars['in'], $double_chars['out'], $string); | ||
544 | - } | ||
545 | - return $string; | ||
546 | -} | ||
547 | -function seems_utf8($Str) { # by bmorel at ssi dot fr | ||
548 | - $length = strlen($Str); | ||
549 | - for ($i = 0; $i < $length; $i++) { | ||
550 | - if (ord($Str[$i]) < 0x80) continue; # 0bbbbbbb | ||
551 | - elseif ((ord($Str[$i]) & 0xE0) == 0xC0) $n = 1; # 110bbbbb | ||
552 | - elseif ((ord($Str[$i]) & 0xF0) == 0xE0) $n = 2; # 1110bbbb | ||
553 | - elseif ((ord($Str[$i]) & 0xF8) == 0xF0) $n = 3; # 11110bbb | ||
554 | - elseif ((ord($Str[$i]) & 0xFC) == 0xF8) $n = 4; # 111110bb | ||
555 | - elseif ((ord($Str[$i]) & 0xFE) == 0xFC) $n = 5; # 1111110b | ||
556 | - else return false; # Does not match any model | ||
557 | - for ($j = 0; $j < $n; $j++) { # n bytes matching 10bbbbbb follow ? | ||
558 | - if ((++$i == $length) || ((ord($Str[$i]) & 0xC0) != 0x80)) | ||
559 | - return false; | ||
560 | - } | ||
561 | - } | ||
562 | - return true; | ||
563 | -} | ||
564 | -?> | ||
565 | -<script>window.scrollTo(0,10000);</script> | ||
566 | -</body> | ||
567 | -</html> |
admin/php/ogcws.php
@@ -1,55 +0,0 @@ | @@ -1,55 +0,0 @@ | ||
1 | -<?php | ||
2 | -/* | ||
3 | -Title: ogcws.php | ||
4 | - | ||
5 | -Funções utilizadas pelo editor do arquivo ogcws.map | ||
6 | - | ||
7 | -Licenca: | ||
8 | - | ||
9 | -GPL2 | ||
10 | - | ||
11 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
12 | - | ||
13 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
14 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
15 | - | ||
16 | -Este programa é software livre; você pode redistribuí-lo | ||
17 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
18 | -GNU conforme publicada pela Free Software Foundation; | ||
19 | - | ||
20 | -Este programa é distribuído na expectativa de que seja útil, | ||
21 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
22 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
23 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
24 | -Você deve ter recebido uma cópia da Licença Pública Geral do | ||
25 | -GNU junto com este programa; se não, escreva para a | ||
26 | -Free Software Foundation, Inc., no endereço | ||
27 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
28 | - | ||
29 | -Arquivo: | ||
30 | - | ||
31 | -i3geo/admin/php/ogcws.php | ||
32 | - | ||
33 | -Parametros: | ||
34 | - | ||
35 | -O parâmetro principal é "funcao", que define qual operação será executada, por exemplo, ms_configura.php?funcao=PEGAPARAMETROSCONFIGURA | ||
36 | - | ||
37 | -Cada operação possuí seus próprios parâmetros, que devem ser enviados também na requisição da operação. | ||
38 | - | ||
39 | -*/ | ||
40 | -include_once(dirname(__FILE__)."/login.php"); | ||
41 | -if(verificaOperacaoSessao("admin/html/ogcws") == false){ | ||
42 | - retornaJSON("Vc nao pode realizar essa operacao.");exit; | ||
43 | -} | ||
44 | -//error_reporting(0); | ||
45 | -$versao = versao(); | ||
46 | -$map_file = $locaplic."/aplicmap/ogcwsv".$versao["principal"].".map"; | ||
47 | -$mapa = ms_newMapObj($map_file); | ||
48 | -$web = $mapa->web; | ||
49 | -//faz a busca da função que deve ser executada | ||
50 | -switch (strtoupper($funcao)) | ||
51 | -{ | ||
52 | - | ||
53 | -} | ||
54 | - | ||
55 | -?> | ||
56 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/operacoes.php
@@ -1,183 +0,0 @@ | @@ -1,183 +0,0 @@ | ||
1 | -<?php | ||
2 | -/* | ||
3 | -Title: operacoes.php | ||
4 | - | ||
5 | -Controle das requisições em Ajax utilizadas para gerenciar operacoes de usuário e controle de acesso | ||
6 | - | ||
7 | -Recebe as requisições feitas em JavaScript (AJAX) e retorna o resultado para a interface. | ||
8 | - | ||
9 | -O parâmetro "funcao" define qual a operação que será executada. Esse parâmetro é verificado em um bloco "switch ($funcao)". | ||
10 | - | ||
11 | -Licenca: | ||
12 | - | ||
13 | -GPL2 | ||
14 | - | ||
15 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
16 | - | ||
17 | -Direitos Autorais Reservados (c) 2006 Edmar Moretti | ||
18 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
19 | - | ||
20 | -Este programa é software livre; você pode redistribuí-lo | ||
21 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
22 | -GNU conforme publicada pela Free Software Foundation; | ||
23 | - | ||
24 | -Este programa é distribuído na expectativa de que seja útil, | ||
25 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
26 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
27 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
28 | -Você deve ter recebido uma copia da Licença Pública Geral do | ||
29 | -GNU junto com este programa; se não, escreva para a | ||
30 | -Free Software Foundation, Inc., no endereço | ||
31 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
32 | - | ||
33 | -Arquivo: | ||
34 | - | ||
35 | -i3geo/classesphp/operacoes.php | ||
36 | - | ||
37 | -Parametros: | ||
38 | - | ||
39 | -funcao - opção que será executada (veja abaixo a lista de Valores que esse parâmetro pode assumir). | ||
40 | - | ||
41 | -Retorno: | ||
42 | - | ||
43 | -O resultado da operação será retornado em um objeto CPAINT. | ||
44 | - | ||
45 | -A construção da string JSON é feita preferencialmente pelas funções nativas do PHP. | ||
46 | -Para efeitos de compatibilidade, uma vez que até a versão 4.2 a string JSON era construida pelo CPAINT, | ||
47 | -o objeto CPAINT ainda é definido, porém, a função cpjson verifica se as funções nativas do PHPO (json) | ||
48 | -estão instaladas, se estiverem, utiliza-se a função nativa, se não, utiliza-se o CPAINT para gerar o JSON. | ||
49 | - | ||
50 | -Exemplo de chamada CPAINT (Ajax) do lado do cliente (javascript): | ||
51 | - | ||
52 | -var p = "classesphp/mapa_controle.php?funcao=crialente&resolucao=1.5&g_sid="+g_sid | ||
53 | - | ||
54 | -var cp = new cpaint() | ||
55 | - | ||
56 | -cp.set_response_type("JSON") | ||
57 | - | ||
58 | -cp.call(p,"lente",ajaxabrelente) | ||
59 | - | ||
60 | -*/ | ||
61 | -//error_reporting(0); | ||
62 | -// | ||
63 | -//pega as variaveis passadas com get ou post | ||
64 | -// | ||
65 | -include_once(dirname(__FILE__)."/login.php"); | ||
66 | - | ||
67 | -$id = $_GET["id"]; | ||
68 | -$id_operacao = $_GET["id_operacao"]; | ||
69 | -$id_papel = $_GET["id_papel"]; | ||
70 | - | ||
71 | -testaSafeNumerico([$id,$id_operacao]); | ||
72 | - | ||
73 | -$funcoesEdicao = array( | ||
74 | - "ALTERAROPERACOES", | ||
75 | - "ADICIONAPAPELOPERACOES", | ||
76 | - "EXCLUIRPAPELOPERACAO" | ||
77 | -); | ||
78 | -if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
79 | - if(verificaOperacaoSessao("admin/html/operacoes") == false){ | ||
80 | - retornaJSON("Vc nao pode realizar essa operacao.");exit; | ||
81 | - } | ||
82 | -} | ||
83 | -switch (strtoupper($funcao)) | ||
84 | -{ | ||
85 | - case "ALTERAROPERACOES": | ||
86 | - $novo = alterarOperacoes(); | ||
87 | - $sql = "SELECT * from ".$esquemaadmin."i3geousr_operacoes WHERE id_operacao = ".$novo; | ||
88 | - retornaJSON(pegaDados($sql)); | ||
89 | - exit; | ||
90 | - break; | ||
91 | - case "PEGAOPERACOES": | ||
92 | - retornaJSON(pegaDados("SELECT id_operacao,codigo,descricao from ".$esquemaadmin."i3geousr_operacoes order by codigo")); | ||
93 | - exit; | ||
94 | - break; | ||
95 | - case "PEGAPAPEISOPERACAO": | ||
96 | - $dados = pegaDados("SELECT P.id_papel, P.nome, P.descricao, OP.id_operacao FROM ".$esquemaadmin."i3geousr_operacoes AS O JOIN ".$esquemaadmin."i3geousr_operacoespapeis AS OP ON O.id_operacao = OP.id_operacao JOIN ".$esquemaadmin."i3geousr_papeis AS P ON OP.id_papel = P.id_papel WHERE O.id_operacao = $id_operacao"); | ||
97 | - $dados[] = array("id_papel"=>1,"nome"=>"admin","descricao"=>"admin"); | ||
98 | - retornaJSON($dados); | ||
99 | - exit; | ||
100 | - break; | ||
101 | - case "PEGADADOSOPERACAO": | ||
102 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geousr_operacoes WHERE id_operacao = $id_operacao")); | ||
103 | - exit; | ||
104 | - break; | ||
105 | - case "ADICIONAPAPELOPERACOES": | ||
106 | - adicionaPapelOperacoes(); | ||
107 | - $dados = pegaDados("SELECT P.id_papel, P.nome, P.descricao, OP.id_operacao FROM ".$esquemaadmin."i3geousr_operacoes AS O JOIN ".$esquemaadmin."i3geousr_operacoespapeis AS OP ON O.id_operacao = OP.id_operacao JOIN ".$esquemaadmin."i3geousr_papeis AS P ON OP.id_papel = P.id_papel WHERE O.id_operacao = $id_operacao AND P.id_papel = $id_papel"); | ||
108 | - retornaJSON($dados); | ||
109 | - exit; | ||
110 | - break; | ||
111 | - case "EXCLUIRPAPELOPERACAO": | ||
112 | - excluirPapelOperacao(); | ||
113 | - retornaJSON("ok"); | ||
114 | - exit; | ||
115 | - break; | ||
116 | - case "LISTAPAPEIS": | ||
117 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geousr_papeis order by nome")); | ||
118 | - exit; | ||
119 | - break; | ||
120 | -} | ||
121 | -cpjson($retorno); | ||
122 | -function alterarOperacoes(){ | ||
123 | - global $id_operacao; | ||
124 | - try{ | ||
125 | - include(dirname(__FILE__)."/conexao.php"); | ||
126 | - if($convUTF){ | ||
127 | - $_GET["descricao"] = utf8_encode($_GET["descricao"]); | ||
128 | - } | ||
129 | - if($id_operacao != ""){ | ||
130 | - $dataCol = array( | ||
131 | - "codigo" => $_GET["codigo"], | ||
132 | - "descricao" => $_GET["descricao"] | ||
133 | - ); | ||
134 | - i3GeoAdminUpdate($dbhw,"i3geousr_operacoes",$dataCol,"WHERE id_operacao = $id_operacao"); | ||
135 | - $retorna = $id_operacao; | ||
136 | - } | ||
137 | - else{ | ||
138 | - $dataCol = array( | ||
139 | - "descricao" => '' | ||
140 | - ); | ||
141 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geousr_operacoes",$dataCol,"descricao","id_operacao"); | ||
142 | - } | ||
143 | - $dbhw = null; | ||
144 | - $dbh = null; | ||
145 | - return $retorna; | ||
146 | - } | ||
147 | - catch (PDOException $e){ | ||
148 | - return "Error!: "; | ||
149 | - } | ||
150 | -} | ||
151 | -function adicionaPapelOperacoes(){ | ||
152 | - global $id_operacao,$id_papel; | ||
153 | - try{ | ||
154 | - include(dirname(__FILE__)."/conexao.php"); | ||
155 | - $dataCol = array( | ||
156 | - "id_operacao" => $id_operacao, | ||
157 | - "id_papel" => $id_papel | ||
158 | - ); | ||
159 | - i3GeoAdminInsert($dbhw,"i3geousr_operacoespapeis",$dataCol); | ||
160 | - $dbhw = null; | ||
161 | - $dbh = null; | ||
162 | - return "ok"; | ||
163 | - } | ||
164 | - catch (PDOException $e){ | ||
165 | - return "Error!: "; | ||
166 | - } | ||
167 | -} | ||
168 | -function excluirPapelOperacao(){ | ||
169 | - global $id_operacao,$id_papel; | ||
170 | - try{ | ||
171 | - include(dirname(__FILE__)."/conexao.php"); | ||
172 | - $sql = "DELETE from ".$esquemaadmin."i3geousr_operacoespapeis WHERE id_operacao = $id_operacao AND id_papel = $id_papel"; | ||
173 | - $dbhw->query($sql); | ||
174 | - i3GeoAdminInsertLog($dbhw,$sql); | ||
175 | - $dbhw = null; | ||
176 | - $dbh = null; | ||
177 | - return "ok"; | ||
178 | - } | ||
179 | - catch (PDOException $e){ | ||
180 | - return "Error!: "; | ||
181 | - } | ||
182 | -} | ||
183 | -?> |
admin/php/parsemapfile.php
@@ -1,572 +0,0 @@ | @@ -1,572 +0,0 @@ | ||
1 | -<?php | ||
2 | -/* | ||
3 | -Title: parsemapfile.php | ||
4 | - | ||
5 | -Converte um mapfile em um arquivo XML | ||
6 | - | ||
7 | -O padrão XML utilizado é compatível com a estrutura de um projeto do softwrae GVSIG ate a versão 1.1 | ||
8 | -Esse XML é utilizado pelo plugin do i3Geo para GVSIG, que permite visualizar a árvore de temas do i3Geo dentro do GVSIG. | ||
9 | - | ||
10 | -No caso de layers que fazem acesso a banco de dados, a string de conexao e bloqueada por default | ||
11 | - | ||
12 | -Para desbloquear e necessario editar a variavel de configuracao existente nesse mesmo arquivo | ||
13 | - | ||
14 | -Licenca: | ||
15 | - | ||
16 | -GPL2 | ||
17 | - | ||
18 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
19 | - | ||
20 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
21 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
22 | - | ||
23 | -Este programa é software livre; você pode redistribuí-lo | ||
24 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
25 | -GNU conforme publicada pela Free Software Foundation; | ||
26 | - | ||
27 | -Este programa é distribuído na expectativa de que seja útil, | ||
28 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
29 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
30 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
31 | -Você deve ter recebido uma c�pia da Licença Pública Geral do | ||
32 | -GNU junto com este programa; se não, escreva para a | ||
33 | -Free Software Foundation, Inc., no endereço | ||
34 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
35 | - | ||
36 | -Arquivo: | ||
37 | - | ||
38 | -i3geo/admin/php/parsemapfile.php | ||
39 | -*/ | ||
40 | -include_once (dirname(__FILE__)."/../../classesphp/sani_request.php"); | ||
41 | -$_GET = array_merge($_GET,$_POST); | ||
42 | -include(dirname(__FILE__)."/../../ms_configura.php"); | ||
43 | -include_once(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php"); | ||
44 | -include_once(dirname(__FILE__)."/../../classesphp/carrega_ext.php"); | ||
45 | - | ||
46 | -// | ||
47 | -//essa variavel indica se a senha do banco e bloqueada ou nao caso | ||
48 | -//o tema seja do tipo postgis | ||
49 | -//por default e feito o bloqueio | ||
50 | -// | ||
51 | -$bloqueiaStringConexao = true; | ||
52 | -// | ||
53 | -$forcawms = $_GET["forcawms"]; | ||
54 | -//error_reporting(0); | ||
55 | -if(!isset($forcawms)){$forcawms = "nao";} | ||
56 | -$objcontype[0] = "MS_INLINE"; | ||
57 | -$objcontype[1] = "MS_SHAPEFILE"; | ||
58 | -$objcontype[2] = "MS_TILED_SHAPEFILE"; | ||
59 | -$objcontype[3] = "MS_SDE"; | ||
60 | -$objcontype[4] = "MS_OGR"; | ||
61 | -$objcontype[5] = "MS_TILED_OGR"; | ||
62 | -$objcontype[6] = "MS_POSTGIS"; | ||
63 | -$objcontype[7] = "MS_WMS"; | ||
64 | -$objcontype[8] = "MS_ORACLESPATIAL"; | ||
65 | -$objcontype[9] = "MS_WFS"; | ||
66 | -$objcontype[10] = "MS_GRATICULE"; | ||
67 | -$objcontype[11] = "MS_MYGIS"; | ||
68 | -$objcontype[12] = "MS_RASTER"; | ||
69 | -$objcontype[13] = "MS_PLUGIN"; | ||
70 | - | ||
71 | -$objlayertypes[0] = "MS_LAYER_POINT"; | ||
72 | -$objlayertypes[1] = "MS_LAYER_LINE"; | ||
73 | -$objlayertypes[2] = "MS_LAYER_POLYGON"; | ||
74 | -$objlayertypes[3] = "MS_LAYER_RASTER"; | ||
75 | -$objlayertypes[4] = "MS_LAYER_ANNOTATION"; | ||
76 | -$objlayertypes[5] = "MS_LAYER_QUERY"; | ||
77 | -$objlayertypes[6] = "MS_LAYER_CIRCLE"; | ||
78 | -$objlayertypes[7] = "MS_LAYER_TILEINDEX"; | ||
79 | -$objlayertypes[8] = "MS_LAYER_CHART"; | ||
80 | - | ||
81 | -$codigoLayer = $_GET(["id"]); | ||
82 | -$mapfile = $locaplic."/temas/".$codigoLayer.".map"; | ||
83 | -//remove temas restritos pelo sistema de controle de usuarios | ||
84 | -$indevidos = validaAcessoTemas($mapfile,false); | ||
85 | -if($indevidos == true){ | ||
86 | - echo "Encontrados layers restritos"; | ||
87 | - exit; | ||
88 | -} | ||
89 | -// | ||
90 | -$mapa = ms_newMapObj($mapfile); | ||
91 | -$tipoparse = $_GET(["tipoparse"]); | ||
92 | -if(!isset($tipoparse) || $tipoparse==""){ | ||
93 | - mapfile($_GET["output"]); | ||
94 | - exit; | ||
95 | -} | ||
96 | -$layername = $_GET(["layername"]); | ||
97 | -if($tipoparse == "legenda") | ||
98 | -{ | ||
99 | - $tipoLegenda = tipoLegenda($layername); | ||
100 | - if($tipoLegenda == "simples"){ | ||
101 | - legendaSimples($layername); | ||
102 | - } | ||
103 | - if($tipoLegenda == "valorunico"){ | ||
104 | - legendaValorUnico($layername); | ||
105 | - } | ||
106 | -} | ||
107 | -// | ||
108 | -//verifica o tipo de legenda | ||
109 | -//pode retornar: | ||
110 | -//simples - o layer não terá classes | ||
111 | -//valorunico - as classes são definidas por um item | ||
112 | -//intervalo - as classes são definidas por um intervalo do mesmo item | ||
113 | -// | ||
114 | -function tipoLegenda($layername) | ||
115 | -{ | ||
116 | - global $mapa; | ||
117 | - $tipolegenda = ""; | ||
118 | - $layer = $mapa->getlayerbyname($layername); | ||
119 | - $nclasses = $layer->numclasses; | ||
120 | - if($nclasses == 1) | ||
121 | - { | ||
122 | - $classe = $layer->getclass(0); | ||
123 | - $expressao = $classe->getExpressionString(); | ||
124 | - if($expressao == "") | ||
125 | - {return "simples";exit;} | ||
126 | - $expressao = str_replace("'eq'","="); | ||
127 | - $expressao = str_replace("'eq '","="); | ||
128 | - $expressao = str_replace("' eq'","="); | ||
129 | - $expressao = str_replace("' eq '","="); | ||
130 | - if(count(explode("=",$expressao)) != 2) | ||
131 | - {return "simples";exit;} | ||
132 | - } | ||
133 | - $verItem = array(); | ||
134 | - for($i=0;$i<$nclasses;++$i) | ||
135 | - { | ||
136 | - $classe = $layer->getclass($i); | ||
137 | - $expressao = $classe->getExpressionString(); | ||
138 | - if(count(explode("[",$expressao)) > 2) | ||
139 | - { | ||
140 | - return "intervalo"; | ||
141 | - exit; | ||
142 | - } | ||
143 | - // | ||
144 | - //verifica se os itens são únicos nas expressões | ||
145 | - // | ||
146 | - $item = preg_replace('/.*\[|\].*/i','\1', $expressao); | ||
147 | - $verItem[$item] = 0; | ||
148 | - } | ||
149 | - if(count($verItem) == 1) | ||
150 | - return "valorunico"; | ||
151 | - else | ||
152 | - return "simples"; | ||
153 | -} | ||
154 | -function legendaValorUnico($layername) | ||
155 | -{ | ||
156 | - global $mapa; | ||
157 | - $tipolegenda = ""; | ||
158 | - $layer = $mapa->getlayerbyname($layername); | ||
159 | - $nclasses = $layer->numclasses; | ||
160 | - $outlinecolor = array(); | ||
161 | - $color = array(); | ||
162 | - $nomes = array(); | ||
163 | - $valor = array(); | ||
164 | - // | ||
165 | - $classe = $layer->getclass(0); | ||
166 | - $expressao = $classe->getExpressionString(); | ||
167 | - $item = preg_replace('/.*\[|\].*/i','\1', $expressao); | ||
168 | - for($i=0;$i<$nclasses;++$i) | ||
169 | - { | ||
170 | - $classe = $layer->getclass($i); | ||
171 | - $estilo = $classe->getstyle(0); | ||
172 | - $nomes[] = $classe->name; | ||
173 | - $cor = $estilo->outlinecolor; | ||
174 | - $outlinecolor[] = "'".$cor->red.",".$cor->green.",".$cor->blue.",255'"; | ||
175 | - $cor = $estilo->color; | ||
176 | - $color[] = "'".$cor->red.",".$cor->green.",".$cor->blue.",255'"; | ||
177 | - $expressao = $classe->getExpressionString(); | ||
178 | - $expressao = str_replace("'eq","=",$expressao); | ||
179 | - $expressao = str_replace("'eq ","=",$expressao); | ||
180 | - $expressao = str_replace("' eq","=",$expressao); | ||
181 | - $expressao = str_replace("' eq ","=",$expressao); | ||
182 | - $temp = explode("=",$expressao); | ||
183 | - $temp = trim($temp[1]); | ||
184 | - $temp = trim(str_replace("'","",$temp)); | ||
185 | - $temp = trim(str_replace(")","",$temp)); | ||
186 | - $valor[] = trim(str_replace("'","",$temp)); | ||
187 | - } | ||
188 | - // | ||
189 | - //monta o xml | ||
190 | - // | ||
191 | - $xml = "<"."\x3F"."xml version='1.0' encoding='ISO-8859-1' "."\x3F".">"; | ||
192 | - $xml .= "<xml-tag xmlns='http://www.gvsig.gva.es'>\n"; | ||
193 | - $xml .= "<property key='className' value='com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend'/>\n"; | ||
194 | - $xml .= "<property key='fieldName' value='$item'/>\n"; | ||
195 | - $xml .= "<property key='labelfield'/><property key='labelFieldHeight'/><property key='labelFieldRotation'/><property key='useDefaultSymbol' value='true'/><property key='sorter' value='true'/>\n"; | ||
196 | - $xml .= "<property key='numKeys' value='".(count($valor) + 1)."'/>\n"; | ||
197 | - $xml .= "<property key='tipoValueKeys' value='com.hardcode.gdbms.engine.values.StringValue'/>\n"; | ||
198 | - $xml .= "<property key='keys' value='Default ,".implode(" ,",$nomes)."'/>\n"; | ||
199 | - $xml .= "<property key='values' value='Default ,".implode(" ,",$valor)."'/>\n"; | ||
200 | - $temp = array(); | ||
201 | - $temp[] = "1111"; | ||
202 | - foreach($valor as $v) | ||
203 | - {$temp[] = "-1";} | ||
204 | - $temp = implode(" ,",$temp); | ||
205 | - //$temp = "1111 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1"; | ||
206 | - $xml .= "<property key='typeKeys' value='$temp'/>\n"; | ||
207 | - $xml .= "<property key='typeValues' value='$temp'/>\n"; | ||
208 | - $xml .= "<property key='followHeaderEncoding' value='true'/>\n"; | ||
209 | - $xml .= "<xml-tag><property key='className' value='com.iver.cit.gvsig.fmap.core.v02.FSymbol'/><property key='m_symbolType' value='4'/><property key='m_Style' value='1'/><property key='m_useOutline' value='true'/><property key='m_Color' value='150,150,150,255'/><property key='m_outlineColor' value='255,255,255,255'/><property key='m_bUseFontSize' value='true'/><property key='m_bDrawShape' value='true'/><property key='m_Size' value='2'/><property key='m_Rotation' value='0'/><property key='m_LinePattern' value='0'/><property key='m_stroke' value='1.0'/><property key='m_bUseSize' value='false'/><property key='m_AlingVert' value='0'/><property key='m_AlingHoriz' value='0'/><property key='m_Descrip' value='Default'/><property key='rgb' value='-14902251'/></xml-tag>"; | ||
210 | - $xml .= "<xml-tag><property key='className' value='com.iver.cit.gvsig.fmap.core.v02.FSymbol'/><property key='m_symbolType' value='4'/><property key='m_Style' value='1'/><property key='m_useOutline' value='true'/><property key='m_Color' value='150,150,150,255'/><property key='m_outlineColor' value='255,255,255,255'/><property key='m_bUseFontSize' value='true'/><property key='m_bDrawShape' value='true'/><property key='m_Size' value='2'/><property key='m_Rotation' value='0'/><property key='m_LinePattern' value='0'/><property key='m_stroke' value='1.0'/><property key='m_bUseSize' value='false'/><property key='m_AlingVert' value='0'/><property key='m_AlingHoriz' value='0'/><property key='m_Descrip' value='Default'/><property key='rgb' value='-14902251'/></xml-tag>\n"; | ||
211 | - $c = count($valor); | ||
212 | - for($i=0;$i<$c;++$i) | ||
213 | - { | ||
214 | - $xml .= "<xml-tag>\n"; | ||
215 | - $xml .= "<property key='className' value='com.iver.cit.gvsig.fmap.core.v02.FSymbol'/>\n"; | ||
216 | - $xml .= "<property key='m_symbolType' value='4'/>\n"; | ||
217 | - $xml .= "<property key='m_Style' value='1'/>\n"; | ||
218 | - $temp = "true"; | ||
219 | - if($outlinecolor[$i] == "'-1,-1,-1,255'"){$temp = "false";} | ||
220 | - $xml .= "<property key='m_useOutline' value='$temp'/>\n"; | ||
221 | - if($color[$i] != "'-1,-1,-1,255'") | ||
222 | - $xml .= "<property key='m_Color' value=$color[$i]/>\n"; | ||
223 | - if($temp != "false") | ||
224 | - $xml .= "<property key='m_outlineColor' value=$outlinecolor[$i]/>\n"; | ||
225 | - $xml .= "<property key='m_bUseFontSize' value='true'/>\n"; | ||
226 | - $xml .= "<property key='m_bDrawShape' value='true'/>\n"; | ||
227 | - $xml .= "<property key='m_Size' value='2'/>\n"; | ||
228 | - $xml .= "<property key='m_Rotation' value='0'/>\n"; | ||
229 | - $xml .= "<property key='m_LinePattern' value='0'/>\n"; | ||
230 | - $xml .= "<property key='m_stroke' value='1.0'/>\n"; | ||
231 | - $xml .= "<property key='m_bUseSize' value='false'/>\n"; | ||
232 | - $xml .= "<property key='m_AlingVert' value='0'/>\n"; | ||
233 | - $xml .= "<property key='m_AlingHoriz' value='0'/>\n"; | ||
234 | - $xml .= "<property key='m_Descrip' value='$nomes[$i]'/>\n"; | ||
235 | - $xml .= "<property key='rgb' value='-16145084'/>\n"; | ||
236 | - $xml .= "</xml-tag>\n"; | ||
237 | - } | ||
238 | - $xml .= "</xml-tag>\n"; | ||
239 | - echo header("Content-type: application/xml"); | ||
240 | - echo $xml; | ||
241 | - exit; | ||
242 | -} | ||
243 | -function legendaSimples($layername) | ||
244 | -{ | ||
245 | - global $mapa; | ||
246 | - $tipolegenda = ""; | ||
247 | - $layer = $mapa->getlayerbyname($layername); | ||
248 | - $classe = $layer->getclass(0); | ||
249 | - $estilo = $classe->getstyle(0); | ||
250 | - $cor = $estilo->color; | ||
251 | - $outcor = $estilo->outlinecolor; | ||
252 | - $xml = "<"."\x3F"."xml version='1.0' encoding='ISO-8859-1' "."\x3F".">"; | ||
253 | - $xml .= "<xml-tag xmlns='http://www.gvsig.gva.es'>\n"; | ||
254 | - $xml .= "<property key='className' value='com.iver.cit.gvsig.fmap.rendering.SingleSymbolLegend'/>\n"; | ||
255 | - $xml .= "<property key='labelFieldName'/>\n"; | ||
256 | - $xml .= "<property key='labelHeightFieldName'/>\n"; | ||
257 | - $xml .= "<property key='labelRotationFieldName'/>\n"; | ||
258 | - $xml .= "<property key='followHeaderEncoding' value='true'/>\n"; | ||
259 | - $xml .= "<xml-tag>\n"; | ||
260 | - $xml .= "<property key='className' value='com.iver.cit.gvsig.fmap.core.v02.FSymbol'/>\n"; | ||
261 | - $xml .= "<property key='m_symbolType' value='4'/>\n"; | ||
262 | - $xml .= "<property key='m_Style' value='1'/>\n"; | ||
263 | - $xml .= "<property key='m_useOutline' value='true'/>\n"; | ||
264 | - if($cor->red != -1) | ||
265 | - $xml .= "<property key='m_Color' value='".$cor->red.",".$cor->green.",".$cor->blue.",255'/>\n"; | ||
266 | - if($outcor->red != -1) | ||
267 | - $xml .= "<property key='m_outlineColor' value='".$outcor->red.",".$outcor->green.",".$outcor->blue.",255'/>\n"; | ||
268 | - else | ||
269 | - $xml .= "<property key='m_outlineColor' value='0,0,0,255'/>\n"; | ||
270 | - $xml .= "<property key='m_bUseFontSize' value='true'/>\n"; | ||
271 | - $xml .= "<property key='m_bDrawShape' value='true'/>\n"; | ||
272 | - $xml .= "<property key='m_Size' value='2'/>\n"; | ||
273 | - $xml .= "<property key='m_Rotation' value='0'/>\n"; | ||
274 | - $xml .= "<property key='m_LinePattern' value='0'/>\n"; | ||
275 | - $xml .= "<property key='m_stroke' value='1.0'/>\n"; | ||
276 | - $xml .= "<property key='m_bUseSize' value='false'/>\n"; | ||
277 | - $xml .= "<property key='m_AlingVert' value='0'/>\n"; | ||
278 | - $xml .= "<property key='m_AlingHoriz' value='0'/>\n"; | ||
279 | - $xml .= "<property key='m_Descrip'/>\n"; | ||
280 | - $xml .= "<property key='rgb' value='-14902251'/>\n"; | ||
281 | - $xml .= "</xml-tag>\n"; | ||
282 | - $xml .= "</xml-tag>\n"; | ||
283 | - echo header("Content-type: application/xml"); | ||
284 | - echo $xml; | ||
285 | - exit; | ||
286 | -} | ||
287 | -// | ||
288 | -//gera xml com parâmetros do mapfile | ||
289 | -// | ||
290 | -function mapfile($output="xml") | ||
291 | -{ | ||
292 | - global $codigoLayer,$mapfile,$mapa,$objcontype,$objlayertypes,$forcawms,$postgis_mapa,$bloqueiaStringConexao; | ||
293 | - $layers = $mapa->getalllayernames(); | ||
294 | - $dados = array(); | ||
295 | - $xml = "<"."\x3F"."xml version='1.0' encoding='ISO-8859-1' "."\x3F".">"; | ||
296 | - $xml .= "\n<parsemapfile>\n"; | ||
297 | - $xml .= "<tiposconexao>".implode(",",$objcontype)."</tiposconexao>\n"; | ||
298 | - $xml .= "<tiposlayer>".implode(",",$objlayertypes)."</tiposlayer>\n"; | ||
299 | - $json = array( | ||
300 | - "tiposconexao"=>implode(",",$objcontype), | ||
301 | - "tiposlayer"=>implode(",",$objlayertypes), | ||
302 | - ); | ||
303 | - //verifica se tem grupos | ||
304 | - $nlayers = array(); | ||
305 | - foreach ($layers as $layerName) | ||
306 | - { | ||
307 | - $layer = $mapa->getlayerbyname($layerName); | ||
308 | - if($objcontype[$layer->connectiontype] != MS_WMS ) | ||
309 | - { | ||
310 | - if($layer->group == "") | ||
311 | - {$nlayers[] = $layer->name;} | ||
312 | - else | ||
313 | - { | ||
314 | - if($layer->group == $layer->name) | ||
315 | - {$nlayers[] = $layer->name;} | ||
316 | - } | ||
317 | - $layers = $nlayers; | ||
318 | - } | ||
319 | - } | ||
320 | - foreach ($layers as $layerName) | ||
321 | - { | ||
322 | - $xml .= "\n<layer>\n"; | ||
323 | - $layer = $mapa->getlayerbyname($layerName); | ||
324 | - $xml .= "<titulo>".$layer->getmetadata('tema')."</titulo>\n"; | ||
325 | - $json["layer"] = array(); | ||
326 | - $d = $layer->data; | ||
327 | - if (@$layer->open() == MS_SUCCESS){ | ||
328 | - $colunas = implode(",",$layer->getItems()); | ||
329 | - } | ||
330 | - else{ | ||
331 | - $colunas = "*"; | ||
332 | - } | ||
333 | - $ct = $objcontype[$layer->connectiontype]; | ||
334 | - $tagLegenda = "parsemapfile.php?id=".$codigoLayer."&layername=".$layer->name."&tipoparse=legenda"; | ||
335 | - $nomeLayer = $layer->name; | ||
336 | - if ($forcawms == "sim" || $ct == "MS_SHAPEFILE" || $ct == "" || $ct == "MS_RASTER" && $ct != "MS_WMS") | ||
337 | - { | ||
338 | - $ct = "MS_WMS"; | ||
339 | - $d = "http://".$_SERVER['HTTP_HOST'].str_replace("/admin/php/parsemapfile.php","",$_SERVER['PHP_SELF'])."/ogc.php?tema=".$codigoLayer; | ||
340 | - $xml .= "<version>1.1.1</version>"; | ||
341 | - $json["layer"]["version"] = "1.1.1"; | ||
342 | - $xml .= "<srs>EPSG:4326</srs>"; | ||
343 | - $json["layer"]["srs"] = "EPSG:4326"; | ||
344 | - $xml .= "<format>image/png</format>"; | ||
345 | - $json["layer"]["format"] = "image/png"; | ||
346 | - $xml .= "<style>default</style>"; | ||
347 | - $json["layer"]["style"] = "default"; | ||
348 | - $tagLegenda = ""; | ||
349 | - } | ||
350 | - else if($ct == "MS_WMS") | ||
351 | - { | ||
352 | - $d = $layer->connection; | ||
353 | - $v = $layer->getmetadata("wms_server_version"); | ||
354 | - $e = $layer->getmetadata("wms_srs"); | ||
355 | - $i = $layer->getmetadata("wms_format"); | ||
356 | - $s = $layer->getmetadata("wms_style"); | ||
357 | - $nomeLayer = $layer->getmetadata("wms_name"); | ||
358 | - if($nomeLayer == "") | ||
359 | - $nomeLayer = $layer->getmetadata("ows_name"); | ||
360 | - if($v == "") | ||
361 | - $v = $layer->getmetadata("ows_server_version"); | ||
362 | - if($e == "") | ||
363 | - $e = $layer->getmetadata("ows_srs"); | ||
364 | - if($i == "") | ||
365 | - $i = $layer->getmetadata("ows_format"); | ||
366 | - if($s == "") | ||
367 | - $s = $layer->getmetadata("ows_style"); | ||
368 | - if($s == "") | ||
369 | - {$s = "default";} | ||
370 | - $xml .= "<version>$v</version>"; | ||
371 | - $json["layer"]["version"] = $v; | ||
372 | - $xml .= "<srs>$e</srs>"; | ||
373 | - $json["layer"]["srs"] = $e; | ||
374 | - $xml .= "<format>image/png</format>"; | ||
375 | - $json["layer"]["format"] = "image/png"; | ||
376 | - $xml .= "<style>$s</style>"; | ||
377 | - $json["layer"]["style"] = $s; | ||
378 | - $tagLegenda = ""; | ||
379 | - } | ||
380 | - $xml .= "<geraxmllegenda><![CDATA[".$tagLegenda."]]></geraxmllegenda>"; | ||
381 | - $json["layer"]["geraxmllegenda"] = $tagLegenda; | ||
382 | - $xml .= "<connectiontype>".$ct."</connectiontype>\n"; | ||
383 | - $json["layer"]["connectiontype"] = $ct; | ||
384 | - $xml .= "<data>$d</data>\n"; | ||
385 | - $json["layer"]["data"] = $d; | ||
386 | - $xml .= "<name>$nomeLayer</name>\n"; | ||
387 | - $json["layer"]["name"] = $nomeLayer; | ||
388 | - if($ct != "MS_WMS") | ||
389 | - { | ||
390 | - $xml .= "<connection>\n"; | ||
391 | - $json["layer"]["connection"] = array(); | ||
392 | - $con = $layer->connection; | ||
393 | - if (($con == " ") || ($con == "") || (in_array($con,array_keys($postgis_mapa)))) | ||
394 | - { | ||
395 | - if(($con == " ") || ($con == "")) | ||
396 | - {$con = $postgis_mapa;} | ||
397 | - else | ||
398 | - {$con = $postgis_mapa[$con];} | ||
399 | - } | ||
400 | - if($bloqueiaStringConexao == true){ | ||
401 | - $xml .= "<user>bloqueado (veja i3geo/admin/php/parsemapfile)</user>\n"; | ||
402 | - $json["layer"]["connection"]["user"] = "bloqueado (veja i3geo/admin/php/parsemapfile)"; | ||
403 | - $xml .= "<password></password>\n"; | ||
404 | - $json["layer"]["connection"]["password"] = ""; | ||
405 | - $xml .= "<dbname></dbname>\n"; | ||
406 | - $json["layer"]["connection"]["dbname"] = ""; | ||
407 | - $xml .= "<host></host>\n"; | ||
408 | - $json["layer"]["connection"]["host"] = ""; | ||
409 | - $xml .= "<port></port>\n"; | ||
410 | - $json["layer"]["connection"]["port"] = ""; | ||
411 | - } | ||
412 | - else{ | ||
413 | - $xml .= "<user>".preg_replace('/.*user\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con)."</user>\n"; | ||
414 | - $json["layer"]["connection"]["user"] = preg_replace('/.*user\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con); | ||
415 | - | ||
416 | - $xml .= "<password>".preg_replace('/.*password\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con)."</password>\n"; | ||
417 | - $json["layer"]["connection"]["password"] = preg_replace('/.*password\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con); | ||
418 | - | ||
419 | - $xml .= "<dbname>".preg_replace('/.*dbname\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con)."</dbname>\n"; | ||
420 | - $json["layer"]["connection"]["dbname"] = preg_replace('/.*dbname\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con); | ||
421 | - | ||
422 | - $xml .= "<host>".preg_replace('/.*host\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con)."</host>\n"; | ||
423 | - $json["layer"]["connection"]["host"] = preg_replace('/.*host\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con); | ||
424 | - | ||
425 | - $xml .= "<port>".preg_replace('/.*port\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con)."</port>\n"; | ||
426 | - $json["layer"]["connection"]["port"] = preg_replace('/.*port\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con); | ||
427 | - } | ||
428 | - $xml .= "</connection>\n"; | ||
429 | - $d = explode("(",$d); | ||
430 | - $d = explode(")",$d[1]); | ||
431 | - $dstring = $d[0]; | ||
432 | - $dstring = str_replace("the_geom","",$dstring); | ||
433 | - $dstring = str_replace("*",$colunas,$dstring); | ||
434 | - $xml .= "<colunas>$colunas</colunas>"; | ||
435 | - $json["layer"]["colunas"] = $colunas; | ||
436 | - $xml .= "<select>$dstring</select>\n"; | ||
437 | - $json["layer"]["select"] = $dstring; | ||
438 | - $string = preg_replace('/.*from\s*(.+).*/i', '\1', $d[0]); | ||
439 | - $s = explode("WHERE",$string); | ||
440 | - if(count($s) == 1) | ||
441 | - $s = explode("where",$string); | ||
442 | - $esquemaTabela = explode(".",$s[0]); | ||
443 | - $xml .= "<esquema>".$esquemaTabela[0]."</esquema>"; | ||
444 | - $xml .= "<tabela>".$esquemaTabela[1]."</tabela>"; | ||
445 | - $xml .= "<where>".$s[1]."</where>"; | ||
446 | - $xml .= "<type>".$objlayertypes[$layer->type]."</type>\n"; | ||
447 | - $xml .= "<filter>".$layer->getfilterstring()."</filter>\n"; | ||
448 | - $xml .= "<filteritem>$layer->filteritem</filteritem>\n"; | ||
449 | - $xml .= "<labelitem>$layer->labelitem</labelitem>\n"; | ||
450 | - $xml .= "<labelmaxscale>$layer->labelmaxscaledenom</labelmaxscale>\n"; | ||
451 | - $xml .= "<labelminscale>$layer->labelminscaledenom</labelminscale>\n"; | ||
452 | - $xml .= "<labelsizeitem></labelsizeitem>\n"; | ||
453 | - | ||
454 | - $json["layer"]["esquema"] = $esquemaTabela[0]; | ||
455 | - $json["layer"]["tabela"] = $esquemaTabela[1]; | ||
456 | - $json["layer"]["where"] = $s[1]; | ||
457 | - $json["layer"]["type"] = $objlayertypes[$layer->type]; | ||
458 | - $json["layer"]["filter"] = $layer->getfilterstring(); | ||
459 | - $json["layer"]["filteritem"] = $layer->filteritem; | ||
460 | - $json["layer"]["labelitem"] = $layer->labelitem; | ||
461 | - $json["layer"]["labelmaxscale"] = $layer->labelmaxscaledenom; | ||
462 | - $json["layer"]["labelminscale"] = $layer->labelminscaledenom; | ||
463 | - $json["layer"]["labelsizeitem"] = ""; | ||
464 | - } | ||
465 | - $xml .= "<group>$layer->group</group>\n"; | ||
466 | - $xml .= "<maxscale>$layer->maxscaledenom</maxscale>\n"; | ||
467 | - $xml .= "<minscale>$layer->minscaledenom</minscale>\n"; | ||
468 | - $xml .= "<offsite>".$layer->offsite->red.",".$layer->offsite->green.",".$layer->offsite->blue."</offsite>\n"; | ||
469 | - $xml .= "<opacity>$layer->opacity</opacity>\n"; | ||
470 | - | ||
471 | - $json["layer"]["group"] = $layer->group; | ||
472 | - $json["layer"]["maxscale"] = $layer->maxscaledenom; | ||
473 | - $json["layer"]["minscale"] = $layer->minscaledenom; | ||
474 | - $json["layer"]["offsite"] = $layer->offsite->red.",".$layer->offsite->green.",".$layer->offsite->blue; | ||
475 | - $json["layer"]["opacity"] = $layer->opacity; | ||
476 | - | ||
477 | - if($ct != "xMS_WMS") | ||
478 | - { | ||
479 | - $xml .= "<symbolscale>$layer->symbolscaledenom</symbolscale>\n"; | ||
480 | - $xml .= "<tileindex>$layer->tileindex</tileindex>\n"; | ||
481 | - $xml .= "<tileitem>$layer->tileitem</tileitem>\n"; | ||
482 | - $xml .= "<tolerance>$layer->tolerance</tolerance>\n"; | ||
483 | - $xml .= "<toleranceunits>$layer->toleranceunits</toleranceunits>\n"; | ||
484 | - $xml .= "<sizeunits>$layer->sizeunits</sizeunits>\n"; | ||
485 | - $xml .= "<projection>".$layer->getProjection()."</projection>\n"; | ||
486 | - $xml .= "<classes>\n"; | ||
487 | - $xml .= pegaClasses($layer,"xml"); | ||
488 | - $xml .= "</classes>\n"; | ||
489 | - | ||
490 | - $json["layer"]["symbolscale"] = $layer->symbolscaledenom; | ||
491 | - $json["layer"]["tileindex"] = $layer->tileindex; | ||
492 | - $json["layer"]["tileitem"] = $layer->tileitem; | ||
493 | - $json["layer"]["tolerance"] = $layer->tolerance; | ||
494 | - $json["layer"]["toleranceunits"] = $layer->toleranceunits; | ||
495 | - $json["layer"]["sizeunits"] = $layer->sizeunits; | ||
496 | - $json["layer"]["projection"] = $layer->getProjection(); | ||
497 | - $json["layer"]["classes"] = pegaClasses($layer,"json"); | ||
498 | - } | ||
499 | - $xml .= "</layer>"; | ||
500 | - } | ||
501 | - $xml .= "</parsemapfile>\n"; | ||
502 | - echo header("Content-type: application/".$output); | ||
503 | - if($output=="xml"){ | ||
504 | - echo $xml; | ||
505 | - } | ||
506 | - else{ | ||
507 | - echo json_encode($json); | ||
508 | - } | ||
509 | -} | ||
510 | -function pegaClasses($layer,$output="xml") | ||
511 | -{ | ||
512 | - $xml = ""; | ||
513 | - $json = array(); | ||
514 | - $dados = array(); | ||
515 | - $nclasses = $layer->numclasses; | ||
516 | - for($i=0;$i<$nclasses;++$i) | ||
517 | - { | ||
518 | - $xml .= "<classe>\n"; | ||
519 | - $classe = $layer->getclass($i); | ||
520 | - $xml .= "<name>".mb_convert_encoding(($classe->name),"UTF-8","ISO-8859-1")."</name>\n"; | ||
521 | - $xml .= "<expression>".$classe->getExpressionString()."</expression>\n"; | ||
522 | - $xml .= "<keyimage>$classe->keyimage</keyimage>\n"; | ||
523 | - $xml .= "<estilos>\n"; | ||
524 | - $xml .= pegaEstilos($classe,$output); | ||
525 | - $xml .= "</estilos>\n"; | ||
526 | - $xml .= "</classe>\n"; | ||
527 | - | ||
528 | - $j = array(); | ||
529 | - $j["name"] = mb_convert_encoding(($classe->name),"UTF-8","ISO-8859-1"); | ||
530 | - $j["expression"] = $classe->getExpressionString(); | ||
531 | - $j["keyimage"] = $classe->keyimage; | ||
532 | - $j["estilos"] = pegaEstilos($classe,$output); | ||
533 | - $json[] = $j; | ||
534 | - } | ||
535 | - if($output == "xml"){ | ||
536 | - return $xml; | ||
537 | - } | ||
538 | - else{ | ||
539 | - return $json; | ||
540 | - } | ||
541 | -} | ||
542 | -function pegaEstilos($classe,$output = "xml") | ||
543 | -{ | ||
544 | - $numestilos = $classe->numstyles; | ||
545 | - $json = array(); | ||
546 | - for($j=0;$j<$numestilos;++$j) | ||
547 | - { | ||
548 | - $xml .= "<estilo>\n"; | ||
549 | - $estilo = $classe->getstyle($j); | ||
550 | - $xml .= "<symbolname>$estilo->symbolname</symbolname>\n"; | ||
551 | - $xml .= "<color>".$estilo->color->red.",".$estilo->color->green.",".$estilo->color->blue."</color>\n"; | ||
552 | - $xml .= "<size>$estilo->size</size>\n"; | ||
553 | - $xml .= "<backgroundcolor>".$estilo->backgroundcolor->red.",".$estilo->backgroundcolor->green.",".$estilo->backgroundcolor->blue."</backgroundcolor>\n"; | ||
554 | - $xml .= "<outlinecolor>".$estilo->outlinecolor->red.",".$estilo->outlinecolor->green.",".$estilo->outlinecolor->blue."</outlinecolor>\n"; | ||
555 | - $xml .= "</estilo>\n"; | ||
556 | - | ||
557 | - $e = array(); | ||
558 | - $e["symbolname"] = $estilo->symbolname; | ||
559 | - $e["color"] = $estilo->color->red.",".$estilo->color->green.",".$estilo->color->blue; | ||
560 | - $e["size"] = $estilo->size; | ||
561 | - $e["backgroundcolor"] = $estilo->backgroundcolor->red.",".$estilo->backgroundcolor->green.",".$estilo->backgroundcolor->blue; | ||
562 | - $e["outlinecolor"] = $estilo->outlinecolor->red.",".$estilo->outlinecolor->green.",".$estilo->outlinecolor->blue; | ||
563 | - $json[] = $e; | ||
564 | - } | ||
565 | - if($output == "xml"){ | ||
566 | - return $xml; | ||
567 | - } | ||
568 | - else{ | ||
569 | - return $json; | ||
570 | - } | ||
571 | -} | ||
572 | -?> | ||
573 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/preview.php
@@ -1,198 +0,0 @@ | @@ -1,198 +0,0 @@ | ||
1 | -<?php | ||
2 | -/** | ||
3 | -Esse programa e uma adaptacao do codigo i3geo/ogc.php | ||
4 | -E utilizado no preview de camadas no editor de mapfiles | ||
5 | -Evita bloqueios de OGC e nao faz cache | ||
6 | - */ | ||
7 | -include(dirname(__FILE__)."/login.php"); | ||
8 | -if(verificaOperacaoSessao("admin/php/editortexto") == false){ | ||
9 | - //echo "Vc nao pode realizar essa operacao.";exit; | ||
10 | -} | ||
11 | - | ||
12 | -// | ||
13 | -//pega os endereços para compor a url de chamada do gerador de web services | ||
14 | -//ogc.php | ||
15 | -// | ||
16 | -$protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); | ||
17 | -$protocolo = $protocolo[0]; | ||
18 | -$protocolo1 = strtolower($protocolo) . '://'.$_SERVER['SERVER_NAME']; | ||
19 | -$protocolo = strtolower($protocolo) . '://'.$_SERVER['SERVER_NAME'] .":". $_SERVER['SERVER_PORT']; | ||
20 | -$urli3geo = str_replace("/ogc.php","",$protocolo.$_SERVER["PHP_SELF"]); | ||
21 | -// | ||
22 | -//cria o web service | ||
23 | -// | ||
24 | -//error_reporting(0); | ||
25 | -$versao = versao(); | ||
26 | -$versao = $versao["principal"]; | ||
27 | - | ||
28 | - | ||
29 | -if($_GET["SRS"] == "EPSG:900913"){ | ||
30 | - $_GET["SRS"] = "EPSG:3857"; | ||
31 | -} | ||
32 | -if(isset($_GET["BBOX"])){ | ||
33 | - $_GET["BBOX"] = str_replace(" ",",",$_GET["BBOX"]); | ||
34 | -} | ||
35 | -$req = ms_newowsrequestobj(); | ||
36 | - | ||
37 | -if(!isset($_GET["srs"]) && !isset($_GET["SRS"])){ | ||
38 | - $_GET["srs"] = "EPSG:4326"; | ||
39 | -} | ||
40 | -foreach ($_GET as $k=>$v){ | ||
41 | - $req->setParameter(strtoupper($k), $v); | ||
42 | - if(strtolower($k) == "layers" && empty($_GET["tema"])){ | ||
43 | - $tema = $v; | ||
44 | - } | ||
45 | - if(strtolower($k) == "layer" && empty($_GET["tema"])){ | ||
46 | - $tema = $v; | ||
47 | - } | ||
48 | -} | ||
49 | -if(empty($tema)){ | ||
50 | - $tema = $_GET["tema"]; | ||
51 | -} | ||
52 | -$req->setParameter("srsName",$req->getValueByName("SRS")); | ||
53 | -$listaepsg = $req->getValueByName("SRS")." EPSG:4618 EPSG:4291 EPSG:4326 EPSG:22521 EPSG:22522 EPSG:22523 EPSG:22524 EPSG:22525 EPSG:29101 EPSG:29119 EPSG:29120 EPSG:29121 EPSG:29122 EPSG:29177 EPSG:29178 EPSG:29179 EPSG:29180 EPSG:29181 EPSG:29182 EPSG:29183 EPSG:29184 EPSG:29185"; | ||
54 | -if(isset($_GET["version"]) && !isset($VERSION)){ | ||
55 | - $_GET["VERSION"] = $_GET["version"]; | ||
56 | -} | ||
57 | -$req->setParameter("VeRsIoN",$_GET["VERSION"]); | ||
58 | - | ||
59 | -// | ||
60 | -//compatibiliza chamadas fora do padrao | ||
61 | -// | ||
62 | -if(isset($_GET["outputFormat"]) && $_GET["outputFormat"] != ""){ | ||
63 | - $_GET["OUTPUTFORMAT"] = $_GET["outputFormat"]; | ||
64 | -} | ||
65 | -//essa variavel e usada para definir se a imagem final gerada devera ser cortada ou nao | ||
66 | -$cortePixels = 0; | ||
67 | - | ||
68 | -if(empty($ogcwsmap)){ | ||
69 | - $oMap = ms_newMapobj($locaplic."/aplicmap/ogcwsv".$versao.".map"); | ||
70 | -} | ||
71 | -else{ | ||
72 | - $oMap = ms_newMapobj($ogcwsmap); | ||
73 | -} | ||
74 | - | ||
75 | -$proto = "http" . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "") . "://"; | ||
76 | -$server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; | ||
77 | -$or = $proto.$server.$_SERVER['PHP_SELF']; | ||
78 | -$or = $or."?tema=".$tema."&"; | ||
79 | -$oMap->setmetadata("ows_onlineresource",$or); | ||
80 | -$oMap->setmetadata("wms_onlineresource",$or); | ||
81 | -$oMap->setmetadata("wms_attribution_onlineresource",$proto.$server.dirname($_SERVER['PHP_SELF'])); | ||
82 | -$oMap->setmetadata("ows_enable_request","*"); | ||
83 | - | ||
84 | -//parametro mandatario | ||
85 | -if($oMap->getmetadata("wms_srs") == ""){ | ||
86 | - $oMap->setmetadata("wms_srs","EPSG:4326"); | ||
87 | -} | ||
88 | - | ||
89 | -$e = $oMap->extent; | ||
90 | -$extensaoMap = ($e->minx)." ".($e->miny)." ".($e->maxx)." ".($e->maxy); | ||
91 | -//gera o mapa | ||
92 | - | ||
93 | -$nmap = ms_newMapobj($tema); | ||
94 | - | ||
95 | -$nmap->setmetadata("ows_enable_request","*"); | ||
96 | -$l = $nmap->getlayer(0); | ||
97 | - | ||
98 | -//$l->setmetadata("ows_title",pegaNome($l)); | ||
99 | -$l->setmetadata("ows_srs",$listaepsg); | ||
100 | -$l->set("group",""); | ||
101 | -$l->setmetadata("gml_include_items","all"); | ||
102 | -$l->set("template","none.htm"); | ||
103 | -$l->set("dump",MS_TRUE); | ||
104 | -$l->setmetadata("WMS_INCLUDE_ITEMS","all"); | ||
105 | -$l->setmetadata("WFS_INCLUDE_ITEMS","all"); | ||
106 | -//inclui extensao geografica | ||
107 | -$extensao = $l->getmetadata("EXTENSAO"); | ||
108 | -if($extensao == ""){ | ||
109 | - $extensao = $extensaoMap; | ||
110 | -} | ||
111 | - | ||
112 | -$l->setmetadata("wms_extent",$extensao); | ||
113 | -if (!empty($postgis_mapa)){ | ||
114 | - if ($l->connectiontype == MS_POSTGIS){ | ||
115 | - $lcon = $l->connection; | ||
116 | - if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))){ | ||
117 | - // | ||
118 | - //o metadata CONEXAOORIGINAL guarda o valor original para posterior substituição | ||
119 | - // | ||
120 | - if(($lcon == " ") || ($lcon == "")){ | ||
121 | - $l->set("connection",$postgis_mapa); | ||
122 | - $l->setmetadata("CONEXAOORIGINAL",$lcon); | ||
123 | - } | ||
124 | - else{ | ||
125 | - $l->set("connection",$postgis_mapa[$lcon]); | ||
126 | - $l->setmetadata("CONEXAOORIGINAL",$lcon); | ||
127 | - } | ||
128 | - } | ||
129 | - } | ||
130 | -} | ||
131 | - | ||
132 | -autoClasses($l,$oMap); | ||
133 | -if($versao > 5){ | ||
134 | - $pr = $l->getProcessing(); | ||
135 | - if(!in_array("LABEL_NO_CLIP=True",$pr)){ | ||
136 | - $l->setprocessing("LABEL_NO_CLIP=True"); | ||
137 | - } | ||
138 | - if(!in_array("POLYLINE_NO_CLIP=True",$pr)){ | ||
139 | - $l->setprocessing("POLYLINE_NO_CLIP=True"); | ||
140 | - } | ||
141 | -} | ||
142 | -$l->set("status",MS_DEFAULT); | ||
143 | - | ||
144 | -ms_newLayerObj($oMap, $l); | ||
145 | - | ||
146 | -$oMap->setSymbolSet($locaplic."/symbols/".basename($oMap->symbolsetfilename)); | ||
147 | -$oMap->setFontSet($locaplic."/symbols/".basename($oMap->fontsetfilename)); | ||
148 | - | ||
149 | -if(ob_get_contents ()){ | ||
150 | - ob_end_clean(); | ||
151 | -} | ||
152 | -cloneInlineSymbol($l,$nmap,$oMap); | ||
153 | - | ||
154 | -$l = $oMap->getlayer(0); | ||
155 | -$req->setParameter("LAYERS",$l->name); | ||
156 | - | ||
157 | -if(strtolower($req->getValueByName("REQUEST")) == "getfeatureinfo"){ | ||
158 | - $req->setParameter("LAYERS",$l->name); | ||
159 | - $req->setParameter("QUERY_LAYERS",$l->name); | ||
160 | - if(strtolower($req->getValueByName("SRS")) == "epsg:900913"){ | ||
161 | - $req->setParameter("SRS","EPSG:3857"); | ||
162 | - $_GET["SRS"] = "EPSG:3857"; | ||
163 | - } | ||
164 | -} | ||
165 | - | ||
166 | -ms_ioinstallstdouttobuffer(); | ||
167 | -$req->setParameter("format","image/png"); | ||
168 | -$oMap->owsdispatch($req); | ||
169 | -$contenttype = ms_iostripstdoutbuffercontenttype(); | ||
170 | -$oMap->save("/tmp/ms_tmp/teste.map"); | ||
171 | -if(!isset($OUTPUTFORMAT)){ | ||
172 | - header("Content-type: $contenttype"); | ||
173 | -} | ||
174 | - | ||
175 | -$buffer = ms_iogetStdoutBufferBytes(); | ||
176 | -ms_ioresethandlers(); | ||
177 | - | ||
178 | -function texto2iso($texto){ | ||
179 | - if (function_exists("mb_convert_encoding")){ | ||
180 | - if (mb_detect_encoding($texto,"UTF-8",true)){ | ||
181 | - $texto = mb_convert_encoding($texto,"ISO-8859-1","UTF-8"); | ||
182 | - } | ||
183 | - } | ||
184 | - return $texto; | ||
185 | -} | ||
186 | -function nomeRand($n=10) | ||
187 | -{ | ||
188 | - $nomes = ""; | ||
189 | - $a = 'azertyuiopqsdfghjklmwxcvbnABCDEFGHIJKLMNOPQRSTUVWXYZ'; | ||
190 | - $max = 51; | ||
191 | - for($i=0; $i < $n; ++$i) | ||
192 | - { | ||
193 | - $nomes .= $a{mt_rand(0, $max)}; | ||
194 | - } | ||
195 | - return $nomes; | ||
196 | -} | ||
197 | - | ||
198 | -?> |
admin/php/sistemas.php
@@ -1,347 +0,0 @@ | @@ -1,347 +0,0 @@ | ||
1 | -<?php | ||
2 | -/* | ||
3 | - Title: sistemas.php | ||
4 | - | ||
5 | -Funções utilizadas pelo editor do cadastro de sistemas | ||
6 | - | ||
7 | -Sistemas são opções adicionais que pode ser incluídas na árvore de adição de temas do i3Geo | ||
8 | - | ||
9 | -Licenca: | ||
10 | - | ||
11 | -GPL2 | ||
12 | - | ||
13 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
14 | - | ||
15 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
16 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
17 | - | ||
18 | -Este programa é software livre; você pode redistribuí-lo | ||
19 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
20 | -GNU conforme publicada pela Free Software Foundation; | ||
21 | - | ||
22 | -Este programa é distribuído na expectativa de que seja útil, | ||
23 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
24 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
25 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
26 | -Você deve ter recebido uma cópia da Licença Pública Geral do | ||
27 | - GNU junto com este programa; se não, escreva para a | ||
28 | -Free Software Foundation, Inc., no endereço | ||
29 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
30 | - | ||
31 | -Arquivo: | ||
32 | - | ||
33 | -i3geo/admin/php/sistemas.php | ||
34 | - | ||
35 | -Parametros: | ||
36 | - | ||
37 | -O parâmetro principal é "funcao", que define qual operação será executada, por exemplo, sistemas.php?funcao=pegasistemas. | ||
38 | - | ||
39 | -Cada operação possuí seus próprios parâmetros, que devem ser enviados também na requisição da operação. | ||
40 | -*/ | ||
41 | -include_once(dirname(__FILE__)."/login.php"); | ||
42 | - | ||
43 | -$id_sistema = $_GET["id_sistema"]; | ||
44 | -$id_funcao = $_GET["id_funcao"]; | ||
45 | -$id = $_GET["id"]; | ||
46 | - | ||
47 | -testaSafeNumerico([$id_sistema,$id_funcao,$id]); | ||
48 | - | ||
49 | -$funcoesEdicao = array( | ||
50 | - "ALTERARSISTEMAS", | ||
51 | - "ALTERARFUNCOES", | ||
52 | - "EXCLUIRSISTEMA", | ||
53 | - "EXCLUIRFUNCAO" | ||
54 | -); | ||
55 | -if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
56 | - if(verificaOperacaoSessao("admin/html/sistemas") == false){ | ||
57 | - retornaJSON("Vc nao pode realizar essa operacao.");exit; | ||
58 | - } | ||
59 | -} | ||
60 | -//error_reporting(0); | ||
61 | -//faz a busca da função que deve ser executada | ||
62 | -switch (strtoupper($funcao)) | ||
63 | -{ | ||
64 | - /* | ||
65 | - Note: | ||
66 | - | ||
67 | - Valores que o parâmetro &funcao pode receber. Os parâmetros devem ser enviados na requisição em AJAX. | ||
68 | - */ | ||
69 | - /* | ||
70 | - Valor: PEGASISTEMAS | ||
71 | - | ||
72 | - Lista de sistemas | ||
73 | - | ||
74 | - Retorno: | ||
75 | - | ||
76 | - {JSON} | ||
77 | - */ | ||
78 | - case "PEGASISTEMAS": | ||
79 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_sistemas order by nome_sistema")); | ||
80 | - exit; | ||
81 | - break; | ||
82 | - /* | ||
83 | - Valor: PEGASISTEMA | ||
84 | - | ||
85 | - Dados de um sistemas | ||
86 | - | ||
87 | - Parametro: | ||
88 | - | ||
89 | - id_sistema | ||
90 | - | ||
91 | - Retorno: | ||
92 | - | ||
93 | - {JSON} | ||
94 | - */ | ||
95 | - case "PEGASISTEMA": | ||
96 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_sistemas where id_sistema='$id_sistema'")); | ||
97 | - exit; | ||
98 | - break; | ||
99 | - /* | ||
100 | - Valor: PEGAFUNCOES | ||
101 | - | ||
102 | - Lista de funções de um sistema | ||
103 | - | ||
104 | - Parametro: | ||
105 | - | ||
106 | - id_sistema | ||
107 | - | ||
108 | - Retorno: | ||
109 | - | ||
110 | - {JSON} | ||
111 | - */ | ||
112 | - case "PEGAFUNCOES": | ||
113 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_sistemasf where id_sistema ='$id_sistema'")); | ||
114 | - exit; | ||
115 | - break; | ||
116 | - /* | ||
117 | - Valor: PEGAFUNCAO | ||
118 | - | ||
119 | - Pega os dados de uma função específica | ||
120 | - | ||
121 | - Parametro: | ||
122 | - | ||
123 | - id_funcao | ||
124 | - | ||
125 | - Retorno: | ||
126 | - | ||
127 | - {JSON} | ||
128 | - */ | ||
129 | - case "PEGAFUNCAO": | ||
130 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_sistemasf where id_funcao ='$id_funcao'")); | ||
131 | - exit; | ||
132 | - break; | ||
133 | - /* | ||
134 | - Valor: ALTERARSISTEMAS | ||
135 | - | ||
136 | - Altera os dados de um sistema | ||
137 | - | ||
138 | - Parametros: | ||
139 | - | ||
140 | - id_sistema | ||
141 | - | ||
142 | - perfil_sistema | ||
143 | - | ||
144 | - nome_sistema | ||
145 | - | ||
146 | - publicado_sistema | ||
147 | - | ||
148 | - Retorno: | ||
149 | - | ||
150 | - {JSON} | ||
151 | - */ | ||
152 | - case "ALTERARSISTEMAS": | ||
153 | - $novo = alterarSistemas(); | ||
154 | - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_sistemas WHERE id_sistema = '".$novo."'"; | ||
155 | - retornaJSON(pegaDados($sql)); | ||
156 | - exit; | ||
157 | - break; | ||
158 | - /* | ||
159 | - Valor: ALTERARFUNCOES | ||
160 | - | ||
161 | - Altera os dados de uma função | ||
162 | - | ||
163 | - Parametros: | ||
164 | - | ||
165 | - id_sistema | ||
166 | - | ||
167 | - id_funcao | ||
168 | - | ||
169 | - perfil_funcao | ||
170 | - | ||
171 | - nome_funcao | ||
172 | - | ||
173 | - w_funcao | ||
174 | - | ||
175 | - h_funcao | ||
176 | - | ||
177 | - abrir_funcao | ||
178 | - | ||
179 | - Retorno: | ||
180 | - | ||
181 | - {JSON} | ||
182 | - */ | ||
183 | - case "ALTERARFUNCOES": | ||
184 | - $novo = alterarFuncoes(); | ||
185 | - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_sistemasf WHERE id_funcao = '".$novo."'"; | ||
186 | - retornaJSON(pegaDados($sql)); | ||
187 | - exit; | ||
188 | - break; | ||
189 | - /* | ||
190 | - Valor: EXCLUIRSISTEMA | ||
191 | - | ||
192 | - Exclui um sistema | ||
193 | - | ||
194 | - Parametros: | ||
195 | - | ||
196 | - id | ||
197 | - | ||
198 | - Retorno: | ||
199 | - | ||
200 | - {JSON} | ||
201 | - */ | ||
202 | - case "EXCLUIRSISTEMA": | ||
203 | - $tabela = "i3geoadmin_sistemas"; | ||
204 | - $f = verificaFilhos(); | ||
205 | - if(!$f) | ||
206 | - { | ||
207 | - retornaJSON(excluirSistemas()); | ||
208 | - exit; | ||
209 | - } | ||
210 | - else | ||
211 | - { | ||
212 | - retornaJSON("erro"); | ||
213 | - exit; | ||
214 | - } | ||
215 | - break; | ||
216 | - /* | ||
217 | - Valor: EXCLUIRFUNCAO | ||
218 | - | ||
219 | - Exclui uma função | ||
220 | - | ||
221 | - Parametros: | ||
222 | - | ||
223 | - id | ||
224 | - | ||
225 | - Retorno: | ||
226 | - | ||
227 | - {JSON} | ||
228 | - */ | ||
229 | - case "EXCLUIRFUNCAO": | ||
230 | - retornaJSON(excluirFuncoes()); | ||
231 | - exit; | ||
232 | - break; | ||
233 | - | ||
234 | -} | ||
235 | -/* | ||
236 | - Altera o registro de um WS | ||
237 | -*/ | ||
238 | -function alterarSistemas(){ | ||
239 | - global $esquemaadmin,$id_sistema; | ||
240 | - try { | ||
241 | - require_once("conexao.php"); | ||
242 | - if($convUTF){ | ||
243 | - $_GET["nome_sistema"] = utf8_encode($_GET["nome_sistema"]); | ||
244 | - } | ||
245 | - if($id_sistema != ""){ | ||
246 | - $dataCol = array( | ||
247 | - "publicado_sistema" => $_GET["publicado_sistema"], | ||
248 | - "nome_sistema" => $_GET["nome_sistema"], | ||
249 | - "perfil_sistema" => $_GET["perfil_sistema"] | ||
250 | - ); | ||
251 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_sistemas",$dataCol,"WHERE id_sistema = $id_sistema"); | ||
252 | - $retorna = $id_sistema; | ||
253 | - } | ||
254 | - else{ | ||
255 | - $dataCol = array( | ||
256 | - "publicado_sistema" => '', | ||
257 | - "nome_sistema" => '', | ||
258 | - "perfil_sistema" => '' | ||
259 | - ); | ||
260 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_sistemas",$dataCol,"nome_sistema","id_sistema"); | ||
261 | - } | ||
262 | - $dbhw = null; | ||
263 | - $dbh = null; | ||
264 | - return $retorna; | ||
265 | - } | ||
266 | - catch (PDOException $e){ | ||
267 | - return "Error!: "; | ||
268 | - } | ||
269 | -} | ||
270 | -function alterarFuncoes(){ | ||
271 | - global $esquemaadmin,$id_sistema,$id_funcao; | ||
272 | - if(empty($_GET["w_funcao"])){ | ||
273 | - $_GET["w_funcao"] = 200; | ||
274 | - } | ||
275 | - if(empty($_GET["h_funcao"])){ | ||
276 | - $_GET["h_funcao"] = 200; | ||
277 | - } | ||
278 | - try{ | ||
279 | - require_once("conexao.php"); | ||
280 | - if($convUTF){ | ||
281 | - $_GET["nome_funcao"] = utf8_encode($_GET["nome_funcao"]); | ||
282 | - } | ||
283 | - if($id_funcao != ""){ | ||
284 | - $dataCol = array( | ||
285 | - "nome_funcao" => $_GET["nome_funcao"], | ||
286 | - "perfil_funcao" => $_GET["perfil_funcao"], | ||
287 | - "w_funcao" => $_GET["w_funcao"], | ||
288 | - "h_funcao" => $_GET["h_funcao"], | ||
289 | - "abrir_funcao" => $_GET["abrir_funcao"] | ||
290 | - ); | ||
291 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_sistemasf",$dataCol,"WHERE id_funcao = $id_funcao"); | ||
292 | - $retorna = $id_sistema; | ||
293 | - } | ||
294 | - else{ | ||
295 | - $dataCol = array( | ||
296 | - "nome_funcao" => '', | ||
297 | - "perfil_funcao" => '', | ||
298 | - "w_funcao" => '', | ||
299 | - "h_funcao" => '', | ||
300 | - "abrir_funcao" => '', | ||
301 | - "id_sistema" => $id_sistema | ||
302 | - ); | ||
303 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_sistemasf",$dataCol,"nome_funcao","id_funcao"); | ||
304 | - } | ||
305 | - $dbhw = null; | ||
306 | - $dbh = null; | ||
307 | - return $retorna; | ||
308 | - } | ||
309 | - catch (PDOException $e) | ||
310 | - { | ||
311 | - return "Error!: "; | ||
312 | - } | ||
313 | -} | ||
314 | -function excluirFuncoes() | ||
315 | -{ | ||
316 | - global $id,$esquemaadmin; | ||
317 | - try { | ||
318 | - include("conexao.php"); | ||
319 | - $sql = "DELETE from ".$esquemaadmin."i3geoadmin_sistemasf WHERE id_funcao = $id"; | ||
320 | - $dbhw->query($sql); | ||
321 | - i3GeoAdminInsertLog($dbhw,$sql); | ||
322 | - $dbhw = null; | ||
323 | - $dbh = null; | ||
324 | - return "ok"; | ||
325 | - } | ||
326 | - catch (PDOException $e){ | ||
327 | - return "Error!: "; | ||
328 | - } | ||
329 | -} | ||
330 | -function excluirSistemas() | ||
331 | -{ | ||
332 | - global $id,$esquemaadmin; | ||
333 | - try { | ||
334 | - include("conexao.php"); | ||
335 | - $sql = "DELETE from ".$esquemaadmin."i3geoadmin_sistemas WHERE id_sistema = $id"; | ||
336 | - $dbhw->query($sql); | ||
337 | - i3GeoAdminInsertLog($dbhw,$sql); | ||
338 | - $dbhw = null; | ||
339 | - $dbh = null; | ||
340 | - return $id; | ||
341 | - } | ||
342 | - catch (PDOException $e){ | ||
343 | - return "Error!: "; | ||
344 | - } | ||
345 | -} | ||
346 | - | ||
347 | -?> | ||
348 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/sqlite.php
@@ -1,66 +0,0 @@ | @@ -1,66 +0,0 @@ | ||
1 | -<?php | ||
2 | -/* | ||
3 | -Title: sqlite.php | ||
4 | - | ||
5 | -Lista as definições do banco de dados de administração | ||
6 | - | ||
7 | -Obtém as definições do arquivo i3geo/menutemas/admin.db | ||
8 | - | ||
9 | -Licenca: | ||
10 | - | ||
11 | -GPL2 | ||
12 | - | ||
13 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
14 | - | ||
15 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
16 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
17 | - | ||
18 | -Este programa é software livre; você pode redistribuí-lo | ||
19 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
20 | -GNU conforme publicada pela Free Software Foundation; | ||
21 | - | ||
22 | -Este programa é distribuído na expectativa de que seja útil, | ||
23 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
24 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
25 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
26 | -Você deve ter recebido uma cópia da Licença Pública Geral do | ||
27 | -GNU junto com este programa; se não, escreva para a | ||
28 | -Free Software Foundation, Inc., no endereço | ||
29 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
30 | - | ||
31 | -Arquivo: | ||
32 | - | ||
33 | -i3geo/admin/php/sqlite.php | ||
34 | -*/ | ||
35 | -if(!file_exists("../admin.db")) | ||
36 | -{ | ||
37 | - echo "O arquivo menutemas/admin.db não existe. Utilize a opção existente no menu de administração para criar o banco de dados SQLITE."; | ||
38 | - exit; | ||
39 | -} | ||
40 | -echo "<pre>"; | ||
41 | -$dbh = new PDO('sqlite:../admin.db'); | ||
42 | -echo "<br><br><span style=color:red >Lista de tabelas</span><br><br>"; | ||
43 | -$q = $dbh->query("SELECT name FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type='table' ORDER BY name",PDO::FETCH_ASSOC); | ||
44 | -$resultado = $q->fetchAll(); | ||
45 | -foreach ($resultado as $r) | ||
46 | -echo $r["name"]."<br>"; | ||
47 | -$q = $dbh->query("select * from sqlite_master",PDO::FETCH_ASSOC); | ||
48 | -$resultado = $q->fetchAll(); | ||
49 | -echo "<br><br><span style=color:red >SQL no padrão SQLITE</span><br><br>"; | ||
50 | -foreach($resultado as $r) | ||
51 | -{ | ||
52 | - echo $r["sql"]."<br>"; | ||
53 | -} | ||
54 | -echo "<br><br><span style=color:red >SQL no padrão POSTGRES</span><br><br>"; | ||
55 | -echo "<br><br>Após criar as tabelas no Postgres, vc deve definir as permissões para os usuários.<br><br>"; | ||
56 | -echo "<br><br>Para usar outro banco de dados que não seja o default (SQLITE), você terá de alterar o programa i3geo/admin/php/conexao.php<br><br>"; | ||
57 | -foreach($resultado as $r) | ||
58 | -{ | ||
59 | - echo str_ireplace("INTEGER PRIMARY KEY","SERIAL PRIMARY KEY NOT NULL",$r["sql"])."<br>"; | ||
60 | -} | ||
61 | -echo "<br><br><span style=color:red >Listagem completa</span><br><br>"; | ||
62 | - | ||
63 | -var_dump($resultado); | ||
64 | -$dbh = null; | ||
65 | -$dbhw = null; | ||
66 | -?> | ||
67 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/subirshapefile.php
@@ -1,188 +0,0 @@ | @@ -1,188 +0,0 @@ | ||
1 | -<?php | ||
2 | -include_once(dirname(__FILE__)."/login.php"); | ||
3 | - | ||
4 | -if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
5 | - if(verificaOperacaoSessao("admin/html/subirshapefile") == false){ | ||
6 | - retornaJSON("Vc nao pode realizar essa operacao.");exit; | ||
7 | - } | ||
8 | -} | ||
9 | -if(isset($_GET["tipo"])){ | ||
10 | - $tipo = $_GET["tipo"]; | ||
11 | -} | ||
12 | -//locaplic e usado para definir a pasta de destino | ||
13 | -if(empty($locaplic)){ | ||
14 | - exit; | ||
15 | -} | ||
16 | -//error_reporting(0); | ||
17 | -?> | ||
18 | -<html> | ||
19 | -<head> | ||
20 | -<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | ||
21 | -<link rel="stylesheet" type="text/css" href="../../css/input.css" /> | ||
22 | -<link rel="stylesheet" type="text/css" href="../../css/geral.css" /> | ||
23 | -<script src="../../classesjs/classe_util.js"></script> | ||
24 | -<title></title> | ||
25 | -</head> | ||
26 | -<body bgcolor="white" style="background-color:white;text-align:left;"> | ||
27 | -<p> | ||
28 | -<?php | ||
29 | -if (isset($_FILES['i3GEOuploadshp']['name'])) | ||
30 | -{ | ||
31 | - $dirDestino = $_POST["dirDestino"]; | ||
32 | - $dirDestino = str_replace(".","",$dirDestino); | ||
33 | - | ||
34 | - if(empty($dirDestino)){ | ||
35 | - echo "Pasta nao encontrada"; exit; | ||
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 não permitido"; | ||
52 | - paraAguarde(); | ||
53 | - exit; | ||
54 | - } | ||
55 | - //verifica nomes | ||
56 | - verificaNome($_FILES['i3GEOuploadshp']['name']); | ||
57 | - verificaNome($_FILES['i3GEOuploadshx']['name']); | ||
58 | - verificaNome($_FILES['i3GEOuploaddbf']['name']); | ||
59 | - | ||
60 | - if($_FILES['i3GEOuploadprj']['name'] != ""){ | ||
61 | - verificaNome($_FILES['i3GEOuploadprj']['name']); | ||
62 | - } | ||
63 | - | ||
64 | - //remove acentos | ||
65 | - $nomePrefixo = str_replace(" ","_",removeAcentos(str_replace(".shp","",$_FILES['i3GEOuploadshp']['name']))); | ||
66 | - | ||
67 | - $nomePrefixo = str_replace(".","",$nomePrefixo); | ||
68 | - $nomePrefixo = strip_tags($nomePrefixo); | ||
69 | - $nomePrefixo = htmlspecialchars($nomePrefixo, ENT_QUOTES); | ||
70 | - | ||
71 | - //sobe arquivo | ||
72 | - $Arquivo = $_FILES['i3GEOuploadshp']['tmp_name']; | ||
73 | - if(file_exists($dirmap."/".$nomePrefixo.".shp")){ | ||
74 | - echo "<p class='paragrafo' >Já existe um SHP com o nome "; | ||
75 | - paraAguarde(); | ||
76 | - exit; | ||
77 | - } | ||
78 | - $status = move_uploaded_file($Arquivo,$dirmap."/".$nomePrefixo.".shp"); | ||
79 | - if($status != 1) | ||
80 | - {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.";paraAguarde();exit;} | ||
81 | - | ||
82 | - $Arquivo = $_FILES['i3GEOuploadshx']['tmp_name']; | ||
83 | - $status = move_uploaded_file($Arquivo,$dirmap."/".$nomePrefixo.".shx"); | ||
84 | - if($status != 1) | ||
85 | - {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo SHX";paraAguarde();exit;} | ||
86 | - | ||
87 | - $Arquivo = $_FILES['i3GEOuploaddbf']['tmp_name']; | ||
88 | - $status = move_uploaded_file($Arquivo,$dirmap."/".$nomePrefixo.".dbf"); | ||
89 | - if($status != 1) | ||
90 | - {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo DBF";paraAguarde();exit;} | ||
91 | - | ||
92 | - if($_FILES['i3GEOuploadprj']['name'] != ""){ | ||
93 | - $Arquivo = $_FILES['i3GEOuploadprj']['tmp_name']; | ||
94 | - $status = move_uploaded_file($Arquivo,$dirmap."/".$nomePrefixo.".prj"); | ||
95 | - if($status != 1){ | ||
96 | - echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo PRJ";paraAguarde();exit; | ||
97 | - } | ||
98 | - } | ||
99 | - | ||
100 | - if(!file_exists($dirmap."/".$nomePrefixo.".shp")) | ||
101 | - {echo "<p class='paragrafo' >Ocorreu algum problema no envio do arquivo ";paraAguarde();exit;} | ||
102 | - | ||
103 | - | ||
104 | - $checkphp = fileContemString($dirmap."/".$nomePrefixo.".prj","<?"); | ||
105 | - if($checkphp == true){ | ||
106 | - echo "Arquivo prj invalido"; | ||
107 | - unlink($dirmap."/".$nomePrefixo.".shp"); | ||
108 | - unlink($dirmap."/".$nomePrefixo.".dbf"); | ||
109 | - unlink($dirmap."/".$nomePrefixo.".shx"); | ||
110 | - unlink($dirmap."/".$nomePrefixo.".prj"); | ||
111 | - exit; | ||
112 | - } | ||
113 | - $checkphp = fileContemString($dirmap."/".$nomePrefixo.".shx","<?"); | ||
114 | - if($checkphp == true){ | ||
115 | - echo "Arquivo shx invalido"; | ||
116 | - unlink($dirmap."/".$nomePrefixo.".shp"); | ||
117 | - unlink($dirmap."/".$nomePrefixo.".dbf"); | ||
118 | - unlink($dirmap."/".$nomePrefixo.".shx"); | ||
119 | - unlink($dirmap."/".$nomePrefixo.".prj"); | ||
120 | - exit; | ||
121 | - } | ||
122 | - $checkphp = fileContemString($dirmap."/".$nomePrefixo.".dbf","<?"); | ||
123 | - if($checkphp == true){ | ||
124 | - echo "Arquivo dbf invalido"; | ||
125 | - unlink($dirmap."/".$nomePrefixo.".shp"); | ||
126 | - unlink($dirmap."/".$nomePrefixo.".dbf"); | ||
127 | - unlink($dirmap."/".$nomePrefixo.".shx"); | ||
128 | - unlink($dirmap."/".$nomePrefixo.".prj"); | ||
129 | - exit; | ||
130 | - } | ||
131 | - echo "<p class='paragrafo' >Arquivo enviado.</p>"; | ||
132 | - echo "<p class='paragrafo'></p>"; | ||
133 | - if($i3GEOuploadCriaMapfile == "on"){ | ||
134 | - //verifica se o usuario marcou a opcao de cria mapfile | ||
135 | - //nesse caso o aplicativo de upload esta sendo executado de dentro do sistema de administracao, e o mapfile devera | ||
136 | - //ser criado e registrado no sistema | ||
137 | - $nome = $nomePrefixo; | ||
138 | - $codigo = $nomePrefixo; | ||
139 | - $it = $nomePrefixo; | ||
140 | - $en = $nomePrefixo; | ||
141 | - $es = $nomePrefixo; | ||
142 | - $sfileObj = ms_newShapefileObj($dirmap."/".$nomePrefixo.".shp", -1); | ||
143 | - if(!isset($tipo) || $tipo == ""){ | ||
144 | - $tipo = $sfileObj->type; | ||
145 | - } | ||
146 | - if ($tipo == 1){ | ||
147 | - $tipoLayer = "point"; | ||
148 | - } | ||
149 | - if ($tipo == 3){ | ||
150 | - $tipoLayer = "line"; | ||
151 | - } | ||
152 | - if ($tipo == 5){ | ||
153 | - $tipoLayer = "polygon"; | ||
154 | - } | ||
155 | - $funcao = "CRIARNOVOMAP"; | ||
156 | - $output = "retorno"; | ||
157 | - $data = $dirmap."/".$nomePrefixo.".shp"; | ||
158 | - include_once($locaplic."/admin/php/editormapfile.php"); | ||
159 | - echo "<b><p class='paragrafo' >Criado!!!<br>"; | ||
160 | - echo "Para editar clique: <a href='../../admin/html/editormapfile.html' target=_blank >editar</a>"; | ||
161 | - echo "<script>window.scrollTo(0,10000);i3GEO.util.insereCookie('I3GEOletraAdmin','".$nomePrefixo."');</script>"; | ||
162 | - } | ||
163 | -} | ||
164 | -else | ||
165 | -{ | ||
166 | - echo "<p class='paragrafo' >Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</p>"; | ||
167 | -} | ||
168 | -paraAguarde(); | ||
169 | -function paraAguarde(){ | ||
170 | - echo "<script>try{window.scrollTo(0,10000);window.parent.i3GEOF.upload.aguarde.visibility='hidden';}catch(e){};</script>"; | ||
171 | -} | ||
172 | -function verificaNome($nome){ | ||
173 | - if(strlen(basename($nome)) > 200){ | ||
174 | - exit; | ||
175 | - } | ||
176 | - $nome = strtolower($nome); | ||
177 | - $lista = explode(".",$nome); | ||
178 | - $extensao = $lista[count($lista) - 1]; | ||
179 | - if(($extensao != "dbf") && ($extensao != "shx") && ($extensao != "shp") && ($extensao != "prj")) | ||
180 | - { | ||
181 | - echo "Nome de arquivo inválido. $nome"; | ||
182 | - paraAguarde(); | ||
183 | - exit; | ||
184 | - } | ||
185 | -} | ||
186 | -?> | ||
187 | -</body> | ||
188 | -</html> |
admin/php/subirsimbolo.php
@@ -1,104 +0,0 @@ | @@ -1,104 +0,0 @@ | ||
1 | -<?php | ||
2 | -include_once(dirname(__FILE__)."/login.php"); | ||
3 | - | ||
4 | -if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
5 | - if(verificaOperacaoSessao("admin/html/editortexto") == false){ | ||
6 | - retornaJSON("Vc nao pode realizar essa operacao.");exit; | ||
7 | - } | ||
8 | -} | ||
9 | -//locaplic e usado para definir a pasta de destino | ||
10 | -if(empty($locaplic)){ | ||
11 | - exit; | ||
12 | -} | ||
13 | -?> | ||
14 | -<html> | ||
15 | -<head> | ||
16 | -<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | ||
17 | -<link rel="stylesheet" type="text/css" href="../../css/input.css" /> | ||
18 | -<link rel="stylesheet" type="text/css" href="../../css/geral.css" /> | ||
19 | -<title></title> | ||
20 | -</head> | ||
21 | -<body bgcolor="white" style="background-color:white;text-align:left;"> | ||
22 | -<p> | ||
23 | -<?php | ||
24 | -if (isset($_FILES['i3GEOuploadsimboloarq']['name']) && strlen(basename($_FILES['i3GEOuploadsimboloarq']['name'])) < 200){ | ||
25 | - $dirDestino = $_GET["dirDestino"]; | ||
26 | - $dirDestino = str_replace(".","",$dirDestino); | ||
27 | - $dirDestino = $locaplic."/".$dirDestino; | ||
28 | - | ||
29 | - $checkphp = fileContemString($_FILES['i3GEOuploadsimboloarq']['tmp_name'],"<?php"); | ||
30 | - if($checkphp == true){ | ||
31 | - echo "Arquivo invalido"; | ||
32 | - exit; | ||
33 | - } | ||
34 | - | ||
35 | - if(isset($logExec) && $logExec["upload"] == true){ | ||
36 | - i3GeoLog("prog: uploadsimbolo filename:" . $_FILES['i3GEOuploadsimboloarq']['name'],$dir_tmp); | ||
37 | - } | ||
38 | - | ||
39 | - echo "<p class='paragrafo' >Carregando o arquivo...</p>"; | ||
40 | - ob_flush(); | ||
41 | - flush(); | ||
42 | - sleep(1); | ||
43 | - | ||
44 | - if(!file_exists($dirDestino)){ | ||
45 | - if(!file_exists($dirDestino)){ | ||
46 | - echo "<p class='paragrafo' >Pasta não existe no servidor"; | ||
47 | - paraAguarde(); | ||
48 | - exit; | ||
49 | - } | ||
50 | - } | ||
51 | - //verifica nomes | ||
52 | - $nome = $_FILES['i3GEOuploadsimboloarq']['name']; | ||
53 | - | ||
54 | - $nome = str_replace(".png","",$nome); | ||
55 | - $nome = str_replace(".","",$nome).".png"; | ||
56 | - | ||
57 | - $nome = strip_tags($nome); | ||
58 | - $nome = htmlspecialchars($nome, ENT_QUOTES); | ||
59 | - | ||
60 | - //$nome = $nome . md5(uniqid(rand(), true)); | ||
61 | - | ||
62 | - verificaNome($nome); | ||
63 | - //sobe arquivo | ||
64 | - $Arquivo = $_FILES['i3GEOuploadsimboloarq']['tmp_name']; | ||
65 | - $destino = $dirDestino."/".$nome; | ||
66 | - | ||
67 | - $check = getimagesize($Arquivo); | ||
68 | - if($check === false) { | ||
69 | - exit; | ||
70 | - } | ||
71 | - | ||
72 | - if(file_exists($destino)) | ||
73 | - {echo "<p class='paragrafo' >Já existe um arquivo com o nome ";paraAguarde();exit;} | ||
74 | - $status = move_uploaded_file($Arquivo,$destino); | ||
75 | - if($status != 1) | ||
76 | - {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo. Pode ser uma limitação quanto ao tamanho do arquivo.";paraAguarde();exit;} | ||
77 | - if(!file_exists($destino)) | ||
78 | - {echo "<p class='paragrafo' >Ocorreu algum problema no envio do arquivo ";paraAguarde();exit;} | ||
79 | - | ||
80 | - echo "<p class='paragrafo' >Arquivo enviado.</p>"; | ||
81 | -} | ||
82 | -else | ||
83 | -{ | ||
84 | - echo "<p class='paragrafo' >Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</p>"; | ||
85 | -} | ||
86 | -paraAguarde(); | ||
87 | -function paraAguarde(){ | ||
88 | - echo "<script>try{window.scrollTo(0,10000);window.parent.i3GEOF.upload.aguarde.visibility='hidden';}catch(e){};</script>"; | ||
89 | -} | ||
90 | -function verificaNome($nome) | ||
91 | -{ | ||
92 | - $nome = strtolower($nome); | ||
93 | - $lista = explode(".",$nome); | ||
94 | - $extensao = $lista[count($lista) - 1]; | ||
95 | - if(($extensao != "png") && ($extensao != "jpg")) | ||
96 | - { | ||
97 | - echo "Nome de arquivo inválido."; | ||
98 | - paraAguarde(); | ||
99 | - exit; | ||
100 | - } | ||
101 | -} | ||
102 | -?> | ||
103 | -</body> | ||
104 | -</html> | ||
105 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/upgradebanco44_45.php
@@ -1,114 +0,0 @@ | @@ -1,114 +0,0 @@ | ||
1 | -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | ||
2 | -<html> | ||
3 | -<head> | ||
4 | -<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | ||
5 | -<link rel="stylesheet" type="text/css" href="../html/admin.css"> | ||
6 | -</head> | ||
7 | -<body class="yui-skin-sam fundoPonto" > | ||
8 | -<div class="bordaSuperior" > </div> | ||
9 | -<div class="mascaraPrincipal" id="divGeral" style=text-align:left > | ||
10 | -Upgrade do banco de administração<br><br> | ||
11 | -<?php | ||
12 | -/* | ||
13 | -Title: upgradebanco44_45.php | ||
14 | - | ||
15 | -Adiciona as novas tabelas utilizadas na versão 4.5 | ||
16 | - | ||
17 | -Se vc quiser recriar o banco de dados default, apague o arquivo | ||
18 | -i3geo/admin/admin.db ou faça uma cópia. Depois é só executar esse programa. | ||
19 | - | ||
20 | -Se a configuração do arquivo de conexão foi alterada (veja ms_configura.php), o novo | ||
21 | -banco irá ser criado conforme a nova string de conexão. | ||
22 | - | ||
23 | -Licenca: | ||
24 | - | ||
25 | -GPL2 | ||
26 | - | ||
27 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
28 | - | ||
29 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
30 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
31 | - | ||
32 | -Este programa é software livre; você pode redistribuí-lo | ||
33 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
34 | -GNU conforme publicada pela Free Software Foundation; | ||
35 | - | ||
36 | -Este programa é distribuído na expectativa de que seja útil, | ||
37 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
38 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
39 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
40 | -Você deve ter recebido uma cópia da Licença Pública Geral do | ||
41 | -GNU junto com este programa; se não, escreva para a | ||
42 | -Free Software Foundation, Inc., no endereço | ||
43 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
44 | - | ||
45 | -Arquivo: | ||
46 | - | ||
47 | -i3geo/admin/php/criabanco.php | ||
48 | -*/ | ||
49 | -$funcao = ""; | ||
50 | -include_once("admin.php"); | ||
51 | -//verifica se o login pode ser realizado | ||
52 | -if(isset($i3geoPermiteLogin) && $i3geoPermiteLogin == false){ | ||
53 | - header ( "HTTP/1.1 403 Login desativado" ); | ||
54 | - exit (); | ||
55 | -} | ||
56 | -//$i3geoPermiteLoginIp vem de ms_configura.php | ||
57 | -if(isset($i3geoPermiteLoginIp)){ | ||
58 | - checaLoginIp($i3geoPermiteLoginIp); | ||
59 | -} | ||
60 | - | ||
61 | -include_once("conexao.php"); | ||
62 | - | ||
63 | -if(empty($_POST["senha"]) || empty($_POST["usuario"])){ | ||
64 | - formularioLoginMaster("upgradebanco44_45.php"); | ||
65 | - exit; | ||
66 | -} | ||
67 | -else{ | ||
68 | - $continua = verificaMaster($_POST["usuario"],$_POST["senha"],$i3geomaster); | ||
69 | - if($continua == false){ | ||
70 | - echo "Usuário não registrado em i3geo/ms_configura.php na variável i3geomaster"; | ||
71 | - exit; | ||
72 | - } | ||
73 | -} | ||
74 | -//error_reporting(0); | ||
75 | -$tabelas = array( | ||
76 | -"CREATE TABLE i3geoadmin_comentarios (comentario TEXT, data TEXT, openidnome TEXT, openidimagem TEXT, openidservico TEXT, openidusuario TEXT, openidurl TEXT, id_tema NUMERIC)", | ||
77 | -"CREATE TABLE i3geoadmin_acessostema (codigo_tema TEXT, nacessos NUMERIC,dia NUMERIC, mes NUMERIC, ano NUMERIC)" | ||
78 | -); | ||
79 | -/* | ||
80 | -if($conexaoadmin == "") | ||
81 | -{ | ||
82 | - //$banco = sqlite_open("../admin.db",0666); | ||
83 | - //$banco = null; | ||
84 | - $dbhw = new PDO('sqlite:../admin.db'); | ||
85 | -} | ||
86 | -else | ||
87 | -{ | ||
88 | - include($conexaoadmin); | ||
89 | -} | ||
90 | -*/ | ||
91 | -foreach($tabelas as $tabela) | ||
92 | -{ | ||
93 | - if($dbhw->getAttribute(PDO::ATTR_DRIVER_NAME) == "pgsql") | ||
94 | - { | ||
95 | - $tabela = str_replace("INTEGER PRIMARY KEY","SERIAL PRIMARY KEY NOT NULL",$tabela); | ||
96 | - } | ||
97 | - $q = $dbhw->query($tabela); | ||
98 | - if($q) | ||
99 | - { | ||
100 | - $banco = null; | ||
101 | - echo "<br>Feito!!!<pre>"; | ||
102 | - var_dump($tabelas); | ||
103 | - } | ||
104 | - else | ||
105 | - { | ||
106 | - echo "<pre>Ocorreu algum problema. Tabelas que deveriam ter sido criadas:\n"; | ||
107 | - var_dump($tabelas); | ||
108 | - $e = $dbhw->errorInfo(); | ||
109 | - throw new Exception($e[2]); | ||
110 | - } | ||
111 | -} | ||
112 | - | ||
113 | -?> | ||
114 | -</div> | ||
115 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/upgradebanco46_47.php
@@ -1,236 +0,0 @@ | @@ -1,236 +0,0 @@ | ||
1 | -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | ||
2 | -<html> | ||
3 | -<head> | ||
4 | -<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | ||
5 | -<link rel="stylesheet" type="text/css" href="../html/admin.css"> | ||
6 | -</head> | ||
7 | -<body class="yui-skin-sam fundoPonto" > | ||
8 | -<div class="bordaSuperior" > </div> | ||
9 | -<div class="mascaraPrincipal" id="divGeral" style=text-align:left > | ||
10 | -Upgrade do banco de administração<br><br> | ||
11 | -<?php | ||
12 | -/* | ||
13 | -Title: upgradebanco46_47.php | ||
14 | - | ||
15 | -Adiciona as novas tabelas utilizadas na versão 4.7 | ||
16 | - | ||
17 | -Se vc quiser recriar o banco de dados default, apague o arquivo | ||
18 | -i3geo/admin/admin.db ou faça uma cópia. Depois é só executar o programa i3geo/admin/php/criabanco.php. | ||
19 | - | ||
20 | -Se a configuração do arquivo de conexão foi alterada (veja ms_configura.php), o novo | ||
21 | -banco irá ser criado conforme a nova string de conexão. | ||
22 | - | ||
23 | -Ver MER i3geo/documentacao/diagramas/cadastrodeusuarios.erm | ||
24 | - | ||
25 | -Licenca: | ||
26 | - | ||
27 | -GPL2 | ||
28 | - | ||
29 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
30 | - | ||
31 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
32 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
33 | - | ||
34 | -Este programa é software livre; você pode redistribuí-lo | ||
35 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
36 | -GNU conforme publicada pela Free Software Foundation; | ||
37 | - | ||
38 | -Este programa é distribuído na expectativa de que seja útil, | ||
39 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
40 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
41 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
42 | -Você deve ter recebido uma cópia da Licença Pública Geral do | ||
43 | -GNU junto com este programa; se não, escreva para a | ||
44 | -Free Software Foundation, Inc., no endereço | ||
45 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
46 | - | ||
47 | -Arquivo: | ||
48 | - | ||
49 | -i3geo/admin/php/criabanco.php | ||
50 | -*/ | ||
51 | -$funcao = ""; | ||
52 | -$locaplic = dirname(__FILE__)."/../.."; | ||
53 | -include_once("admin.php"); | ||
54 | -//verifica se o login pode ser realizado | ||
55 | -if(isset($i3geoPermiteLogin) && $i3geoPermiteLogin == false){ | ||
56 | - header ( "HTTP/1.1 403 Login desativado" ); | ||
57 | - exit (); | ||
58 | -} | ||
59 | -//$i3geoPermiteLoginIp vem de ms_configura.php | ||
60 | -if(isset($i3geoPermiteLoginIp)){ | ||
61 | - checaLoginIp($i3geoPermiteLoginIp); | ||
62 | -} | ||
63 | - | ||
64 | -include_once("conexao.php"); | ||
65 | -if(!empty($esquemaadmin)){ | ||
66 | - $esquemaadmin = str_replace(".","",$esquemaadmin)."."; | ||
67 | -} | ||
68 | -if(empty($_POST["senha"]) || empty($_POST["usuario"])){ | ||
69 | - formularioLoginMaster("upgradebanco46_47.php"); | ||
70 | -} | ||
71 | -else{ | ||
72 | - $continua = verificaMaster($_POST["usuario"],$_POST["senha"],$i3geomaster); | ||
73 | - if($continua == false){ | ||
74 | - echo "Usuário não registrado em i3geo/ms_configura.php na variável i3geomaster"; | ||
75 | - exit; | ||
76 | - } | ||
77 | -} | ||
78 | -//error_reporting(0); | ||
79 | -//tabelas do controle de usuarios e sistema metaestat | ||
80 | -$tabelas = array( | ||
81 | - "ALTER TABLE ".$esquemaadmin."i3geoadmin_mapas ADD mapfile TEXT", | ||
82 | - "CREATE TABLE ".$esquemaadmin."i3geousr_usuarios (ativo NUMERIC, data_cadastro TEXT, email TEXT, id_usuario INTEGER PRIMARY KEY, login TEXT, nome_usuario TEXT, senha TEXT)", | ||
83 | - "CREATE TABLE ".$esquemaadmin."i3geousr_papelusuario (id_papel NUMERIC, id_usuario NUMERIC)", | ||
84 | - "CREATE TABLE ".$esquemaadmin."i3geousr_papeis (descricao TEXT, id_papel INTEGER PRIMARY KEY, nome TEXT)", | ||
85 | - "CREATE TABLE ".$esquemaadmin."i3geousr_operacoes (id_operacao INTEGER PRIMARY KEY, codigo TEXT, descricao TEXT)", | ||
86 | - "CREATE TABLE ".$esquemaadmin."i3geousr_operacoespapeis (id_operacao NUMERIC, id_papel NUMERIC)", | ||
87 | - "CREATE TABLE ".$esquemaadmin."i3geousr_grupousuario (id_usuario NUMERIC, id_grupo NUMERIC)", | ||
88 | - "CREATE TABLE ".$esquemaadmin."i3geousr_grupotema (id_grupo NUMERIC, id_tema NUMERIC)", | ||
89 | - "CREATE TABLE ".$esquemaadmin."i3geousr_grupos (id_grupo INTEGER PRIMARY KEY, nome TEXT, descricao TEXT)", | ||
90 | - "create table ".$esquemaadmin."i3geoestat_conexao (codigo_estat_conexao INTEGER PRIMARY KEY,bancodedados text,host text,porta text,usuario text,senha text)", | ||
91 | - "create table ".$esquemaadmin."i3geoestat_tipo_regiao(codigo_tipo_regiao INTEGER PRIMARY KEY,nome_tipo_regiao text,descricao_tipo_regiao text,codigo_estat_conexao integer,esquemadb text,tabela text,colunageo text,data text,identificador integer,colunanomeregiao text,srid text,colunacentroide text, colunasvisiveis text, apelidos text)", | ||
92 | - "create table ".$esquemaadmin."i3geoestat_agregaregiao(id_agregaregiao INTEGER PRIMARY KEY,codigo_tipo_regiao integer,codigo_tipo_regiao_pai integer,colunaligacao_regiaopai text)", | ||
93 | - "create table ".$esquemaadmin."i3geoestat_tipo_periodo(codigo_tipo_periodo INTEGER PRIMARY KEY,nome text,descricao text)", | ||
94 | - "create table ".$esquemaadmin."i3geoestat_unidade_medida(codigo_unidade_medida INTEGER PRIMARY KEY,nome text,sigla text,permitesoma integer default 0,permitemedia integer default 0)", | ||
95 | - "create table ".$esquemaadmin."i3geoestat_variavel(codigo_variavel INTEGER PRIMARY KEY,nome text,descricao text)", | ||
96 | - "create table ".$esquemaadmin."i3geoestat_medida_variavel(id_medida_variavel INTEGER PRIMARY KEY,codigo_unidade_medida integer,codigo_tipo_periodo integer,codigo_variavel integer,codigo_tipo_regiao integer,codigo_estat_conexao integer,esquemadb text,tabela text,colunavalor text,colunaidgeo text,filtro text,nomemedida text,colunaidunico text)", | ||
97 | - "create table ".$esquemaadmin."i3geoestat_classificacao(id_classificacao INTEGER PRIMARY KEY,nome text,id_medida_variavel integer,observacao text)", | ||
98 | - "create table ".$esquemaadmin."i3geoestat_classes(id_classe INTEGER PRIMARY KEY,expressao text,titulo text,vermelho text,verde text,azul text,id_classificacao integer,tamanho text,simbolo text,overmelho text,overde text,oazul text,otamanho text)", | ||
99 | - "create table ".$esquemaadmin."i3geoestat_fonteinfo(id_fonteinfo INTEGER PRIMARY KEY,titulo text unique,link text)", | ||
100 | - "create table ".$esquemaadmin."i3geoestat_fonteinfo_medida(id_medida_variavel integer not null,id_fonteinfo integer not null)", | ||
101 | - "create table ".$esquemaadmin."i3geoestat_medida_variavel_link(link text,id_medida_variavel integer,nome text,id_link INTEGER PRIMARY KEY)", | ||
102 | - "create table ".$esquemaadmin."i3geoestat_parametro_medida(id_parametro_medida INTEGER PRIMARY KEY,coluna text,nome text,descricao text,id_pai integer default 0,id_medida_variavel integer, tipo integer default 0)", | ||
103 | - "create table ".$esquemaadmin."i3geoestat_mapa(id_mapa INTEGER PRIMARY KEY,titulo text,template text,logoesquerdo text,logodireito text,publicado integer)", | ||
104 | - "create table ".$esquemaadmin."i3geoestat_mapa_grupo(id_mapa_grupo INTEGER PRIMARY KEY,id_mapa integer,titulo text)", | ||
105 | - "create table ".$esquemaadmin."i3geoestat_mapa_tema (id_mapa_tema INTEGER PRIMARY KEY,id_mapa_grupo integer,titulo text,id_medida_variavel integer)" | ||
106 | -); | ||
107 | -$drivename = $dbhw->getAttribute(PDO::ATTR_DRIVER_NAME); | ||
108 | -foreach($tabelas as $tabela){ | ||
109 | - if($drivename == "pgsql"){ | ||
110 | - $tabela = str_replace("INTEGER PRIMARY KEY","SERIAL PRIMARY KEY NOT NULL",$tabela); | ||
111 | - } | ||
112 | -} | ||
113 | -echo "<br><br>Tabelas:<br><br>"; | ||
114 | -foreach($tabelas as $tabela){ | ||
115 | - if($drivename == "pgsql"){ | ||
116 | - $tabela = str_replace("INTEGER PRIMARY KEY","SERIAL PRIMARY KEY NOT NULL",$tabela); | ||
117 | - } | ||
118 | - echo $tabela.";<br>"; | ||
119 | -} | ||
120 | -//var_dump($tabelas); | ||
121 | -echo "<br><br>Inserindo os registros default<br><br>"; | ||
122 | -$teste = lista("select * from ".$esquemaadmin."i3geousr_papeis","id_papel"); | ||
123 | -$sql = array(); | ||
124 | -if(!in_array(1,$teste)) | ||
125 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem executar qualquer tarefa, inclusive cadastrar novos administradores',1,'admin')"; | ||
126 | -if(!in_array(2,$teste)) | ||
127 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem criar/editar qualquer tema (mapfile) mas nao podem editar a arvore do catalogo de temas',2,'editores')"; | ||
128 | -if(!in_array(3,$teste)) | ||
129 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem alterar a arvore do catalogo e dos atlas',3,'publicadores')"; | ||
130 | -if(!in_array(4,$teste)) | ||
131 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem editar dados geograficos',4,'editoresgeo')"; | ||
132 | -if(!in_array(5,$teste)) | ||
133 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES ('Podem administrar o sistema METAESTAT','5', 'adminmetaestat')"; | ||
134 | -$teste = lista("select * from ".$esquemaadmin."i3geousr_usuarios","id_usuario"); | ||
135 | -if(!in_array(1,$teste)) | ||
136 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_usuarios VALUES(1,'','',0,'admingeral','admingeral','admingeral')"; | ||
137 | - | ||
138 | -$teste = lista("select * from ".$esquemaadmin."i3geousr_papelusuario","id_usuario","id_papel"); | ||
139 | -if(!in_array("1-1",$teste)) | ||
140 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papelusuario VALUES(1,1)"; | ||
141 | - | ||
142 | -$teste = lista("select * from ".$esquemaadmin."i3geousr_operacoes","id_operacao"); | ||
143 | -if(!in_array(1,$teste)) | ||
144 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(1,'admin/html/editormapfile','editor de mapfiles do sistema de administracao')"; | ||
145 | -if(!in_array(2,$teste)) | ||
146 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(2,'admin/html/operacoes','abre o editor de operacoes')"; | ||
147 | -if(!in_array(3,$teste)) | ||
148 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(3,'teste/','teste')"; | ||
149 | -if(!in_array(4,$teste)) | ||
150 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(4,'admin/html/arvore','edicao da arvore do catalogo de temas')"; | ||
151 | -if(!in_array(5,$teste)) | ||
152 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(5,'admin/html/menus','edicao da lista de menus')"; | ||
153 | -if(!in_array(6,$teste)) | ||
154 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(6,'admin/html/ogcws','edicao das preferencias do servico WMS')"; | ||
155 | -if(!in_array(7,$teste)) | ||
156 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(7,'admin/html/atlas','edicao de atlas')"; | ||
157 | -if(!in_array(8,$teste)) | ||
158 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(8,'admin/html/identifica','lista de sistemas incluidos na ferramenta de identificacao')"; | ||
159 | -if(!in_array(9,$teste)) | ||
160 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(9,'admin/html/incluimap','adapta mapfiles antigos para versoes novas do Mapserver')"; | ||
161 | -if(!in_array(10,$teste)) | ||
162 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(10,'admin/html/mapas','lista de links para mapas')"; | ||
163 | -if(!in_array(11,$teste)) | ||
164 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(11,'admin/html/perfis','lista controlada de perfis')"; | ||
165 | -if(!in_array(12,$teste)) | ||
166 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(12,'admin/html/sistemas','lista de sistemas complementares que sao mostrados no catalogo')"; | ||
167 | -if(!in_array(13,$teste)) | ||
168 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(13,'admin/html/subirshapefile','upload de shapefile para uma pasta especifica no servidor')"; | ||
169 | -if(!in_array(14,$teste)) | ||
170 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(14,'admin/html/tags','edicao da lista controlada de tags')"; | ||
171 | -if(!in_array(15,$teste)) | ||
172 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(15,'admin/html/webservices','cadastro de links para webservices')"; | ||
173 | -if(!in_array(16,$teste)) | ||
174 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(16,'admin/php/editortexto','editor de texto para mapfiles')"; | ||
175 | -if(!in_array(17,$teste)) | ||
176 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('17', 'admin/html/usuarios', 'cadastro de usuarios')"; | ||
177 | -if(!in_array(18,$teste)) | ||
178 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('18', 'admin/metaestat/geral', 'permite edicoes mais comuns do sistema de metadados estatisticos')"; | ||
179 | -if(!in_array(19,$teste)) | ||
180 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('19', 'admin/metaestat/editorbanco', 'permite gerenciar as tabelas do banco')"; | ||
181 | - | ||
182 | -$teste = lista("select * from ".$esquemaadmin."i3geousr_operacoespapeis","id_operacao","id_papel"); | ||
183 | -if(!in_array('1-2',$teste)) | ||
184 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(1,2)"; | ||
185 | -if(!in_array('1-3',$teste)) | ||
186 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(1,3)"; | ||
187 | -if(!in_array('4-3',$teste)) | ||
188 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(4,3)"; | ||
189 | -if(!in_array('5-3',$teste)) | ||
190 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(5,3)"; | ||
191 | -if(!in_array('7-3',$teste)) | ||
192 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(7,3)"; | ||
193 | -if(!in_array('10-3',$teste)) | ||
194 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(10,3)"; | ||
195 | -if(!in_array('13-2',$teste)) | ||
196 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(13,2)"; | ||
197 | -if(!in_array('13-4',$teste)) | ||
198 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(13,4)"; | ||
199 | -if(!in_array('15-3',$teste)) | ||
200 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(15,3)"; | ||
201 | -if(!in_array('16-2',$teste)) | ||
202 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(16,2)"; | ||
203 | -if(!in_array('18-1',$teste)) | ||
204 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(18,1)"; | ||
205 | -if(!in_array('18-5',$teste)) | ||
206 | - $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES (18,5)"; | ||
207 | - | ||
208 | -$sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('1', 'Anual', '')"; | ||
209 | -$sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('2', 'Mensal', '')"; | ||
210 | -$sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('3', 'Diário', '')"; | ||
211 | -$sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('4', 'Horário', '')"; | ||
212 | - | ||
213 | -echo "<br>Inserts:<br><br>"; | ||
214 | -foreach($sql as $s){ | ||
215 | - echo $s.";<br>"; | ||
216 | -} | ||
217 | - | ||
218 | -echo "<br>Feito!"; | ||
219 | -function lista($sql,$coluna,$coluna1=""){ | ||
220 | - global $dbh; | ||
221 | - $lista = array(); | ||
222 | - $q = $dbh->query($sql,PDO::FETCH_ASSOC); | ||
223 | - if($q) | ||
224 | - { | ||
225 | - $resultado = $q->fetchAll(); | ||
226 | - foreach($resultado as $r){ | ||
227 | - if($coluna1 == "") | ||
228 | - $lista[] = $r[$coluna]; | ||
229 | - else | ||
230 | - $lista[] = $r[$coluna]."-".$r[$coluna1]; | ||
231 | - } | ||
232 | - } | ||
233 | - return $lista; | ||
234 | -} | ||
235 | -?> | ||
236 | -</div> | ||
237 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/uploadgvp.php
@@ -1,67 +0,0 @@ | @@ -1,67 +0,0 @@ | ||
1 | -<?php | ||
2 | -exit; | ||
3 | -include_once("admin.php"); | ||
4 | -include_once("login.php"); | ||
5 | -if(verificaOperacaoSessao("admin/metaestat/geral") == false){ | ||
6 | - echo "Vc nao pode realizar essa operacao.";exit; | ||
7 | -} | ||
8 | -//error_reporting(0); | ||
9 | -if (ob_get_level() == 0) ob_start(); | ||
10 | -?> | ||
11 | -<html> | ||
12 | -<head> | ||
13 | -<link rel="stylesheet" type="text/css" href="../../css/input.css" /> | ||
14 | -<link rel="stylesheet" type="text/css" href="../../css/geral.css" /> | ||
15 | -<title></title> | ||
16 | -</head> | ||
17 | -<body bgcolor="white" style="background-color:white;text-align:left;"> | ||
18 | -<p> | ||
19 | -<?php | ||
20 | -if (isset($_FILES['i3GEOuploadgvp']['name'])){ | ||
21 | - require_once (dirname(__FILE__)."/../../ms_configura.php"); | ||
22 | - echo "<p class='paragrafo' >Carregando o arquivo...</p>"; | ||
23 | - ob_flush(); | ||
24 | - flush(); | ||
25 | - sleep(1); | ||
26 | - verificaNome($_FILES['i3GEOuploadgvp']['name']); | ||
27 | - $ArquivoDest = $_FILES['i3GEOuploadgvp']['name']; | ||
28 | - $ArquivoDest = str_replace(".gvp","",$ArquivoDest).".gvp"; | ||
29 | - $arq = $locaplic."/temas/".$ArquivoDest; | ||
30 | - if(file_exists($arq)){ | ||
31 | - unlink($arq); | ||
32 | - } | ||
33 | - //sobe arquivo | ||
34 | - $Arquivo = $_FILES['i3GEOuploadgvp']['tmp_name']; | ||
35 | - $status = move_uploaded_file($Arquivo,$arq); | ||
36 | - if($status != 1) | ||
37 | - {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo gvp";exit;} | ||
38 | - if($status == 1){ | ||
39 | - echo "<p class='paragrafo' >Arquivo enviado.</p>"; | ||
40 | - paraAguarde(); | ||
41 | - } | ||
42 | - else{ | ||
43 | - echo "<p class='paragrafo' >Erro ao enviar o arquivo.</p>"; | ||
44 | - exit; | ||
45 | - } | ||
46 | -} | ||
47 | -else{ | ||
48 | - echo "<p class='paragrafo' >Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</p>"; | ||
49 | -} | ||
50 | -function paraAguarde(){ | ||
51 | - echo "<script>window.scrollTo(0,10000);window.parent.core_pegaMapfiles('montaArvore()');</script>"; | ||
52 | -} | ||
53 | -function verificaNome($nome) | ||
54 | -{ | ||
55 | - $nome = strtolower($nome); | ||
56 | - $lista = explode(".",$nome); | ||
57 | - $extensao = $lista[count($lista) - 1]; | ||
58 | - if($extensao != "gvp") | ||
59 | - { | ||
60 | - echo "Nome de arquivo inválido."; | ||
61 | - paraAguarde(); | ||
62 | - exit; | ||
63 | - } | ||
64 | -} | ||
65 | -?> | ||
66 | -</body> | ||
67 | -</html> | ||
68 | \ No newline at end of file | 0 | \ No newline at end of file |
admin/php/usuarios.php
@@ -1,269 +0,0 @@ | @@ -1,269 +0,0 @@ | ||
1 | -<?php | ||
2 | -/* | ||
3 | -Title: usuarios.php | ||
4 | - | ||
5 | -Controle das requisições em Ajax utilizadas para gerenciar usuário e controle de acesso | ||
6 | - | ||
7 | -Recebe as requisições feitas em JavaScript (AJAX) e retorna o resultado para a interface. | ||
8 | - | ||
9 | -O parâmetro "funcao" define qual a operação que será executada. Esse parâmetro é verificado em um bloco "switch ($funcao)". | ||
10 | - | ||
11 | -Licenca: | ||
12 | - | ||
13 | -GPL2 | ||
14 | - | ||
15 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
16 | - | ||
17 | -Direitos Autorais Reservados (c) 2006 Edmar Moretti | ||
18 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
19 | - | ||
20 | -Este programa é software livre; você pode redistribuí-lo | ||
21 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
22 | -GNU conforme publicada pela Free Software Foundation; | ||
23 | - | ||
24 | -Este programa é distribuído na expectativa de que seja útil, | ||
25 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
26 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
27 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
28 | -Você deve ter recebido uma copia da Licença Pública Geral do | ||
29 | -GNU junto com este programa; se não, escreva para a | ||
30 | -Free Software Foundation, Inc., no endereço | ||
31 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
32 | - | ||
33 | -Arquivo: | ||
34 | - | ||
35 | -i3geo/classesphp/usuarios.php | ||
36 | - | ||
37 | -Parametros: | ||
38 | - | ||
39 | -funcao - opção que será executada (veja abaixo a lista de Valores que esse parâmetro pode assumir). | ||
40 | - | ||
41 | -Retorno: | ||
42 | - | ||
43 | -O resultado da operação será retornado em um objeto CPAINT. | ||
44 | - | ||
45 | -A construção da string JSON é feita preferencialmente pelas funções nativas do PHP. | ||
46 | -Para efeitos de compatibilidade, uma vez que até a versão 4.2 a string JSON era construida pelo CPAINT, | ||
47 | -o objeto CPAINT ainda é definido, porém, a função cpjson verifica se as funções nativas do PHPO (json) | ||
48 | -estão instaladas, se estiverem, utiliza-se a função nativa, se não, utiliza-se o CPAINT para gerar o JSON. | ||
49 | - | ||
50 | -Exemplo de chamada CPAINT (Ajax) do lado do cliente (javascript): | ||
51 | - | ||
52 | -var p = "classesphp/mapa_controle.php?funcao=crialente&resolucao=1.5&g_sid="+g_sid | ||
53 | - | ||
54 | -var cp = new cpaint() | ||
55 | - | ||
56 | -cp.set_response_type("JSON") | ||
57 | - | ||
58 | -cp.call(p,"lente",ajaxabrelente) | ||
59 | - | ||
60 | -*/ | ||
61 | -//error_reporting(0); | ||
62 | -// | ||
63 | -//pega as variaveis passadas com get ou post | ||
64 | -// | ||
65 | -include_once(dirname(__FILE__)."/login.php"); | ||
66 | -$funcoesEdicao = array( | ||
67 | - "ALTERARUSUARIOS", | ||
68 | - "EXCLUIRUSUARIO", | ||
69 | - "EXCLUIRPAPELUSUARIO", | ||
70 | - "PEGADADOSUSUARIO", | ||
71 | - "PEGAUSUARIOS", | ||
72 | - "PEGAPAPEISUSUARIO", | ||
73 | - "ENVIARSENHAEMAIL", | ||
74 | - "LISTAPAPEIS" | ||
75 | -); | ||
76 | -if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
77 | - if(verificaOperacaoSessao("admin/html/usuarios") == false){ | ||
78 | - retornaJSON("Vc nao pode realizar essa operacao.");exit; | ||
79 | - } | ||
80 | -} | ||
81 | - | ||
82 | -$id = $_GET["id"]; | ||
83 | -$id_usuario = $_GET["id_usuario"]; | ||
84 | -$id_papel = $_GET["id_papel"]; | ||
85 | - | ||
86 | -testaSafeNumerico([$id,$id_usuario,$id_papel]); | ||
87 | - | ||
88 | -switch (strtoupper($funcao)) | ||
89 | -{ | ||
90 | - case "ALTERARUSUARIOS": | ||
91 | - $novo = alterarUsuarios(); | ||
92 | - if($novo == false){ | ||
93 | - retornaJSON(array()); | ||
94 | - exit; | ||
95 | - } | ||
96 | - $sql = "SELECT id_usuario,ativo,data_cadastro,email,login,nome_usuario from ".$esquemaadmin."i3geousr_usuarios WHERE id_usuario = ".$novo; | ||
97 | - retornaJSON(pegaDados($sql)); | ||
98 | - exit; | ||
99 | - break; | ||
100 | - case "PEGAUSUARIOS": | ||
101 | - retornaJSON(pegaDados("SELECT id_usuario,ativo,data_cadastro,email,login,nome_usuario from ".$esquemaadmin."i3geousr_usuarios order by nome_usuario")); | ||
102 | - exit; | ||
103 | - break; | ||
104 | - case "PEGAPAPEISUSUARIO": | ||
105 | - $dados = 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 WHERE U.id_usuario = $id_usuario"); | ||
106 | - retornaJSON($dados); | ||
107 | - exit; | ||
108 | - break; | ||
109 | - case "PEGADADOSUSUARIO": | ||
110 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geousr_usuarios WHERE id_usuario = $id_usuario")); | ||
111 | - exit; | ||
112 | - break; | ||
113 | - case "EXCLUIRUSUARIO": | ||
114 | - $tabela = "i3geousr_usuarios"; | ||
115 | - $id = $id_usuario; | ||
116 | - $f = verificaFilhos(); | ||
117 | - if(!$f){ | ||
118 | - excluirUsuario(); | ||
119 | - retornaJSON("ok"); | ||
120 | - } | ||
121 | - else | ||
122 | - retornaJSON("erro"); | ||
123 | - exit; | ||
124 | - break; | ||
125 | - case "ADICIONAPAPELUSUARIO": | ||
126 | - adicionaPapelUsuario(); | ||
127 | - $dados = 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 WHERE U.id_usuario = $id_usuario"); | ||
128 | - retornaJSON($dados); | ||
129 | - exit; | ||
130 | - break; | ||
131 | - case "EXCLUIRPAPELUSUARIO": | ||
132 | - retornaJSON(excluirPapelUsuario()); | ||
133 | - exit; | ||
134 | - break; | ||
135 | - case "LISTAPAPEIS": | ||
136 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geousr_papeis order by nome")); | ||
137 | - exit; | ||
138 | - break; | ||
139 | - case "ENVIARSENHAEMAIL": | ||
140 | - retornaJSON(enviarSenhaEmail()); | ||
141 | - exit; | ||
142 | - break; | ||
143 | -} | ||
144 | -cpjson($retorno); | ||
145 | -function enviarSenhaEmail(){ | ||
146 | - global $id_usuario; | ||
147 | - include(dirname(__FILE__)."/conexao.php"); | ||
148 | - $novaSenha = rand(9000,1000000); | ||
149 | - $dados = pegaDados("select * from ".$esquemaadmin."i3geousr_usuarios where id_usuario = $id_usuario and ativo = 1"); | ||
150 | - if(count($dados) > 0){ | ||
151 | - //$senha = md5($novaSenha); | ||
152 | - if(!function_exists("password_hash")){ | ||
153 | - $senha = md5($novaSenha); | ||
154 | - } else { | ||
155 | - $senha = password_hash($novaSenha, PASSWORD_DEFAULT); | ||
156 | - } | ||
157 | - $sql = "UPDATE ".$esquemaadmin."i3geousr_usuarios SET senha='$senha' WHERE id_usuario = $id_usuario"; | ||
158 | - $dbhw->query($sql); | ||
159 | - i3GeoAdminInsertLog($dbhw,$sql); | ||
160 | - $to = $dados[0]["email"]; | ||
161 | - $subject = 'senha i3geo'; | ||
162 | - $message = $novaSenha; | ||
163 | - mail($to, $subject, $message); | ||
164 | - return "Ok"; | ||
165 | - } | ||
166 | - else{ | ||
167 | - return "erro"; | ||
168 | - } | ||
169 | -} | ||
170 | -function alterarUsuarios() | ||
171 | -{ | ||
172 | - global $id_usuario; | ||
173 | - try | ||
174 | - { | ||
175 | - include(dirname(__FILE__)."/conexao.php"); | ||
176 | - if($convUTF){ | ||
177 | - $_GET["nome_usuario"] = utf8_encode($_GET["nome_usuario"]); | ||
178 | - } | ||
179 | - if($id_usuario != ""){ | ||
180 | - //verifica uniciade de login | ||
181 | - $dados = pegaDados("select login from ".$esquemaadmin."i3geousr_usuarios where login = '".$_GET["login"]."'"); | ||
182 | - if(count($dados) > 0){ | ||
183 | - $retorna = false; | ||
184 | - } | ||
185 | - $dataCol = array( | ||
186 | - "nome_usuario" => $_GET["nome_usuario"], | ||
187 | - "login" => $_GET["login"], | ||
188 | - "email" => $_GET["email"], | ||
189 | - "ativo" => $_GET["ativo"], | ||
190 | - "data_cadastro" => $_GET["data_cadastro"] | ||
191 | - ); | ||
192 | - //se a senha foi enviada, ela sera trocada | ||
193 | - if($_GET["senha"] != ""){ | ||
194 | - if(!function_exists("password_hash")){ | ||
195 | - $dataCol["senha"] = md5($_GET["senha"]); | ||
196 | - } else { | ||
197 | - $dataCol["senha"] = password_hash($_GET["senha"], PASSWORD_DEFAULT); | ||
198 | - } | ||
199 | - } | ||
200 | - i3GeoAdminUpdate($dbhw,"i3geousr_usuarios",$dataCol,"WHERE id_usuario = $id_usuario"); | ||
201 | - $retorna = $id_usuario; | ||
202 | - } | ||
203 | - else{ | ||
204 | - $dataCol = array( | ||
205 | - "nome_usuario" => '', | ||
206 | - "login" => '', | ||
207 | - "email" => '', | ||
208 | - "ativo" => 0, | ||
209 | - "data_cadastro" => '', | ||
210 | - "senha" => '' | ||
211 | - ); | ||
212 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geousr_usuarios",$dataCol,"nome_usuario","id_usuario"); | ||
213 | - } | ||
214 | - $dbhw = null; | ||
215 | - $dbh = null; | ||
216 | - return $retorna; | ||
217 | - } | ||
218 | - catch (PDOException $e){ | ||
219 | - return "Error!: "; | ||
220 | - } | ||
221 | -} | ||
222 | -function adicionaPapelUsuario(){ | ||
223 | - global $id_usuario,$id_papel; | ||
224 | - try { | ||
225 | - include(dirname(__FILE__)."/conexao.php"); | ||
226 | - $dataCol = array( | ||
227 | - "id_usuario" => $id_usuario, | ||
228 | - "id_papel" => $id_papel | ||
229 | - ); | ||
230 | - i3GeoAdminInsert($dbhw,"i3geousr_papelusuario",$dataCol); | ||
231 | - $dbhw = null; | ||
232 | - $dbh = null; | ||
233 | - return "ok"; | ||
234 | - } | ||
235 | - catch (PDOException $e){ | ||
236 | - return "Error!: "; | ||
237 | - } | ||
238 | -} | ||
239 | -function excluirUsuario(){ | ||
240 | - global $id_usuario; | ||
241 | - try { | ||
242 | - include(dirname(__FILE__)."/conexao.php"); | ||
243 | - $sql = "DELETE FROM ".$esquemaadmin."i3geousr_usuarios WHERE id_usuario = $id_usuario "; | ||
244 | - $dbhw->query($sql); | ||
245 | - i3GeoAdminInsertLog($dbhw,$sql); | ||
246 | - $dbhw = null; | ||
247 | - $dbh = null; | ||
248 | - return "ok"; | ||
249 | - } | ||
250 | - catch (PDOException $e) { | ||
251 | - return "Error!: "; | ||
252 | - } | ||
253 | -} | ||
254 | -function excluirPapelUsuario(){ | ||
255 | - global $id_usuario,$id_papel; | ||
256 | - try { | ||
257 | - include(dirname(__FILE__)."/conexao.php"); | ||
258 | - $sql = "DELETE FROM ".$esquemaadmin."i3geousr_papelusuario WHERE id_usuario = $id_usuario AND id_papel = $id_papel "; | ||
259 | - $dbhw->query($sql); | ||
260 | - i3GeoAdminInsertLog($dbhw,$sql); | ||
261 | - $dbhw = null; | ||
262 | - $dbh = null; | ||
263 | - return "ok"; | ||
264 | - } | ||
265 | - catch (PDOException $e) { | ||
266 | - return "Error!: "; | ||
267 | - } | ||
268 | -} | ||
269 | -?> |
admin/php/webservices.php
@@ -1,250 +0,0 @@ | @@ -1,250 +0,0 @@ | ||
1 | -<?php | ||
2 | -/* | ||
3 | - Title: webservices.php | ||
4 | - | ||
5 | -Funções utilizadas pelo editor do cadastro de Web Services | ||
6 | - | ||
7 | -É utilizado nas funções em AJAX da interface de edição | ||
8 | - | ||
9 | -Licenca: | ||
10 | - | ||
11 | -GPL2 | ||
12 | - | ||
13 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
14 | - | ||
15 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
16 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
17 | - | ||
18 | -Este programa é software livre; você pode redistribuí-lo | ||
19 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
20 | -GNU conforme publicada pela Free Software Foundation; | ||
21 | - | ||
22 | -Este programa é distribuído na expectativa de que seja útil, | ||
23 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
24 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
25 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
26 | -Você deve ter recebido uma cópia da Licença Pública Geral do | ||
27 | - GNU junto com este programa; se não, escreva para a | ||
28 | -Free Software Foundation, Inc., no endereço | ||
29 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
30 | - | ||
31 | -Arquivo: | ||
32 | - | ||
33 | -i3geo/admin/php/webservices.php | ||
34 | - | ||
35 | -Parametros: | ||
36 | - | ||
37 | -O parâmetro principal é "funcao", que define qual operação será executada, por exemplo, webservices.php?funcao=pegaws | ||
38 | - | ||
39 | -Cada operação possuí seus próprios parâmetros, que devem ser enviados também na requisição da operação. | ||
40 | - | ||
41 | -*/ | ||
42 | -//error_reporting(0); | ||
43 | - | ||
44 | -//a funcao PEGAWS pode ser executada por outros programas | ||
45 | - | ||
46 | -$funcoesEdicao = array( | ||
47 | - "ALTERARWS", | ||
48 | - "EXCLUIR" | ||
49 | -); | ||
50 | -if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
51 | - include_once(dirname(__FILE__)."/login.php"); | ||
52 | - $id_ws = $_GET["id_ws"]; | ||
53 | - $id = $_GET["id"]; | ||
54 | - testaSafeNumerico([$id,$id_ws]); | ||
55 | - if(verificaOperacaoSessao("admin/html/webservices") == false){ | ||
56 | - retornaJSON("Vc nao pode realizar essa operacao.");exit; | ||
57 | - } | ||
58 | -} | ||
59 | -//faz a busca da função que deve ser executada | ||
60 | -switch (strtoupper($funcao)) | ||
61 | -{ | ||
62 | - /* | ||
63 | - Note: | ||
64 | - | ||
65 | - Valores que o parâmetro &funcao pode receber. Os parâmetros devem ser enviados na requisição em AJAX. | ||
66 | - */ | ||
67 | - /* | ||
68 | - Valor: PEGAWS | ||
69 | - | ||
70 | - Lista de serviços cadastrados | ||
71 | - | ||
72 | - Retorno: | ||
73 | - | ||
74 | - {JSON} | ||
75 | - */ | ||
76 | - case "PEGAWS": | ||
77 | - if(isset($tipows) && $tipows != "") { | ||
78 | - $sql = "SELECT id_ws,nome_ws,tipo_ws from ".$esquemaadmin."i3geoadmin_ws where tipo_ws = '".strtoupper($_GET["tipows"])."' order by tipo_ws,nome_ws "; | ||
79 | - } | ||
80 | - else{ | ||
81 | - $sql = "SELECT id_ws,nome_ws,tipo_ws from ".$esquemaadmin."i3geoadmin_ws order by tipo_ws,nome_ws"; | ||
82 | - } | ||
83 | - retornaJSON(pegaDados($sql)); | ||
84 | - exit; | ||
85 | - break; | ||
86 | - /* | ||
87 | - Valor: PEGADADOS | ||
88 | - | ||
89 | - Dados de um servico | ||
90 | - | ||
91 | - Parametro: | ||
92 | - | ||
93 | - id_ws {string} | ||
94 | - | ||
95 | - Retorno: | ||
96 | - | ||
97 | - {JSON} | ||
98 | - */ | ||
99 | - case "PEGADADOS": | ||
100 | - retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_ws where id_ws='$id_ws'")); | ||
101 | - exit; | ||
102 | - break; | ||
103 | - /* | ||
104 | - Valor: ALTERARWS | ||
105 | - | ||
106 | - Altera um registro | ||
107 | - | ||
108 | - Parametros: | ||
109 | - | ||
110 | - id_ws | ||
111 | - | ||
112 | - desc_ws | ||
113 | - | ||
114 | - nome_ws | ||
115 | - | ||
116 | - link_ws | ||
117 | - | ||
118 | - autor_ws | ||
119 | - | ||
120 | - tipo_ws | ||
121 | - | ||
122 | - Retorno: | ||
123 | - | ||
124 | - {JSON} | ||
125 | - */ | ||
126 | - case "ALTERARWS": | ||
127 | - $novo = alterarWS(); | ||
128 | - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_ws WHERE id_ws = '".$novo."'"; | ||
129 | - retornaJSON(pegaDados($sql)); | ||
130 | - exit; | ||
131 | - break; | ||
132 | - /* | ||
133 | - Valor: EXCLUIR | ||
134 | - | ||
135 | - Exclui um registro | ||
136 | - | ||
137 | - Parametro: | ||
138 | - | ||
139 | - id {string} | ||
140 | - | ||
141 | - Retorno: | ||
142 | - | ||
143 | - {JSON} | ||
144 | - */ | ||
145 | - case "EXCLUIR": | ||
146 | - retornaJSON(excluirWS()); | ||
147 | - exit; | ||
148 | - break; | ||
149 | - | ||
150 | -} | ||
151 | -/* | ||
152 | - Altera o registro de um WS | ||
153 | -*/ | ||
154 | -function alterarWS(){ | ||
155 | - global $esquemaadmin,$id_ws; | ||
156 | - $desc_ws = $_GET["desc_ws"]; | ||
157 | - $nome_ws = $_GET["nome_ws"]; | ||
158 | - $link_ws = $_GET["link_ws"]; | ||
159 | - $autor_ws = $_GET["autor_ws"]; | ||
160 | - $tipo_ws = $_GET["tipo_ws"]; | ||
161 | - try{ | ||
162 | - require_once("conexao.php"); | ||
163 | - if($convUTF){ | ||
164 | - $nome_ws = utf8_encode($nome_ws); | ||
165 | - $desc_ws = utf8_encode($desc_ws); | ||
166 | - $autor_ws = utf8_encode($autor_ws); | ||
167 | - } | ||
168 | - if($id_ws != ""){ | ||
169 | - $dataCol = array( | ||
170 | - "desc_ws" => $desc_ws, | ||
171 | - "nome_ws" => $nome_ws, | ||
172 | - "link_ws" => $link_ws, | ||
173 | - "autor_ws" => $autor_ws, | ||
174 | - "tipo_ws" => $tipo_ws | ||
175 | - ); | ||
176 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_ws",$dataCol,"WHERE id_ws = $id_ws"); | ||
177 | - $retorna = $id_ws; | ||
178 | - } | ||
179 | - else{ | ||
180 | - $dataCol = array( | ||
181 | - "desc_ws" => '', | ||
182 | - "nome_ws" => '', | ||
183 | - "link_ws" => '', | ||
184 | - "autor_ws" => '', | ||
185 | - "tipo_ws" => '', | ||
186 | - "nacessos" => 0, | ||
187 | - "nacessosok" => 0 | ||
188 | - ); | ||
189 | - $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_ws",$dataCol,"nome_ws","id_ws"); | ||
190 | - } | ||
191 | - $dbhw = null; | ||
192 | - $dbh = null; | ||
193 | - return $retorna; | ||
194 | - } | ||
195 | - catch (PDOException $e){ | ||
196 | - return "Error!: "; | ||
197 | - } | ||
198 | -} | ||
199 | -function excluirWS(){ | ||
200 | - global $id,$esquemaadmin; | ||
201 | - try{ | ||
202 | - include("conexao.php"); | ||
203 | - $sql = "DELETE from ".$esquemaadmin."i3geoadmin_ws WHERE id_ws = $id"; | ||
204 | - $dbhw->query($sql); | ||
205 | - i3GeoAdminInsertLog($dbhw,$sql); | ||
206 | - $dbhw = null; | ||
207 | - $dbh = null; | ||
208 | - return "ok"; | ||
209 | - } | ||
210 | - catch (PDOException $e){ | ||
211 | - return "Error!: "; | ||
212 | - } | ||
213 | -} | ||
214 | -function adicionaAcesso($id_ws,$sucesso){ | ||
215 | - global $esquemaadmin; | ||
216 | - try { | ||
217 | - if($id_ws == ""){ | ||
218 | - return; | ||
219 | - } | ||
220 | - include("conexao.php"); | ||
221 | - $dados = pegaDados("select * from ".$esquemaadmin."i3geoadmin_ws WHERE id_ws = $id_ws"); | ||
222 | - if(count($dados) == 0){ | ||
223 | - return; | ||
224 | - }; | ||
225 | - if($dados[0]["nacessos"] == ""){ | ||
226 | - $dados[0]["nacessos"] = 0; | ||
227 | - } | ||
228 | - $acessos = $dados[0]["nacessos"] + 1; | ||
229 | - | ||
230 | - if($sucesso) | ||
231 | - $ok = $dados[0]["nacessosok"] + 1; | ||
232 | - else | ||
233 | - $ok = $dados[0]["nacessosok"]; | ||
234 | - | ||
235 | - if($ok == ""){ | ||
236 | - $ok = 0; | ||
237 | - } | ||
238 | - $dataCol = array( | ||
239 | - "nacessos" => $acessos, | ||
240 | - "nacessosok" => $ok | ||
241 | - ); | ||
242 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_ws",$dataCol,"WHERE id_ws = $id_ws"); | ||
243 | - $dbhw = null; | ||
244 | - $dbh = null; | ||
245 | - } | ||
246 | - catch (PDOException $e){ | ||
247 | - return "Error!: "; | ||
248 | - } | ||
249 | -} | ||
250 | -?> | ||
251 | \ No newline at end of file | 0 | \ No newline at end of file |
ferramentas/tipoimagem/index.js
@@ -153,7 +153,7 @@ i3GEOF.tipoimagem = { | @@ -153,7 +153,7 @@ i3GEOF.tipoimagem = { | ||
153 | f.push($( this ).prop("name")); | 153 | f.push($( this ).prop("name")); |
154 | }); | 154 | }); |
155 | if(f.length == 0){ | 155 | if(f.length == 0){ |
156 | - f = ["nenhum"]; | 156 | + f.push("nenhum"); |
157 | } | 157 | } |
158 | i3GEO.configura.tipoimagem = f.join(" "); | 158 | i3GEO.configura.tipoimagem = f.join(" "); |
159 | i3GEO.Interface.alteraParametroLayers("TIPOIMAGEM",f.join(" ")); | 159 | i3GEO.Interface.alteraParametroLayers("TIPOIMAGEM",f.join(" ")); |