Commit 221309ba176f548d5f6ef7d6ae5dbeefe81d7e47

Authored by Edmar Moretti
1 parent bec8827e
Exists in master

--no commit message

Showing 1 changed file with 26 additions and 14 deletions   Show diff stats
classesphp/mapa_openlayers.php
@@ -59,7 +59,10 @@ Arquivo: @@ -59,7 +59,10 @@ Arquivo:
59 i3geo/classesphp/mapa_openlayers.php 59 i3geo/classesphp/mapa_openlayers.php
60 60
61 */ 61 */
62 - 62 +//para efeitos de compatibilidade
  63 +if (!function_exists('ms_GetVersion')){
  64 + include_once ("carrega_ext.php");
  65 +}
63 error_reporting(0); 66 error_reporting(0);
64 inicializa(); 67 inicializa();
65 // 68 //
@@ -67,6 +70,7 @@ inicializa(); @@ -67,6 +70,7 @@ inicializa();
67 //nos casos do modo notile, a requisicao e feita como se fosse um wms 70 //nos casos do modo notile, a requisicao e feita como se fosse um wms
68 //quando for do tipo tms $_GET["tms"] contem os parametros do tile 71 //quando for do tipo tms $_GET["tms"] contem os parametros do tile
69 // 72 //
  73 +
70 if(isset($_GET["tms"])){ 74 if(isset($_GET["tms"])){
71 $_GET["WIDTH"] = 256; 75 $_GET["WIDTH"] = 256;
72 $_GET["HEIGHT"] = 256; 76 $_GET["HEIGHT"] = 256;
@@ -83,10 +87,11 @@ if(isset($_GET["tms"])){ @@ -83,10 +87,11 @@ if(isset($_GET["tms"])){
83 $lat2 = ($y+1) / $n * 180.0 - 90.0; 87 $lat2 = ($y+1) / $n * 180.0 - 90.0;
84 $_GET["BBOX"] = $lon1." ".$lat1." ".$lon2." ".$lat2; 88 $_GET["BBOX"] = $lon1." ".$lat1." ".$lon2." ".$lat2;
85 } 89 }
  90 +
86 //para o caso da versao 3 do OpenLayers 91 //para o caso da versao 3 do OpenLayers
87 -//excluir?  
88 -if(isset($_GET["X"])){  
89 - $box = explode(",",$_GET["BBOX"]); 92 +if(isset($_GET["X"]) && !($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature")){
  93 + $box = str_replace(" ",",",$_GET["BBOX"]);
  94 + $box = explode(",",$box);
90 $res = ($box[2] + 180) - ($box[0] + 180); 95 $res = ($box[2] + 180) - ($box[0] + 180);
91 $res = $res / 256; 96 $res = $res / 256;
92 $z = intval((0.703125 / $res) / 4) + 1; 97 $z = intval((0.703125 / $res) / 4) + 1;
@@ -98,6 +103,7 @@ if(isset($_GET["X"])){ @@ -98,6 +103,7 @@ if(isset($_GET["X"])){
98 $_GET["tms"] = "/".$_GET["layer"]."/".$z."/".$x."/".$y.".png"; 103 $_GET["tms"] = "/".$_GET["layer"]."/".$z."/".$x."/".$y.".png";
99 echo $_GET["BBOX"]." ".$_GET["tms"];exit; 104 echo $_GET["BBOX"]." ".$_GET["tms"];exit;
100 } 105 }
  106 +
101 if(isset($_GET["TileMatrix"])){ 107 if(isset($_GET["TileMatrix"])){
102 $_GET["WIDTH"] = 256; 108 $_GET["WIDTH"] = 256;
103 $_GET["HEIGHT"] = 256; 109 $_GET["HEIGHT"] = 256;
@@ -128,6 +134,7 @@ if(isset($_GET["TileMatrix"])){ @@ -128,6 +134,7 @@ if(isset($_GET["TileMatrix"])){
128 134
129 $_GET["BBOX"] = $lon1." ".$lat1." ".$lon2." ".$lat2; 135 $_GET["BBOX"] = $lon1." ".$lat1." ".$lon2." ".$lat2;
130 } 136 }
  137 +
131 $map_fileX = $_SESSION["map_file"]; 138 $map_fileX = $_SESSION["map_file"];
132 // 139 //
133 //verifica se o request e OGC 140 //verifica se o request e OGC
@@ -139,12 +146,16 @@ if(!empty($_GET["request"])){ @@ -139,12 +146,16 @@ if(!empty($_GET["request"])){
139 // 146 //
140 $qyfile = dirname($map_fileX)."/".$_GET["layer"].".php"; 147 $qyfile = dirname($map_fileX)."/".$_GET["layer"].".php";
141 $qy = file_exists($qyfile); 148 $qy = file_exists($qyfile);
142 -if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){ 149 +
  150 +if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){
143 $_GET["DESLIGACACHE"] = "sim"; 151 $_GET["DESLIGACACHE"] = "sim";
144 } 152 }
145 -if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){  
146 - carregaCacheImagem($_SESSION["cachedir"],$_SESSION["map_file"],$_GET["tms"],$_SESSION["i3georendermode"]); 153 +else{
  154 + if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){
  155 + carregaCacheImagem($_SESSION["cachedir"],$_SESSION["map_file"],$_GET["tms"],$_SESSION["i3georendermode"]);
  156 + }
147 } 157 }
  158 +
148 // 159 //
149 //map_fileX e para o caso register_globals = On no PHP.INI 160 //map_fileX e para o caso register_globals = On no PHP.INI
150 // 161 //
@@ -158,9 +169,7 @@ if(isset($_GET["BBOX"])){ @@ -158,9 +169,7 @@ if(isset($_GET["BBOX"])){
158 $_GET["map_size"] = $_GET["WIDTH"]." ".$_GET["HEIGHT"]; 169 $_GET["map_size"] = $_GET["WIDTH"]." ".$_GET["HEIGHT"];
159 } 170 }
160 $_GET["TIPOIMAGEM"] = trim($_GET["TIPOIMAGEM"]); 171 $_GET["TIPOIMAGEM"] = trim($_GET["TIPOIMAGEM"]);
161 -  
162 $mapa = ms_newMapObj($map_fileX); 172 $mapa = ms_newMapObj($map_fileX);
163 -  
164 // 173 //
165 //processa os layers do mapfile 174 //processa os layers do mapfile
166 // 175 //
@@ -219,7 +228,6 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter @@ -219,7 +228,6 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter
219 } 228 }
220 } 229 }
221 } 230 }
222 -  
223 if($layerName == $_GET["layer"]){ 231 if($layerName == $_GET["layer"]){
224 if(strtolower($l->getmetadata("cache")) == "sim"){ 232 if(strtolower($l->getmetadata("cache")) == "sim"){
225 $cache = true; 233 $cache = true;
@@ -228,7 +236,7 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter @@ -228,7 +236,7 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter
228 $nomecache = $layerName; 236 $nomecache = $layerName;
229 } 237 }
230 } 238 }
231 - if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature" ){ 239 + if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature" ){
232 $l->setmetadata("gml_include_items","all"); 240 $l->setmetadata("gml_include_items","all");
233 $l->set("template","none.htm"); 241 $l->set("template","none.htm");
234 $l->setmetadata("WMS_INCLUDE_ITEMS","all"); 242 $l->setmetadata("WMS_INCLUDE_ITEMS","all");
@@ -243,6 +251,7 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter @@ -243,6 +251,7 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter
243 } 251 }
244 } 252 }
245 } 253 }
  254 +
246 if (!function_exists('imagepng')){ 255 if (!function_exists('imagepng')){
247 $_GET["TIPOIMAGEM"] = ""; 256 $_GET["TIPOIMAGEM"] = "";
248 } 257 }
@@ -273,9 +282,13 @@ if(isset($_GET["mapext"])){ @@ -273,9 +282,13 @@ if(isset($_GET["mapext"])){
273 // 282 //
274 //qd a cahamda e para um WMS, redireciona para ogc.php 283 //qd a cahamda e para um WMS, redireciona para ogc.php
275 // 284 //
276 -if($_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){ 285 +if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){
277 $req = ms_newowsrequestobj(); 286 $req = ms_newowsrequestobj();
  287 + if($_GET["BBOX"]){
  288 + $_GET["BBOX"] = str_replace(" ",",",$_GET["BBOX"]);
  289 + }
278 $_GET = array_merge($_GET,$_POST); 290 $_GET = array_merge($_GET,$_POST);
  291 +
279 foreach ($_GET as $k=>$v){ 292 foreach ($_GET as $k=>$v){
280 $req->setParameter($k, $v); 293 $req->setParameter($k, $v);
281 } 294 }
@@ -283,7 +296,6 @@ if($_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){ @@ -283,7 +296,6 @@ if($_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){
283 $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; 296 $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
284 $or = $proto.$server.$_SERVER['PHP_SELF']; 297 $or = $proto.$server.$_SERVER['PHP_SELF'];
285 $mapa->setmetadata("wfs_onlineresource",$or."?".$_SERVER["QUERY_STRING"]); 298 $mapa->setmetadata("wfs_onlineresource",$or."?".$_SERVER["QUERY_STRING"]);
286 -  
287 ms_ioinstallstdouttobuffer(); 299 ms_ioinstallstdouttobuffer();
288 $mapa->owsdispatch($req); 300 $mapa->owsdispatch($req);
289 $contenttype = ms_iostripstdoutbuffercontenttype(); 301 $contenttype = ms_iostripstdoutbuffercontenttype();
@@ -560,7 +572,7 @@ function inicializa(){ @@ -560,7 +572,7 @@ function inicializa(){
560 ilegal(); 572 ilegal();
561 } 573 }
562 session_start(); 574 session_start();
563 - if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){ 575 + if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){
564 return; 576 return;
565 } 577 }
566 if(@$_SESSION["fingerprint"]){ 578 if(@$_SESSION["fingerprint"]){