From 76b0c14002618f5b735935958fd9610318e5a33e Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Fri, 26 Aug 2011 17:44:00 +0000 Subject: [PATCH] --- classesphp/mapa_googleearth.php | 28 +++++++++++----------------- classesphp/mapa_googlemaps.php | 20 ++++++++++++-------- classesphp/mapa_openlayers.php | 26 ++++++++++++++++---------- 3 files changed, 39 insertions(+), 35 deletions(-) diff --git a/classesphp/mapa_googleearth.php b/classesphp/mapa_googleearth.php index 15a60c6..38df801 100644 --- a/classesphp/mapa_googleearth.php +++ b/classesphp/mapa_googleearth.php @@ -40,25 +40,17 @@ if (!function_exists('ms_GetVersion')) { $s = PHP_SHLIB_SUFFIX; @dl( 'php_mapscript.'.$s ); - $ler_extensoes[] = 'php_mapscript'; + $ler_extensoes[] = 'php_mapscript'; } //verificação de segurança session_name("i3GeoPHP"); if(@$_GET["g_sid"]) {session_id($_GET["g_sid"]);} else -{ilegal();} +{exit;} session_start(); -/* -essa verificação não funciona -if(@$_SESSION["fingerprint"]) -{ - if (md5('I3GEOSEC' . $_SERVER['HTTP_USER_AGENT'] . session_id()) != $_SESSION["fingerprint"]) - {ilegal();} -} -else -{ilegal();} -*/ +if(!isset($_SESSION["map_file"])) +{exit;} // $map_fileX = $_SESSION["map_file"]; $postgis_mapa = $_SESSION["postgis_mapa"]; @@ -134,13 +126,13 @@ function retornaWms($map_fileX,$postgis_mapa){ $handle = fopen ($qyfile, "r"); $conteudo = fread ($handle, filesize ($qyfile)); fclose ($handle); - $shp = unserialize($conteudo); + $shp = unserialize($conteudo); foreach ($shp as $indx) {$mapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);} - } + } $layersNames = $mapa->getalllayernames(); $o = $mapa->outputformat; - $o->set("imagemode",MS_IMAGEMODE_RGBA); + $o->set("imagemode",MS_IMAGEMODE_RGBA); if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao´e alterado foreach ($layersNames as $layerName) { @@ -165,7 +157,7 @@ function retornaWms($map_fileX,$postgis_mapa){ if(($lcon == " ") || ($lcon == "")) {$l->set("connection",$postgis_mapa);} else - {$l->set("connection",$postgis_mapa[$lcon]);} + {$l->set("connection",$postgis_mapa[$lcon]);} } } @@ -179,7 +171,7 @@ function retornaWms($map_fileX,$postgis_mapa){ $of = $mapa->outputformat; $of->set("imagemode",MS_IMAGEMODE_RGBA); $of->set("driver","AGG/PNG"); - $of->set("transparent",MS_ON); + $of->set("transparent",MS_ON); } $mapa->setsize($_GET["WIDTH"],$_GET["HEIGHT"]); if(isset($_GET["mapext"])){ @@ -288,6 +280,8 @@ function filtraImagem($nomer,$tipoimagem){ } function ilegal(){ $img = imagecreatefrompng("../imagens/ilegal.png"); + imagealphablending($img, false); + imagesavealpha($img, true); ob_clean(); echo header("Content-type: image/png \n\n"); imagepng($img); diff --git a/classesphp/mapa_googlemaps.php b/classesphp/mapa_googlemaps.php index b44c9ca..2b9b7dd 100644 --- a/classesphp/mapa_googlemaps.php +++ b/classesphp/mapa_googlemaps.php @@ -7,7 +7,7 @@ das variáveis de conexão com banco e outras operações específicas do i3Geo. É utilizado especificamente nas interfaces que utilizam a biblioteca Googlemaps. -Precisa do código da "section" PHP aberta pelo i3Geo ou o código para acesso especial indicado no parâmetro telaR +Precisa do código da "section" PHP aberta pelo i3Geo ou o código para acesso especial indicado no parâmetro telaR (veja a ferramenta TELAREMOTA). Parametros: @@ -64,7 +64,7 @@ if (!function_exists('ms_GetVersion')) { $s = PHP_SHLIB_SUFFIX; @dl( 'php_mapscript.'.$s ); - $ler_extensoes[] = 'php_mapscript'; + $ler_extensoes[] = 'php_mapscript'; } //verificação de segurança session_name("i3GeoPHP"); @@ -80,7 +80,9 @@ if(@$_SESSION["fingerprint"]) {ilegal();} } else -{ilegal();} +{exit;} +if(!isset($_SESSION["map_file"])) +{exit;} // $map_fileX = $_SESSION["map_file"]; $postgis_mapa = $_SESSION["postgis_mapa"]; @@ -135,7 +137,7 @@ if($qy) $handle = fopen ($qyfile, "r"); $conteudo = fread ($handle, filesize ($qyfile)); fclose ($handle); - $shp = unserialize($conteudo); + $shp = unserialize($conteudo); foreach ($shp as $indx) {$mapa->querybyindex($indxlayer,-1,$indx,MS_TRUE);} } @@ -165,7 +167,7 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao´e alter if(($lcon == " ") || ($lcon == "")) {$l->set("connection",$postgis_mapa);} else - {$l->set("connection",$postgis_mapa[$lcon]);} + {$l->set("connection",$postgis_mapa[$lcon]);} } } } @@ -279,7 +281,7 @@ function salvaCacheImagem($bbox,$layer,$map,$w,$h){ {$bbox = "";} if($layer == "") {$layer = "fundo";} - + $nomedir = dirname(dirname($map))."/cache/".$layer; @mkdir($nomedir,0777); $nome = $nomedir."/".$w.$h.$bbox; @@ -311,10 +313,10 @@ function carregaCacheImagem($bbox,$layer,$map,$w,$h){ $img = imagecreatetruecolor($w, $h); imagealphablending($img, false); imagesavealpha($img, true); - + $bgc = imagecolorallocatealpha($img, 255, 255, 255,127); $tc = imagecolorallocate($img, 255, 0, 0); - + imagefilledrectangle($img, 0, 0, $w, $h, $bgc); /* Output an error message */ imagestring($img, 3, 5, 5, 'Erro ao ler ' . $nome, $tc); @@ -370,6 +372,8 @@ function filtraImagem($nomer,$tipoimagem){ } function ilegal(){ $img = imagecreatefrompng("../imagens/ilegal.png"); + imagealphablending($img, false); + imagesavealpha($img, true); ob_clean(); echo header("Content-type: image/png \n\n"); imagepng($img); diff --git a/classesphp/mapa_openlayers.php b/classesphp/mapa_openlayers.php index fd03074..3b384bb 100644 --- a/classesphp/mapa_openlayers.php +++ b/classesphp/mapa_openlayers.php @@ -1,4 +1,5 @@ querybyindex($indxlayer,-1,$indx,MS_TRUE);} } @@ -135,7 +139,7 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter if(($lcon == " ") || ($lcon == "")) {$l->set("connection",$postgis_mapa);} else - {$l->set("connection",$postgis_mapa[$lcon]);} + {$l->set("connection",$postgis_mapa[$lcon]);} } } } @@ -259,7 +263,7 @@ else{ echo header("Content-type: image/png \n\n"); imagepng($img); - + } function salvaCacheImagem($bbox,$layer,$map,$w,$h){ global $img,$map_size; @@ -268,7 +272,7 @@ function salvaCacheImagem($bbox,$layer,$map,$w,$h){ {$bbox = "";} if($layer == "") {$layer = "fundo";} - + $nomedir = dirname(dirname($map))."/cache/".$layer; @mkdir($nomedir,0777); $nome = $nomedir."/".$w.$h.$bbox; @@ -283,7 +287,7 @@ function carregaCacheImagem($bbox,$layer,$map,$w,$h){ {$bbox = "";} if($layer == "") {$layer = "fundo";} - + $nome = $w.$h.$bbox; $nome = dirname(dirname($map))."/cache/".$layer."/".$nome; if(file_exists($nome)) @@ -302,10 +306,10 @@ function carregaCacheImagem($bbox,$layer,$map,$w,$h){ $img = imagecreatetruecolor($w, $h); imagealphablending($img, false); imagesavealpha($img, true); - + $bgc = imagecolorallocatealpha($img, 255, 255, 255,127); $tc = imagecolorallocate($img, 255, 0, 0); - + imagefilledrectangle($img, 0, 0, $w, $h, $bgc); /* Output an error message */ imagestring($img, 3, 5, 5, 'Erro ao ler ' . $nome, $tc); @@ -361,6 +365,8 @@ function filtraImagem($nomer,$tipoimagem){ } function ilegal(){ $img = imagecreatefrompng("../imagens/ilegal.png"); + imagealphablending($img, false); + imagesavealpha($img, true); ob_clean(); echo header("Content-type: image/png \n\n"); imagepng($img); -- libgit2 0.21.2