Commit ab540284caf5e901111e9bb2040e9f5201aadf64

Authored by Edmar Moretti
1 parent 753dc54a
Exists in master

Inclusao de timeout 0 em ogc.php quando não definido no LAYER

Showing 1 changed file with 27 additions and 16 deletions   Show diff stats
@@ -78,6 +78,7 @@ ogc.php?tema=/var/www/i3geo/aplicmap/geral1debianv6.map&layers=mundo @@ -78,6 +78,7 @@ ogc.php?tema=/var/www/i3geo/aplicmap/geral1debianv6.map&layers=mundo
78 78
79 */ 79 */
80 include(dirname(__FILE__)."/classesphp/sani_request.php"); 80 include(dirname(__FILE__)."/classesphp/sani_request.php");
  81 +include_once (dirname(__FILE__)."/classesphp/carrega_ext.php");
81 include(dirname(__FILE__)."/ms_configura.php"); 82 include(dirname(__FILE__)."/ms_configura.php");
82 $_GET = array_merge($_GET,$_POST); 83 $_GET = array_merge($_GET,$_POST);
83 84
@@ -131,7 +132,9 @@ if(isset($_GET["TileMatrix"])){ @@ -131,7 +132,9 @@ if(isset($_GET["TileMatrix"])){
131 $res[] = $temp; 132 $res[] = $temp;
132 $temp = $temp / 2; 133 $temp = $temp / 2;
133 } 134 }
134 - $_GET["tms"] = "/wmts/".$tema."/".$_GET["TileMatrix"]."/".$_GET["TileCol"]."/".$_GET["TileRow"].".png"; 135 + $_GET["tms"] = "/wmts/".$tema."/".$_GET["TileMatrix"]."/".$_GET["TileCol"]."/".$_GET["TileRow"];
  136 + $_GET["tms"] = str_replace(".png","",$_GET["tms"]).".png";
  137 +
135 if($_GET["TileMatrix"]."/".$_GET["TileCol"]."/".$_GET["TileRow"] == "0/0/0" || $_GET["TileCol"] == -1 || $_GET["TileRow"]== -1){ 138 if($_GET["TileMatrix"]."/".$_GET["TileCol"]."/".$_GET["TileRow"] == "0/0/0" || $_GET["TileCol"] == -1 || $_GET["TileRow"]== -1){
136 return; 139 return;
137 } 140 }
@@ -257,7 +260,7 @@ if(strtolower($OUTPUTFORMAT) == "shape-zip" && $ogrOutput == false){ @@ -257,7 +260,7 @@ if(strtolower($OUTPUTFORMAT) == "shape-zip" && $ogrOutput == false){
257 exit; 260 exit;
258 } 261 }
259 // 262 //
260 -//caso seja uma requisi��o WMS com format 263 +//caso seja uma requisição WMS com format
261 // 264 //
262 $format = $_GET["format"]; 265 $format = $_GET["format"];
263 if(strpos(strtolower($format),"kml") !== false){ 266 if(strpos(strtolower($format),"kml") !== false){
@@ -388,7 +391,6 @@ $cortePixels = 0; @@ -388,7 +391,6 @@ $cortePixels = 0;
388 if(empty($ogcwsmap)){ 391 if(empty($ogcwsmap)){
389 $ogcwsmap = $_GET["ogcwsmap"]; 392 $ogcwsmap = $_GET["ogcwsmap"];
390 } 393 }
391 -  
392 if(file_exists($nomeMapfileTmp) && $tipo == ""){ 394 if(file_exists($nomeMapfileTmp) && $tipo == ""){
393 //substituiCon($nomeMapfileTmp,$postgis_mapa); 395 //substituiCon($nomeMapfileTmp,$postgis_mapa);
394 //$oMap = ms_newMapobj($nomeMapfileTmp); 396 //$oMap = ms_newMapobj($nomeMapfileTmp);
@@ -496,7 +498,12 @@ else{ @@ -496,7 +498,12 @@ else{
496 } 498 }
497 $l->setmetadata("ows_title",pegaNome($l)); 499 $l->setmetadata("ows_title",pegaNome($l));
498 $l->setmetadata("ows_srs",$listaepsg); 500 $l->setmetadata("ows_srs",$listaepsg);
499 - $l->set("group",""); 501 + $l->set("group","");
  502 + //timeout
  503 + $tout = $l->getmetadata("wms_connectiontimeout");
  504 + if($tout == ""){
  505 + $l->setmetadata("wms_connectiontimeout",0);
  506 + }
500 //essa linha é necessária pq as vezes no mapfile não tem nenhum layer com o nome igual ao nome do mapfile 507 //essa linha é necessária pq as vezes no mapfile não tem nenhum layer com o nome igual ao nome do mapfile
501 if(count($ts)==1 && $temai3geo == true){ 508 if(count($ts)==1 && $temai3geo == true){
502 $l->set("name",$tx); 509 $l->set("name",$tx);
@@ -769,7 +776,6 @@ else{ @@ -769,7 +776,6 @@ else{
769 $oMap->setSymbolSet($locaplic."/symbols/".basename($oMap->symbolsetfilename)); 776 $oMap->setSymbolSet($locaplic."/symbols/".basename($oMap->symbolsetfilename));
770 $oMap->setFontSet($locaplic."/symbols/".basename($oMap->fontsetfilename)); 777 $oMap->setFontSet($locaplic."/symbols/".basename($oMap->fontsetfilename));
771 //verifica se existem layers com plugin definido e processa conforme o tipo de plugin 778 //verifica se existem layers com plugin definido e processa conforme o tipo de plugin
772 -  
773 processaPluginI3geo(); 779 processaPluginI3geo();
774 // 780 //
775 //caso seja download ou json ou csv 781 //caso seja download ou json ou csv
@@ -1541,14 +1547,13 @@ function converteenc($texto){ @@ -1541,14 +1547,13 @@ function converteenc($texto){
1541 } 1547 }
1542 function processaPluginI3geo(){ 1548 function processaPluginI3geo(){
1543 global $oMap, $locaplic; 1549 global $oMap, $locaplic;
1544 - return;  
1545 $numlayers = $oMap->numlayers; 1550 $numlayers = $oMap->numlayers;
1546 for ($i=0;$i < $numlayers;$i++){ 1551 for ($i=0;$i < $numlayers;$i++){
1547 - $l = $oMap->getlayer($i);  
1548 - $c = $l->getmetadata("PLUGINI3GEO"); 1552 + $l = $oMap->getlayer($i);
  1553 + $c = $l->getmetadata("PLUGINI3GEO");
1549 if($c != ""){ 1554 if($c != ""){
1550 $cs = json_decode($c,true); 1555 $cs = json_decode($c,true);
1551 - if($cs["plugin"] == "parametrossql"){ 1556 + if($cs["plugin"] == "parametrossql"){
1552 $data = $l->data; 1557 $data = $l->data;
1553 $cs = $cs["parametros"]; 1558 $cs = $cs["parametros"];
1554 $chaves = array(); 1559 $chaves = array();
@@ -1573,8 +1578,8 @@ function processaPluginI3geo(){ @@ -1573,8 +1578,8 @@ function processaPluginI3geo(){
1573 $temp = explode(",",$c["valores"]); 1578 $temp = explode(",",$c["valores"]);
1574 $plugin[] = $temp[0]; 1579 $plugin[] = $temp[0];
1575 } 1580 }
1576 - elseif ($c["prog"] != ""){  
1577 - $plugin[] = execProg($locaplic."/".$c["prog"]); 1581 + elseif ($c["prog"] != ""){
  1582 + $plugin[] = execProg($c["prog"]);
1578 } 1583 }
1579 } 1584 }
1580 } 1585 }
@@ -1594,7 +1599,7 @@ function processaPluginI3geo(){ @@ -1594,7 +1599,7 @@ function processaPluginI3geo(){
1594 } 1599 }
1595 if($filtro != ""){ 1600 if($filtro != ""){
1596 $l->setfilter($filtro); 1601 $l->setfilter($filtro);
1597 - } 1602 + }
1598 $l->set("data",$data); 1603 $l->set("data",$data);
1599 } 1604 }
1600 } 1605 }
@@ -1602,10 +1607,16 @@ function processaPluginI3geo(){ @@ -1602,10 +1607,16 @@ function processaPluginI3geo(){
1602 } 1607 }
1603 //utilizada para obter os dados default quando se utiliza o plugin parametrossql 1608 //utilizada para obter os dados default quando se utiliza o plugin parametrossql
1604 function execProg($prog){ 1609 function execProg($prog){
1605 - return;  
1606 - include($prog);  
1607 - //$retorno variavel deve ser retornada pelo programa $prog  
1608 - //veja como exemplo i3geo/aplicmap/daods/listaano.php 1610 + //$retorno variavel deve ser retornada pelo programa $prog
  1611 + //veja como exemplo i3geo/aplicmap/daods/listaano.php
  1612 + global $urli3geo;
  1613 + $handle = curl_init();
  1614 + curl_setopt( $handle, CURLOPT_URL, $urli3geo."/".$prog);
  1615 + curl_setopt( $handle, CURLOPT_HEADER, false );
  1616 + curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
  1617 + $str = curl_exec( $handle );
  1618 + curl_close( $handle );
  1619 + $retorno = json_decode($str,true);
1609 return $retorno[0]["v"]; 1620 return $retorno[0]["v"];
1610 } 1621 }
1611 ?> 1622 ?>