Commit 5318f548f3aec40feb82a68c539610af628a219d

Authored by Edmar Moretti
1 parent 248c8929
Exists in master

Correção no header enviado por ogc.php nas requisições getmap

Showing 1 changed file with 19 additions and 15 deletions   Show diff stats
ogc.php
... ... @@ -268,7 +268,7 @@ include(dirname(__FILE__)."/classesphp/sani_request.php");
268 268 include_once (dirname(__FILE__)."/classesphp/carrega_ext.php");
269 269 include(dirname(__FILE__)."/ms_configura.php");
270 270 $_GET = array_merge($_GET,$_POST);
271   -
  271 +//error_log($_SERVER['QUERY_STRING']);
272 272 if(isset($_GET["BBOX"])){
273 273 $_GET["BBOX"] = str_replace(" ",",",$_GET["BBOX"]);
274 274 }
... ... @@ -276,7 +276,7 @@ if(isset($_GET["BBOX"])){
276 276 if(isset($_GET["tema"])){
277 277 $tema = $_GET["tema"];
278 278 }
279   -if($_GET["id_medida_variavel"] != ""){
  279 +if(@$_GET["id_medida_variavel"] != ""){
280 280 $_GET["id_medida_variavel"] = filter_var ( $_GET["id_medida_variavel"], FILTER_SANITIZE_NUMBER_INT);
281 281 }
282 282 //
... ... @@ -337,7 +337,7 @@ if(isset($_GET["TileMatrix"])){
337 337 if(isset($_GET["tms"]) && $_GET["tms"] != "" && $_GET["DESLIGACACHE"] != "sim"){
338 338 carregaCacheImagem($cachedir,$nomeMapfileTmp,$_GET["tms"]);
339 339 }
340   -if($_GET["DESLIGACACHE"] != "sim" && isset($_GET["Z"]) && isset($_GET["X"])){
  340 +if(@$_GET["DESLIGACACHE"] != "sim" && isset($_GET["Z"]) && isset($_GET["X"])){
341 341 $x = $_GET["X"];
342 342 $y = $_GET["Y"];
343 343 $z = $_GET["Z"];
... ... @@ -407,7 +407,10 @@ if(!file_exists($tema)){
407 407  
408 408 $layers = $tema;
409 409 //ajusta o OUTPUTFORMAT
410   -$OUTPUTFORMAT = $_GET["OUTPUTFORMAT"];
  410 +$OUTPUTFORMAT = "";
  411 +if(isset($_GET["OUTPUTFORMAT"])){
  412 + $OUTPUTFORMAT = $_GET["OUTPUTFORMAT"];
  413 +}
411 414 if(strpos(strtolower($OUTPUTFORMAT),"kml") !== false){
412 415 $OUTPUTFORMAT = "kml";
413 416 }
... ... @@ -463,7 +466,7 @@ if(strpos(strtolower($format),"kmz") !== false){
463 466 //
464 467 //usa o epsg correto ao inves do apelido inventado pelo Google
465 468 //
466   -if($_GET["SRS"] == "EPSG:900913" || $_GET["srs"] == "EPSG:900913"){
  469 +if(@$_GET["SRS"] == "EPSG:900913" || @$_GET["srs"] == "EPSG:900913"){
467 470 $_GET["SRS"] = "EPSG:3857";
468 471 $_GET["srs"] = "EPSG:3857";
469 472 }
... ... @@ -498,7 +501,8 @@ if(isset($format) && strtolower($format) == "application/openlayers"){
498 501 }
499 502 else{
500 503 echo "<meta http-equiv='refresh' content='0;url=$urln'>";
501   - }
  504 + }
  505 + exit;
502 506 }
503 507 //
504 508 //pega a versao do Mapserver
... ... @@ -762,7 +766,7 @@ else{
762 766 //
763 767 //verifica se existem parametros de substituicao passados via url
764 768 //
765   - $parametro = $_GET["map_layer_".$l->name."_filter"];
  769 + $parametro = @$_GET["map_layer_".$l->name."_filter"];
766 770 //echo $parametro;exit;
767 771 if(!empty($parametro)){
768 772 $l->setfilter($parametro);
... ... @@ -1223,7 +1227,7 @@ ms_ioinstallstdouttobuffer();
1223 1227 //verifica parametro outputformat e ajusta a requisicao
1224 1228 //
1225 1229 if(strtolower($req->getValueByName("REQUEST")) == "getmap" && $req->getValueByName("format") == ""){
1226   - $req->setParameter("format","image/png");
  1230 + $req->setParameter("format","image/png");
1227 1231 }
1228 1232 if(strtolower($req->getValueByName("REQUEST")) == "getfeatureinfo" && $_GET["info_format"] == "text/xml"){
1229 1233 $req->setParameter("info_format","application/vnd.ogc.gml");
... ... @@ -1233,12 +1237,9 @@ if(strtolower($req-&gt;getValueByName(&quot;REQUEST&quot;)) == &quot;getfeatureinfo&quot; &amp;&amp; $_GET[&quot;inf
1233 1237 getfeatureinfoJson();
1234 1238 exit;
1235 1239 }
1236   -if(strtolower($request) == "getcapabilities"){
1237   - //header('Content-Disposition: attachment; filename=getcapabilities.xml');
1238   -}
1239   -elseif(!isset($OUTPUTFORMAT)){
  1240 +if(!isset($OUTPUTFORMAT) && !headers_sent()){
1240 1241 //$contenttype = ms_iostripstdoutbuffercontenttype();
1241   - header("Content-type: $contenttype");
  1242 + header("Content-type: $contenttype");
1242 1243 }
1243 1244 //$ogrOutput vem de ms_configura.php
1244 1245  
... ... @@ -1329,9 +1330,12 @@ if(strtolower($OUTPUTFORMAT) == &quot;csv&quot;){
1329 1330 exit;
1330 1331 }
1331 1332 //echo $req->getValue(1);exit;
1332   -ob_clean();
  1333 +if(ob_get_contents() != false){
  1334 + ob_clean();
  1335 +}
1333 1336 $oMap->owsdispatch($req);
1334   -$contenttype = ms_iostripstdoutbuffercontenttype();
  1337 +$contenttype = ms_iostripstdoutbuffercontenttype();
  1338 +header("Content-type: $contenttype");
1335 1339 $buffer = ms_iogetStdoutBufferBytes();
1336 1340  
1337 1341 ms_ioresethandlers();
... ...