Commit 6cb418e30ea96b441f4e3cc0e813abea5c60d301
1 parent
f3d5e4fc
Exists in
master
and in
7 other branches
--no commit message
Showing
7 changed files
with
58 additions
and
12 deletions
Show diff stats
admin/php/atlas.php
@@ -262,7 +262,11 @@ function importarXmlAtlas() | @@ -262,7 +262,11 @@ function importarXmlAtlas() | ||
262 | if(!isset($atlasExistentes[$titulo])) | 262 | if(!isset($atlasExistentes[$titulo])) |
263 | $dbhw->query("INSERT INTO i3geoadmin_atlas (desc_atlas,h_atlas,w_atlas,icone_atlas,link_atlas,pranchadefault_atlas,template_atlas,tipoguias_atlas,titulo_atlas) VALUES ('$desc','$h','$w','$icone','$link','$pranchadefault','$template','$tipoguias','$titulo')"); | 263 | $dbhw->query("INSERT INTO i3geoadmin_atlas (desc_atlas,h_atlas,w_atlas,icone_atlas,link_atlas,pranchadefault_atlas,template_atlas,tipoguias_atlas,titulo_atlas) VALUES ('$desc','$h','$w','$icone','$link','$pranchadefault','$template','$tipoguias','$titulo')"); |
264 | $atlasExistentes[$titulo] = 0; | 264 | $atlasExistentes[$titulo] = 0; |
265 | - $id_atlas = $dbh->lastInsertId("id_atlas"); | 265 | + |
266 | + $id_atlas = $dbhw->query("SELECT id_atlas FROM i3geoadmin_atlas"); | ||
267 | + $id_atlas = $id_atlas->fetchAll(); | ||
268 | + $id_atlas = intval($id_atlas[count($id_atlas)-1]['id_atlas']); | ||
269 | + | ||
266 | foreach ($atlas->PRANCHAS->PRANCHA as $prancha) | 270 | foreach ($atlas->PRANCHAS->PRANCHA as $prancha) |
267 | { | 271 | { |
268 | $titulo = ixml($prancha,"TITULO"); | 272 | $titulo = ixml($prancha,"TITULO"); |
@@ -271,16 +275,21 @@ function importarXmlAtlas() | @@ -271,16 +275,21 @@ function importarXmlAtlas() | ||
271 | $link = ixml($prancha,"LINKMAISINFO"); | 275 | $link = ixml($prancha,"LINKMAISINFO"); |
272 | $w = ixml($prancha,"WABERUTRA"); | 276 | $w = ixml($prancha,"WABERUTRA"); |
273 | $h = ixml($prancha,"HABERTURA"); | 277 | $h = ixml($prancha,"HABERTURA"); |
278 | + if($w == ""){$w = 'null';} | ||
279 | + if($h == ""){$h = 'null';} | ||
274 | $mapext = ixml($prancha,"MAPEXT"); | 280 | $mapext = ixml($prancha,"MAPEXT"); |
275 | - $dbhw->query("INSERT INTO i3geoadmin_atlasp (id_atlas,desc_prancha,h_prancha,w_prancha,icone_prancha,link_prancha,titulo_prancha,mapext_prancha) VALUES ('$id_atlas','$desc','$h','$w','$icone','$link','$titulo','$mapext')"); | ||
276 | - $id_prancha = $dbh->lastInsertId("id_prancha"); | 281 | + $dbhw->query("INSERT INTO i3geoadmin_atlasp (id_atlas,desc_prancha,h_prancha,w_prancha,icone_prancha,link_prancha,titulo_prancha,mapext_prancha) VALUES ('$id_atlas','$desc',$h,$w,'$icone','$link','$titulo','$mapext')"); |
282 | + | ||
283 | + $id_prancha = $dbhw->query("SELECT id_prancha FROM i3geoadmin_atlasp"); | ||
284 | + $id_prancha = $id_prancha->fetchAll(); | ||
285 | + $id_prancha = intval($id_prancha[count($id_prancha)-1]['id_prancha']); | ||
286 | + | ||
277 | foreach ($prancha->TEMAS->TEMA as $tema) | 287 | foreach ($prancha->TEMAS->TEMA as $tema) |
278 | { | 288 | { |
279 | $codigo = ixml($tema,"CODIGO"); | 289 | $codigo = ixml($tema,"CODIGO"); |
280 | $ligado = ixml($tema,"LIGADO"); | 290 | $ligado = ixml($tema,"LIGADO"); |
281 | $dbhw->query("INSERT INTO i3geoadmin_atlast (id_prancha,codigo_tema,ligado_tema) VALUES ('$id_prancha','$codigo','$ligado')"); | 291 | $dbhw->query("INSERT INTO i3geoadmin_atlast (id_prancha,codigo_tema,ligado_tema) VALUES ('$id_prancha','$codigo','$ligado')"); |
282 | } | 292 | } |
283 | - | ||
284 | } | 293 | } |
285 | } | 294 | } |
286 | $dbhw = null; | 295 | $dbhw = null; |
admin/php/conexaomma.php
1 | <?php | 1 | <?php |
2 | -$dbh = new PDO('pgsql:dbname=geodados;user=pgsql;password=pgsql;host=dsvmapas.mma.gov.br'); | 2 | +$dbh = new PDO('pgsql:dbname=geodados;user=geodados;password=geodados;host=dsvmapas.mma.gov.br'); |
3 | +$dbhw = new PDO('pgsql:dbname=geodados;user=pgsql;password=pgsql;host=dsvmapas.mma.gov.br'); | ||
3 | ?> | 4 | ?> |
4 | \ No newline at end of file | 5 | \ No newline at end of file |
admin/php/menutemas.php
@@ -413,7 +413,9 @@ function importarXmlMenu() | @@ -413,7 +413,9 @@ function importarXmlMenu() | ||
413 | include_once("../../classesphp/funcoes_gerais.php"); | 413 | include_once("../../classesphp/funcoes_gerais.php"); |
414 | include("conexao.php"); | 414 | include("conexao.php"); |
415 | $dbhw->query("INSERT INTO i3geoadmin_menus (desc_menu,nome_menu) VALUES ('','$nomemenu')"); | 415 | $dbhw->query("INSERT INTO i3geoadmin_menus (desc_menu,nome_menu) VALUES ('','$nomemenu')"); |
416 | - $id_menu = $dbhw->lastInsertId("id_menu"); | 416 | + $id_menu = $dbhw->query("SELECT id_menu FROM i3geoadmin_menus"); |
417 | + $id_menu = $id_menu->fetchAll(); | ||
418 | + $id_menu = intval($id_menu[count($id_menu)-1]['id_menu']); | ||
417 | 419 | ||
418 | $xml = simplexml_load_file($xml); | 420 | $xml = simplexml_load_file($xml); |
419 | // | 421 | // |
@@ -537,7 +539,10 @@ function importarXmlMenu() | @@ -537,7 +539,10 @@ function importarXmlMenu() | ||
537 | $r = $dbhw->query("select id_grupo from i3geoadmin_grupos where nome_grupo = '$gtipo'"); | 539 | $r = $dbhw->query("select id_grupo from i3geoadmin_grupos where nome_grupo = '$gtipo'"); |
538 | $id_grupo = $r->fetchColumn(); | 540 | $id_grupo = $r->fetchColumn(); |
539 | $dbhw->query("INSERT INTO i3geoadmin_n1 (id_menu,id_grupo,n1_perfil) VALUES ('$id_menu','$id_grupo','$n1_perfil')"); | 541 | $dbhw->query("INSERT INTO i3geoadmin_n1 (id_menu,id_grupo,n1_perfil) VALUES ('$id_menu','$id_grupo','$n1_perfil')"); |
540 | - $id_n1 = $dbhw->lastInsertId("id_n1"); | 542 | + $id_n1 = $dbhw->query("SELECT id_menu FROM i3geoadmin_n1"); |
543 | + $id_n1 = $id_n1->fetchAll(); | ||
544 | + $id_n1 = intval($id_n1[count($id_n1)-1]['id_n1']); | ||
545 | + | ||
541 | foreach($grupo->TEMA as $tema) | 546 | foreach($grupo->TEMA as $tema) |
542 | { | 547 | { |
543 | $codigo = ixml($tema,"TID"); | 548 | $codigo = ixml($tema,"TID"); |
@@ -554,7 +559,9 @@ function importarXmlMenu() | @@ -554,7 +559,9 @@ function importarXmlMenu() | ||
554 | $id_subgrupo = $r->fetchColumn(); | 559 | $id_subgrupo = $r->fetchColumn(); |
555 | 560 | ||
556 | $dbhw->query("INSERT INTO i3geoadmin_n2 (id_n1,id_subgrupo,n2_perfil) VALUES ('$id_n1','$id_subgrupo','$n2_perfil')"); | 561 | $dbhw->query("INSERT INTO i3geoadmin_n2 (id_n1,id_subgrupo,n2_perfil) VALUES ('$id_n1','$id_subgrupo','$n2_perfil')"); |
557 | - $id_n2 = $dbhw->lastInsertId("id_n2"); | 562 | + $id_n2 = $dbhw->query("SELECT id_n2 FROM i3geoadmin_n2"); |
563 | + $id_n2 = $id_n2->fetchAll(); | ||
564 | + $id_n2 = intval($id_n2[count($id_n2)-1]['id_n2']); | ||
558 | foreach($subgrupo->TEMA as $tema) | 565 | foreach($subgrupo->TEMA as $tema) |
559 | { | 566 | { |
560 | $codigo = ixml($tema,"TID"); | 567 | $codigo = ixml($tema,"TID"); |
admin/php/sistemas.php
@@ -199,7 +199,9 @@ function importarXmlSistemas() | @@ -199,7 +199,9 @@ function importarXmlSistemas() | ||
199 | if(!isset($sistemasExistentes[$nome])) | 199 | if(!isset($sistemasExistentes[$nome])) |
200 | $dbhw->query("INSERT INTO i3geoadmin_sistemas (nome_sistema,perfil_sistema) VALUES ('$nome','$perfil')"); | 200 | $dbhw->query("INSERT INTO i3geoadmin_sistemas (nome_sistema,perfil_sistema) VALUES ('$nome','$perfil')"); |
201 | $sistemasExistentes[$nome] = 0; | 201 | $sistemasExistentes[$nome] = 0; |
202 | - $id_sistema = $dbh->lastInsertId("id_sistema"); | 202 | + $id_sistema = $dbhw->query("SELECT id_sistema FROM i3geoadmin_sistemas"); |
203 | + $id_sistema = $id_sistema->fetchAll(); | ||
204 | + $id_sistema = intval($id_sistema[count($id_sistema)-1]['id_sistema']); | ||
203 | foreach ($item->FUNCAO as $funcao) | 205 | foreach ($item->FUNCAO as $funcao) |
204 | { | 206 | { |
205 | $abrir_funcao = ixml($funcao,"ABRIR"); | 207 | $abrir_funcao = ixml($funcao,"ABRIR"); |
admin/php/sqlite.php
@@ -16,6 +16,8 @@ foreach($resultado as $r) | @@ -16,6 +16,8 @@ foreach($resultado as $r) | ||
16 | echo $r["sql"]."<br>"; | 16 | echo $r["sql"]."<br>"; |
17 | } | 17 | } |
18 | echo "<br><br><span style=color:red >SQL no padrão POSTGRES</span><br><br>"; | 18 | echo "<br><br><span style=color:red >SQL no padrão POSTGRES</span><br><br>"; |
19 | +echo "<br><br>Após criar as tabelas no Postgres, vc deve definir as permissões para os usuários.<br><br>"; | ||
20 | +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>"; | ||
19 | foreach($resultado as $r) | 21 | foreach($resultado as $r) |
20 | { | 22 | { |
21 | echo str_ireplace("INTEGER PRIMARY KEY","SERIAL",$r["sql"])."<br>"; | 23 | echo str_ireplace("INTEGER PRIMARY KEY","SERIAL",$r["sql"])."<br>"; |
admin/php/xml.php
@@ -328,7 +328,8 @@ function geraXmlAtlas_pegapranchas($xml,$id_atlas,$dbh) | @@ -328,7 +328,8 @@ function geraXmlAtlas_pegapranchas($xml,$id_atlas,$dbh) | ||
328 | } | 328 | } |
329 | function geraXmlAtlas_pegatemas($xml,$id_prancha,$dbh) | 329 | function geraXmlAtlas_pegatemas($xml,$id_prancha,$dbh) |
330 | { | 330 | { |
331 | - $q = "select tema.codigo_tema,t.ligado_tema from i3geoadmin_atlast as t,i3geoadmin_temas as tema where tema.id_tema = t.id_tema and t.id_prancha = $id_prancha "; | 331 | + $q = "select t.codigo_tema,t.ligado_tema from i3geoadmin_atlast as t where t.id_prancha = $id_prancha"; |
332 | + //echo $q; | ||
332 | $qtemas = $dbh->query($q); | 333 | $qtemas = $dbh->query($q); |
333 | foreach($qtemas as $row) | 334 | foreach($qtemas as $row) |
334 | { | 335 | { |
@@ -337,7 +338,6 @@ function geraXmlAtlas_pegatemas($xml,$id_prancha,$dbh) | @@ -337,7 +338,6 @@ function geraXmlAtlas_pegatemas($xml,$id_prancha,$dbh) | ||
337 | $xml .= "<LIGADO>".$row["ligado_tema"]."</LIGADO>\n"; | 338 | $xml .= "<LIGADO>".$row["ligado_tema"]."</LIGADO>\n"; |
338 | $xml .= "</TEMA>\n"; | 339 | $xml .= "</TEMA>\n"; |
339 | } | 340 | } |
340 | - | ||
341 | } | 341 | } |
342 | function geraXmlSistemas_pegafuncoes($perfil,&$xml,$id_sistema,$dbh) | 342 | function geraXmlSistemas_pegafuncoes($perfil,&$xml,$id_sistema,$dbh) |
343 | { | 343 | { |
@@ -356,7 +356,7 @@ function geraXmlSistemas_pegafuncoes($perfil,&$xml,$id_sistema,$dbh) | @@ -356,7 +356,7 @@ function geraXmlSistemas_pegafuncoes($perfil,&$xml,$id_sistema,$dbh) | ||
356 | { | 356 | { |
357 | $xml .= "<FUNCAO>\n"; | 357 | $xml .= "<FUNCAO>\n"; |
358 | $xml .= " <NOMEFUNCAO>".xmlTexto_prepara($row["nome_funcao"])."</NOMEFUNCAO>\n"; | 358 | $xml .= " <NOMEFUNCAO>".xmlTexto_prepara($row["nome_funcao"])."</NOMEFUNCAO>\n"; |
359 | - $xml .= " <ABRIR>".$row["abrir_funcao"]."</ABRIR>\n"; | 359 | + $xml .= " <ABRIR>".xmlTexto_prepara($row["abrir_funcao"])."</ABRIR>\n"; |
360 | $xml .= " <JANELAW>".$row["w_funcao"]."</JANELAW>\n"; | 360 | $xml .= " <JANELAW>".$row["w_funcao"]."</JANELAW>\n"; |
361 | $xml .= " <JANELAH>".$row["h_funcao"]."</JANELAH>\n"; | 361 | $xml .= " <JANELAH>".$row["h_funcao"]."</JANELAH>\n"; |
362 | $xml .= " <PERFIL>".$row["perfil_funcao"]."</PERFIL>\n"; | 362 | $xml .= " <PERFIL>".$row["perfil_funcao"]."</PERFIL>\n"; |
@@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
1 | +<?php | ||
2 | +error_reporting(0); | ||
3 | +if(!isset($locaplic)) | ||
4 | +{ | ||
5 | + $locaplic = ""; | ||
6 | + if(file_exists("../../../ms_configura.php")) | ||
7 | + {include_once("../../../ms_configura.php");} | ||
8 | + else | ||
9 | + { | ||
10 | + if(file_exists("../../ms_configura.php")) | ||
11 | + {include_once("../../ms_configura.php");} | ||
12 | + else | ||
13 | + { | ||
14 | + if(file_exists("../ms_configura.php")) | ||
15 | + {include_once("../ms_configura.php");} | ||
16 | + else | ||
17 | + include_once("ms_configura.php"); | ||
18 | + } | ||
19 | + } | ||
20 | +} | ||
21 | +include_once($locaplic."/classesphp/pega_variaveis.php"); | ||
22 | +include_once($locaplic."/admin/php/xml.php"); | ||
23 | +if(!isset($perfil)){$perfil = "";} | ||
24 | +echo geraXmlSistemas($perfil,$locaplic); | ||
25 | +?> |