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 | 40 | |
| 41 | 41 | */ |
| 42 | 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 | 46 | $funcoesEdicao = array( |
| 54 | 47 | "ALTERARWS", |
| 55 | 48 | "EXCLUIR" |
| 56 | 49 | ); |
| 57 | 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 | 55 | if(verificaOperacaoSessao("admin/html/webservices") == false){ |
| 59 | 56 | retornaJSON("Vc nao pode realizar essa operacao.");exit; |
| 60 | 57 | } | ... | ... |
admin/php/xml.php
| ... | ... | @@ -487,13 +487,17 @@ RSS |
| 487 | 487 | function geraXmlRSS($locaplic,$sql,$descricao,$output="xml") |
| 488 | 488 | { |
| 489 | 489 | global $esquemaadmin; |
| 490 | + if(empty($output)){ | |
| 491 | + $output = "xml"; | |
| 492 | + } | |
| 490 | 493 | //var_dump($_SERVER);exit; |
| 491 | 494 | $dbh = ""; |
| 492 | 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 | 501 | $xml .= "<rss version='2.0'>"; |
| 498 | 502 | $xml .= "<channel>\n"; |
| 499 | 503 | $xml .= "<title>RSS</title>\n"; |
| ... | ... | @@ -510,8 +514,7 @@ function geraXmlRSS($locaplic,$sql,$descricao,$output="xml") |
| 510 | 514 | ); |
| 511 | 515 | $jsonItems = array(); |
| 512 | 516 | $qatlas = $dbh->query($sql); |
| 513 | - foreach($qatlas as $row) | |
| 514 | - { | |
| 517 | + foreach($qatlas as $row) { | |
| 515 | 518 | $xml .= "<item>\n"; |
| 516 | 519 | $xml .= "<category/>\n"; |
| 517 | 520 | $xml .= "<title>".entity_decode($row["nome_ws"])."</title>\n"; |
| ... | ... | @@ -541,7 +544,7 @@ function geraXmlRSS($locaplic,$sql,$descricao,$output="xml") |
| 541 | 544 | $xml .= "</channel></rss>\n"; |
| 542 | 545 | $dbh = null; |
| 543 | 546 | $dbhw = null; |
| 544 | - if($output=="xml"){ | |
| 547 | + if($output == "xml"){ | |
| 545 | 548 | return $xml; |
| 546 | 549 | } |
| 547 | 550 | else{ | ... | ... |
classesphp/mapa_controle.php
| ... | ... | @@ -1821,6 +1821,11 @@ switch (strtoupper($funcao)) |
| 1821 | 1821 | */ |
| 1822 | 1822 | case "LISTALAYERSWMS": |
| 1823 | 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 | 1829 | $retorno = listaLayersWMS(); |
| 1825 | 1830 | break; |
| 1826 | 1831 | /* | ... | ... |
classesphp/wmswfs.php
| ... | ... | @@ -54,8 +54,9 @@ Return: |
| 54 | 54 | function gravaCacheWMS($servico) |
| 55 | 55 | { |
| 56 | 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 | 60 | error_reporting(0); |
| 60 | 61 | try{ |
| 61 | 62 | $teste = explode("=",$servico); |
| ... | ... | @@ -476,10 +477,12 @@ function listaLayersWMS() |
| 476 | 477 | if(!isset($nomelayer)){ |
| 477 | 478 | $nomelayer = "undefined"; |
| 478 | 479 | } |
| 480 | + | |
| 479 | 481 | //para o caso do sistema de metadados estatisticos |
| 480 | 482 | $wms_service_request = gravaCacheWMS($servico); |
| 481 | 483 | include_once(dirname(__FILE__)."/../admin/php/admin.php"); |
| 482 | 484 | include_once(dirname(__FILE__)."/../admin/php/webservices.php"); |
| 485 | + | |
| 483 | 486 | error_reporting(0); |
| 484 | 487 | if($tipo_ws != "WMSMETAESTAT" && $nivel < 2){ |
| 485 | 488 | if($wms_service_request == "erro") { |
| ... | ... | @@ -494,6 +497,7 @@ function listaLayersWMS() |
| 494 | 497 | adicionaAcesso($id_ws,true); |
| 495 | 498 | } |
| 496 | 499 | } |
| 500 | + | |
| 497 | 501 | $handle = fopen ($wms_service_request, "r"); |
| 498 | 502 | $wms_capabilities = fread ($handle, filesize ($wms_service_request)); |
| 499 | 503 | fclose ($handle); | ... | ... |
classesphp/wscliente.php
| ... | ... | @@ -498,58 +498,50 @@ function listaRSSwsARRAY() |
| 498 | 498 | include_once("$locaplic/admin/php/xml.php"); |
| 499 | 499 | include_once("$locaplic/ms_configura.php"); |
| 500 | 500 | $rsss = explode("|",$rss); |
| 501 | - if(count($rsss) == 0){$rsss = array(" ");} | |
| 501 | + if(count($rsss) == 0){ | |
| 502 | + $rsss = array(" "); | |
| 503 | + } | |
| 502 | 504 | $erro = "Erro. Nao foi possivel ler o arquivo"; |
| 503 | 505 | $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); |
| 504 | 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 | 511 | $canali = simplexml_load_string(geraXmlGeorss($locaplic)); |
| 513 | 512 | $linkrss = $urli3geo."/admin/xmlgeorss.php"; |
| 514 | 513 | } |
| 515 | - if($tipo == "KML") | |
| 516 | - { | |
| 514 | + if($tipo == "KML"){ | |
| 517 | 515 | $canali = simplexml_load_string(geraXmlKmlrss($locaplic)); |
| 518 | 516 | $linkrss = $urli3geo."/admin/xmlkmlrss.php"; |
| 519 | 517 | } |
| 520 | - if($tipo == "WMS" || $tipo == "WMS-Tile") | |
| 521 | - { | |
| 518 | + if($tipo == "WMS" || $tipo == "WMS-Tile"){ | |
| 522 | 519 | $canali = simplexml_load_string(geraXmlWMS($locaplic)); |
| 523 | 520 | $linkrss = $urli3geo."/admin/xmlservicoswms.php"; |
| 524 | 521 | } |
| 525 | - if($tipo == "WMSMETAESTAT") | |
| 526 | - { | |
| 522 | + if($tipo == "WMSMETAESTAT") { | |
| 527 | 523 | $canali = simplexml_load_string(geraXmlWMSmetaestat($locaplic)); |
| 528 | 524 | $linkrss = $urli3geo."/admin/xmlservicoswms.php"; |
| 529 | 525 | } |
| 530 | - if($tipo == "WS") | |
| 531 | - { | |
| 526 | + if($tipo == "WS"){ | |
| 532 | 527 | $canali = simplexml_load_string(geraXmlWS($locaplic)); |
| 533 | 528 | $linkrss = $urli3geo."/admin/xmlservicosws.php"; |
| 534 | 529 | } |
| 535 | - if($tipo == "DOWNLOAD") | |
| 536 | - { | |
| 530 | + if($tipo == "DOWNLOAD"){ | |
| 537 | 531 | $canali = simplexml_load_string(geraXmlDownload($locaplic)); |
| 538 | 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 | 537 | if($r != "") |
| 544 | 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 | 540 | $linhas["rss"] = "<a href='".$linkrss."' target=blank ><img style='border:0px solid white;' src='../../imagens/rss.gif' /></a>"; |
| 548 | 541 | } |
| 549 | 542 | //var_dump($canali); |
| 550 | 543 | $canais = array(); |
| 551 | - foreach ($canali->channel->item as $item) | |
| 552 | - { | |
| 544 | + foreach ($canali->channel->item as $item){ | |
| 553 | 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 | 547 | $linhas["canais"] = $canais; | ... | ... |