Commit 78745a022cc160db1c162cefc5f35668e9dbfe7b
1 parent
d14e62fd
Exists in
master
and in
7 other branches
Correção na opção que lista os WMS cadastrados e as camadas do WMS escolhido
Showing
6 changed files
with
41 additions
and
40 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin/php/webservices.php
@@ -40,21 +40,18 @@ Cada operação possuí seus próprios parâmetros, que de | @@ -40,21 +40,18 @@ Cada operação possuí seus próprios parâmetros, que de | ||
40 | 40 | ||
41 | */ | 41 | */ |
42 | error_reporting(0); | 42 | error_reporting(0); |
43 | -// | ||
44 | -//não sei pq mas ob_start e clean são necessários no Linux para não gerar erro indesejado | ||
45 | -// | ||
46 | -include_once(dirname(__FILE__)."/login.php"); | ||
47 | 43 | ||
48 | -$id_ws = $_GET["id_ws"]; | ||
49 | -$id = $_GET["id"]; | ||
50 | - | ||
51 | -testaSafeNumerico([$id,$id_ws]); | 44 | +//a funcao PEGAWS pode ser executada por outros programas |
52 | 45 | ||
53 | $funcoesEdicao = array( | 46 | $funcoesEdicao = array( |
54 | "ALTERARWS", | 47 | "ALTERARWS", |
55 | "EXCLUIR" | 48 | "EXCLUIR" |
56 | ); | 49 | ); |
57 | if(in_array(strtoupper($funcao),$funcoesEdicao)){ | 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]); | ||
58 | if(verificaOperacaoSessao("admin/html/webservices") == false){ | 55 | if(verificaOperacaoSessao("admin/html/webservices") == false){ |
59 | retornaJSON("Vc nao pode realizar essa operacao.");exit; | 56 | retornaJSON("Vc nao pode realizar essa operacao.");exit; |
60 | } | 57 | } |
admin/php/xml.php
@@ -487,13 +487,17 @@ RSS | @@ -487,13 +487,17 @@ RSS | ||
487 | function geraXmlRSS($locaplic,$sql,$descricao,$output="xml") | 487 | function geraXmlRSS($locaplic,$sql,$descricao,$output="xml") |
488 | { | 488 | { |
489 | global $esquemaadmin; | 489 | global $esquemaadmin; |
490 | + if(empty($output)){ | ||
491 | + $output = "xml"; | ||
492 | + } | ||
490 | //var_dump($_SERVER);exit; | 493 | //var_dump($_SERVER);exit; |
491 | $dbh = ""; | 494 | $dbh = ""; |
492 | include($locaplic."/admin/php/conexao.php"); | 495 | include($locaplic."/admin/php/conexao.php"); |
493 | - if($convUTF) | ||
494 | - $xml = "<"."\x3F"."xml version='1.0' encoding='UTF-8' "."\x3F".">"; | ||
495 | - else | ||
496 | - $xml = "<"."\x3F"."xml version='1.0' encoding='ISO-8859-1' "."\x3F".">"; | 496 | + if($convUTF){ |
497 | + $xml = "<"."\x3F"."xml version='1.0' encoding='UTF-8' "."\x3F".">"; | ||
498 | + } else { | ||
499 | + $xml = "<"."\x3F"."xml version='1.0' encoding='ISO-8859-1' "."\x3F".">"; | ||
500 | + } | ||
497 | $xml .= "<rss version='2.0'>"; | 501 | $xml .= "<rss version='2.0'>"; |
498 | $xml .= "<channel>\n"; | 502 | $xml .= "<channel>\n"; |
499 | $xml .= "<title>RSS</title>\n"; | 503 | $xml .= "<title>RSS</title>\n"; |
@@ -510,8 +514,7 @@ function geraXmlRSS($locaplic,$sql,$descricao,$output="xml") | @@ -510,8 +514,7 @@ function geraXmlRSS($locaplic,$sql,$descricao,$output="xml") | ||
510 | ); | 514 | ); |
511 | $jsonItems = array(); | 515 | $jsonItems = array(); |
512 | $qatlas = $dbh->query($sql); | 516 | $qatlas = $dbh->query($sql); |
513 | - foreach($qatlas as $row) | ||
514 | - { | 517 | + foreach($qatlas as $row) { |
515 | $xml .= "<item>\n"; | 518 | $xml .= "<item>\n"; |
516 | $xml .= "<category/>\n"; | 519 | $xml .= "<category/>\n"; |
517 | $xml .= "<title>".entity_decode($row["nome_ws"])."</title>\n"; | 520 | $xml .= "<title>".entity_decode($row["nome_ws"])."</title>\n"; |
@@ -541,7 +544,7 @@ function geraXmlRSS($locaplic,$sql,$descricao,$output="xml") | @@ -541,7 +544,7 @@ function geraXmlRSS($locaplic,$sql,$descricao,$output="xml") | ||
541 | $xml .= "</channel></rss>\n"; | 544 | $xml .= "</channel></rss>\n"; |
542 | $dbh = null; | 545 | $dbh = null; |
543 | $dbhw = null; | 546 | $dbhw = null; |
544 | - if($output=="xml"){ | 547 | + if($output == "xml"){ |
545 | return $xml; | 548 | return $xml; |
546 | } | 549 | } |
547 | else{ | 550 | else{ |
classesphp/mapa_controle.php
@@ -1821,6 +1821,11 @@ switch (strtoupper($funcao)) | @@ -1821,6 +1821,11 @@ switch (strtoupper($funcao)) | ||
1821 | */ | 1821 | */ |
1822 | case "LISTALAYERSWMS": | 1822 | case "LISTALAYERSWMS": |
1823 | include_once("wmswfs.php"); | 1823 | include_once("wmswfs.php"); |
1824 | + $servico = $_pg["servico"]; | ||
1825 | + $nivel = $_pg["nivel"]; | ||
1826 | + $id_ws = $_pg["id_ws"]; | ||
1827 | + $nomelayer = $_pg["nomelayer"]; | ||
1828 | + $tipo_ws = $_pg["tipo_ws"]; | ||
1824 | $retorno = listaLayersWMS(); | 1829 | $retorno = listaLayersWMS(); |
1825 | break; | 1830 | break; |
1826 | /* | 1831 | /* |
classesphp/wmswfs.php
@@ -54,8 +54,9 @@ Return: | @@ -54,8 +54,9 @@ Return: | ||
54 | function gravaCacheWMS($servico) | 54 | function gravaCacheWMS($servico) |
55 | { | 55 | { |
56 | global $dir_tmp; | 56 | global $dir_tmp; |
57 | - if($dir_tmp == "") | ||
58 | - {include(dirname(__FILE__)."/../ms_configura.php");} | 57 | + if($dir_tmp == ""){ |
58 | + include(dirname(__FILE__)."/../ms_configura.php"); | ||
59 | + } | ||
59 | error_reporting(0); | 60 | error_reporting(0); |
60 | try{ | 61 | try{ |
61 | $teste = explode("=",$servico); | 62 | $teste = explode("=",$servico); |
@@ -476,10 +477,12 @@ function listaLayersWMS() | @@ -476,10 +477,12 @@ function listaLayersWMS() | ||
476 | if(!isset($nomelayer)){ | 477 | if(!isset($nomelayer)){ |
477 | $nomelayer = "undefined"; | 478 | $nomelayer = "undefined"; |
478 | } | 479 | } |
480 | + | ||
479 | //para o caso do sistema de metadados estatisticos | 481 | //para o caso do sistema de metadados estatisticos |
480 | $wms_service_request = gravaCacheWMS($servico); | 482 | $wms_service_request = gravaCacheWMS($servico); |
481 | include_once(dirname(__FILE__)."/../admin/php/admin.php"); | 483 | include_once(dirname(__FILE__)."/../admin/php/admin.php"); |
482 | include_once(dirname(__FILE__)."/../admin/php/webservices.php"); | 484 | include_once(dirname(__FILE__)."/../admin/php/webservices.php"); |
485 | + | ||
483 | error_reporting(0); | 486 | error_reporting(0); |
484 | if($tipo_ws != "WMSMETAESTAT" && $nivel < 2){ | 487 | if($tipo_ws != "WMSMETAESTAT" && $nivel < 2){ |
485 | if($wms_service_request == "erro") { | 488 | if($wms_service_request == "erro") { |
@@ -494,6 +497,7 @@ function listaLayersWMS() | @@ -494,6 +497,7 @@ function listaLayersWMS() | ||
494 | adicionaAcesso($id_ws,true); | 497 | adicionaAcesso($id_ws,true); |
495 | } | 498 | } |
496 | } | 499 | } |
500 | + | ||
497 | $handle = fopen ($wms_service_request, "r"); | 501 | $handle = fopen ($wms_service_request, "r"); |
498 | $wms_capabilities = fread ($handle, filesize ($wms_service_request)); | 502 | $wms_capabilities = fread ($handle, filesize ($wms_service_request)); |
499 | fclose ($handle); | 503 | fclose ($handle); |
classesphp/wscliente.php
@@ -498,58 +498,50 @@ function listaRSSwsARRAY() | @@ -498,58 +498,50 @@ function listaRSSwsARRAY() | ||
498 | include_once("$locaplic/admin/php/xml.php"); | 498 | include_once("$locaplic/admin/php/xml.php"); |
499 | include_once("$locaplic/ms_configura.php"); | 499 | include_once("$locaplic/ms_configura.php"); |
500 | $rsss = explode("|",$rss); | 500 | $rsss = explode("|",$rss); |
501 | - if(count($rsss) == 0){$rsss = array(" ");} | 501 | + if(count($rsss) == 0){ |
502 | + $rsss = array(" "); | ||
503 | + } | ||
502 | $erro = "Erro. Nao foi possivel ler o arquivo"; | 504 | $erro = "Erro. Nao foi possivel ler o arquivo"; |
503 | $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); | 505 | $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); |
504 | $urli3geo = strtolower($protocolo[0])."://".$_SERVER['HTTP_HOST']."/".basename($locaplic); | 506 | $urli3geo = strtolower($protocolo[0])."://".$_SERVER['HTTP_HOST']."/".basename($locaplic); |
505 | - foreach ($rsss as $r) | ||
506 | - { | ||
507 | - if($r == "" || $r == " ") | ||
508 | - { | 507 | + foreach ($rsss as $r){ |
508 | + if($r == "" || $r == " "){ | ||
509 | 509 | ||
510 | - if($tipo == "GEORSS") | ||
511 | - { | 510 | + if($tipo == "GEORSS"){ |
512 | $canali = simplexml_load_string(geraXmlGeorss($locaplic)); | 511 | $canali = simplexml_load_string(geraXmlGeorss($locaplic)); |
513 | $linkrss = $urli3geo."/admin/xmlgeorss.php"; | 512 | $linkrss = $urli3geo."/admin/xmlgeorss.php"; |
514 | } | 513 | } |
515 | - if($tipo == "KML") | ||
516 | - { | 514 | + if($tipo == "KML"){ |
517 | $canali = simplexml_load_string(geraXmlKmlrss($locaplic)); | 515 | $canali = simplexml_load_string(geraXmlKmlrss($locaplic)); |
518 | $linkrss = $urli3geo."/admin/xmlkmlrss.php"; | 516 | $linkrss = $urli3geo."/admin/xmlkmlrss.php"; |
519 | } | 517 | } |
520 | - if($tipo == "WMS" || $tipo == "WMS-Tile") | ||
521 | - { | 518 | + if($tipo == "WMS" || $tipo == "WMS-Tile"){ |
522 | $canali = simplexml_load_string(geraXmlWMS($locaplic)); | 519 | $canali = simplexml_load_string(geraXmlWMS($locaplic)); |
523 | $linkrss = $urli3geo."/admin/xmlservicoswms.php"; | 520 | $linkrss = $urli3geo."/admin/xmlservicoswms.php"; |
524 | } | 521 | } |
525 | - if($tipo == "WMSMETAESTAT") | ||
526 | - { | 522 | + if($tipo == "WMSMETAESTAT") { |
527 | $canali = simplexml_load_string(geraXmlWMSmetaestat($locaplic)); | 523 | $canali = simplexml_load_string(geraXmlWMSmetaestat($locaplic)); |
528 | $linkrss = $urli3geo."/admin/xmlservicoswms.php"; | 524 | $linkrss = $urli3geo."/admin/xmlservicoswms.php"; |
529 | } | 525 | } |
530 | - if($tipo == "WS") | ||
531 | - { | 526 | + if($tipo == "WS"){ |
532 | $canali = simplexml_load_string(geraXmlWS($locaplic)); | 527 | $canali = simplexml_load_string(geraXmlWS($locaplic)); |
533 | $linkrss = $urli3geo."/admin/xmlservicosws.php"; | 528 | $linkrss = $urli3geo."/admin/xmlservicosws.php"; |
534 | } | 529 | } |
535 | - if($tipo == "DOWNLOAD") | ||
536 | - { | 530 | + if($tipo == "DOWNLOAD"){ |
537 | $canali = simplexml_load_string(geraXmlDownload($locaplic)); | 531 | $canali = simplexml_load_string(geraXmlDownload($locaplic)); |
538 | $linkrss = $urli3geo."/admin/xmllinksdownload.php"; | 532 | $linkrss = $urli3geo."/admin/xmllinksdownload.php"; |
539 | } | 533 | } |
534 | + } else { | ||
535 | + $canali = simplexml_load_file($rss); | ||
540 | } | 536 | } |
541 | - else | ||
542 | - {$canali = simplexml_load_file($rss);} | ||
543 | if($r != "") | 537 | if($r != "") |
544 | $linhas["rss"] = "<a href='".$r."' target=blank ><img style='border:0px solid white;' src='../../imagens/rss.gif' /></a>"; | 538 | $linhas["rss"] = "<a href='".$r."' target=blank ><img style='border:0px solid white;' src='../../imagens/rss.gif' /></a>"; |
545 | - else | ||
546 | - { | 539 | + else{ |
547 | $linhas["rss"] = "<a href='".$linkrss."' target=blank ><img style='border:0px solid white;' src='../../imagens/rss.gif' /></a>"; | 540 | $linhas["rss"] = "<a href='".$linkrss."' target=blank ><img style='border:0px solid white;' src='../../imagens/rss.gif' /></a>"; |
548 | } | 541 | } |
549 | //var_dump($canali); | 542 | //var_dump($canali); |
550 | $canais = array(); | 543 | $canais = array(); |
551 | - foreach ($canali->channel->item as $item) | ||
552 | - { | 544 | + foreach ($canali->channel->item as $item){ |
553 | $canais[] = array("id_ws"=>(ixml($item,"id")),"title"=>(ixml($item,"title")),"description"=>(ixml($item,"description")),"link"=>(ixml($item,"link")),"author"=>(ixml($item,"author")),"nacessos"=>(ixml($item,"nacessos")),"nacessosok"=>(ixml($item,"nacessosok")),"tipo_ws"=>(ixml($item,"tipo"))); | 545 | $canais[] = array("id_ws"=>(ixml($item,"id")),"title"=>(ixml($item,"title")),"description"=>(ixml($item,"description")),"link"=>(ixml($item,"link")),"author"=>(ixml($item,"author")),"nacessos"=>(ixml($item,"nacessos")),"nacessosok"=>(ixml($item,"nacessosok")),"tipo_ws"=>(ixml($item,"tipo"))); |
554 | } | 546 | } |
555 | $linhas["canais"] = $canais; | 547 | $linhas["canais"] = $canais; |