Commit 76b0c14002618f5b735935958fd9610318e5a33e

Authored by Edmar Moretti
1 parent 3633a2ff

--no commit message

classesphp/mapa_googleearth.php
... ... @@ -40,25 +40,17 @@ if (!function_exists('ms_GetVersion'))
40 40 {
41 41 $s = PHP_SHLIB_SUFFIX;
42 42 @dl( 'php_mapscript.'.$s );
43   - $ler_extensoes[] = 'php_mapscript';
  43 + $ler_extensoes[] = 'php_mapscript';
44 44 }
45 45 //verificação de segurança
46 46 session_name("i3GeoPHP");
47 47 if(@$_GET["g_sid"])
48 48 {session_id($_GET["g_sid"]);}
49 49 else
50   -{ilegal();}
  50 +{exit;}
51 51 session_start();
52   -/*
53   -essa verificação não funciona
54   -if(@$_SESSION["fingerprint"])
55   -{
56   - if (md5('I3GEOSEC' . $_SERVER['HTTP_USER_AGENT'] . session_id()) != $_SESSION["fingerprint"])
57   - {ilegal();}
58   -}
59   -else
60   -{ilegal();}
61   -*/
  52 +if(!isset($_SESSION["map_file"]))
  53 +{exit;}
62 54 //
63 55 $map_fileX = $_SESSION["map_file"];
64 56 $postgis_mapa = $_SESSION["postgis_mapa"];
... ... @@ -134,13 +126,13 @@ function retornaWms($map_fileX,$postgis_mapa){
134 126 $handle = fopen ($qyfile, "r");
135 127 $conteudo = fread ($handle, filesize ($qyfile));
136 128 fclose ($handle);
137   - $shp = unserialize($conteudo);
  129 + $shp = unserialize($conteudo);
138 130 foreach ($shp as $indx)
139 131 {$mapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);}
140   - }
  132 + }
141 133 $layersNames = $mapa->getalllayernames();
142 134 $o = $mapa->outputformat;
143   - $o->set("imagemode",MS_IMAGEMODE_RGBA);
  135 + $o->set("imagemode",MS_IMAGEMODE_RGBA);
144 136 if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao´e alterado
145 137 foreach ($layersNames as $layerName)
146 138 {
... ... @@ -165,7 +157,7 @@ function retornaWms($map_fileX,$postgis_mapa){
165 157 if(($lcon == " ") || ($lcon == ""))
166 158 {$l->set("connection",$postgis_mapa);}
167 159 else
168   - {$l->set("connection",$postgis_mapa[$lcon]);}
  160 + {$l->set("connection",$postgis_mapa[$lcon]);}
169 161 }
170 162 }
171 163  
... ... @@ -179,7 +171,7 @@ function retornaWms($map_fileX,$postgis_mapa){
179 171 $of = $mapa->outputformat;
180 172 $of->set("imagemode",MS_IMAGEMODE_RGBA);
181 173 $of->set("driver","AGG/PNG");
182   - $of->set("transparent",MS_ON);
  174 + $of->set("transparent",MS_ON);
183 175 }
184 176 $mapa->setsize($_GET["WIDTH"],$_GET["HEIGHT"]);
185 177 if(isset($_GET["mapext"])){
... ... @@ -288,6 +280,8 @@ function filtraImagem($nomer,$tipoimagem){
288 280 }
289 281 function ilegal(){
290 282 $img = imagecreatefrompng("../imagens/ilegal.png");
  283 + imagealphablending($img, false);
  284 + imagesavealpha($img, true);
291 285 ob_clean();
292 286 echo header("Content-type: image/png \n\n");
293 287 imagepng($img);
... ...
classesphp/mapa_googlemaps.php
... ... @@ -7,7 +7,7 @@ das variáveis de conexão com banco e outras operações específicas do i3Geo.
7 7  
8 8 É utilizado especificamente nas interfaces que utilizam a biblioteca Googlemaps.
9 9  
10   -Precisa do código da "section" PHP aberta pelo i3Geo ou o código para acesso especial indicado no parâmetro telaR
  10 +Precisa do código da "section" PHP aberta pelo i3Geo ou o código para acesso especial indicado no parâmetro telaR
11 11 (veja a ferramenta TELAREMOTA).
12 12  
13 13 Parametros:
... ... @@ -64,7 +64,7 @@ if (!function_exists('ms_GetVersion'))
64 64 {
65 65 $s = PHP_SHLIB_SUFFIX;
66 66 @dl( 'php_mapscript.'.$s );
67   - $ler_extensoes[] = 'php_mapscript';
  67 + $ler_extensoes[] = 'php_mapscript';
68 68 }
69 69 //verificação de segurança
70 70 session_name("i3GeoPHP");
... ... @@ -80,7 +80,9 @@ if(@$_SESSION["fingerprint"])
80 80 {ilegal();}
81 81 }
82 82 else
83   -{ilegal();}
  83 +{exit;}
  84 +if(!isset($_SESSION["map_file"]))
  85 +{exit;}
84 86 //
85 87 $map_fileX = $_SESSION["map_file"];
86 88 $postgis_mapa = $_SESSION["postgis_mapa"];
... ... @@ -135,7 +137,7 @@ if($qy)
135 137 $handle = fopen ($qyfile, "r");
136 138 $conteudo = fread ($handle, filesize ($qyfile));
137 139 fclose ($handle);
138   - $shp = unserialize($conteudo);
  140 + $shp = unserialize($conteudo);
139 141 foreach ($shp as $indx)
140 142 {$mapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);}
141 143 }
... ... @@ -165,7 +167,7 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao´e alter
165 167 if(($lcon == " ") || ($lcon == ""))
166 168 {$l->set("connection",$postgis_mapa);}
167 169 else
168   - {$l->set("connection",$postgis_mapa[$lcon]);}
  170 + {$l->set("connection",$postgis_mapa[$lcon]);}
169 171 }
170 172 }
171 173 }
... ... @@ -279,7 +281,7 @@ function salvaCacheImagem($bbox,$layer,$map,$w,$h){
279 281 {$bbox = "";}
280 282 if($layer == "")
281 283 {$layer = "fundo";}
282   -
  284 +
283 285 $nomedir = dirname(dirname($map))."/cache/".$layer;
284 286 @mkdir($nomedir,0777);
285 287 $nome = $nomedir."/".$w.$h.$bbox;
... ... @@ -311,10 +313,10 @@ function carregaCacheImagem($bbox,$layer,$map,$w,$h){
311 313 $img = imagecreatetruecolor($w, $h);
312 314 imagealphablending($img, false);
313 315 imagesavealpha($img, true);
314   -
  316 +
315 317 $bgc = imagecolorallocatealpha($img, 255, 255, 255,127);
316 318 $tc = imagecolorallocate($img, 255, 0, 0);
317   -
  319 +
318 320 imagefilledrectangle($img, 0, 0, $w, $h, $bgc);
319 321 /* Output an error message */
320 322 imagestring($img, 3, 5, 5, 'Erro ao ler ' . $nome, $tc);
... ... @@ -370,6 +372,8 @@ function filtraImagem($nomer,$tipoimagem){
370 372 }
371 373 function ilegal(){
372 374 $img = imagecreatefrompng("../imagens/ilegal.png");
  375 + imagealphablending($img, false);
  376 + imagesavealpha($img, true);
373 377 ob_clean();
374 378 echo header("Content-type: image/png \n\n");
375 379 imagepng($img);
... ...
classesphp/mapa_openlayers.php
1 1 <?php
  2 +
2 3 /*
3 4 Title: mapa_openlayers.php
4 5  
... ... @@ -7,7 +8,7 @@ das variáveis de conexão com banco e outras operações específicas do i3Geo.
7 8  
8 9 É utilizado especificamente nas interfaces que utilizam a biblioteca OpenLayers em LAYERS do tipo WMS.
9 10  
10   -Precisa do código da "section" PHP aberta pelo i3Geo ou o código para acesso especial indicado no parâmetro telaR
  11 +Precisa do código da "section" PHP aberta pelo i3Geo ou o código para acesso especial indicado no parâmetro telaR
11 12 (veja a ferramenta TELAREMOTA).
12 13  
13 14 Parametros:
... ... @@ -62,7 +63,7 @@ if (!function_exists(&#39;ms_GetVersion&#39;))
62 63 {
63 64 $s = PHP_SHLIB_SUFFIX;
64 65 @dl( 'php_mapscript.'.$s );
65   - $ler_extensoes[] = 'php_mapscript';
  66 + $ler_extensoes[] = 'php_mapscript';
66 67 }
67 68 //verificação de segurança
68 69 session_name("i3GeoPHP");
... ... @@ -79,7 +80,10 @@ if(@$_SESSION[&quot;fingerprint&quot;])
79 80 {ilegal();}
80 81 }
81 82 else
82   -{ilegal();}
  83 +{exit;}
  84 +if(!isset($_SESSION["map_file"]))
  85 +{exit;}
  86 +
83 87 //
84 88 //map_fileX é necessário caso register_globals = On no PHP.INI
85 89 $map_fileX = $_SESSION["map_file"];
... ... @@ -104,7 +108,7 @@ if($qy)
104 108 $handle = fopen ($qyfile, "r");
105 109 $conteudo = fread ($handle, filesize ($qyfile));
106 110 fclose ($handle);
107   - $shp = unserialize($conteudo);
  111 + $shp = unserialize($conteudo);
108 112 foreach ($shp as $indx)
109 113 {$mapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);}
110 114 }
... ... @@ -135,7 +139,7 @@ if(!isset($_GET[&quot;telaR&quot;])){//no caso de projecoes remotas, o mapfile nao e alter
135 139 if(($lcon == " ") || ($lcon == ""))
136 140 {$l->set("connection",$postgis_mapa);}
137 141 else
138   - {$l->set("connection",$postgis_mapa[$lcon]);}
  142 + {$l->set("connection",$postgis_mapa[$lcon]);}
139 143 }
140 144 }
141 145 }
... ... @@ -259,7 +263,7 @@ else{
259 263  
260 264 echo header("Content-type: image/png \n\n");
261 265 imagepng($img);
262   -
  266 +
263 267 }
264 268 function salvaCacheImagem($bbox,$layer,$map,$w,$h){
265 269 global $img,$map_size;
... ... @@ -268,7 +272,7 @@ function salvaCacheImagem($bbox,$layer,$map,$w,$h){
268 272 {$bbox = "";}
269 273 if($layer == "")
270 274 {$layer = "fundo";}
271   -
  275 +
272 276 $nomedir = dirname(dirname($map))."/cache/".$layer;
273 277 @mkdir($nomedir,0777);
274 278 $nome = $nomedir."/".$w.$h.$bbox;
... ... @@ -283,7 +287,7 @@ function carregaCacheImagem($bbox,$layer,$map,$w,$h){
283 287 {$bbox = "";}
284 288 if($layer == "")
285 289 {$layer = "fundo";}
286   -
  290 +
287 291 $nome = $w.$h.$bbox;
288 292 $nome = dirname(dirname($map))."/cache/".$layer."/".$nome;
289 293 if(file_exists($nome))
... ... @@ -302,10 +306,10 @@ function carregaCacheImagem($bbox,$layer,$map,$w,$h){
302 306 $img = imagecreatetruecolor($w, $h);
303 307 imagealphablending($img, false);
304 308 imagesavealpha($img, true);
305   -
  309 +
306 310 $bgc = imagecolorallocatealpha($img, 255, 255, 255,127);
307 311 $tc = imagecolorallocate($img, 255, 0, 0);
308   -
  312 +
309 313 imagefilledrectangle($img, 0, 0, $w, $h, $bgc);
310 314 /* Output an error message */
311 315 imagestring($img, 3, 5, 5, 'Erro ao ler ' . $nome, $tc);
... ... @@ -361,6 +365,8 @@ function filtraImagem($nomer,$tipoimagem){
361 365 }
362 366 function ilegal(){
363 367 $img = imagecreatefrompng("../imagens/ilegal.png");
  368 + imagealphablending($img, false);
  369 + imagesavealpha($img, true);
364 370 ob_clean();
365 371 echo header("Content-type: image/png \n\n");
366 372 imagepng($img);
... ...