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