Commit c57fe425f06c3d528d714809ff16cf149794169b

Authored by Edmar Moretti
1 parent 60ac62e8

correção na geração dos arquivos de selecao

classesphp/classe_mapa.php
... ... @@ -227,7 +227,6 @@ class Mapa
227 227 $temas = array();
228 228 $existesel = false;
229 229 $dir = dirname($this->arquivo);
230   - //$qy = file_exists($this->qyfile);
231 230 foreach($this->layers as $l){
232 231 $l->set("template","none.htm");
233 232 }
... ... @@ -278,7 +277,7 @@ class Mapa
278 277 foreach ($this->layers as $oLayer){
279 278 $sel = "nao";
280 279 $nSel = 0;
281   - $arqS = $dir."/".$oLayer->name.".php";
  280 + $arqS = $dir."/".$oLayer->name."_qy.map";
282 281 if(file_exists($arqS)){
283 282 $sel = "sim";
284 283 $existesel = true;
... ... @@ -462,51 +461,6 @@ class Mapa
462 461 }
463 462 $ferramentas["animagif"] = json_decode($f);
464 463 }
465   - //formatacao antiga, antes da versao 6.0
466   - /*
467   - $temas[] = array(
468   - "name"=>($oLayer->name),
469   - "nomeoriginal"=>($oLayer->getmetadata("nomeoriginal")),
470   - "status"=>($oLayer->status),
471   - "tema"=>(mb_convert_encoding(($oLayer->getmetadata("tema")),"UTF-8","ISO-8859-1")),
472   - "transparency"=>($oLayer->opacity),
473   - "type"=>($oLayer->type),
474   - "sel"=>$sel,
475   - "nsel"=>$nSel,
476   - "escala"=>$escala,
477   - "download"=>$down,
478   - "features"=>$f,
479   - "connectiontype"=>$ct,
480   - "zoomtema"=>$zoomtema,
481   - "contextoescala"=>$contextoescala,
482   - "etiquetas"=>($oLayer->getmetadata("TIP")),
483   - "identifica"=>($oLayer->getmetadata("IDENTIFICA")),
484   - "editorsql"=>$editorsql,
485   - "linhadotempo"=>$ltempo,
486   - "escondido"=>strtolower($escondido),
487   - "iconetema"=>($oLayer->getmetadata("iconetema")),
488   - "classe"=>($oLayer->getmetadata("classe")),
489   - "permitecomentario"=>$permitecomentario,
490   - "exttema"=>$exttema,
491   - "aplicaextensao"=>$aplicaextensao,
492   - "transitioneffect"=>$transitioneffect,
493   - "wmsurl"=>$wmsurl,
494   - "wmsname"=>$wmsname,
495   - "wmsformat"=>$wmsformat,
496   - "wmssrs"=>$wmssrs,
497   - "wmstile"=>$wmstile,
498   - "tiles"=>$tiles,
499   - "temporizador"=>($oLayer->getmetadata("temporizador")),
500   - "permiteogc"=>($oLayer->getmetadata("permiteogc")),
501   - "itembuscarapida"=>($oLayer->getmetadata("itembuscarapida")),
502   - "usasld"=>$usasld,
503   - "cache"=>$cache,
504   - "editavel"=>($oLayer->getmetadata("EDITAVEL")),
505   - "colunaidunico"=>($oLayer->getmetadata("COLUNAIDUNICO")),
506   - "cortepixels"=>$cortepixels,
507   - "plugini3geo"=>$plugini3geo
508   - );
509   - */
510 464 $temas[] = array(
511 465 $oLayer->name,
512 466 $oLayer->getmetadata("nomeoriginal"),
... ...
classesphp/classe_selecao.php
... ... @@ -103,9 +103,9 @@ $ext - extensão geográfica do mapa
103 103 $this->postgis_mapa = $postgis_mapa;
104 104 $this->v = versao();
105 105 $this->v = $this->v["principal"];
106   - $this->qyfile = str_replace(".map",".qy",$map_file);
  106 + $this->qyfile = str_replace(".map","_qy.map",$map_file);
107 107 if($tema != ""){
108   - $this->qyfileTema = dirname($map_file)."/".$tema.".php";
  108 + $this->qyfileTema = dirname($map_file)."/".$tema."_qy.map";
109 109 }
110 110 else{
111 111 $this->qyfileTema = "";
... ... @@ -953,6 +953,7 @@ $arquivo - arquivo que será processado
953 953 */
954 954 function unserializeQ($arq)
955 955 {
  956 + $arq = str_replace("_qy.map","",$arq)."_qy.map";
956 957 $handle = fopen ($arq, "r");
957 958 $conteudo = fread ($handle, filesize ($arq));
958 959 fclose ($handle);
... ... @@ -970,8 +971,10 @@ $geos - array com os dados
970 971 */
971 972 function serializeQ($arq,$geos)
972 973 {
973   - if (file_exists($arq))
974   - {unlink($arq);}
  974 + $arq = str_replace("_qy.map","",$arq)."_qy.map";
  975 + if (file_exists($arq)){
  976 + unlink($arq);
  977 + }
975 978 $fp = fopen($arq,"w");
976 979 $r = serialize($geos);
977 980 fwrite($fp,$r);
... ...
classesphp/funcoes_gerais.php
... ... @@ -2491,7 +2491,7 @@ function removeLinha($texto,$mapfile)
2491 2491 //
2492 2492 function carregaquery($mapfile,$objlayer,$objmapa)
2493 2493 {
2494   - $qyfile = dirname($mapfile)."/".$objlayer->name.".php";
  2494 + $qyfile = dirname($mapfile)."/".$objlayer->name."_qy.map";
2495 2495 if(file_exists($qyfile))
2496 2496 {
2497 2497 $indxlayer = $objlayer->index;
... ... @@ -2522,7 +2522,7 @@ $objmapa
2522 2522 */
2523 2523 function carregaquery2($mapfile,&$objlayer,&$objmapa)
2524 2524 {
2525   - $qyfile = dirname($mapfile)."/".$objlayer->name.".php";
  2525 + $qyfile = dirname($mapfile)."/".$objlayer->name."_qy.map";
2526 2526 if(file_exists($qyfile)){
2527 2527 $indxlayer = $objlayer->index;
2528 2528 $handle = fopen ($qyfile, "r");
... ... @@ -2620,11 +2620,10 @@ function retornaShapesMapext($objLayer,$objMapa){
2620 2620 }
2621 2621 function retornaShapesSelecionados($objLayer,$map_file,$objMapa,$indexado=false){
2622 2622 $shapes = array();
2623   - $qyfile = dirname($map_file)."/".$objLayer->name.".php";
  2623 + $qyfile = dirname($map_file)."/".$objLayer->name."_qy.map";
2624 2624 if(!file_exists($qyfile)){
2625 2625 return $shapes;
2626 2626 }
2627   -
2628 2627 $handle = fopen ($qyfile, "r");
2629 2628 $conteudo = fread ($handle, filesize ($qyfile));
2630 2629 fclose ($handle);
... ...
classesphp/mapa_googleearth.php
... ... @@ -122,7 +122,7 @@ function retornaWms($map_fileX,$postgis_mapa){
122 122 //
123 123 //resolve o problema da seleção na versão nova do mapserver
124 124 //
125   - $qyfile = dirname($map_fileX)."/".$_GET["layer"].".php";
  125 + $qyfile = dirname($map_fileX)."/".$_GET["layer"]."_qy.map";
126 126 $qy = file_exists($qyfile);
127 127 $o = $mapa->outputformat;
128 128 $o->set("imagemode",MS_IMAGEMODE_RGBA);
... ...
classesphp/mapa_googlemaps.php
... ... @@ -110,7 +110,7 @@ elseif ($_GET["X"] != ""){
110 110 $y = $_GET["Y"];
111 111 $z = $_GET["Z"];
112 112  
113   - $qyfile = dirname($map_fileX)."/".$_GET["layer"].".php";
  113 + $qyfile = dirname($map_fileX)."/".$_GET["layer"]."_qy.map";
114 114 $qy = file_exists($qyfile);
115 115 if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){
116 116 carregaCacheImagem();
... ...
classesphp/mapa_openlayers.php
... ... @@ -144,7 +144,7 @@ if(!empty($_GET["request"])){
144 144 //
145 145 //resolve o problema da selecao nas versoes mais recentes nova do mapserver
146 146 //
147   -$qyfile = dirname($map_fileX)."/".$_GET["layer"];
  147 +$qyfile = dirname($map_fileX)."/".$_GET["layer"]."_qy.map";
148 148 $qy = file_exists($qyfile);
149 149  
150 150 if($_GET["REQUEST"] == "getlegendgraphic" || $_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){
... ...
ferramentas/inicia.php
... ... @@ -45,6 +45,7 @@ if(!empty($g_sid)){
45 45 $mapdir = $_SESSION["mapdir"];
46 46 $imgdir = $_SESSION["imgdir"];
47 47 $contadorsalva = $_SESSION["contadorsalva"];
  48 + $fingerprint = $_SESSION['fingerprint'];
48 49 }
49 50 include_once(dirname(__FILE__)."/../classesphp/funcoes_gerais.php");
50 51 if(isset($fingerprint) && !empty($g_sid)) {
... ...
ferramentas/safe.php 0 → 100755
... ... @@ -0,0 +1,87 @@
  1 +<?php
  2 +include_once (dirname(__FILE__)."/../classesphp/sani_request.php");
  3 +$_GET = array_merge($_GET,$_POST);
  4 +if(!empty($_GET["g_sid"])){
  5 + $g_sid = $_GET["g_sid"];
  6 + session_name("i3GeoPHP");
  7 + session_id($g_sid);
  8 + session_start();
  9 + $statusFerramentas = $_SESSION["statusFerramentas"];
  10 + $imgurl = $_SESSION["imgurl"];
  11 + $tmpurl = $_SESSION["tmpurl"];
  12 + $map_file = $_SESSION["map_file"];
  13 + $mapext = $_SESSION["mapext"];
  14 + $locaplic = $_SESSION["locaplic"];
  15 + $mapext = $_SESSION["mapext"];
  16 + $ler_extensoes = $_SESSION["ler_extensoes"];
  17 + $perfil = $_SESSION["perfil"];
  18 + $interface = $_SESSION["interface"];
  19 + $kmlurl = $_SESSION["kmlurl"];
  20 + $mapdir = $_SESSION["mapdir"];
  21 + $imgdir = $_SESSION["imgdir"];
  22 + $contadorsalva = $_SESSION["contadorsalva"];
  23 + $fingerprint = $_SESSION['fingerprint'];
  24 +}
  25 +include_once(dirname(__FILE__)."/../classesphp/funcoes_gerais.php");
  26 +if(isset($fingerprint) && !empty($g_sid)) {
  27 + $f = explode(",",$fingerprint);
  28 + if($f[0] != md5('I3GEOSEC' . $_SERVER['HTTP_USER_AGENT'] . session_id())){
  29 + cpjson(". Tentativa de acesso nao permitida. Inicie um novo mapa.");
  30 + return;
  31 + }
  32 +}
  33 +include_once(dirname(__FILE__)."/../ms_configura.php");
  34 +include_once(dirname(__FILE__)."/../classesphp/classe_vermultilayer.php");
  35 +include_once(dirname(__FILE__)."/../classesphp/classe_estatistica.php");
  36 +//
  37 +//substitui a string de conex&atilde;o
  38 +//
  39 +if(!substituiCon($map_file,$postgis_mapa)){
  40 + unlink($map_file);
  41 + cpjson("erro",$cp);
  42 + return;
  43 +}
  44 +//
  45 +function redesenhaMapa()
  46 +{
  47 + global $map_file,$tipoimagem,$cp,$postgis_mapa,$utilizacgi,$locmapserv,$interface,$mapexten;
  48 + substituiCon($map_file,$postgis_mapa);
  49 + if($tipoimagem != "nenhum" && $tipoimagem != "")
  50 + {$utilizacgi = "nao";}
  51 + if (connection_aborted()){exit();}
  52 + if($interface == "googleearth" && $mapexten != ""){
  53 + include_once(dirname(__FILE__)."/../classesphp/classe_navegacao.php");
  54 + $m = new Navegacao($map_file);
  55 + $m->mudaExtensao($mapexten);
  56 + $m->salva();
  57 + }
  58 + include_once(dirname(__FILE__)."/../classesphp/classe_mapa.php");
  59 + $m = New Mapa($map_file);
  60 + $par = $m->parametrosTemas();
  61 + //
  62 + //na interface googlemaps n&atilde;o &eacute; necess&aacute;rio gerar a imagem
  63 + //
  64 + $e = $m->mapa->extent;
  65 + $ext = $e->minx." ".$e->miny." ".$e->maxx." ".$e->maxy;
  66 + $res["mapimagem"] = "";
  67 + $res["mapexten"] = $ext;
  68 + $res["mapres"] = "";
  69 + $res["erro"] = "";
  70 + $res["mapscale"] = "";
  71 + $res["pixelsize"] = "";
  72 + $res["mapimagem"] = "";
  73 + $res["w"] = $m->mapa->width;
  74 + $res["h"] = $m->mapa->height;
  75 + $res["mappath"] = "";
  76 + $res["mapurl"] = "";
  77 + $res["mensagens"] = $m->pegaMensagens();
  78 + $res["tempo"] = microtime(1) - $tempo;
  79 + restauraCon($map_file,$postgis_mapa);
  80 + ob_clean();
  81 + if ($par == "")
  82 + {$retorno = "erro";}
  83 + else
  84 + {$retorno = array("variaveis"=>$res,"temas"=>$par);}
  85 + cpjson($retorno);
  86 +}
  87 +?>
0 88 \ No newline at end of file
... ...