Commit d81cbc920cdd7b8bdbfa55ff31eaae966d35b03f

Authored by Edmar Moretti
1 parent 4f6d3911
Exists in master

Revisão do código do sistema de administração

admin/dicionario/subirsimbolo.js 0 → 100755
@@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
  1 +//+$trad(1,i3GEOF.uploadsimbolo.dicionario)+
  2 +i3GEOF.uploadsimbolo.dicionario = {
  3 + 'pastaArmazenamento' : [ {
  4 + pt : "Pasta dentro de 'i3geo' (pasta onde o i3Geo está instalado, por exemplo, 'temas') onde a imagem será armazenada. A pasta deve ter permissões adequadas para permitir o upload, consulte o administrador do sistema caso ocorra algum problema.",
  5 + en : "",
  6 + es : ""
  7 + } ],
  8 + 'envia' : [ {
  9 + pt : "Enviar",
  10 + en : "",
  11 + es : ""
  12 + } ],
  13 + 'ajudaCaracter' : [ {
  14 + pt : "Não utilize _ no nome do arquivo. Apenas letras e números são aceitos!!!",
  15 + en : "",
  16 + es : ""
  17 + } ],
  18 + "escolha" : [ {
  19 + pt : "Selecione o arquivo PNG",
  20 + en : "",
  21 + es : ""
  22 + } ]
  23 +};
admin/html/subirshapefile.html
@@ -16,7 +16,7 @@ body { @@ -16,7 +16,7 @@ body {
16 </style> 16 </style>
17 <script type="text/javascript" src="../js/core.js"></script> 17 <script type="text/javascript" src="../js/core.js"></script>
18 <script type="text/javascript" src="../../classesjs/i3geo.js"></script> 18 <script type="text/javascript" src="../../classesjs/i3geo.js"></script>
19 -<script type="text/javascript" src="../../ferramentas/upload/index.js"></script> 19 +<script type="text/javascript" src="../js/subirshapefile.js"></script>
20 <script type="text/javascript" src="../../ferramentas/upload/dicionario.js"></script> 20 <script type="text/javascript" src="../../ferramentas/upload/dicionario.js"></script>
21 <script type="text/javascript" src="../dicionario/core.js"></script> 21 <script type="text/javascript" src="../dicionario/core.js"></script>
22 <link rel="stylesheet" type="text/css" href="admin.css"> 22 <link rel="stylesheet" type="text/css" href="admin.css">
admin/html/subirsimbolo.html
@@ -16,8 +16,8 @@ body { @@ -16,8 +16,8 @@ body {
16 </style> 16 </style>
17 <script type="text/javascript" src="../js/core.js"></script> 17 <script type="text/javascript" src="../js/core.js"></script>
18 <script type="text/javascript" src="../../classesjs/i3geo.js"></script> 18 <script type="text/javascript" src="../../classesjs/i3geo.js"></script>
19 -<script type="text/javascript" src="../../ferramentas/uploadsimbolo/index.js"></script>  
20 -<script type="text/javascript" src="../../ferramentas/uploadsimbolo/dicionario.js"></script> 19 +<script type="text/javascript" src="../js/subirsimbolo.js"></script>
  20 +<script type="text/javascript" src="../dicionario/subirsimbolo.js"></script>
21 21
22 <script type="text/javascript" src="../dicionario/core.js"></script> 22 <script type="text/javascript" src="../dicionario/core.js"></script>
23 <link rel="stylesheet" type="text/css" href="admin.css"> 23 <link rel="stylesheet" type="text/css" href="admin.css">
admin/js/subirshapefile.js 0 → 100755
@@ -0,0 +1,203 @@ @@ -0,0 +1,203 @@
  1 +//Esse programa e um clone de i3geo/ferramentas/upload/index.js
  2 +//
  3 +
  4 +/*
  5 +
  6 +
  7 +Title: Upload de arquivo shapefile
  8 +
  9 +Envia para o servidor um arquivo shapefile local e insere como uma camada no mapa.
  10 +
  11 +Veja:
  12 +
  13 +<i3GEO.arvoreDeTemas.dialogo.upload>
  14 +
  15 +Arquivo: i3geo/ferramentas/upload/index.js.php
  16 +
  17 +About: Licen&ccedil;a
  18 +
  19 +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  20 +
  21 +Direitos Autorais Reservados (c) 2006 Minist&eacute;rio do Meio Ambiente Brasil
  22 +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
  23 +
  24 +Este programa &eacute; software livre; voc&ecirc; pode redistribu&iacute;-lo
  25 +e/ou modific&aacute;-lo sob os termos da Licen&ccedil;a P&uacute;blica Geral
  26 +GNU conforme publicada pela Free Software Foundation;
  27 +
  28 +Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til,
  29 +por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita
  30 +de COMERCIABILIDADE OU ADEQUA&Ccedil;&Atilde;O A UMA FINALIDADE ESPEC&Iacute;FICA.
  31 +Consulte a Licen&ccedil;a P&uacute;blica Geral do GNU para mais detalhes.
  32 +Voc&ecirc; deve ter recebido uma c&oacute;pia da Licen&ccedil;a P&uacute;blica Geral do
  33 +GNU junto com este programa; se n&atilde;o, escreva para a
  34 +Free Software Foundation, Inc., no endere&ccedil;o
  35 +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  36 +*/
  37 +if(typeof(i3GEOF) === 'undefined'){
  38 + var i3GEOF = {};
  39 +}
  40 +/*
  41 +Classe: i3GEOF.upload
  42 +*/
  43 +i3GEOF.upload = {
  44 + /*
  45 + Variavel: aguarde
  46 +
  47 + Estilo do objeto DOM com a imagem de aguarde existente no cabe&ccedil;alho da janela.
  48 + */
  49 + aguarde: "",
  50 + /*
  51 + Para efeitos de compatibilidade antes da vers&atilde;o 4.7 que n&atilde;o tinha dicion&aacute;rio
  52 + */
  53 + criaJanelaFlutuante: function(){
  54 + i3GEOF.upload.iniciaDicionario();
  55 + },
  56 + /*
  57 + Function: iniciaDicionario
  58 +
  59 + Carrega o dicion&aacute;rio e chama a fun&ccedil;&atilde;o que inicia a ferramenta
  60 +
  61 + O Javascript &eacute; carregado com o id i3GEOF.nomedaferramenta.dicionario_script
  62 + */
  63 + iniciaDicionario: function(){
  64 + if(typeof(i3GEOF.upload.dicionario) === 'undefined'){
  65 + i3GEO.util.scriptTag(
  66 + i3GEO.configura.locaplic+"/ferramentas/upload/dicionario.js",
  67 + "i3GEOF.upload.iniciaJanelaFlutuante()",
  68 + "i3GEOF.upload.dicionario_script"
  69 + );
  70 + }
  71 + else{
  72 + i3GEOF.upload.iniciaJanelaFlutuante();
  73 + }
  74 + },
  75 + /*
  76 + Function: inicia
  77 +
  78 + Inicia a ferramenta. &Eacute; chamado por criaJanelaFlutuante
  79 +
  80 + Parametro:
  81 +
  82 + iddiv {String} - id do div que receber&aacute; o conteudo HTML da ferramenta
  83 + */
  84 + inicia: function(iddiv){
  85 + try{
  86 + $i(iddiv).innerHTML += i3GEOF.upload.html();
  87 + var b = new YAHOO.widget.Button(
  88 + "i3GEOuploadbotao1",
  89 + {onclick:{fn: i3GEOF.upload.submete}}
  90 + );
  91 + b.addClass("rodar");
  92 + i3GEO.util.radioEpsg(
  93 + function(retorno){
  94 + $i("i3GEOuploadListaepsg").innerHTML = retorno.dados;
  95 + },
  96 + "i3GEOuploadListaepsg",
  97 + "upload",
  98 + "nao"
  99 + );
  100 + }
  101 + catch(erro){i3GEO.janela.tempoMsg(erro);}
  102 + },
  103 + /*
  104 + Function: html
  105 +
  106 + Gera o c&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta
  107 +
  108 + Retorno:
  109 +
  110 + String com o c&oacute;digo html
  111 + */
  112 + html:function(){
  113 + var ins = '<form id=i3GEOuploadf target="i3GEOuploadiframe" action="'+i3GEO.configura.locaplic+'/admin/php/subirshapefile.php" method="post" ENCTYPE="multipart/form-data">' +
  114 + '<fieldset class=subbloco >' +
  115 + '<p class="paragrafo" >shp: <br><input type="file" size=22 name="i3GEOuploadshp" style="top:0px;left:0px;cursor:pointer;"></p>' +
  116 + '<p class="paragrafo" >shx: <br><input type="file" size=22 name="i3GEOuploadshx" style="top:0px;left:0px;cursor:pointer;"></p>' +
  117 + '<p class="paragrafo" >dbf: <br><input type="file" size=22 name="i3GEOuploaddbf" style="top:0px;left:0px;cursor:pointer;"></p>' +
  118 + '<p class="paragrafo" >prj (opcional): <br><input type="file" size=22 name="i3GEOuploadprj" style="top:0px;left:0px;cursor:pointer;"></p>' +
  119 + '</fieldset>';
  120 + if(i3GEO.parametros.editor === "sim"){
  121 + ins += '<fieldset class=subbloco >' +
  122 + '<p class="paragrafo" >'+$trad('pastaArmazenamento',i3GEOF.upload.dicionario)+':</p>' +
  123 + '<div class="i3geoForm i3geoFormIconeEdita" ><input type="text" name="dirDestino" id="dirDestino" /></div>' +
  124 + "&nbsp;<img onclick='i3GEO.util.navegadorDir(\"dirDestino\",false,false,false,true);' src='"+i3GEO.configura.locaplic+"/imagens/ic_zoom.png' style='cursor:pointer;position :relative;top:2px'/></p>" +
  125 + '<p class="paragrafo" ><input type=checkbox name=i3GEOuploadCriaMapfile id=i3GEOuploadCriaMapfile />&nbsp;'+$trad('criaMapfile',i3GEOF.upload.dicionario) +
  126 + '</fieldset>';
  127 + }
  128 + ins += '<fieldset class=subbloco >' +
  129 + '<p class="paragrafo" >'+$trad('tipoGeom',i3GEOF.upload.dicionario)+': </p>' +
  130 + ' <div class=styled-select >' +
  131 + ' <select id=tipo name=tipo >' +
  132 + ' <option value="">'+$trad('naoConhecido',i3GEOF.upload.dicionario)+'</option>' +
  133 + ' <option value="1">'+$trad('pontual',i3GEOF.upload.dicionario)+'</option>' +
  134 + ' <option value="5">'+$trad('poligonal',i3GEOF.upload.dicionario)+'</option>' +
  135 + ' <option value="3">'+$trad('linear',i3GEOF.upload.dicionario)+'</option>' +
  136 + ' </select>' +
  137 + '</div>' +
  138 + '<br><p class=paragrafo >'+$trad('projecao',i3GEOF.upload.dicionario)+':</p>' +
  139 + '<div id=i3GEOuploadListaepsg width="98%" style="text-align:left;border:1px solid gray;left:0px;overflow:auto;height:60px"></div>' +
  140 + '</fieldset>' +
  141 + '<fieldset class=subbloco >' +
  142 + '<p class="paragrafo" ><input id=i3GEOuploadbotao1 type="button" value="'+$trad('envia',i3GEOF.upload.dicionario)+'" size=12 name="submit">' +
  143 + '<input type=hidden name=g_sid value="'+i3GEO.configura.sid+'" >' +
  144 + '<input type="hidden" name="MAX_FILE_SIZE" value="1000000">' +
  145 + '</form>' +
  146 +
  147 + "<p class='paragrafo' style=color:red >"+$trad('ajudaCaracter',i3GEOF.upload.dicionario)+"</p>" +
  148 + '<iframe name=i3GEOuploadiframe style="text-align:left;border:1px solid gray;" width="98%" height="60px"></iframe>' +
  149 + '</fieldset>';
  150 + return ins;
  151 + },
  152 + /*
  153 + Function: iniciaJanelaFlutuante
  154 +
  155 + Cria a janela flutuante para controle da ferramenta.
  156 + */
  157 + iniciaJanelaFlutuante: function(){
  158 + var janela,divid,titulo,cabecalho,minimiza;
  159 + if ($i("i3GEOF.upload")) {
  160 + return;
  161 + }
  162 + cabecalho = function(){};
  163 + minimiza = function(){
  164 + i3GEO.janela.minimiza("i3GEOF.upload");
  165 + };
  166 + titulo = "<span class='i3GEOiconeFerramenta i3GEOiconeUpload'></span>"
  167 + + "<div class='i3GeoTituloJanela'>" + $trad("a2")+"<a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=4&idajuda=27' ><b> </b></a></div>";
  168 + janela = i3GEO.janela.cria(
  169 + "400px",
  170 + "480px",
  171 + "",
  172 + "",
  173 + "",
  174 + titulo,
  175 + "i3GEOF.upload",
  176 + false,
  177 + "hd",
  178 + cabecalho,
  179 + minimiza,
  180 + "",
  181 + true
  182 + );
  183 + divid = janela[2].id;
  184 + $i("i3GEOF.upload_corpo").style.backgroundColor = "white";
  185 + i3GEOF.upload.aguarde = $i("i3GEOF.upload_imagemCabecalho").style;
  186 + i3GEOF.upload.inicia(divid);
  187 + },
  188 + /*
  189 + Function: submete
  190 +
  191 + Submete o arquivo ao servidor
  192 + */
  193 + submete: function(){
  194 + if(i3GEOF.upload.aguarde.visibility==="visible")
  195 + {return;}
  196 + i3GEOF.upload.aguarde.visibility="visible";
  197 + $i("i3GEOuploadf").submit();
  198 + },
  199 + selNavegador: function(onde){
  200 + i3GEO.util.navegadorDir(onde,false,false,false);
  201 + }
  202 +};
  203 +
admin/js/subirsimbolo.js 0 → 100755
@@ -0,0 +1,166 @@ @@ -0,0 +1,166 @@
  1 +/*
  2 +Title: uploadsimbolo de arquivo de simbolo
  3 +
  4 +Envia para o servidor um arquivo shapefile local e insere como uma camada no mapa.
  5 +
  6 +Veja:
  7 +
  8 +<i3GEO.arvoreDeTemas.dialogo.uploadsimbolo>
  9 +
  10 +Arquivo: i3geo/ferramentas/uploadsimbolo/index.js.php
  11 +
  12 +About: Licen&ccedil;a
  13 +
  14 +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  15 +
  16 +Direitos Autorais Reservados (c) 2006 Minist&eacute;rio do Meio Ambiente Brasil
  17 +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
  18 +
  19 +Este programa &eacute; software livre; voc&ecirc; pode redistribu&iacute;-lo
  20 +e/ou modific&aacute;-lo sob os termos da Licen&ccedil;a P&uacute;blica Geral
  21 +GNU conforme publicada pela Free Software Foundation;
  22 +
  23 +Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til,
  24 +por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita
  25 +de COMERCIABILIDADE OU ADEQUA&Ccedil;&Atilde;O A UMA FINALIDADE ESPEC&Iacute;FICA.
  26 +Consulte a Licen&ccedil;a P&uacute;blica Geral do GNU para mais detalhes.
  27 +Voc&ecirc; deve ter recebido uma c&oacute;pia da Licen&ccedil;a P&uacute;blica Geral do
  28 +GNU junto com este programa; se n&atilde;o, escreva para a
  29 +Free Software Foundation, Inc., no endere&ccedil;o
  30 +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  31 +*/
  32 +if(typeof(i3GEOF) === 'undefined'){
  33 + var i3GEOF = {};
  34 +}
  35 +//TODO incluir icone de upload no botao de enviar
  36 +/*
  37 +Classe: i3GEOF.uploadsimbolo
  38 +*/
  39 +i3GEOF.uploadsimbolo = {
  40 + /*
  41 + Variavel: aguarde
  42 +
  43 + Estilo do objeto DOM com a imagem de aguarde existente no cabe&ccedil;alho da janela.
  44 + */
  45 + aguarde: "",
  46 + /*
  47 + Para efeitos de compatibilidade antes da vers&atilde;o 4.7 que n&atilde;o tinha dicion&aacute;rio
  48 + */
  49 + criaJanelaFlutuante: function(){
  50 + i3GEOF.uploadsimbolo.iniciaDicionario();
  51 + },
  52 + /*
  53 + Function: iniciaDicionario
  54 +
  55 + Carrega o dicion&aacute;rio e chama a fun&ccedil;&atilde;o que inicia a ferramenta
  56 +
  57 + O Javascript &eacute; carregado com o id i3GEOF.nomedaferramenta.dicionario_script
  58 + */
  59 + iniciaDicionario: function(){
  60 + if(typeof(i3GEOF.uploadsimbolo.dicionario) === 'undefined'){
  61 + i3GEO.util.scriptTag(
  62 + i3GEO.configura.locaplic+"/ferramentas/uploadsimbolo/dicionario.js",
  63 + "i3GEOF.uploadsimbolo.iniciaJanelaFlutuante()",
  64 + "i3GEOF.uploadsimbolo.dicionario_script"
  65 + );
  66 + }
  67 + else{
  68 + i3GEOF.uploadsimbolo.iniciaJanelaFlutuante();
  69 + }
  70 + },
  71 + /*
  72 + Function: inicia
  73 +
  74 + Inicia a ferramenta. &Eacute; chamado por criaJanelaFlutuante
  75 +
  76 + Parametro:
  77 +
  78 + iddiv {String} - id do div que receber&aacute; o conteudo HTML da ferramenta
  79 + */
  80 + inicia: function(iddiv){
  81 + try{
  82 + $i(iddiv).innerHTML += i3GEOF.uploadsimbolo.html();
  83 + var b = new YAHOO.widget.Button(
  84 + "i3GEOuploadsimbolobotao1",
  85 + {onclick:{fn: i3GEOF.uploadsimbolo.submete}}
  86 + );
  87 + b.addClass("rodar");
  88 + //pega a pasta default
  89 + }
  90 + catch(erro){i3GEO.janela.tempoMsg(erro);}
  91 + },
  92 + /*
  93 + Function: html
  94 +
  95 + Gera o c&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta
  96 +
  97 + Retorno:
  98 +
  99 + String com o c&oacute;digo html
  100 + */
  101 + html:function(){
  102 + var ins = '<form id=i3GEOuploadsimbolof target="i3GEOuploadsimboloiframe" action="../php/subirsimbolo.php" method="post" ENCTYPE="multipart/form-data">' +
  103 + '<p class="paragrafo" >'+$trad('escolha',i3GEOF.uploadsimbolo.dicionario)+': <br><br><input type="file" size=42 name="i3GEOuploadsimboloarq" style="top:0px;left:0px;cursor:pointer;"></p>';
  104 + if(i3GEO.parametros.editor === "sim"){
  105 + ins += '<p class="paragrafo" >'+$trad('pastaArmazenamento',i3GEOF.uploadsimbolo.dicionario)+':</p><div class="i3geoForm i3geoFormIconeEdita" style="width:300px;" ><input class=digitar type="text" name="dirDestino" id="dirDestino" ></div>';
  106 + //ins += "<img onclick='i3GEOF.uploadsimbolo.selNavegador(\"dirDestino\")' src='"+limg+"' style='cursor:pointer;position :relative;top:2px'/></p>";
  107 + }
  108 + ins += '<br><p class="paragrafo" ><input id=i3GEOuploadsimbolobotao1 type="button" value="'+$trad('envia',i3GEOF.uploadsimbolo.dicionario)+'" size=12 name="submit">' +
  109 + '<input type=hidden name=g_sid value="'+i3GEO.configura.sid+'" >' +
  110 + '<input type="hidden" name="MAX_FILE_SIZE" value="1000000">' +
  111 + '</form>' +
  112 + "<p class='paragrafo' style=color:red >"+$trad('ajudaCaracter',i3GEOF.uploadsimbolo.dicionario)+"</p>" +
  113 + '<iframe name=i3GEOuploadsimboloiframe style="text-align:left;border:1px solid gray;" width="98%" height="60px"></iframe>';
  114 + return ins;
  115 + },
  116 + /*
  117 + Function: iniciaJanelaFlutuante
  118 +
  119 + Cria a janela flutuante para controle da ferramenta.
  120 + */
  121 + iniciaJanelaFlutuante: function(){
  122 + var janela,divid,titulo,cabecalho,minimiza;
  123 + if ($i("i3GEOF.uploadsimbolo")) {
  124 + return;
  125 + }
  126 + cabecalho = function(){};
  127 + minimiza = function(){
  128 + i3GEO.janela.minimiza("i3GEOF.uploadsimbolo");
  129 + };
  130 + titulo = "<div class='i3GeoTituloJanela'>PNG<a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=4&idajuda=116' ><b> </b></a></div>";
  131 + janela = i3GEO.janela.cria(
  132 + "355px",
  133 + "470px",
  134 + "",
  135 + "",
  136 + "",
  137 + titulo,
  138 + "i3GEOF.uploadsimbolo",
  139 + false,
  140 + "hd",
  141 + cabecalho,
  142 + minimiza,
  143 + "",
  144 + true,
  145 + i3GEO.configura.locaplic+"/imagens/oxygen/16x16/svn-commit.png"
  146 + );
  147 + divid = janela[2].id;
  148 + $i("i3GEOF.uploadsimbolo_corpo").style.backgroundColor = "white";
  149 + i3GEOF.uploadsimbolo.aguarde = $i("i3GEOF.uploadsimbolo_imagemCabecalho").style;
  150 + i3GEOF.uploadsimbolo.inicia(divid);
  151 + },
  152 + /*
  153 + Function: submete
  154 +
  155 + Submete o arquivo ao servidor
  156 + */
  157 + submete: function(){
  158 + if(i3GEOF.uploadsimbolo.aguarde.visibility==="visible")
  159 + {return;}
  160 + i3GEOF.uploadsimbolo.aguarde.visibility="visible";
  161 + $i("i3GEOuploadsimbolof").submit();
  162 + },
  163 + selNavegador: function(onde){
  164 + i3GEO.util.navegadorDir(onde,false,false,false);
  165 + }
  166 +};
0 \ No newline at end of file 167 \ No newline at end of file
admin/menu.html
@@ -195,11 +195,6 @@ a { @@ -195,11 +195,6 @@ a {
195 type: "html", 195 type: "html",
196 enableHighlight: false, 196 enableHighlight: false,
197 197
198 - },{  
199 - html: "<a href='html/subirsimbolo.html' target='principal'><img src='imagens/open.png' />"+$trad("uploadSimbolo",i3GEOadmin.menup.dicionario)+"</a>",  
200 - type: "html",  
201 - enableHighlight: false,  
202 -  
203 } 198 }
204 ]},{ 199 ]},{
205 html: $trad("editaMapfile",i3GEOadmin.menup.dicionario), 200 html: $trad("editaMapfile",i3GEOadmin.menup.dicionario),
admin/php/admin.php
@@ -41,7 +41,8 @@ if(!file_exists($dir_tmp)){ @@ -41,7 +41,8 @@ if(!file_exists($dir_tmp)){
41 @mkdir ($dir_tmp,0744); 41 @mkdir ($dir_tmp,0744);
42 chmod($dir_tmp,0744); 42 chmod($dir_tmp,0744);
43 } 43 }
44 -include_once($locaplic."/classesphp/pega_variaveis.php"); 44 +//TODO retirar daqui
  45 +//include_once($locaplic."/classesphp/pega_variaveis.php");
45 error_reporting(0); 46 error_reporting(0);
46 47
47 // 48 //
@@ -66,7 +67,8 @@ if(!empty($esquemaadmin)){ @@ -66,7 +67,8 @@ if(!empty($esquemaadmin)){
66 function testaNumerico($valores){ 67 function testaNumerico($valores){
67 foreach ($valores as $valor) { 68 foreach ($valores as $valor) {
68 if(!empty($valor) && !is_numeric($valor)) { 69 if(!empty($valor) && !is_numeric($valor)) {
69 - echo "valor nao numerico"; 70 + ob_clean();
  71 + header ( "HTTP/1.1 403 valor nao numerico" );
70 exit; 72 exit;
71 } 73 }
72 } 74 }
admin/php/arvore.php
@@ -42,6 +42,9 @@ Cada opera&amp;ccedil;&amp;atilde;o possu&amp;iacute; seus próprios par&amp;acirc;metros, que de @@ -42,6 +42,9 @@ Cada opera&amp;ccedil;&amp;atilde;o possu&amp;iacute; seus próprios par&amp;acirc;metros, que de
42 42
43 */ 43 */
44 include_once(dirname(__FILE__)."/login.php"); 44 include_once(dirname(__FILE__)."/login.php");
  45 +$id = $_GET["id"];
  46 +testaNumerico([$id]);
  47 +
45 $funcoesEdicao = array( 48 $funcoesEdicao = array(
46 "ADICIONARTEMARAIZ", 49 "ADICIONARTEMARAIZ",
47 "ADICIONARTEMARAIZGRUPO", 50 "ADICIONARTEMARAIZGRUPO",
@@ -69,6 +72,7 @@ if($idioma == &quot;&quot;) @@ -69,6 +72,7 @@ if($idioma == &quot;&quot;)
69 { 72 {
70 $idioma = "pt"; 73 $idioma = "pt";
71 } 74 }
  75 +
72 error_reporting(0); 76 error_reporting(0);
73 //faz a busca da fun&ccedil;&atilde;o que deve ser executada 77 //faz a busca da fun&ccedil;&atilde;o que deve ser executada
74 switch (strtoupper($funcao)) 78 switch (strtoupper($funcao))
@@ -539,7 +543,8 @@ switch (strtoupper($funcao)) @@ -539,7 +543,8 @@ switch (strtoupper($funcao))
539 Altera o registro de um n&iacute;vel 3 (temas) 543 Altera o registro de um n&iacute;vel 3 (temas)
540 */ 544 */
541 function alteraN3(){ 545 function alteraN3(){
542 - global $publicado,$n3_perfil,$id,$id_n2,$id_tema,$ordem,$esquemaadmin; 546 + global $publicado,$id,$id_n2,$id_tema,$ordem,$esquemaadmin;
  547 + $n3_perfil = $_GET["n3_perfil"];
543 try { 548 try {
544 require_once("conexao.php"); 549 require_once("conexao.php");
545 if($id != ""){ 550 if($id != ""){
@@ -576,7 +581,8 @@ function alteraN3(){ @@ -576,7 +581,8 @@ function alteraN3(){
576 Altera o registro de um n&iacute;vel 2 581 Altera o registro de um n&iacute;vel 2
577 */ 582 */
578 function alteraN2(){ 583 function alteraN2(){
579 - global $publicado,$n2_perfil,$id,$id_subgrupo,$id_n1,$esquemaadmin; 584 + global $publicado,$id,$id_subgrupo,$id_n1,$esquemaadmin;
  585 + $n2_perfil = $_GET["n2_perfil"];
580 try { 586 try {
581 require("conexao.php"); 587 require("conexao.php");
582 if($id != ""){ 588 if($id != ""){
@@ -612,7 +618,8 @@ function alteraN2(){ @@ -612,7 +618,8 @@ function alteraN2(){
612 Altera o registro de um n&iacute;vel 1 (grupos) 618 Altera o registro de um n&iacute;vel 1 (grupos)
613 */ 619 */
614 function alteraN1(){ 620 function alteraN1(){
615 - global $publicado,$n1_perfil,$id_grupo,$id,$id_menu,$esquemaadmin; 621 + global $publicado,$id_grupo,$id,$id_menu,$esquemaadmin;
  622 + $n1_perfil = $_GET["n1_perfil"];
616 try{ 623 try{
617 require("conexao.php"); 624 require("conexao.php");
618 if($id != ""){ 625 if($id != ""){
admin/php/atlas.php
@@ -40,6 +40,13 @@ Cada opera&amp;ccedil;&amp;atilde;o possu&amp;iacute; seus proprios par&amp;acirc;metros, que de @@ -40,6 +40,13 @@ Cada opera&amp;ccedil;&amp;atilde;o possu&amp;iacute; seus proprios par&amp;acirc;metros, que de
40 40
41 */ 41 */
42 include_once(dirname(__FILE__)."/login.php"); 42 include_once(dirname(__FILE__)."/login.php");
  43 +
  44 +$id = $_GET["id"];
  45 +$id_atlas = $_GET["id_atlas"];
  46 +$id_prancha = $_GET["id_prancha"];
  47 +
  48 +testaSafeNumerico([$id,$id_atlas,$id_prancha]);
  49 +
43 $funcoesEdicao = array( 50 $funcoesEdicao = array(
44 "ALTERARATLAS", 51 "ALTERARATLAS",
45 "ALTERARPRANCHA", 52 "ALTERARPRANCHA",
@@ -437,27 +444,27 @@ function dadosAtlas() @@ -437,27 +444,27 @@ function dadosAtlas()
437 } 444 }
438 function alterarAtlas() 445 function alterarAtlas()
439 { 446 {
440 - global $esquemaadmin,$publicado_atlas,$id_atlas,$basemapfile_atlas,$desc_atlas,$h_atlas,$w_atlas,$icone_atlas,$link_atlas,$pranchadefault_atlas,$template_atlas,$tipoguias_atlas,$titulo_atlas,$ordem_atlas; 447 + global $esquemaadmin,$id_atlas;
441 try{ 448 try{
442 include("conexao.php"); 449 include("conexao.php");
443 if($id_atlas != ""){ 450 if($id_atlas != ""){
444 if($convUTF){ 451 if($convUTF){
445 - $desc_atlas = utf8_encode($desc_atlas);  
446 - $titulo_atlas = utf8_encode($titulo_atlas); 452 + $_GET["desc_atlas"] = utf8_encode($_GET["desc_atlas"]);
  453 + $_GET["titulo_atlas"] = utf8_encode($_GET["titulo_atlas"]);
447 } 454 }
448 $dataCol = array( 455 $dataCol = array(
449 - "publicado_atlas"=>$publicado_atlas,  
450 - "ordem_atlas"=>$ordem_atlas == "" ? 0 : $ordem_atlas,  
451 - "basemapfile_atlas"=>$basemapfile_atlas,  
452 - "desc_atlas"=>$desc_atlas,  
453 - "h_atlas"=>$h_atlas == "" ? 0 : $h_atlas,  
454 - "w_atlas"=>$w_atlas == "" ? 0 : $w_atlas,  
455 - "icone_atlas"=>$icone_atlas,  
456 - "link_atlas"=>$link_atlas,  
457 - "pranchadefault_atlas"=>$pranchadefault_atlas,  
458 - "template_atlas"=>$template_atlas,  
459 - "tipoguias_atlas"=>$tipoguias_atlas,  
460 - "titulo_atlas"=>$titulo_atlas 456 + "publicado_atlas"=>$_GET["publicado_atlas"],
  457 + "ordem_atlas"=>$_GET["ordem_atlas"] == "" ? 0 : $_GET["ordem_atlas"],
  458 + "basemapfile_atlas"=>$_GET["basemapfile_atlas"],
  459 + "desc_atlas"=>$_GET["desc_atlas"],
  460 + "h_atlas"=>$_GET["h_atlas"] == "" ? 0 : $_GET["h_atlas"],
  461 + "w_atlas"=>$_GET["w_atlas"] == "" ? 0 : $_GET["w_atlas"],
  462 + "icone_atlas"=>$_GET["icone_atlas"],
  463 + "link_atlas"=>$_GET["link_atlas"],
  464 + "pranchadefault_atlas"=>$_GET["pranchadefault_atlas"],
  465 + "template_atlas"=>$_GET["template_atlas"],
  466 + "tipoguias_atlas"=>$_GET["tipoguias_atlas"],
  467 + "titulo_atlas"=>$_GET["titulo_atlas"]
461 ); 468 );
462 i3GeoAdminUpdate($dbhw,"i3geoadmin_atlas",$dataCol,"WHERE id_atlas = $id_atlas"); 469 i3GeoAdminUpdate($dbhw,"i3geoadmin_atlas",$dataCol,"WHERE id_atlas = $id_atlas");
463 $retorna = $id_atlas; 470 $retorna = $id_atlas;
@@ -492,23 +499,24 @@ function alterarAtlas() @@ -492,23 +499,24 @@ function alterarAtlas()
492 } 499 }
493 function alterarPrancha() 500 function alterarPrancha()
494 { 501 {
495 - global $esquemaadmin,$mapext_prancha,$id_atlas,$id_prancha,$desc_prancha,$h_prancha,$w_prancha,$icone_prancha,$link_prancha,$titulo_prancha,$ordem_prancha; 502 + global $esquemaadmin,$id_atlas,$id_prancha;
  503 +
496 try{ 504 try{
497 include("conexao.php"); 505 include("conexao.php");
498 if($id_prancha != ""){ 506 if($id_prancha != ""){
499 if($convUTF){ 507 if($convUTF){
500 - $desc_prancha = utf8_encode($desc_prancha);  
501 - $titulo_prancha = utf8_encode($titulo_prancha); 508 + $_GET["desc_prancha"] = utf8_encode($_GET["desc_prancha"]);
  509 + $_GET["titulo_prancha"] = utf8_encode($_GET["titulo_prancha"]);
502 } 510 }
503 $dataCol = array( 511 $dataCol = array(
504 - "ordem_prancha"=>$ordem_prancha,  
505 - "mapext_prancha"=>$mapext_prancha,  
506 - "desc_prancha"=>$desc_prancha,  
507 - "h_prancha"=>$h_prancha == "" ? 0 : $h_prancha,  
508 - "w_prancha"=>$w_prancha == "" ? 0 : $w_prancha,  
509 - "icone_prancha"=>$icone_prancha,  
510 - "link_prancha"=>$link_prancha,  
511 - "titulo_prancha"=>$titulo_prancha 512 + "ordem_prancha"=>$_GET["ordem_prancha"],
  513 + "mapext_prancha"=>$_GET["mapext_prancha"],
  514 + "desc_prancha"=>$_GET["desc_prancha"],
  515 + "h_prancha"=>$_GET["h_prancha"] == "" ? 0 : $_GET["h_prancha"],
  516 + "w_prancha"=>$_GET["w_prancha"] == "" ? 0 : $_GET["w_prancha"],
  517 + "icone_prancha"=>$_GET["icone_prancha"],
  518 + "link_prancha"=>$_GET["link_prancha"],
  519 + "titulo_prancha"=>$_GET["titulo_prancha"]
512 ); 520 );
513 i3GeoAdminUpdate($dbhw,"i3geoadmin_atlasp",$dataCol,"WHERE id_prancha = $id_prancha"); 521 i3GeoAdminUpdate($dbhw,"i3geoadmin_atlasp",$dataCol,"WHERE id_prancha = $id_prancha");
514 $retorna = $id_prancha; 522 $retorna = $id_prancha;
@@ -522,8 +530,8 @@ function alterarPrancha() @@ -522,8 +530,8 @@ function alterarPrancha()
522 "ordem_prancha"=>$o, 530 "ordem_prancha"=>$o,
523 "mapext_prancha"=>'', 531 "mapext_prancha"=>'',
524 "desc_prancha"=>'', 532 "desc_prancha"=>'',
525 - "h_prancha"=>$h_prancha == "" ? 0 : $h_prancha,  
526 - "w_prancha"=>$w_prancha == "" ? 0 : $w_prancha, 533 + "h_prancha"=>$_GET["h_prancha"] == "" ? 0 : $_GET["h_prancha"],
  534 + "w_prancha"=>$_GET["w_prancha"] == "" ? 0 : $_GET["w_prancha"],
527 "icone_prancha"=>'', 535 "icone_prancha"=>'',
528 "link_prancha"=>'', 536 "link_prancha"=>'',
529 "titulo_prancha"=>'', 537 "titulo_prancha"=>'',
@@ -540,14 +548,14 @@ function alterarPrancha() @@ -540,14 +548,14 @@ function alterarPrancha()
540 } 548 }
541 } 549 }
542 function alterarTema(){ 550 function alterarTema(){
543 - global $esquemaadmin,$id_tema,$id_prancha,$codigo_tema,$ligado_tema,$ordem_tema; 551 + global $esquemaadmin,$id_tema,$id_prancha;
544 try{ 552 try{
545 include("conexao.php"); 553 include("conexao.php");
546 if($id_tema != ""){ 554 if($id_tema != ""){
547 $dataCol = array( 555 $dataCol = array(
548 - "ordem_tema"=>$ordem_tema,  
549 - "codigo_tema"=>$codigo_tema,  
550 - "ligado_tema"=>$ligado_tema 556 + "ordem_tema"=>$_GET["ordem_tema"],
  557 + "codigo_tema"=>$_GET["codigo_tema"],
  558 + "ligado_tema"=>$_GET["ligado_tema"]
551 ); 559 );
552 i3GeoAdminUpdate($dbhw,"i3geoadmin_atlast",$dataCol,"WHERE id_tema = $id_tema"); 560 i3GeoAdminUpdate($dbhw,"i3geoadmin_atlast",$dataCol,"WHERE id_tema = $id_tema");
553 $retorna = $id_tema; 561 $retorna = $id_tema;
@@ -558,8 +566,8 @@ function alterarTema(){ @@ -558,8 +566,8 @@ function alterarTema(){
558 $o = $o[0]['o'] + 1; 566 $o = $o[0]['o'] + 1;
559 $dataCol = array( 567 $dataCol = array(
560 "ordem_tema"=>$o, 568 "ordem_tema"=>$o,
561 - "codigo_tema"=>$codigo_tema,  
562 - "ligado_tema"=>$ligado_tema, 569 + "codigo_tema"=>$_GET["codigo_tema"],
  570 + "ligado_tema"=>$_GET["ligado_tema"],
563 "id_prancha"=>$id_prancha 571 "id_prancha"=>$id_prancha
564 ); 572 );
565 $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_atlast",$dataCol,"codigo_tema","id_tema"); 573 $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_atlast",$dataCol,"codigo_tema","id_tema");
admin/php/classe_arvore.php
@@ -92,7 +92,7 @@ class Arvore @@ -92,7 +92,7 @@ class Arvore
92 else{ 92 else{
93 $coluna = $idioma; 93 $coluna = $idioma;
94 } 94 }
95 - $this->sql_grupos = "select CASE i3geoadmin_grupos.$coluna WHEN '' THEN nome_grupo ELSE i3geoadmin_grupos.$coluna END as nome_grupo,id_n1,id_menu,i3geoadmin_n1.publicado,n1_perfil from ".$this->esquemaadmin."i3geoadmin_n1 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_grupos ON i3geoadmin_n1.id_grupo = i3geoadmin_grupos.id_grupo "; 95 + $this->sql_grupos = "select CASE i3geoadmin_grupos.$coluna WHEN '' THEN nome_grupo ELSE i3geoadmin_grupos.$coluna END as nome_grupo,i3geoadmin_grupos.id_grupo, id_n1,id_menu,i3geoadmin_n1.publicado,n1_perfil,ordem from ".$this->esquemaadmin."i3geoadmin_n1 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_grupos ON i3geoadmin_n1.id_grupo = i3geoadmin_grupos.id_grupo ";
96 if($filtro === "ogc" || $filtro === "download"){ 96 if($filtro === "ogc" || $filtro === "download"){
97 //esse sql retorna tambem os grupos dos temas que estao na raiz do grupo 97 //esse sql retorna tambem os grupos dos temas que estao na raiz do grupo
98 $this->sql_grupos = "select DISTINCT * from (select CASE grupos.$coluna WHEN '' THEN nome_grupo ELSE grupos.$coluna END as nome_grupo,gr.id_n1,gr.id_menu,gr.publicado,gr.n1_perfil, 0 as ordem from ".$this->esquemaadmin."i3geoadmin_grupos as grupos, ".$this->esquemaadmin."i3geoadmin_n1 as gr, ".$this->esquemaadmin."i3geoadmin_n2 as sg, ".$this->esquemaadmin."i3geoadmin_n3 as t, ".$this->esquemaadmin."i3geoadmin_temas as temas where gr.id_grupo = grupos.id_grupo AND sg.id_n1 = gr.id_n1 AND t.id_n2 = sg.id_n2 AND t.id_tema = temas.id_tema AND (temas.ogc_tema NOT IN ('NAO','nao') OR temas.download_tema NOT IN ('NAO','nao') ) UNION select c.nome_grupo as nome_grupo,a.id_nivel as id_n1,a.id_menu,'SIM' as publicado,a.perfil as n1_perfil, 0 as ordem from ".$this->esquemaadmin."i3geoadmin_raiz as a, ".$this->esquemaadmin."i3geoadmin_temas as b, ".$this->esquemaadmin."i3geoadmin_grupos as c, ".$this->esquemaadmin."i3geoadmin_n1 as d where nivel = 1 AND a.id_tema = b.id_tema AND a.id_nivel = d.id_n1 AND d.id_grupo = c.id_grupo) as s "; 98 $this->sql_grupos = "select DISTINCT * from (select CASE grupos.$coluna WHEN '' THEN nome_grupo ELSE grupos.$coluna END as nome_grupo,gr.id_n1,gr.id_menu,gr.publicado,gr.n1_perfil, 0 as ordem from ".$this->esquemaadmin."i3geoadmin_grupos as grupos, ".$this->esquemaadmin."i3geoadmin_n1 as gr, ".$this->esquemaadmin."i3geoadmin_n2 as sg, ".$this->esquemaadmin."i3geoadmin_n3 as t, ".$this->esquemaadmin."i3geoadmin_temas as temas where gr.id_grupo = grupos.id_grupo AND sg.id_n1 = gr.id_n1 AND t.id_n2 = sg.id_n2 AND t.id_tema = temas.id_tema AND (temas.ogc_tema NOT IN ('NAO','nao') OR temas.download_tema NOT IN ('NAO','nao') ) UNION select c.nome_grupo as nome_grupo,a.id_nivel as id_n1,a.id_menu,'SIM' as publicado,a.perfil as n1_perfil, 0 as ordem from ".$this->esquemaadmin."i3geoadmin_raiz as a, ".$this->esquemaadmin."i3geoadmin_temas as b, ".$this->esquemaadmin."i3geoadmin_grupos as c, ".$this->esquemaadmin."i3geoadmin_n1 as d where nivel = 1 AND a.id_tema = b.id_tema AND a.id_nivel = d.id_n1 AND d.id_grupo = c.id_grupo) as s ";
@@ -104,7 +104,7 @@ class Arvore @@ -104,7 +104,7 @@ class Arvore
104 else{ 104 else{
105 $coluna = $idioma; 105 $coluna = $idioma;
106 } 106 }
107 - $this->sql_subgrupos = "select CASE i3geoadmin_subgrupos.$coluna WHEN '' THEN nome_subgrupo ELSE i3geoadmin_subgrupos.$coluna END as nome_subgrupo,i3geoadmin_n2.id_n2,i3geoadmin_n2.publicado,i3geoadmin_n2.n2_perfil from ".$this->esquemaadmin."i3geoadmin_n2 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_subgrupos ON i3geoadmin_n2.id_subgrupo = i3geoadmin_subgrupos.id_subgrupo "; 107 + $this->sql_subgrupos = "select CASE i3geoadmin_subgrupos.$coluna WHEN '' THEN nome_subgrupo ELSE i3geoadmin_subgrupos.$coluna END as nome_subgrupo,i3geoadmin_subgrupos.id_subgrupo,i3geoadmin_n2.id_n2,i3geoadmin_n2.publicado,i3geoadmin_n2.n2_perfil from ".$this->esquemaadmin."i3geoadmin_n2 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_subgrupos ON i3geoadmin_n2.id_subgrupo = i3geoadmin_subgrupos.id_subgrupo ";
108 108
109 if($idioma == "pt"){ 109 if($idioma == "pt"){
110 $coluna = "nome_tema"; 110 $coluna = "nome_tema";
@@ -113,7 +113,7 @@ class Arvore @@ -113,7 +113,7 @@ class Arvore
113 $coluna = $idioma; 113 $coluna = $idioma;
114 } 114 }
115 115
116 - $this->sql_temasraiz = "select codigo_tema,id_raiz,i3geoadmin_raiz.id_tema,CASE $coluna WHEN '' THEN nome_tema ELSE $coluna END as nome_tema,tipoa_tema,perfil, ogc_tema, download_tema, link_tema FROM ".$this->esquemaadmin."i3geoadmin_raiz LEFT JOIN ".$this->esquemaadmin."i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema "; 116 + $this->sql_temasraiz = "select id_nivel,ordem,codigo_tema,id_raiz,i3geoadmin_raiz.id_tema,CASE $coluna WHEN '' THEN nome_tema ELSE $coluna END as nome_tema,tipoa_tema,perfil, ogc_tema, download_tema, link_tema FROM ".$this->esquemaadmin."i3geoadmin_raiz LEFT JOIN ".$this->esquemaadmin."i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema ";
117 $this->sql_temasSubgrupo = "select i3geoadmin_temas.tipoa_tema, i3geoadmin_temas.codigo_tema,i3geoadmin_temas.tags_tema,i3geoadmin_n3.id_n3,CASE i3geoadmin_temas.$coluna WHEN '' THEN nome_tema ELSE i3geoadmin_temas.$coluna END as nome_tema,i3geoadmin_n3.publicado,i3geoadmin_n3.n3_perfil,i3geoadmin_n3.id_tema,i3geoadmin_temas.download_tema,i3geoadmin_temas.ogc_tema from ".$this->esquemaadmin."i3geoadmin_n3 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_temas ON i3geoadmin_n3.id_tema = i3geoadmin_temas.id_tema "; 117 $this->sql_temasSubgrupo = "select i3geoadmin_temas.tipoa_tema, i3geoadmin_temas.codigo_tema,i3geoadmin_temas.tags_tema,i3geoadmin_n3.id_n3,CASE i3geoadmin_temas.$coluna WHEN '' THEN nome_tema ELSE i3geoadmin_temas.$coluna END as nome_tema,i3geoadmin_n3.publicado,i3geoadmin_n3.n3_perfil,i3geoadmin_n3.id_tema,i3geoadmin_temas.download_tema,i3geoadmin_temas.ogc_tema from ".$this->esquemaadmin."i3geoadmin_n3 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_temas ON i3geoadmin_n3.id_tema = i3geoadmin_temas.id_tema ";
118 118
119 //$this->sql_temas = "select kmz_tema,nacessos,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,$coluna as nome_tema,codigo_tema from i3geoadmin_temas "; 119 //$this->sql_temas = "select kmz_tema,nacessos,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,$coluna as nome_tema,codigo_tema from i3geoadmin_temas ";
@@ -201,6 +201,54 @@ class Arvore @@ -201,6 +201,54 @@ class Arvore
201 return $resultado; 201 return $resultado;
202 } 202 }
203 /* 203 /*
  204 + Function: pegaListaDeTiposGrupos
  205 +
  206 + Retorna a lista de grupos de um menu
  207 +
  208 + Parametros:
  209 +
  210 + id_menu {string}
  211 +
  212 + Return:
  213 +
  214 + {array}
  215 + */
  216 + function pegaListaDeTiposGrupos(){
  217 + if($this->idioma == "pt"){
  218 + $coluna = "nome_grupo";
  219 + }
  220 + else{
  221 + $coluna = $this->idioma;
  222 + }
  223 + $sql = "select CASE i3geoadmin_grupos.$coluna WHEN '' THEN nome_grupo ELSE i3geoadmin_grupos.$coluna END as nome_grupo, id_grupo from ".$this->esquemaadmin."i3geoadmin_grupos ORDER by nome_grupo ";
  224 + $grupos = $this->execSQL($sql);
  225 + return $grupos;
  226 + }
  227 + /*
  228 + Function: pegaListaDeTiposSubGrupos
  229 +
  230 + Retorna a lista de grupos de um menu
  231 +
  232 + Parametros:
  233 +
  234 + id_menu {string}
  235 +
  236 + Return:
  237 +
  238 + {array}
  239 + */
  240 + function pegaListaDeTiposSubGrupos(){
  241 + if($this->idioma == "pt"){
  242 + $coluna = "nome_subgrupo";
  243 + }
  244 + else{
  245 + $coluna = $this->idioma;
  246 + }
  247 + $sql = "select CASE i3geoadmin_subgrupos.$coluna WHEN '' THEN nome_subgrupo ELSE i3geoadmin_subgrupos.$coluna END as nome_subgrupo, id_subgrupo from ".$this->esquemaadmin."i3geoadmin_subgrupos ORDER by nome_subgrupo ";
  248 + $subgrupos = $this->execSQL($sql);
  249 + return $subgrupos;
  250 + }
  251 + /*
204 Function: procuraTemas 252 Function: procuraTemas
205 253
206 Localiza temas conforme uma palavra de busca 254 Localiza temas conforme uma palavra de busca
@@ -584,7 +632,12 @@ class Arvore @@ -584,7 +632,12 @@ class Arvore
584 } 632 }
585 $f = implode(" AND ",$ff) . " AND "; 633 $f = implode(" AND ",$ff) . " AND ";
586 } 634 }
587 - $raiz = $this->execSQL($this->sql_temasraiz."where $f i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel = $id_n1 order by ordem"); 635 + if($id_n1 == ""){
  636 + $raiz = $this->execSQL($this->sql_temasraiz."where $f i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel > 0 order by ordem");
  637 + }
  638 + else {
  639 + $raiz = $this->execSQL($this->sql_temasraiz."where $f i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel = $id_n1 order by ordem");
  640 + }
588 $raiz = $this->validaTemas($raiz,"codigo_tema"); 641 $raiz = $this->validaTemas($raiz,"codigo_tema");
589 return $raiz; 642 return $raiz;
590 } 643 }
@@ -732,17 +785,21 @@ class Arvore @@ -732,17 +785,21 @@ class Arvore
732 if(count($dados["grupos"]) == 0){ 785 if(count($dados["grupos"]) == 0){
733 $grupos[] = array(); 786 $grupos[] = array();
734 } 787 }
  788 + $raizgrupos = $this->pegaTemasRaizGrupo($id_menu,"",$filtraOgc,$filtraDown);
  789 + //var_dump($raizgrupos);exit;
735 foreach($dados["grupos"] as $grupo) { 790 foreach($dados["grupos"] as $grupo) {
736 $a = $grupo["n1_perfil"]; 791 $a = $grupo["n1_perfil"];
737 $a = str_replace(" ",",",$a); 792 $a = str_replace(" ",",",$a);
738 if($this->verificaOcorrencia($perfil,explode(",",$a)) == true) 793 if($this->verificaOcorrencia($perfil,explode(",",$a)) == true)
739 { 794 {
740 $temas = array(); 795 $temas = array();
741 - $raizgrupo = $this->pegaTemasRaizGrupo($id_menu,$grupo["id_n1"],$filtraOgc,$filtraDown); 796 + //$raizgrupo = $this->pegaTemasRaizGrupo($id_menu,$grupo["id_n1"],$filtraOgc,$filtraDown);
742 $grupodown = "nao"; 797 $grupodown = "nao";
743 $grupoogc = "nao"; 798 $grupoogc = "nao";
744 - foreach($raizgrupo as $tema){  
745 - $temas[] = $this->formataTema($tema["id_tema"]); 799 + foreach($raizgrupos as $tema){
  800 + if($tema["id_nivel"] == $grupo["id_n1"]){
  801 + $temas[] = $this->formataTema($tema["id_tema"]);
  802 + }
746 } 803 }
747 if($temas > 0){ 804 if($temas > 0){
748 $grupodown = "sim"; 805 $grupodown = "sim";
admin/php/classe_metaestat.php
@@ -679,7 +679,7 @@ class Metaestat{ @@ -679,7 +679,7 @@ class Metaestat{
679 $dados[] = ' METADATA'; 679 $dados[] = ' METADATA';
680 $dados[] = ' TEMA "'.$titulolayer.'"'; 680 $dados[] = ' TEMA "'.$titulolayer.'"';
681 $dados[] = ' tme "{\"titulo\":\"'.$titulolayer.'\",\"colnome\":\"'.$sql["nomeregiao"].'\",\"colsdata\":[\"'.$sql["colunavalor"].'\"],\"lmax\":\"8000\",\"amax\":\"500000\",\"outlinecolor\":\"-1,-1,-1\",\"numvertices\":\"4\",\"auto\":\"nao\",\"exec\":\"nao\"}"'; 681 $dados[] = ' tme "{\"titulo\":\"'.$titulolayer.'\",\"colnome\":\"'.$sql["nomeregiao"].'\",\"colsdata\":[\"'.$sql["colunavalor"].'\"],\"lmax\":\"8000\",\"amax\":\"500000\",\"outlinecolor\":\"-1,-1,-1\",\"numvertices\":\"4\",\"auto\":\"nao\",\"exec\":\"nao\"}"';
682 - 682 +
683 $dados[] = ' TIP "'.$sql["colunavalor"].','.$sql["nomeregiao"].'"'; 683 $dados[] = ' TIP "'.$sql["colunavalor"].','.$sql["nomeregiao"].'"';
684 $dados[] = ' CLASSE "SIM"'; 684 $dados[] = ' CLASSE "SIM"';
685 $dados[] = ' permitedownload "SIM"'; 685 $dados[] = ' permitedownload "SIM"';
admin/php/editormapfile.php
@@ -40,6 +40,15 @@ Cada opera&amp;ccedil;&amp;atilde;o possu&amp;iacute; seus proprios par&amp;acirc;metros, que de @@ -40,6 +40,15 @@ Cada opera&amp;ccedil;&amp;atilde;o possu&amp;iacute; seus proprios par&amp;acirc;metros, que de
40 40
41 */ 41 */
42 include_once(dirname(__FILE__)."/login.php"); 42 include_once(dirname(__FILE__)."/login.php");
  43 +
  44 +$id = $_GET["id"];
  45 +
  46 +testaSafeNumerico([$id]);
  47 +
  48 +$codigoMap = $_GET["codigoMap"];
  49 +$codigoLayer = $_GET["codigoLayer"];
  50 +$movimento = $_GET["movimento"];
  51 +
43 $funcoesEdicao = array( 52 $funcoesEdicao = array(
44 "CRIARNOVOMAP", 53 "CRIARNOVOMAP",
45 "EDITASIMBOLO", 54 "EDITASIMBOLO",
@@ -68,7 +77,8 @@ $funcoesEdicao = array( @@ -68,7 +77,8 @@ $funcoesEdicao = array(
68 "ALTERAREDITAVEL", 77 "ALTERAREDITAVEL",
69 "PEGAPLUGIN", 78 "PEGAPLUGIN",
70 "GRAVAPLUGIN", 79 "GRAVAPLUGIN",
71 - "REMOVEPLUGIN" 80 + "REMOVEPLUGIN",
  81 + "DOWNLOADGVP"
72 ); 82 );
73 if(in_array(strtoupper($funcao),$funcoesEdicao)){ 83 if(in_array(strtoupper($funcao),$funcoesEdicao)){
74 if(verificaOperacaoSessao("admin/html/editormapfile") == false){ 84 if(verificaOperacaoSessao("admin/html/editormapfile") == false){
@@ -91,8 +101,10 @@ error_reporting(0); @@ -91,8 +101,10 @@ error_reporting(0);
91 //algumas funcoes podem ser inseridas com include em outros programas 101 //algumas funcoes podem ser inseridas com include em outros programas
92 //nesse caso, defina output como "retorno" 102 //nesse caso, defina output como "retorno"
93 //caso contrario sera definido como json 103 //caso contrario sera definido como json
94 -if(empty($output)){ 104 +if(empty($_GET["output"])){
95 $output = "json"; 105 $output = "json";
  106 +} else {
  107 + $output = $_GET["output"];
96 } 108 }
97 //faz a busca da fun&ccedil;&atilde;o que deve ser executada 109 //faz a busca da fun&ccedil;&atilde;o que deve ser executada
98 switch (strtoupper($funcao)) 110 switch (strtoupper($funcao))
@@ -142,7 +154,7 @@ switch (strtoupper($funcao)) @@ -142,7 +154,7 @@ switch (strtoupper($funcao))
142 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 154 $mapfile = $locaplic."/temas/".$codigoMap.".map";
143 $mapa = ms_newMapObj($mapfile); 155 $mapa = ms_newMapObj($mapfile);
144 $layer = $mapa->getlayerbyname($codigoLayer); 156 $layer = $mapa->getlayerbyname($codigoLayer);
145 - $layer->setmetadata("PLUGINI3GEO",$plugin); 157 + $layer->setmetadata("PLUGINI3GEO",$_GET["plugin"]);
146 $mapa->save($mapfile); 158 $mapa->save($mapfile);
147 removeCabecalho($mapfile); 159 removeCabecalho($mapfile);
148 retornaJSON("ok"); 160 retornaJSON("ok");
@@ -216,8 +228,9 @@ switch (strtoupper($funcao)) @@ -216,8 +228,9 @@ switch (strtoupper($funcao))
216 $base = $locaplic."/aplicmap/".$base; 228 $base = $locaplic."/aplicmap/".$base;
217 } 229 }
218 } 230 }
  231 + $base = str_replace(".map","",$base).".map";
219 $m = new Legenda($base,$locaplic); 232 $m = new Legenda($base,$locaplic);
220 - retornaJSON($m->listaSimbolos($tipo,$dir_tmp,"",$onclick,8,1,true)); 233 + retornaJSON($m->listaSimbolos($tipo,$dir_tmp,"",$_GET["onclick"],8,1,true));
221 exit; 234 exit;
222 break; 235 break;
223 /* 236 /*
@@ -1130,10 +1143,10 @@ switch (strtoupper($funcao)) @@ -1130,10 +1143,10 @@ switch (strtoupper($funcao))
1130 } 1143 }
1131 function clonarMapfile() 1144 function clonarMapfile()
1132 { 1145 {
1133 - global $novomap, $codigomap, $locaplic; 1146 + global $codigomap, $locaplic;
1134 error_reporting(0); 1147 error_reporting(0);
1135 $arqtema = $locaplic."/temas/".$codigomap.".map"; 1148 $arqtema = $locaplic."/temas/".$codigomap.".map";
1136 - $novotema = $locaplic."/temas/".$novomap.".map"; 1149 + $novotema = $locaplic."/temas/".$_GET["novomap"].".map";
1137 copy($arqtema,$novotema); 1150 copy($arqtema,$novotema);
1138 $mapa = ms_newMapObj($novotema); 1151 $mapa = ms_newMapObj($novotema);
1139 $layer = @$mapa->getlayerbyname($codigomap); 1152 $layer = @$mapa->getlayerbyname($codigomap);
@@ -1144,7 +1157,11 @@ function clonarMapfile() @@ -1144,7 +1157,11 @@ function clonarMapfile()
1144 } 1157 }
1145 function refazerLayer() 1158 function refazerLayer()
1146 { 1159 {
1147 - global $nomelayer, $codigomap, $maporigem, $locaplic, $cache; 1160 + global $nomelayer, $codigomap, $locaplic;
  1161 +
  1162 + $maporigem = $_GET["maporigem"];
  1163 + $cache = $_GET["cache"];
  1164 +
1148 error_reporting(0); 1165 error_reporting(0);
1149 if(empty($cache)){ 1166 if(empty($cache)){
1150 $cache = ""; 1167 $cache = "";
@@ -1187,7 +1204,10 @@ function refazerLayer() @@ -1187,7 +1204,10 @@ function refazerLayer()
1187 } 1204 }
1188 function sobeDesce() 1205 function sobeDesce()
1189 { 1206 {
1190 - global $movimento,$tipo,$codigoMap,$codigoLayer,$indiceClasse,$indiceEstilo,$locaplic; 1207 + global $movimento,$tipo,$codigoMap,$codigoLayer,$locaplic;
  1208 +
  1209 + $indiceClasse = $_GET["indiceClasse"];
  1210 + $indiceEstilo = $_GET["indiceEstilo"];
1191 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 1211 $mapfile = $locaplic."/temas/".$codigoMap.".map";
1192 $mapa = ms_newMapObj($mapfile); 1212 $mapa = ms_newMapObj($mapfile);
1193 $layer = $mapa->getlayerbyname($codigoLayer); 1213 $layer = $mapa->getlayerbyname($codigoLayer);
@@ -1232,49 +1252,51 @@ function sobeDesce() @@ -1232,49 +1252,51 @@ function sobeDesce()
1232 } 1252 }
1233 //essa funcao e usada tambem por i3geo/ferramentas/upload/upload.php 1253 //essa funcao e usada tambem por i3geo/ferramentas/upload/upload.php
1234 function criarNovoMap(){ 1254 function criarNovoMap(){
1235 - global $nome,$codigo,$locaplic,$it,$en,$es,$esquemaadmin,$metaestat,$tipoLayer,$data,$conexao,$acessopublico;  
1236 - $arq = $locaplic."/temas/".$codigo.".map";  
1237 - if(empty($acessopublico)){  
1238 - $acessopublico = "SIM"; 1255 + global $locaplic,$esquemaadmin;
  1256 +
  1257 + $arq = $locaplic."/temas/".$_GET["codigo"].".map";
  1258 + if(empty($_GET["acessopublico"])){
  1259 + $_GET["acessopublico"] = "SIM";
1239 } 1260 }
1240 if(!file_exists($arq)){ 1261 if(!file_exists($arq)){
1241 - if(empty($tipoLayer)){  
1242 - $tipoLayer = "line"; 1262 + if(empty($_GET["tipoLayer"])){
  1263 + $_GET["tipoLayer"] = "line";
1243 } 1264 }
1244 $dados[] = "MAP"; 1265 $dados[] = "MAP";
1245 $dados[] = "SYMBOLSET ../symbols/simbolosv6.sym"; 1266 $dados[] = "SYMBOLSET ../symbols/simbolosv6.sym";
1246 $dados[] = 'FONTSET "../symbols/fontes.txt"'; 1267 $dados[] = 'FONTSET "../symbols/fontes.txt"';
1247 $dados[] = "LAYER"; 1268 $dados[] = "LAYER";
1248 - $dados[] = ' NAME "'.$codigo.'"'; 1269 + $dados[] = ' NAME "'.$_GET["codigo"].'"';
1249 $dados[] = ' TEMPLATE "none.htm"'; 1270 $dados[] = ' TEMPLATE "none.htm"';
1250 - if(!empty($metaestat) && $metaestat == "SIM"){ 1271 + if(!empty($_GET["metaestat"]) && $_GET["metaestat"] == "SIM"){
1251 $dados[] = ' CONNECTIONTYPE POSTGIS'; 1272 $dados[] = ' CONNECTIONTYPE POSTGIS';
1252 $tipoLayer = "polygon"; 1273 $tipoLayer = "polygon";
1253 } 1274 }
1254 elseif(!empty($conexao)){ 1275 elseif(!empty($conexao)){
1255 $dados[] = ' CONNECTIONTYPE POSTGIS'; 1276 $dados[] = ' CONNECTIONTYPE POSTGIS';
1256 - $dados[] = ' CONNECTION "'.$conexao.'"'; 1277 + $dados[] = ' CONNECTION "'.$_GET["conexao"].'"';
1257 } 1278 }
1258 - $dados[] = " TYPE ".$tipoLayer;  
1259 - if(empty($data)){ 1279 + $dados[] = " TYPE ".$_GET["tipoLayer"];
  1280 + if(empty($_GET["data"])){
1260 $dados[] = ' DATA ""'; 1281 $dados[] = ' DATA ""';
1261 $dados[] = ' CONNECTION ""'; 1282 $dados[] = ' CONNECTION ""';
1262 } 1283 }
1263 else{ 1284 else{
1264 - $dados[] = ' DATA "'.$data.'"'; 1285 + $dados[] = ' DATA "'.$_GET["data"].'"';
1265 } 1286 }
1266 $dados[] = ' STATUS DEFAULT'; 1287 $dados[] = ' STATUS DEFAULT';
1267 $dados[] = ' METADATA'; 1288 $dados[] = ' METADATA';
1268 - $dados[] = ' TEMA "'.$nome.'"'; 1289 + $dados[] = ' TEMA "'.$_GET["nome"].'"';
1269 $dados[] = ' CLASSE "SIM"'; 1290 $dados[] = ' CLASSE "SIM"';
1270 $tipoa_tema = ""; 1291 $tipoa_tema = "";
1271 - if(!empty($metaestat) && $metaestat == "SIM"){ 1292 + if(!empty($_GET["metaestat"]) && $_GET["metaestat"] == "SIM"){
1272 $dados[] = ' METAESTAT "SIM"'; 1293 $dados[] = ' METAESTAT "SIM"';
1273 //para marcar no banco de dados de administracao 1294 //para marcar no banco de dados de administracao
1274 $tipoa_tema = "META"; 1295 $tipoa_tema = "META";
1275 //METAESTAT_CODIGO_TIPO_REGIAO 1296 //METAESTAT_CODIGO_TIPO_REGIAO
1276 //ID_MEDIDA_VARIAVEL 1297 //ID_MEDIDA_VARIAVEL
1277 } 1298 }
  1299 + $acessopublico = $_GET["acessopublico"];
1278 $dados[] = ' permiteogc "'.$acessopublico.'"'; 1300 $dados[] = ' permiteogc "'.$acessopublico.'"';
1279 $dados[] = ' permitedownload "'.$acessopublico.'"'; 1301 $dados[] = ' permitedownload "'.$acessopublico.'"';
1280 $dados[] = ' permitekml "'.$acessopublico.'"'; 1302 $dados[] = ' permitekml "'.$acessopublico.'"';
@@ -1301,8 +1323,8 @@ function criarNovoMap(){ @@ -1301,8 +1323,8 @@ function criarNovoMap(){
1301 1323
1302 include("conexao.php"); 1324 include("conexao.php");
1303 if($convUTF){ 1325 if($convUTF){
1304 - $nome = utf8_encode($nome);  
1305 - $desc = utf8_encode($desc); 1326 + $_GET["nome"] = utf8_encode($_GET["nome"]);
  1327 + $_GET["desc"] = utf8_encode($_GET["desc"]);
1306 } 1328 }
1307 $dataCol = array( 1329 $dataCol = array(
1308 "link_tema" => '', 1330 "link_tema" => '',
@@ -1313,11 +1335,11 @@ function criarNovoMap(){ @@ -1313,11 +1335,11 @@ function criarNovoMap(){
1313 "desc_tema" => '', 1335 "desc_tema" => '',
1314 "tipoa_tema" => $tipoa_tema, 1336 "tipoa_tema" => $tipoa_tema,
1315 "tags_tema" => '', 1337 "tags_tema" => '',
1316 - "nome_tema" => $nome,  
1317 - "codigo_tema" => $codigo,  
1318 - "it" => $it,  
1319 - "es" => $es,  
1320 - "en" => $en 1338 + "nome_tema" => $_GET["nome"],
  1339 + "codigo_tema" => $_GET["codigo"],
  1340 + "it" => $_GET["it"],
  1341 + "es" => $_GET["es"],
  1342 + "en" => $_GET["en"]
1321 ); 1343 );
1322 i3GeoAdminInsert($dbhw,"i3geoadmin_temas",$dataCol); 1344 i3GeoAdminInsert($dbhw,"i3geoadmin_temas",$dataCol);
1323 $dbh = null; 1345 $dbh = null;
@@ -1329,6 +1351,7 @@ function criarNovoMap(){ @@ -1329,6 +1351,7 @@ function criarNovoMap(){
1329 function criarNovoLayer() 1351 function criarNovoLayer()
1330 { 1352 {
1331 global $locaplic,$codigoMap; 1353 global $locaplic,$codigoMap;
  1354 +
1332 include_once("$locaplic/classesphp/funcoes_gerais.php"); 1355 include_once("$locaplic/classesphp/funcoes_gerais.php");
1333 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 1356 $mapfile = $locaplic."/temas/".$codigoMap.".map";
1334 $mapa = ms_newMapObj($mapfile); 1357 $mapa = ms_newMapObj($mapfile);
@@ -1341,7 +1364,7 @@ function criarNovoLayer() @@ -1341,7 +1364,7 @@ function criarNovoLayer()
1341 } 1364 }
1342 function autoClassesLayer() 1365 function autoClassesLayer()
1343 { 1366 {
1344 - global $codigoMap,$codigoLayer,$itemExpressao,$itemNome,$locaplic,$dir_tmp,$postgis_mapa; 1367 + global $codigoMap,$codigoLayer,$locaplic,$dir_tmp,$postgis_mapa;
1345 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 1368 $mapfile = $locaplic."/temas/".$codigoMap.".map";
1346 include_once("$locaplic/classesphp/classe_alteraclasse.php"); 1369 include_once("$locaplic/classesphp/classe_alteraclasse.php");
1347 error_reporting(0); 1370 error_reporting(0);
@@ -1403,7 +1426,7 @@ function autoClassesLayer() @@ -1403,7 +1426,7 @@ function autoClassesLayer()
1403 } 1426 }
1404 $mapageral->save($nometemp); 1427 $mapageral->save($nometemp);
1405 $m = new Alteraclasse($nometemp,$codigoLayer); 1428 $m = new Alteraclasse($nometemp,$codigoLayer);
1406 - $m->valorunico($itemExpressao,"",$itemNome); 1429 + $m->valorunico($_GET["itemExpressao"],"",$_GET["itemNome"]);
1407 $m->salva(); 1430 $m->salva();
1408 $mapatemp = ms_newMapObj($nometemp); 1431 $mapatemp = ms_newMapObj($nometemp);
1409 1432
@@ -1438,11 +1461,11 @@ function criarNovaClasse() @@ -1438,11 +1461,11 @@ function criarNovaClasse()
1438 } 1461 }
1439 function criarNovoEstilo() 1462 function criarNovoEstilo()
1440 { 1463 {
1441 - global $codigoMap,$codigoLayer,$indiceClasse,$locaplic; 1464 + global $codigoMap,$codigoLayer,$locaplic;
1442 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 1465 $mapfile = $locaplic."/temas/".$codigoMap.".map";
1443 $mapa = ms_newMapObj($mapfile); 1466 $mapa = ms_newMapObj($mapfile);
1444 $nl = $mapa->getlayerbyname($codigoLayer); 1467 $nl = $mapa->getlayerbyname($codigoLayer);
1445 - $classObj = $nl->getclass($indiceClasse); 1468 + $classObj = $nl->getclass($_GET["indiceClasse"]);
1446 $numestilos = $classObj->numstyles; 1469 $numestilos = $classObj->numstyles;
1447 $nestilo = ms_newStyleObj($classObj); 1470 $nestilo = ms_newStyleObj($classObj);
1448 $mapa->save($mapfile); 1471 $mapa->save($mapfile);
@@ -1546,7 +1569,7 @@ function listaClasses() @@ -1546,7 +1569,7 @@ function listaClasses()
1546 } 1569 }
1547 function listaEstilos() 1570 function listaEstilos()
1548 { 1571 {
1549 - global $codigoMap,$codigoLayer,$indiceClasse,$locaplic; 1572 + global $codigoMap,$codigoLayer,$locaplic;
1550 $dados = array(); 1573 $dados = array();
1551 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 1574 $mapfile = $locaplic."/temas/".$codigoMap.".map";
1552 $mapa = ms_newMapObj($mapfile); 1575 $mapa = ms_newMapObj($mapfile);
@@ -1554,7 +1577,7 @@ function listaEstilos() @@ -1554,7 +1577,7 @@ function listaEstilos()
1554 if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){ 1577 if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){
1555 return $dados; 1578 return $dados;
1556 } 1579 }
1557 - $classe = $layer->getclass($indiceClasse); 1580 + $classe = $layer->getclass($_GET["indiceClasse"]);
1558 $numestilos = $classe->numstyles; 1581 $numestilos = $classe->numstyles;
1559 for($i=0;$i<$numestilos;++$i) 1582 for($i=0;$i<$numestilos;++$i)
1560 { 1583 {
@@ -1576,11 +1599,11 @@ function excluirLayer() @@ -1576,11 +1599,11 @@ function excluirLayer()
1576 } 1599 }
1577 function excluirClasse() 1600 function excluirClasse()
1578 { 1601 {
1579 - global $codigoMap,$codigoLayer,$indiceClasse,$locaplic; 1602 + global $codigoMap,$codigoLayer,$locaplic;
1580 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 1603 $mapfile = $locaplic."/temas/".$codigoMap.".map";
1581 $mapa = ms_newMapObj($mapfile); 1604 $mapa = ms_newMapObj($mapfile);
1582 $nl = $mapa->getlayerbyname($codigoLayer); 1605 $nl = $mapa->getlayerbyname($codigoLayer);
1583 - $classObj = $nl->getclass($indiceClasse); 1606 + $classObj = $nl->getclass($_GET["indiceClasse"]);
1584 $classObj->set("status",MS_DELETE); 1607 $classObj->set("status",MS_DELETE);
1585 $mapa->save($mapfile); 1608 $mapa->save($mapfile);
1586 removeCabecalho($mapfile); 1609 removeCabecalho($mapfile);
@@ -1588,12 +1611,12 @@ function excluirClasse() @@ -1588,12 +1611,12 @@ function excluirClasse()
1588 } 1611 }
1589 function excluirEstilo() 1612 function excluirEstilo()
1590 { 1613 {
1591 - global $codigoMap,$codigoLayer,$indiceClasse,$indiceEstilo,$locaplic; 1614 + global $codigoMap,$codigoLayer,$locaplic;
1592 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 1615 $mapfile = $locaplic."/temas/".$codigoMap.".map";
1593 $mapa = ms_newMapObj($mapfile); 1616 $mapa = ms_newMapObj($mapfile);
1594 $nl = $mapa->getlayerbyname($codigoLayer); 1617 $nl = $mapa->getlayerbyname($codigoLayer);
1595 - $classObj = $nl->getclass($indiceClasse);  
1596 - $classObj->deletestyle($indiceEstilo); 1618 + $classObj = $nl->getclass($_GET["indiceClasse"]);
  1619 + $classObj->deletestyle($_GET["indiceEstilo"]);
1597 $mapa->save($mapfile); 1620 $mapa->save($mapfile);
1598 removeCabecalho($mapfile); 1621 removeCabecalho($mapfile);
1599 return "ok"; 1622 return "ok";
@@ -1633,40 +1656,40 @@ function pegaComport() @@ -1633,40 +1656,40 @@ function pegaComport()
1633 } 1656 }
1634 function alterarComport() 1657 function alterarComport()
1635 { 1658 {
1636 - global $dir_tmp,$codigoMap,$codigoLayer,$locaplic,$aplicaextensao,$permitecomentario,$temporizador,$classe,$legendaimg,$escondido,$identifica,$transitioneffect,$status,$offsite,$opacity,$maxscale,$minscale,$labelitem,$labelmaxscale,$labelminscale,$symbolscale,$tolerance,$toleranceunits,$sizeunits; 1659 + global $dir_tmp,$codigoMap,$codigoLayer,$locaplic;
1637 $v = versao(); 1660 $v = versao();
1638 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 1661 $mapfile = $locaplic."/temas/".$codigoMap.".map";
1639 $mapa = ms_newMapObj($mapfile); 1662 $mapa = ms_newMapObj($mapfile);
1640 $layer = $mapa->getlayerbyname($codigoLayer); 1663 $layer = $mapa->getlayerbyname($codigoLayer);
1641 - $layer->setmetadata("aplicaextensao",$aplicaextensao);  
1642 - $layer->setmetadata("permitecomentario",$permitecomentario);  
1643 - $layer->setmetadata("temporizador",$temporizador);  
1644 - $layer->setmetadata("classe",$classe);  
1645 - $layer->setmetadata("legendaimg",$legendaimg);  
1646 - $layer->setmetadata("escondido",$escondido);  
1647 - $layer->setmetadata("identifica",$identifica);  
1648 - $layer->setmetadata("transitioneffect",$transitioneffect);  
1649 - $layer->set("status",$status);  
1650 - if($offsite == -1 || $offsite == "null") 1664 + $layer->setmetadata("aplicaextensao",$_GET["aplicaextensao"]);
  1665 + $layer->setmetadata("permitecomentario",$_GET["permitecomentario"]);
  1666 + $layer->setmetadata("temporizador",$_GET["temporizador"]);
  1667 + $layer->setmetadata("classe",$_GET["classe"]);
  1668 + $layer->setmetadata("legendaimg",$_GET["legendaimg"]);
  1669 + $layer->setmetadata("escondido",$_GET["escondido"]);
  1670 + $layer->setmetadata("identifica",$_GET["identifica"]);
  1671 + $layer->setmetadata("transitioneffect",$_GET["transitioneffect"]);
  1672 + $layer->set("status",$_GET["status"]);
  1673 + if($_GET["offsite"] == -1 || $_GET["offsite"] == "null")
1651 { 1674 {
1652 - $offsite = "-1,-1,-1"; 1675 + $_GET["offsite"] = "-1,-1,-1";
1653 } 1676 }
1654 $cor = $layer->offsite; 1677 $cor = $layer->offsite;
1655 - $c = explode(",",$offsite); 1678 + $c = explode(",",$_GET["offsite"]);
1656 if(count($c) < 3) 1679 if(count($c) < 3)
1657 - $c = explode(" ",$offsite); 1680 + $c = explode(" ",$_GET["offsite"]);
1658 $cor->setrgb($c[0],$c[1],$c[2]); 1681 $cor->setrgb($c[0],$c[1],$c[2]);
1659 $layer->offsite->red.",".$layer->offsite->green.",".$layer->offsite->blue; 1682 $layer->offsite->red.",".$layer->offsite->green.",".$layer->offsite->blue;
1660 - $v["principal"] == "4" ? $layer->set("transparency",$opacity) : $layer->set("opacity",$opacity);  
1661 - $layer->set("maxscaledenom",$maxscale);  
1662 - $layer->set("minscaledenom",$minscale);  
1663 - $layer->set("labelitem",$labelitem);  
1664 - $layer->set("labelmaxscaledenom",$labelmaxscale);  
1665 - $layer->set("labelminscaledenom",$labelminscale);  
1666 - $layer->set("symbolscaledenom",$symbolscale);  
1667 - $layer->set("tolerance",$tolerance);  
1668 - $layer->set("toleranceunits",$toleranceunits);  
1669 - $layer->set("sizeunits",$sizeunits); 1683 + $v["principal"] == "4" ? $layer->set("transparency",$_GET["opacity"]) : $layer->set("opacity",$_GET["opacity"]);
  1684 + $layer->set("maxscaledenom",$_GET["maxscale"]);
  1685 + $layer->set("minscaledenom",$_GET["minscale"]);
  1686 + $layer->set("labelitem",$_GET["labelitem"]);
  1687 + $layer->set("labelmaxscaledenom",$_GET["labelmaxscale"]);
  1688 + $layer->set("labelminscaledenom",$_GET["labelminscale"]);
  1689 + $layer->set("symbolscaledenom",$_GET["symbolscale"]);
  1690 + $layer->set("tolerance",$_GET["tolerance"]);
  1691 + $layer->set("toleranceunits",$_GET["toleranceunits"]);
  1692 + $layer->set("sizeunits",$_GET["sizeunits"]);
1670 1693
1671 $mapa->save($mapfile); 1694 $mapa->save($mapfile);
1672 removeCabecalho($mapfile); 1695 removeCabecalho($mapfile);
@@ -1691,20 +1714,20 @@ function pegaTitulo() @@ -1691,20 +1714,20 @@ function pegaTitulo()
1691 return $dados; 1714 return $dados;
1692 } 1715 }
1693 function alterarNomeTema(){ 1716 function alterarNomeTema(){
1694 - global $locaplic,$codigoMap, $novoNome, $esquemaadmin; 1717 + global $locaplic,$codigoMap, $esquemaadmin;
1695 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 1718 $mapfile = $locaplic."/temas/".$codigoMap.".map";
1696 $mapa = ms_newMapObj($mapfile); 1719 $mapa = ms_newMapObj($mapfile);
1697 $layer = $mapa->getlayerbyname($codigoMap); 1720 $layer = $mapa->getlayerbyname($codigoMap);
1698 if($layer){ 1721 if($layer){
1699 - $layer->setmetadata("tema",$novoNome); 1722 + $layer->setmetadata("tema",$_GET["novoNome"]);
1700 $mapa->save($mapfile); 1723 $mapa->save($mapfile);
1701 removeCabecalho($mapfile); 1724 removeCabecalho($mapfile);
1702 include("conexao.php"); 1725 include("conexao.php");
1703 if($convUTF){ 1726 if($convUTF){
1704 - $novoNome = utf8_encode($novoNome); 1727 + $_GET["novoNome"] = utf8_encode($_GET["novoNome"]);
1705 } 1728 }
1706 $dataCol = array( 1729 $dataCol = array(
1707 - "nome_tema" => $novoNome 1730 + "nome_tema" => $_GET["novoNome"]
1708 ); 1731 );
1709 i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol," WHERE codigo_tema='$codigoMap'"); 1732 i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol," WHERE codigo_tema='$codigoMap'");
1710 $dbhw = null; 1733 $dbhw = null;
@@ -1714,22 +1737,22 @@ function alterarNomeTema(){ @@ -1714,22 +1737,22 @@ function alterarNomeTema(){
1714 } 1737 }
1715 function alterarTitulo() 1738 function alterarTitulo()
1716 { 1739 {
1717 - global $dir_tmp,$codigoMap,$codigoLayer,$locaplic,$name,$tema,$iconetema,$mensagem,$escala,$extensao; 1740 + global $dir_tmp,$codigoMap,$codigoLayer,$locaplic;
1718 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 1741 $mapfile = $locaplic."/temas/".$codigoMap.".map";
1719 $mapa = ms_newMapObj($mapfile); 1742 $mapa = ms_newMapObj($mapfile);
1720 $layer = $mapa->getlayerbyname($codigoLayer); 1743 $layer = $mapa->getlayerbyname($codigoLayer);
1721 1744
1722 - $layer->set("name",$name);  
1723 - $layer->setmetadata("tema",$tema);  
1724 - $layer->setmetadata("iconetema",$iconetema);  
1725 - $layer->setmetadata("mensagem",$mensagem);  
1726 - $layer->setmetadata("escala",$escala);  
1727 - $layer->setmetadata("extensao",$extensao);  
1728 - $layer->set("group",$group); 1745 + $layer->set("name",$_GET["name"]);
  1746 + $layer->setmetadata("tema",$_GET["tema"]);
  1747 + $layer->setmetadata("iconetema",$_GET["iconetema"]);
  1748 + $layer->setmetadata("mensagem",$_GET["mensagem"]);
  1749 + $layer->setmetadata("escala",$_GET["escala"]);
  1750 + $layer->setmetadata("extensao",$_GET["extensao"]);
  1751 + $layer->set("group",$_GET["group"]);
1729 1752
1730 $mapa->save($mapfile); 1753 $mapa->save($mapfile);
1731 removeCabecalho($mapfile); 1754 removeCabecalho($mapfile);
1732 - $codigoLayer = $name; 1755 + $codigoLayer = $_GET["name"];
1733 return "ok"; 1756 return "ok";
1734 } 1757 }
1735 function pegaDispo() 1758 function pegaDispo()
@@ -1768,15 +1791,15 @@ function pegaEditavel() @@ -1768,15 +1791,15 @@ function pegaEditavel()
1768 } 1791 }
1769 function alterarEditavel() 1792 function alterarEditavel()
1770 { 1793 {
1771 - global $dir_tmp,$codigoMap,$codigoLayer,$locaplic,$editavel,$colunaidunico,$tabelaeditavel,$esquematabelaeditavel,$colunageometria; 1794 + global $dir_tmp,$codigoMap,$codigoLayer,$locaplic;
1772 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 1795 $mapfile = $locaplic."/temas/".$codigoMap.".map";
1773 $mapa = ms_newMapObj($mapfile); 1796 $mapa = ms_newMapObj($mapfile);
1774 $layer = $mapa->getlayerbyname($codigoLayer); 1797 $layer = $mapa->getlayerbyname($codigoLayer);
1775 - $layer->setmetadata("EDITAVEL",$editavel);  
1776 - $layer->setmetadata("COLUNAIDUNICO",$colunaidunico);  
1777 - $layer->setmetadata("TABELAEDITAVEL",$tabelaeditavel);  
1778 - $layer->setmetadata("ESQUEMATABELAEDITAVEL",$esquematabelaeditavel);  
1779 - $layer->setmetadata("COLUNAGEOMETRIA",$colunageometria); 1798 + $layer->setmetadata("EDITAVEL",$_GET["editavel"]);
  1799 + $layer->setmetadata("COLUNAIDUNICO",$_GET["colunaidunico"]);
  1800 + $layer->setmetadata("TABELAEDITAVEL",$_GET["tabelaeditavel"]);
  1801 + $layer->setmetadata("ESQUEMATABELAEDITAVEL",$_GET["esquematabelaeditavel"]);
  1802 + $layer->setmetadata("COLUNAGEOMETRIA",$_GET["colunageometria"]);
1780 $layer->setmetadata("cache",""); 1803 $layer->setmetadata("cache","");
1781 $mapa->save($mapfile); 1804 $mapa->save($mapfile);
1782 removeCabecalho($mapfile); 1805 removeCabecalho($mapfile);
@@ -1784,30 +1807,30 @@ function alterarEditavel() @@ -1784,30 +1807,30 @@ function alterarEditavel()
1784 } 1807 }
1785 function alterarDispo() 1808 function alterarDispo()
1786 { 1809 {
1787 - global $dir_tmp,$codigoMap,$codigoLayer,$locaplic,$download,$arquivodownload,$arquivokmz,$ogc_tema,$kml_tema,$kmz_tema,$download_tema; 1810 + global $dir_tmp,$codigoMap,$codigoLayer,$locaplic;
1788 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 1811 $mapfile = $locaplic."/temas/".$codigoMap.".map";
1789 $mapa = ms_newMapObj($mapfile); 1812 $mapa = ms_newMapObj($mapfile);
1790 $layer = $mapa->getlayerbyname($codigoLayer); 1813 $layer = $mapa->getlayerbyname($codigoLayer);
1791 - $layer->setmetadata("download",$download);  
1792 - $layer->setmetadata("arquivodownload",$arquivodownload);  
1793 - $layer->setmetadata("arquivokmz",$arquivokmz);  
1794 - $layer->setmetadata("permiteogc",$ogc_tema);  
1795 - $layer->setmetadata("permitekml",$kml_tema);  
1796 - $layer->setmetadata("permitekmz",$kmz_tema);  
1797 - $layer->setmetadata("permitedownload",$download_tema); 1814 + $layer->setmetadata("download",$_GET["download"]);
  1815 + $layer->setmetadata("arquivodownload",$_GET["arquivodownload"]);
  1816 + $layer->setmetadata("arquivokmz",$_GET["arquivokmz"]);
  1817 + $layer->setmetadata("permiteogc",$_GET["ogc_tema"]);
  1818 + $layer->setmetadata("permitekml",$_GET["kml_tema"]);
  1819 + $layer->setmetadata("permitekmz",$_GET["kmz_tema"]);
  1820 + $layer->setmetadata("permitedownload",$_GET["download_tema"]);
1798 $mapa->save($mapfile); 1821 $mapa->save($mapfile);
1799 removeCabecalho($mapfile); 1822 removeCabecalho($mapfile);
1800 return "ok"; 1823 return "ok";
1801 } 1824 }
1802 //essa funcao existe tambem em menutemas.php 1825 //essa funcao existe tambem em menutemas.php
1803 function alteraTemas(){ 1826 function alteraTemas(){
1804 - global $esquemaadmin,$codigoLayer,$ogc_tema,$kml_tema,$kmz_tema,$locaplic,$download_tema; 1827 + global $esquemaadmin,$codigoLayer,$locaplic;
1805 include("conexao.php"); 1828 include("conexao.php");
1806 $dataCol = array( 1829 $dataCol = array(
1807 - "download_tema" => $download_tema,  
1808 - "ogc_tema" => $ogc_tema,  
1809 - "kml_tema" => $kml_tema,  
1810 - "kmz_tema" => $kmz_tema 1830 + "download_tema" => $_GET["download_tema"],
  1831 + "ogc_tema" => $_GET["ogc_tema"],
  1832 + "kml_tema" => $_GET["kml_tema"],
  1833 + "kmz_tema" => $_GET["kmz_tema"]
1811 ); 1834 );
1812 i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE codigo_tema = '$codigoLayer'"); 1835 i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE codigo_tema = '$codigoLayer'");
1813 $dbhw = null; 1836 $dbhw = null;
@@ -1870,9 +1893,9 @@ function pegaConexao() @@ -1870,9 +1893,9 @@ function pegaConexao()
1870 } 1893 }
1871 function alterarConexao() 1894 function alterarConexao()
1872 { 1895 {
1873 - global $tiles,$cortepixels,$esquemaadmin,$metaestat_id_medida_variavel,$metaestat,$convcaracter,$cache,$tipooriginal,$filteritem,$filter,$projection,$type,$dir_tmp,$testar,$codigoMap,$codigoLayer,$locaplic,$connection,$connectiontype,$data,$tileitem,$tileindex;  
1874 - if($data != ""){  
1875 - $data = base64_decode($data); 1896 + global $esquemaadmin,$dir_tmp,$codigoMap,$codigoLayer,$locaplic;
  1897 + if($_GET["data"] != ""){
  1898 + $_GET["data"] = base64_decode($_GET["data"]);
1876 } 1899 }
1877 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 1900 $mapfile = $locaplic."/temas/".$codigoMap.".map";
1878 $mapa = ms_newMapObj($mapfile); 1901 $mapa = ms_newMapObj($mapfile);
@@ -1898,17 +1921,17 @@ function alterarConexao() @@ -1898,17 +1921,17 @@ function alterarConexao()
1898 i3GeoAdminInsert($dbhw,"i3geoadmin_temas",$dataCol); 1921 i3GeoAdminInsert($dbhw,"i3geoadmin_temas",$dataCol);
1899 } 1922 }
1900 if(strtoupper($metaestat) == "SIM"){ 1923 if(strtoupper($metaestat) == "SIM"){
1901 - $connectiontype = 6;  
1902 - $filteritem = "";  
1903 - $filter = "";  
1904 - $data = "";  
1905 - $connection = ""; 1924 + $_GET["connectiontype"] = 6;
  1925 + $_GET["filteritem"] = "";
  1926 + $_GET["filter"] = "";
  1927 + $_GET["data"] = "";
  1928 + $_GET["connection"] = "";
1906 $dataCol = array( 1929 $dataCol = array(
1907 "tipoa_tema" => "META" 1930 "tipoa_tema" => "META"
1908 ); 1931 );
1909 i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE codigo_tema = '$codigoMap'"); 1932 i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE codigo_tema = '$codigoMap'");
1910 $layer->setmetadata("metaestat","SIM"); 1933 $layer->setmetadata("metaestat","SIM");
1911 - $layer->setmetadata("METAESTAT_ID_MEDIDA_VARIAVEL",$metaestat_id_medida_variavel); 1934 + $layer->setmetadata("METAESTAT_ID_MEDIDA_VARIAVEL",$_GET["metaestat_id_medida_variavel"]);
1912 } 1935 }
1913 else{ 1936 else{
1914 $layer->setmetadata("METAESTAT_CODIGO_TIPO_REGIAO",""); 1937 $layer->setmetadata("METAESTAT_CODIGO_TIPO_REGIAO","");
@@ -1919,56 +1942,56 @@ function alterarConexao() @@ -1919,56 +1942,56 @@ function alterarConexao()
1919 ); 1942 );
1920 i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE codigo_tema = '$codigoMap'"); 1943 i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE codigo_tema = '$codigoMap'");
1921 } 1944 }
1922 - $layer->set("connection",$connection); 1945 + $layer->set("connection",$_GET["connection"]);
1923 if(ms_GetVersionInt() > 50201){ 1946 if(ms_GetVersionInt() > 50201){
1924 - $layer->setconnectiontype($connectiontype); 1947 + $layer->setconnectiontype($_GET["connectiontype"]);
1925 } 1948 }
1926 else{ 1949 else{
1927 - $layer->set("connectiontype",$connectiontype); 1950 + $layer->set("connectiontype",$_GET["connectiontype"]);
1928 } 1951 }
1929 - $layer->set("data",$data);  
1930 - $layer->set("tileitem",$tileitem);  
1931 - $layer->set("tileindex",$tileindex);  
1932 - $layer->set("type",$type);  
1933 - if($type == 0){ 1952 + $layer->set("data",$_GET["data"]);
  1953 + $layer->set("tileitem",$_GET["tileitem"]);
  1954 + $layer->set("tileindex",$_GET["tileindex"]);
  1955 + $layer->set("type",$_GET["type"]);
  1956 + if($_GET["type"] == 0){
1934 $c = $layer->getClass(0); 1957 $c = $layer->getClass(0);
1935 $e = $c->getStyle(0); 1958 $e = $c->getStyle(0);
1936 if($e->symbolname == ""){ 1959 if($e->symbolname == ""){
1937 $e->set("symbolname","ponto"); 1960 $e->set("symbolname","ponto");
1938 } 1961 }
1939 } 1962 }
1940 - if($type == 1){ 1963 + if($_GET["type"] == 1){
1941 $c = $layer->getClass(0); 1964 $c = $layer->getClass(0);
1942 $e = $c->getStyle(0); 1965 $e = $c->getStyle(0);
1943 if($e->symbolname == "" || $e->symbolname == "ponto"){ 1966 if($e->symbolname == "" || $e->symbolname == "ponto"){
1944 $e->set("symbolname","linha"); 1967 $e->set("symbolname","linha");
1945 } 1968 }
1946 } 1969 }
1947 - if($type == 2){ 1970 + if($_GET["type"] == 2){
1948 $c = $layer->getClass(0); 1971 $c = $layer->getClass(0);
1949 $e = $c->getStyle(0); 1972 $e = $c->getStyle(0);
1950 if($e->symbolname == "linha" || $e->symbolname == "ponto"){ 1973 if($e->symbolname == "linha" || $e->symbolname == "ponto"){
1951 $e->set("symbolname"," "); 1974 $e->set("symbolname"," ");
1952 } 1975 }
1953 } 1976 }
1954 - $layer->setfilter($filter);  
1955 - $layer->set("filteritem",$filteritem); 1977 + $layer->setfilter($_GET["filter"]);
  1978 + $layer->set("filteritem",$_GET["filteritem"]);
1956 if($layer->getprojection() == MS_TRUE) 1979 if($layer->getprojection() == MS_TRUE)
1957 - $layer->setprojection($projection);  
1958 - if($layer->getprojection() == MS_FALSE && $projection != "")  
1959 - $layer->setprojection($projection); 1980 + $layer->setprojection($_GET["projection"]);
  1981 + if($layer->getprojection() == MS_FALSE && $_GET["projection"] != "")
  1982 + $layer->setprojection($_GET["projection"]);
1960 if($layer->connectiontype == 7 || $layer->connectiontype== 9){ 1983 if($layer->connectiontype == 7 || $layer->connectiontype== 9){
1961 - $layer->setmetadata("tipooriginal",$tipooriginal); 1984 + $layer->setmetadata("tipooriginal",$_GET["tipooriginal"]);
1962 } 1985 }
1963 - $layer->setmetadata("cache",$cache);  
1964 - $layer->setmetadata("tiles",$tiles);  
1965 - if($cortepixels == ""){  
1966 - $cortepixels = 0; 1986 + $layer->setmetadata("cache",$_GET["cache"]);
  1987 + $layer->setmetadata("tiles",$_GET["tiles"]);
  1988 + if($_GET["cortepixels"] == ""){
  1989 + $_GET["cortepixels"] = 0;
1967 } 1990 }
1968 - $layer->setmetadata("cortepixels",$cortepixels); 1991 + $layer->setmetadata("cortepixels",$_GET["cortepixels"]);
1969 1992
1970 - $layer->setmetadata("convcaracter",$convcaracter);  
1971 - if($testar == "true") 1993 + $layer->setmetadata("convcaracter",$_GET["convcaracter"]);
  1994 + if($_GET["testar"] == "true")
1972 { 1995 {
1973 $nome = $dir_tmp."/".$codigoMap.".map"; 1996 $nome = $dir_tmp."/".$codigoMap.".map";
1974 $mapa->save($nome); 1997 $mapa->save($nome);
@@ -2059,7 +2082,7 @@ function pegaMetadados() @@ -2059,7 +2082,7 @@ function pegaMetadados()
2059 } 2082 }
2060 function alterarMetadados() 2083 function alterarMetadados()
2061 { 2084 {
2062 - global $tipooriginal,$wms_srs,$wms_name,$wms_server_version,$wms_format,$wms_auth_username,$wms_auth_password,$wms_auth_type,$wms_connectiontimeout,$wms_latlonboundingbox,$wms_proxy_auth_type,$wms_proxy_host,$wms_proxy_port,$wms_proxy_type,$wms_proxy_username,$wms_proxy_password,$wms_sld_body,$wms_sld_url,$wms_style,$wms_bgcolor,$wms_transparent,$wms_time,$wms_tile,$itembuscarapida,$iconetema,$ltempoformatodata,$ltempoconvencode,$ltempoiteminicio,$ltempoitemfim,$ltempoitemtitulo,$ltempoitemdescricao,$ltempoitemtip,$ltempoitemimagem,$ltempoitemicone,$ltempoitemlink,$description_template,$palletestep,$palletefile,$codigoMap,$codigoLayer,$locaplic,$classestamanho,$classessimbolo,$classescor,$classesnome,$classesitem,$mensagem,$extensao,$tip,$itenslink,$itens,$itensdesc,$editorsql; 2085 + global $codigoMap,$codigoLayer,$locaplic;
2063 $dados = array(); 2086 $dados = array();
2064 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 2087 $mapfile = $locaplic."/temas/".$codigoMap.".map";
2065 $mapa = ms_newMapObj($mapfile); 2088 $mapa = ms_newMapObj($mapfile);
@@ -2067,78 +2090,78 @@ function alterarMetadados() @@ -2067,78 +2090,78 @@ function alterarMetadados()
2067 if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){ 2090 if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){
2068 return "erro. Layer METAESTAT"; 2091 return "erro. Layer METAESTAT";
2069 } 2092 }
2070 - $itens = str_replace(", ",",",$itens);  
2071 - $itens = str_replace(" ,",",",$itens);  
2072 - $layer->setmetadata("itens",$itens);  
2073 - $itensdesc = str_replace(", ",",",$itensdesc);  
2074 - $itensdesc = str_replace(" ,",",",$itensdesc);  
2075 - $layer->setmetadata("itensdesc",$itensdesc);  
2076 - $layer->setmetadata("itenslink",$itenslink);  
2077 - $tip = str_replace(", ",",",$tip);  
2078 - $tip = str_replace(" ,",",",$tip);  
2079 - $layer->setmetadata("tip",$tip);  
2080 - $layer->setmetadata("classesitem",$classesitem);  
2081 - $layer->setmetadata("classesnome",$classesnome);  
2082 - $layer->setmetadata("classescor",$classescor);  
2083 - $layer->setmetadata("classessimbolo",$classessimbolo);  
2084 - $layer->setmetadata("classestamanho",$classestamanho);  
2085 - $layer->setmetadata("palletefile",$palletefile);  
2086 - $layer->setmetadata("palletestep",$palletestep);  
2087 - $layer->setmetadata("description_template",$description_template);  
2088 - $layer->setmetadata("editorsql",$editorsql);  
2089 - $layer->setmetadata("ltempoformatodata",$ltempoformatodata);  
2090 - $layer->setmetadata("ltempoiteminicio",$ltempoiteminicio);  
2091 - $layer->setmetadata("ltempoitemfim",$ltempoitemfim);  
2092 - $layer->setmetadata("ltempoitemtitulo",$ltempoitemtitulo);  
2093 - $layer->setmetadata("ltempoconvencode",$ltempoconvencode);  
2094 - $layer->setmetadata("ltempoitemdescricao",$ltempoitemdescricao);  
2095 - $layer->setmetadata("ltempoitemtip",$ltempoitemtip);  
2096 - $layer->setmetadata("ltempoitemimagem",$ltempoitemimagem);  
2097 - $layer->setmetadata("ltempoitemicone",$ltempoitemicone);  
2098 - $layer->setmetadata("ltempoitemlink",$ltempoitemlink);  
2099 -  
2100 - $layer->setmetadata("itembuscarapida",$itembuscarapida); 2093 + $_GET["itens"] = str_replace(", ",",",$_GET["itens"]);
  2094 + $_GET["itens"] = str_replace(" ,",",",$_GET["itens"]);
  2095 + $layer->setmetadata("itens",$_GET["itens"]);
  2096 + $_GET["itensdesc"] = str_replace(", ",",",$_GET["itensdesc"]);
  2097 + $_GET["itensdesc"] = str_replace(" ,",",",$_GET["itensdesc"]);
  2098 + $layer->setmetadata("itensdesc",$_GET["itensdesc"]);
  2099 + $layer->setmetadata("itenslink",$_GET["itenslink"]);
  2100 + $_GET["tip"] = str_replace(", ",",",$_GET["tip"]);
  2101 + $_GET["tip"] = str_replace(" ,",",",$_GET["tip"]);
  2102 + $layer->setmetadata("tip",$_GET["tip"]);
  2103 + $layer->setmetadata("classesitem",$_GET["classesitem"]);
  2104 + $layer->setmetadata("classesnome",$_GET["classesnome"]);
  2105 + $layer->setmetadata("classescor",$_GET["classescor"]);
  2106 + $layer->setmetadata("classessimbolo",$_GET["classessimbolo"]);
  2107 + $layer->setmetadata("classestamanho",$_GET["classestamanho"]);
  2108 + $layer->setmetadata("palletefile",$_GET["palletefile"]);
  2109 + $layer->setmetadata("palletestep",$_GET["palletestep"]);
  2110 + $layer->setmetadata("description_template",$_GET["description_template"]);
  2111 + $layer->setmetadata("editorsql",$_GET["editorsql"]);
  2112 + $layer->setmetadata("ltempoformatodata",$_GET["ltempoformatodata"]);
  2113 + $layer->setmetadata("ltempoiteminicio",$_GET["ltempoiteminicio"]);
  2114 + $layer->setmetadata("ltempoitemfim",$_GET["ltempoitemfim"]);
  2115 + $layer->setmetadata("ltempoitemtitulo",$_GET["ltempoitemtitulo"]);
  2116 + $layer->setmetadata("ltempoconvencode",$_GET["ltempoconvencode"]);
  2117 + $layer->setmetadata("ltempoitemdescricao",$_GET["ltempoitemdescricao"]);
  2118 + $layer->setmetadata("ltempoitemtip",$_GET["ltempoitemtip"]);
  2119 + $layer->setmetadata("ltempoitemimagem",$_GET["ltempoitemimagem"]);
  2120 + $layer->setmetadata("ltempoitemicone",$_GET["ltempoitemicone"]);
  2121 + $layer->setmetadata("ltempoitemlink",$_GET["ltempoitemlink"]);
  2122 +
  2123 + $layer->setmetadata("itembuscarapida",$_GET["itembuscarapida"]);
2101 if($layer->connectiontype == 7 || $layer->connectiontype== 9){ 2124 if($layer->connectiontype == 7 || $layer->connectiontype== 9){
2102 - $layer->setmetadata("wms_srs",$wms_srs);  
2103 - $layer->setmetadata("wms_name",$wms_name);  
2104 - $layer->setmetadata("wms_server_version",$wms_server_version);  
2105 - $layer->setmetadata("wms_format",$wms_format);  
2106 - if($wms_auth_username != ""){  
2107 - $layer->setmetadata("wms_auth_username",$wms_auth_username);  
2108 - $layer->setmetadata("wms_auth_password",$wms_auth_password);  
2109 - $layer->setmetadata("wms_auth_type",$wms_auth_type); 2125 + $layer->setmetadata("wms_srs",$_GET["wms_srs"]);
  2126 + $layer->setmetadata("wms_name",$_GET["wms_name"]);
  2127 + $layer->setmetadata("wms_server_version",$_GET["wms_server_version"]);
  2128 + $layer->setmetadata("wms_format",$_GET["wms_format"]);
  2129 + if($_GET["wms_auth_username"] != ""){
  2130 + $layer->setmetadata("wms_auth_username",$_GET["wms_auth_username"]);
  2131 + $layer->setmetadata("wms_auth_password",$_GET["wms_auth_password"]);
  2132 + $layer->setmetadata("wms_auth_type",$_GET["wms_auth_type"]);
2110 } 2133 }
2111 - $layer->setmetadata("wms_connectiontimeout",$wms_connectiontimeout);  
2112 - if($wms_latlonboundingbox != "") 2134 + $layer->setmetadata("wms_connectiontimeout",$_GET["wms_connectiontimeout"]);
  2135 + if($_GET["wms_latlonboundingbox"] != "")
2113 { 2136 {
2114 - $layer->setmetadata("wms_latlonboundingbox",$wms_latlonboundingbox); 2137 + $layer->setmetadata("wms_latlonboundingbox",$_GET["wms_latlonboundingbox"]);
2115 } 2138 }
2116 - if($wms_proxy_host != ""){  
2117 - $layer->setmetadata("wms_proxy_auth_type",$wms_proxy_auth_type);  
2118 - $layer->setmetadata("wms_proxy_host",$wms_proxy_host);  
2119 - $layer->setmetadata("wms_proxy_port",$wms_proxy_port);  
2120 - $layer->setmetadata("wms_proxy_type",$wms_proxy_type);  
2121 - $layer->setmetadata("wms_proxy_username",$wms_proxy_username);  
2122 - $layer->setmetadata("wms_proxy_password",$wms_proxy_password); 2139 + if($_GET["wms_proxy_host"] != ""){
  2140 + $layer->setmetadata("wms_proxy_auth_type",$_GET["wms_proxy_auth_type"]);
  2141 + $layer->setmetadata("wms_proxy_host",$_GET["wms_proxy_host"]);
  2142 + $layer->setmetadata("wms_proxy_port",$_GET["wms_proxy_port"]);
  2143 + $layer->setmetadata("wms_proxy_type",$_GET["wms_proxy_type"]);
  2144 + $layer->setmetadata("wms_proxy_username",$_GET["wms_proxy_username"]);
  2145 + $layer->setmetadata("wms_proxy_password",$_GET["wms_proxy_password"]);
2123 } 2146 }
2124 - if($wms_sld_body != "") 2147 + if($_GET["wms_sld_body"] != "")
2125 { 2148 {
2126 - $layer->setmetadata("wms_sld_body",$wms_sld_body); 2149 + $layer->setmetadata("wms_sld_body",$_GET["wms_sld_body"]);
2127 } 2150 }
2128 - if($wms_sld_url != "") 2151 + if($_GET["wms_sld_url"] != "")
2129 { 2152 {
2130 - $layer->setmetadata("wms_sld_url",$wms_sld_url); 2153 + $layer->setmetadata("wms_sld_url",$_GET["wms_sld_url"]);
2131 } 2154 }
2132 - $layer->setmetadata("wms_style",$wms_style);  
2133 - if($wms_bgcolor != "")  
2134 - $layer->setmetadata("wms_bgcolor",$wms_bgcolor);  
2135 - if($wms_transparent != "")  
2136 - $layer->setmetadata("wms_transparent",$wms_transparent);  
2137 - if($wms_time != "")  
2138 - $layer->setmetadata("wms_time",$wms_time);  
2139 - if($wms_tile != "")  
2140 - $layer->setmetadata("wms_tile",$wms_tile);  
2141 - $layer->setmetadata("tipooriginal",$tipooriginal); 2155 + $layer->setmetadata("wms_style",$_GET["wms_style"]);
  2156 + if($_GET["wms_bgcolor"] != "")
  2157 + $layer->setmetadata("wms_bgcolor",$_GET["wms_bgcolor"]);
  2158 + if($_GET["wms_transparent"] != "")
  2159 + $layer->setmetadata("wms_transparent",$_GET["wms_transparent"]);
  2160 + if($_GET["wms_time"] != "")
  2161 + $layer->setmetadata("wms_time",$_GET["wms_time"]);
  2162 + if($_GET["wms_tile"] != "")
  2163 + $layer->setmetadata("wms_tile",$_GET["wms_tile"]);
  2164 + $layer->setmetadata("tipooriginal",$_GET["tipooriginal"]);
2142 } 2165 }
2143 $mapa->save($mapfile); 2166 $mapa->save($mapfile);
2144 removeCabecalho($mapfile); 2167 removeCabecalho($mapfile);
@@ -2146,14 +2169,14 @@ function alterarMetadados() @@ -2146,14 +2169,14 @@ function alterarMetadados()
2146 } 2169 }
2147 function pegaClasseGeral() 2170 function pegaClasseGeral()
2148 { 2171 {
2149 - global $codigoMap,$codigoLayer,$indiceClasse,$locaplic; 2172 + global $codigoMap,$codigoLayer,$locaplic;
2150 2173
2151 error_reporting(0); 2174 error_reporting(0);
2152 $dados = array(); 2175 $dados = array();
2153 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 2176 $mapfile = $locaplic."/temas/".$codigoMap.".map";
2154 $mapa = ms_newMapObj($mapfile); 2177 $mapa = ms_newMapObj($mapfile);
2155 $layer = $mapa->getlayerbyname($codigoLayer); 2178 $layer = $mapa->getlayerbyname($codigoLayer);
2156 - $classe = $layer->getclass($indiceClasse); 2179 + $classe = $layer->getclass($_GET["indiceClasse"]);
2157 $dados["name"] = base64_encode($classe->name); 2180 $dados["name"] = base64_encode($classe->name);
2158 $dados["title"] = base64_encode($classe->title); 2181 $dados["title"] = base64_encode($classe->title);
2159 $temp = $classe->getExpressionString(); 2182 $temp = $classe->getExpressionString();
@@ -2169,13 +2192,13 @@ function pegaClasseGeral() @@ -2169,13 +2192,13 @@ function pegaClasseGeral()
2169 //$dados["text"] = $classe->getTextString(); 2192 //$dados["text"] = $classe->getTextString();
2170 $dados["codigoMap"] = $codigoMap; 2193 $dados["codigoMap"] = $codigoMap;
2171 $dados["codigoLayer"] = $codigoLayer; 2194 $dados["codigoLayer"] = $codigoLayer;
2172 - $dados["indiceClasse"] = $indiceClasse; 2195 + $dados["indiceClasse"] = $_GET["indiceClasse"];
2173 $dados["colunas"] = implode(" ,",pegaItens($layer)); 2196 $dados["colunas"] = implode(" ,",pegaItens($layer));
2174 return $dados; 2197 return $dados;
2175 } 2198 }
2176 function alterarClasseGeral() 2199 function alterarClasseGeral()
2177 { 2200 {
2178 - global $codigoMap,$codigoLayer,$indiceClasse,$locaplic,$status,$minscale,$maxscale,$name,$expression,$keyimage,$title; 2201 + global $codigoMap,$codigoLayer,$locaplic;
2179 $dados = array(); 2202 $dados = array();
2180 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 2203 $mapfile = $locaplic."/temas/".$codigoMap.".map";
2181 $mapa = ms_newMapObj($mapfile); 2204 $mapa = ms_newMapObj($mapfile);
@@ -2183,26 +2206,26 @@ function alterarClasseGeral() @@ -2183,26 +2206,26 @@ function alterarClasseGeral()
2183 if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){ 2206 if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){
2184 return "erro. Layer METAESTAT"; 2207 return "erro. Layer METAESTAT";
2185 } 2208 }
2186 - $classe = $layer->getclass($indiceClasse);  
2187 - $classe->set("name",base64_decode($name));  
2188 - $classe->set("title",base64_decode($title));  
2189 - $classe->setexpression(base64_decode($expression));  
2190 - $classe->set("keyimage",$keyimage);  
2191 - $classe->set("maxscaledenom",$maxscale);  
2192 - $classe->set("minscaledenom",$minscale);  
2193 - $classe->set("status",$status); 2209 + $classe = $layer->getclass($_GET["indiceClasse"]);
  2210 + $classe->set("name",base64_decode($_GET["name"]));
  2211 + $classe->set("title",base64_decode($_GET["title"]));
  2212 + $classe->setexpression(base64_decode($_GET["expression"]));
  2213 + $classe->set("keyimage",$_GET["keyimage"]);
  2214 + $classe->set("maxscaledenom",$_GET["maxscale"]);
  2215 + $classe->set("minscaledenom",$_GET["minscale"]);
  2216 + $classe->set("status",$_GET["status"]);
2194 $mapa->save($mapfile); 2217 $mapa->save($mapfile);
2195 removeCabecalho($mapfile); 2218 removeCabecalho($mapfile);
2196 return "ok"; 2219 return "ok";
2197 } 2220 }
2198 function pegaClasseLabel() 2221 function pegaClasseLabel()
2199 { 2222 {
2200 - global $codigoMap,$codigoLayer,$indiceClasse,$locaplic; 2223 + global $codigoMap,$codigoLayer,$locaplic;
2201 $dados = array(); 2224 $dados = array();
2202 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 2225 $mapfile = $locaplic."/temas/".$codigoMap.".map";
2203 $mapa = ms_newMapObj($mapfile); 2226 $mapa = ms_newMapObj($mapfile);
2204 $layer = $mapa->getlayerbyname($codigoLayer); 2227 $layer = $mapa->getlayerbyname($codigoLayer);
2205 - $classe = $layer->getclass($indiceClasse); 2228 + $classe = $layer->getclass($_GET["indiceClasse"]);
2206 2229
2207 $v = versao(); 2230 $v = versao();
2208 $vi = $v["inteiro"]; 2231 $vi = $v["inteiro"];
@@ -2266,12 +2289,12 @@ function pegaClasseLabel() @@ -2266,12 +2289,12 @@ function pegaClasseLabel()
2266 } 2289 }
2267 function alterarClasseLabel() 2290 function alterarClasseLabel()
2268 { 2291 {
2269 - global $text,$codigoMap,$codigoLayer,$indiceClasse,$locaplic,$autoangle,$encoding,$force,$partials,$mindistance,$minfeaturesize,$wrap,$antialias,$buffer,$angle,$offsety,$offsetx,$position,$maxsize,$minsize,$size,$backgroundshadowsizey,$backgroundshadowsizex,$shadowsizey,$shadowsizex,$shadowcolor,$outlinecolor,$color,$backgroundshadowcolor,$backgroundcolor,$type,$font;  
2270 - if(!isset($text)){  
2271 - $text = ""; 2292 + global $codigoMap,$codigoLayer,$locaplic;
  2293 + if(!isset($_GET["text"])){
  2294 + $_GET["text"] = "";
2272 } 2295 }
2273 else{ 2296 else{
2274 - $text = "[".$text."]"; 2297 + $_GET["text"] = "[".$_GET["text"]."]";
2275 } 2298 }
2276 $dados = array(); 2299 $dados = array();
2277 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 2300 $mapfile = $locaplic."/temas/".$codigoMap.".map";
@@ -2280,7 +2303,7 @@ function alterarClasseLabel() @@ -2280,7 +2303,7 @@ function alterarClasseLabel()
2280 if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){ 2303 if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){
2281 return "erro. Layer METAESTAT"; 2304 return "erro. Layer METAESTAT";
2282 } 2305 }
2283 - $classe = $layer->getclass($indiceClasse); 2306 + $classe = $layer->getclass($_GET["indiceClasse"]);
2284 $v = versao(); 2307 $v = versao();
2285 $vi = $v["inteiro"]; 2308 $vi = $v["inteiro"];
2286 if($vi >= 60300){ 2309 if($vi >= 60300){
@@ -2299,11 +2322,11 @@ function alterarClasseLabel() @@ -2299,11 +2322,11 @@ function alterarClasseLabel()
2299 } 2322 }
2300 elseif ($vi >= 60300 && $classe->numlabels == 0){ 2323 elseif ($vi >= 60300 && $classe->numlabels == 0){
2301 if($wrap != ""){ 2324 if($wrap != ""){
2302 - $s = "CLASS LABEL WRAP '$wrap' TEXT '".$text."' END END"; 2325 + $s = "CLASS LABEL WRAP '$wrap' TEXT '".$_GET["text"]."' END END";
2303 $classe->updateFromString($s); 2326 $classe->updateFromString($s);
2304 } 2327 }
2305 else{ 2328 else{
2306 - $s = "CLASS LABEL TEXT '".$text."' END END"; 2329 + $s = "CLASS LABEL TEXT '".$_GET["text"]."' END END";
2307 $classe->updateFromString($s); 2330 $classe->updateFromString($s);
2308 } 2331 }
2309 } 2332 }
@@ -2318,67 +2341,67 @@ function alterarClasseLabel() @@ -2318,67 +2341,67 @@ function alterarClasseLabel()
2318 if($wrap != ""){ 2341 if($wrap != ""){
2319 $label->set("maxlength",1); 2342 $label->set("maxlength",1);
2320 } 2343 }
2321 - if($fonte != "bitmap"){ 2344 + if($_GET["fonte"] != "bitmap"){
2322 //para funcionar na versao 7 do mapserver 2345 //para funcionar na versao 7 do mapserver
2323 $label->updateFromString("LABEL type truetype END"); 2346 $label->updateFromString("LABEL type truetype END");
2324 - $label->set("font",$fonte);  
2325 - $label->set("size",$tamanho); 2347 + $label->set("font",$_GET["fonte"]);
  2348 + $label->set("size",$_GET["tamanho"]);
2326 } 2349 }
2327 else{ 2350 else{
2328 //para funcionar na versao 7 do mapserver 2351 //para funcionar na versao 7 do mapserver
2329 $label->updateFromString("LABEL type bitmap END"); 2352 $label->updateFromString("LABEL type bitmap END");
2330 $t = MS_TINY; 2353 $t = MS_TINY;
2331 - if ($tamanho > 5 ){ 2354 + if ($_GET["tamanho"] > 5 ){
2332 $t = MS_TINY; 2355 $t = MS_TINY;
2333 } 2356 }
2334 - if ($tamanho >= 7 ){ 2357 + if ($_GET["tamanho"] >= 7 ){
2335 $t = MS_SMALL; 2358 $t = MS_SMALL;
2336 } 2359 }
2337 - if ($tamanho >= 10 ){ 2360 + if ($_GET["tamanho"] >= 10 ){
2338 $t = MS_MEDIUM; 2361 $t = MS_MEDIUM;
2339 } 2362 }
2340 - if ($tamanho >= 12 ){ 2363 + if ($_GET["tamanho"] >= 12 ){
2341 $t = MS_LARGE; 2364 $t = MS_LARGE;
2342 } 2365 }
2343 - if ($tamanho >= 14 ){ 2366 + if ($_GET["tamanho"] >= 14 ){
2344 $t = MS_GIANT; 2367 $t = MS_GIANT;
2345 } 2368 }
2346 $label->set("size",$t); 2369 $label->set("size",$t);
2347 } 2370 }
2348 if ($label != ""){ 2371 if ($label != ""){
2349 //$label->set("type",$type); 2372 //$label->set("type",$type);
2350 - corE($label,$backgroundcolor,"backgroundcolor");  
2351 - corE($label,$backgroundshadowcolor,"backgroundshadowcolor");  
2352 - corE($label,$color,"color");  
2353 - corE($label,$outlinecolor,"outlinecolor");  
2354 - if(!empty($sombra) && !empty($backgroundshadowsizex)){  
2355 - corE($label,$sombra,"backgroundshadowcolor",$backgroundshadowsizex,$backgroundshadowsizey); 2373 + corE($label,$_GET["backgroundcolor"],"backgroundcolor");
  2374 + corE($label,$_GET["backgroundshadowcolor"],"backgroundshadowcolor");
  2375 + corE($label,$_GET["color"],"color");
  2376 + corE($label,$_GET["outlinecolor"],"outlinecolor");
  2377 + if(!empty($_GET["sombra"]) && !empty($_GET["backgroundshadowsizex"])){
  2378 + corE($label,$_GET["sombra"],"backgroundshadowcolor",$_GET["backgroundshadowsizex"],$_GET["backgroundshadowsizey"]);
2356 } 2379 }
2357 - $label->set("shadowsizex",$shadowsizex);  
2358 - $label->set("shadowsizey",$shadowsizey); 2380 + $label->set("shadowsizex",$_GET["shadowsizex"]);
  2381 + $label->set("shadowsizey",$_GET["shadowsizey"]);
2359 //$label->set("backgroundshadowsizex",$backgroundshadowsizex); 2382 //$label->set("backgroundshadowsizex",$backgroundshadowsizex);
2360 //$label->set("backgroundshadowsizey",$backgroundshadowsizey); 2383 //$label->set("backgroundshadowsizey",$backgroundshadowsizey);
2361 2384
2362 - $label->set("minsize",$minsize);  
2363 - $label->set("maxsize",$maxsize); 2385 + $label->set("minsize",$_GET["minsize"]);
  2386 + $label->set("maxsize",$_GET["maxsize"]);
2364 //$label->set("position",$position); 2387 //$label->set("position",$position);
2365 2388
2366 - $label->set("offsetx",$offsetx);  
2367 - $label->set("offsety",$offsety);  
2368 - $label->set("angle",$angle); 2389 + $label->set("offsetx",$_GET["offsetx"]);
  2390 + $label->set("offsety",$_GET["offsety"]);
  2391 + $label->set("angle",$_GET["angle"]);
2369 2392
2370 //$label->set("autoangle",$autoangle); 2393 //$label->set("autoangle",$autoangle);
2371 //$label->set("buffer",$buffer); 2394 //$label->set("buffer",$buffer);
2372 //$label->set("antialias",$antialias); 2395 //$label->set("antialias",$antialias);
2373 - $label->set("wrap",$wrap);  
2374 - $label->set("minfeaturesize",$minfeaturesize);  
2375 - $label->set("mindistance",$mindistance);  
2376 - $label->set("partials",$partials);  
2377 - $label->set("force",$force);  
2378 - $label->set("encoding",$encoding); 2396 + $label->set("wrap",$_GET["wrap"]);
  2397 + $label->set("minfeaturesize",$_GET["minfeaturesize"]);
  2398 + $label->set("mindistance",$_GET["mindistance"]);
  2399 + $label->set("partials",$_GET["partials"]);
  2400 + $label->set("force",$_GET["force"]);
  2401 + $label->set("encoding",$_GET["encoding"]);
2379 2402
2380 $p = array("MS_AUTO"=>MS_AUTO,"MS_UL"=>MS_UL,"MS_LR"=>MS_LR,"MS_UR"=>MS_UR,"MS_LL"=>MS_LL,"MS_CR"=>MS_CR,"MS_CL"=>MS_CL,"MS_UC"=>MS_UC,"MS_LC"=>MS_LC,"MS_CC"=>MS_CC); 2403 $p = array("MS_AUTO"=>MS_AUTO,"MS_UL"=>MS_UL,"MS_LR"=>MS_LR,"MS_UR"=>MS_UR,"MS_LL"=>MS_LL,"MS_CR"=>MS_CR,"MS_CL"=>MS_CL,"MS_UC"=>MS_UC,"MS_LC"=>MS_LC,"MS_CC"=>MS_CC);
2381 - $label->set("position",$p[$position]); 2404 + $label->set("position",$p[$_GET["position"]]);
2382 } 2405 }
2383 $mapa->save($mapfile); 2406 $mapa->save($mapfile);
2384 removeCabecalho($mapfile); 2407 removeCabecalho($mapfile);
@@ -2386,14 +2409,14 @@ function alterarClasseLabel() @@ -2386,14 +2409,14 @@ function alterarClasseLabel()
2386 } 2409 }
2387 function pegaEstilo() 2410 function pegaEstilo()
2388 { 2411 {
2389 - global $codigoMap,$codigoLayer,$indiceClasse,$indiceEstilo,$locaplic; 2412 + global $codigoMap,$codigoLayer,$locaplic;
2390 $dados = array(); 2413 $dados = array();
2391 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 2414 $mapfile = $locaplic."/temas/".$codigoMap.".map";
2392 $mapa = ms_newMapObj($mapfile); 2415 $mapa = ms_newMapObj($mapfile);
2393 $layer = $mapa->getlayerbyname($codigoLayer); 2416 $layer = $mapa->getlayerbyname($codigoLayer);
2394 $nclasses = $layer->numclasses; 2417 $nclasses = $layer->numclasses;
2395 - $classe = $layer->getclass($indiceClasse);  
2396 - $estilo = $classe->getstyle($indiceEstilo); 2418 + $classe = $layer->getclass($_GET["indiceClasse"]);
  2419 + $estilo = $classe->getstyle($_GET["indiceEstilo"]);
2397 $dados["symbolname"] = $estilo->symbolname; 2420 $dados["symbolname"] = $estilo->symbolname;
2398 2421
2399 $dados["color"] = $estilo->color->red.",".$estilo->color->green.",".$estilo->color->blue; 2422 $dados["color"] = $estilo->color->red.",".$estilo->color->green.",".$estilo->color->blue;
@@ -2422,7 +2445,7 @@ function pegaEstilo() @@ -2422,7 +2445,7 @@ function pegaEstilo()
2422 } 2445 }
2423 function alterarEstilo() 2446 function alterarEstilo()
2424 { 2447 {
2425 - global $codigoMap,$codigoLayer,$indiceClasse,$indiceEstilo,$locaplic,$angle,$maxwidth,$minwidth,$width,$outlinecolor,$backgroundcolor,$antialias,$offsety,$offsetx,$maxsize,$minsize,$size,$color,$symbolname; 2448 + global $codigoMap,$codigoLayer,$locaplic;
2426 $dados = array(); 2449 $dados = array();
2427 $mapfile = $locaplic."/temas/".$codigoMap.".map"; 2450 $mapfile = $locaplic."/temas/".$codigoMap.".map";
2428 $mapa = ms_newMapObj($mapfile); 2451 $mapa = ms_newMapObj($mapfile);
@@ -2431,28 +2454,28 @@ function alterarEstilo() @@ -2431,28 +2454,28 @@ function alterarEstilo()
2431 return "erro. Layer METAESTAT"; 2454 return "erro. Layer METAESTAT";
2432 } 2455 }
2433 $nclasses = $layer->numclasses; 2456 $nclasses = $layer->numclasses;
2434 - $classe = $layer->getclass($indiceClasse);  
2435 - $estilo = $classe->getstyle($indiceEstilo);  
2436 - if(!empty($symbolname)){  
2437 - $estilo->set("symbolname",$symbolname); 2457 + $classe = $layer->getclass($_GET["indiceClasse"]);
  2458 + $estilo = $classe->getstyle($_GET["indiceEstilo"]);
  2459 + if(!empty($_GET["symbolname"])){
  2460 + $estilo->set("symbolname",$_GET["symbolname"]);
2438 } 2461 }
2439 - if(empty($symbolname)){ 2462 + if(empty($_GET["symbolname"])){
2440 $estilo->set("symbolname"," "); 2463 $estilo->set("symbolname"," ");
2441 } 2464 }
2442 corE($estilo,$color,"color"); 2465 corE($estilo,$color,"color");
2443 2466
2444 - $estilo->set("size",$size);  
2445 - $estilo->set("minsize",$minsize);  
2446 - $estilo->set("maxsize",$maxsize);  
2447 - $estilo->set("offsetx",$offsetx);  
2448 - $estilo->set("offsety",$offsety);  
2449 - $estilo->set("antialias",$antialias);  
2450 - corE($estilo,$backgroundcolor,"backgroundcolor");  
2451 - corE($estilo,$outlinecolor,"outlinecolor");  
2452 - $estilo->set("width",$width);  
2453 - $estilo->set("minwidth",$minwidth);  
2454 - $estilo->set("maxwidth",$maxwidth);  
2455 - $estilo->set("angle",$angle); 2467 + $estilo->set("size",$_GET["size"]);
  2468 + $estilo->set("minsize",$_GET["minsize"]);
  2469 + $estilo->set("maxsize",$_GET["maxsize"]);
  2470 + $estilo->set("offsetx",$_GET["offsetx"]);
  2471 + $estilo->set("offsety",$_GET["offsety"]);
  2472 + $estilo->set("antialias",$_GET["antialias"]);
  2473 + corE($estilo,$_GET["backgroundcolor"],"backgroundcolor");
  2474 + corE($estilo,$_GET["outlinecolor"],"outlinecolor");
  2475 + $estilo->set("width",$_GET["width"]);
  2476 + $estilo->set("minwidth",$_GET["minwidth"]);
  2477 + $estilo->set("maxwidth",$_GET["maxwidth"]);
  2478 + $estilo->set("angle",$_GET["angle"]);
2456 //$estilo->set("opacity",$opacity); 2479 //$estilo->set("opacity",$opacity);
2457 $mapa->save($mapfile); 2480 $mapa->save($mapfile);
2458 removeCabecalho($mapfile); 2481 removeCabecalho($mapfile);
admin/php/gruposusuarios.php
@@ -72,6 +72,10 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){ @@ -72,6 +72,10 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){
72 retornaJSON("Vc nao pode realizar essa operacao.");exit; 72 retornaJSON("Vc nao pode realizar essa operacao.");exit;
73 } 73 }
74 } 74 }
  75 +
  76 +$id_usuario = $_GET["id_usuario"];
  77 +testaSafeNumerico([$id_usuario]);
  78 +
75 switch (strtoupper($funcao)) 79 switch (strtoupper($funcao))
76 { 80 {
77 case "ALTERARGRUPOS": 81 case "ALTERARGRUPOS":
@@ -127,9 +131,11 @@ switch (strtoupper($funcao)) @@ -127,9 +131,11 @@ switch (strtoupper($funcao))
127 cpjson($retorno); 131 cpjson($retorno);
128 function alterarGrupos() 132 function alterarGrupos()
129 { 133 {
130 - global $id_grupo,$nome,$descricao; 134 + global $id_grupo;
131 try 135 try
132 { 136 {
  137 + $nome = $_GET["nome"];
  138 + $descricao = $_GET["descricao"];
133 include(dirname(__FILE__)."/conexao.php"); 139 include(dirname(__FILE__)."/conexao.php");
134 if($convUTF){ 140 if($convUTF){
135 $nome = utf8_encode($nome); 141 $nome = utf8_encode($nome);
admin/php/identifica.php
@@ -50,6 +50,11 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){ @@ -50,6 +50,11 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){
50 retornaJSON("Vc nao pode realizar essa operacao.");exit; 50 retornaJSON("Vc nao pode realizar essa operacao.");exit;
51 } 51 }
52 } 52 }
  53 +
  54 +$id_i = $_GET["id_i"];
  55 +$id = $_GET["id"];
  56 +testaSafeNumerico([$id_i,$id]);
  57 +
53 error_reporting(0); 58 error_reporting(0);
54 //faz a busca da fun&ccedil;&atilde;o que deve ser executada 59 //faz a busca da fun&ccedil;&atilde;o que deve ser executada
55 switch (strtoupper($funcao)) 60 switch (strtoupper($funcao))
@@ -127,19 +132,19 @@ switch (strtoupper($funcao)) @@ -127,19 +132,19 @@ switch (strtoupper($funcao))
127 Altera o registro de um WS 132 Altera o registro de um WS
128 */ 133 */
129 function alterarFuncoes(){ 134 function alterarFuncoes(){
130 - global $id_i,$abrir_i,$nome_i,$target_i,$publicado_i,$esquemaadmin; 135 + global $id_i,$esquemaadmin;
131 try{ 136 try{
132 //$nome_i = mb_convert_encoding($nome_i,"UTF-8","ISO-8859-1"); 137 //$nome_i = mb_convert_encoding($nome_i,"UTF-8","ISO-8859-1");
133 require_once("conexao.php"); 138 require_once("conexao.php");
134 if($convUTF){ 139 if($convUTF){
135 - $nome_i = utf8_encode($nome_i); 140 + $_GET["nome_i"] = utf8_encode($_GET["nome_i"]);
136 } 141 }
137 if($id_i != ""){ 142 if($id_i != ""){
138 $dataCol = array( 143 $dataCol = array(
139 - "publicado_i" => $publicado_i,  
140 - "nome_i" => $nome_i,  
141 - "abrir_i" => $abrir_i,  
142 - "target_i" => $target_i 144 + "publicado_i" => $_GET["publicado_i"],
  145 + "nome_i" => $_GET["nome_i"],
  146 + "abrir_i" => $_GET["abrir_i"],
  147 + "target_i" => $_GET["target_i"]
143 ); 148 );
144 i3GeoAdminUpdate($dbhw,"i3geoadmin_identifica",$dataCol,"WHERE id_i = $id_i"); 149 i3GeoAdminUpdate($dbhw,"i3geoadmin_identifica",$dataCol,"WHERE id_i = $id_i");
145 $retorna = $id_i; 150 $retorna = $id_i;
admin/php/login.php
@@ -62,13 +62,13 @@ error_reporting(0); @@ -62,13 +62,13 @@ error_reporting(0);
62 // 62 //
63 //pega as variaveis passadas com get ou post 63 //pega as variaveis passadas com get ou post
64 // 64 //
65 -include_once(dirname(__FILE__)."/../../classesphp/pega_variaveis.php"); 65 +include_once(dirname(__FILE__)."/../safe.php");
66 include_once(dirname(__FILE__)."/admin.php"); 66 include_once(dirname(__FILE__)."/admin.php");
67 error_reporting(0); 67 error_reporting(0);
68 session_write_close(); 68 session_write_close();
69 session_name("i3GeoLogin"); 69 session_name("i3GeoLogin");
70 //se o usuario estiver tentando fazer login 70 //se o usuario estiver tentando fazer login
71 -if(!empty($usuario) && !empty($senha)){ 71 +if(!empty($_POST["usuario"]) && !empty($_POST["senha"])){
72 logoutUsuario(); 72 logoutUsuario();
73 session_regenerate_id(); 73 session_regenerate_id();
74 $_SESSION = array(); 74 $_SESSION = array();
@@ -97,6 +97,9 @@ switch (strtoupper($funcao)) @@ -97,6 +97,9 @@ switch (strtoupper($funcao))
97 97
98 */ 98 */
99 case "LOGIN": 99 case "LOGIN":
  100 + $usuario = $_POST["usuario"];
  101 + $senha = $_POST["senha"];
  102 +
100 $teste = autenticaUsuario($usuario,$senha); 103 $teste = autenticaUsuario($usuario,$senha);
101 if($teste != false){ 104 if($teste != false){
102 $_SESSION["usuario"] = $usuario; 105 $_SESSION["usuario"] = $usuario;
@@ -137,12 +140,11 @@ switch (strtoupper($funcao)) @@ -137,12 +140,11 @@ switch (strtoupper($funcao))
137 */ 140 */
138 case "VALIDAOPERACAOSESSAO": 141 case "VALIDAOPERACAOSESSAO":
139 $retorno = "nao"; 142 $retorno = "nao";
140 - if($operacao == ""){ 143 + if($_GET["operacao"] == ""){
141 $retorno = "sim"; 144 $retorno = "sim";
142 } 145 }
143 else{ 146 else{
144 - //echo "oi";exit;  
145 - if(verificaOperacaoSessao($operacao) == true){ 147 + if(verificaOperacaoSessao($_GET["operacao"]) == true){
146 $retorno = "sim"; 148 $retorno = "sim";
147 } 149 }
148 else{ 150 else{
@@ -163,8 +165,8 @@ switch (strtoupper($funcao)) @@ -163,8 +165,8 @@ switch (strtoupper($funcao))
163 */ 165 */
164 case "RECUPERARSENHA": 166 case "RECUPERARSENHA":
165 $retorno = false; 167 $retorno = false;
166 - if(!empty($usuario)){  
167 - $retorno = recuperarSenha($usuario); 168 + if(!empty($_POST["usuario"])){
  169 + $retorno = recuperarSenha($_POST["usuario"]);
168 } 170 }
169 cpjson($retorno); 171 cpjson($retorno);
170 break; 172 break;
@@ -181,8 +183,8 @@ switch (strtoupper($funcao)) @@ -181,8 +183,8 @@ switch (strtoupper($funcao))
181 */ 183 */
182 case "ALTERARSENHA": 184 case "ALTERARSENHA":
183 $retorno = false; 185 $retorno = false;
184 - if(!empty($usuario)){  
185 - $retorno = alterarSenha($usuario,$novaSenha); 186 + if(!empty($_POST["usuario"])){
  187 + $retorno = alterarSenha($_POST["usuario"],$_POST["novaSenha"]);
186 } 188 }
187 cpjson($retorno); 189 cpjson($retorno);
188 break; 190 break;
admin/php/mapas.php
@@ -39,7 +39,6 @@ O par&amp;acirc;metro principal &amp;eacute; &quot;funcao&quot;, que define qual opera&amp;ccedil;&amp;ati @@ -39,7 +39,6 @@ O par&amp;acirc;metro principal &amp;eacute; &quot;funcao&quot;, que define qual opera&amp;ccedil;&amp;ati
39 Cada opera&ccedil;&atilde;o possu&iacute; seus pr&oacute;prios par&acirc;metros, que devem ser enviados tamb&eacute;m na requisi&ccedil;&atilde;o da opera&ccedil;&atilde;o. 39 Cada opera&ccedil;&atilde;o possu&iacute; seus pr&oacute;prios par&acirc;metros, que devem ser enviados tamb&eacute;m na requisi&ccedil;&atilde;o da opera&ccedil;&atilde;o.
40 40
41 */ 41 */
42 -  
43 include_once(dirname(__FILE__)."/login.php"); 42 include_once(dirname(__FILE__)."/login.php");
44 $funcoesEdicao = array( 43 $funcoesEdicao = array(
45 "ALTERARMAPA", 44 "ALTERARMAPA",
@@ -51,6 +50,11 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){ @@ -51,6 +50,11 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){
51 retornaJSON("Vc nao pode realizar essa operacao. Tente fazer login novamente.");exit; 50 retornaJSON("Vc nao pode realizar essa operacao. Tente fazer login novamente.");exit;
52 } 51 }
53 } 52 }
  53 +$id = $_GET["id"];
  54 +$id_mapa = $_GET["id_mapa"];
  55 +testaSafeNumerico([$id,$id_mapa]);
  56 +
  57 +
54 error_reporting(0); 58 error_reporting(0);
55 //faz a busca da fun&ccedil;&atilde;o que deve ser executada 59 //faz a busca da fun&ccedil;&atilde;o que deve ser executada
56 switch (strtoupper($funcao)) 60 switch (strtoupper($funcao))
@@ -174,7 +178,7 @@ switch (strtoupper($funcao)) @@ -174,7 +178,7 @@ switch (strtoupper($funcao))
174 break; 178 break;
175 } 179 }
176 function salvaMapfile(){ 180 function salvaMapfile(){
177 - global $esquemaadmin,$nome_mapa,$arqmapfile,$url,$id_mapa,$preferenciasbase64,$geometriasbase64,$graficosbase64,$tabelasbase64,$ext; 181 + global $esquemaadmin,$id_mapa;
178 //as preferencias sao criadas via javascript e guardadas junto com o mapa 182 //as preferencias sao criadas via javascript e guardadas junto com o mapa
179 try{ 183 try{
180 // 184 //
@@ -186,24 +190,24 @@ function salvaMapfile(){ @@ -186,24 +190,24 @@ function salvaMapfile(){
186 //o parser para reconstruir os valores e feito em javascript, no cliente 190 //o parser para reconstruir os valores e feito em javascript, no cliente
187 // 191 //
188 $customizacoesinit = array(); 192 $customizacoesinit = array();
189 - if(isset($preferenciasbase64) || isset($geometriasbase64) || isset($graficosbase64) || isset($tabelasbase64)){  
190 - $customizacoesinit[] = '"preferenciasbase64":"'.$preferenciasbase64.'"';  
191 - $customizacoesinit[] = '"geometriasbase64":"'.$geometriasbase64.'"';  
192 - $customizacoesinit[] = '"graficosbase64":"'.$graficosbase64.'"';  
193 - $customizacoesinit[] = '"tabelasbase64":"'.$tabelasbase64.'"';  
194 - $m = ms_newMapObj($arqmapfile); 193 + if(isset($_GET["preferenciasbase64"]) || isset($_GET["geometriasbase64"]) || isset($_GET["graficosbase64"]) || isset($_GET["tabelasbase64"])){
  194 + $customizacoesinit[] = '"preferenciasbase64":"'.$_GET["preferenciasbase64"].'"';
  195 + $customizacoesinit[] = '"geometriasbase64":"'.$_GET["geometriasbase64"].'"';
  196 + $customizacoesinit[] = '"graficosbase64":"'.$_GET["graficosbase64"].'"';
  197 + $customizacoesinit[] = '"tabelasbase64":"'.$_GET["tabelasbase64"].'"';
  198 + $m = ms_newMapObj($_GET["arqmapfile"]);
195 $m->setmetadata("CUSTOMIZACOESINIT",'{'.implode(",",$customizacoesinit).'}'); 199 $m->setmetadata("CUSTOMIZACOESINIT",'{'.implode(",",$customizacoesinit).'}');
196 - $m->save($arqmapfile); 200 + $m->save($_GET["arqmapfile"]);
197 } 201 }
198 - if($ext && $ext != ""){  
199 - $e = explode(" ",$ext);  
200 - $m = ms_newMapObj($arqmapfile); 202 + if($_GET["ext"] && $_GET["ext"] != ""){
  203 + $e = explode(" ",$_GET["ext"]);
  204 + $m = ms_newMapObj($_GET["arqmapfile"]);
201 $extatual = $m->extent; 205 $extatual = $m->extent;
202 $extatual->setextent((min($e[0],$e[2])),(min($e[1],$e[3])),(max($e[0],$e[2])),(max($e[1],$e[3]))); 206 $extatual->setextent((min($e[0],$e[2])),(min($e[1],$e[3])),(max($e[0],$e[2])),(max($e[1],$e[3])));
203 - $m->save($arqmapfile); 207 + $m->save($_GET["arqmapfile"]);
204 } 208 }
205 - $handle = fopen ($arqmapfile, 'r');  
206 - $conteudo = fread ($handle, filesize ($arqmapfile)); 209 + $handle = fopen ($_GET["arqmapfile"], 'r');
  210 + $conteudo = fread ($handle, filesize ($_GET["arqmapfile"]));
207 fclose ($handle); 211 fclose ($handle);
208 $conteudo = base64_encode($conteudo); 212 $conteudo = base64_encode($conteudo);
209 if($conteudo == false){ 213 if($conteudo == false){
@@ -211,7 +215,7 @@ function salvaMapfile(){ @@ -211,7 +215,7 @@ function salvaMapfile(){
211 } 215 }
212 require_once("conexao.php"); 216 require_once("conexao.php");
213 if($convUTF){ 217 if($convUTF){
214 - $nome_mapa = utf8_encode($nome_mapa); 218 + $_GET["nome_mapa"] = utf8_encode($_GET["nome_mapa"]);
215 } 219 }
216 $retorna = ""; 220 $retorna = "";
217 if(empty($id_mapa)){ 221 if(empty($id_mapa)){
@@ -236,8 +240,8 @@ function salvaMapfile(){ @@ -236,8 +240,8 @@ function salvaMapfile(){
236 $dataCol = array( 240 $dataCol = array(
237 "mapfile" => $conteudo, 241 "mapfile" => $conteudo,
238 "publicado_mapa" => "sim", 242 "publicado_mapa" => "sim",
239 - "nome_mapa" => $nome_mapa,  
240 - "outros_mapa" => "&restauramapa=$id&interface=$url" 243 + "nome_mapa" => $_GET["nome_mapa"],
  244 + "outros_mapa" => "&restauramapa=$id&interface=".$_GET["url"]
241 ); 245 );
242 i3GeoAdminUpdate($dbhw,"i3geoadmin_mapas",$dataCol, "WHERE id_mapa =".$id); 246 i3GeoAdminUpdate($dbhw,"i3geoadmin_mapas",$dataCol, "WHERE id_mapa =".$id);
243 $dbhw = null; 247 $dbhw = null;
@@ -252,29 +256,29 @@ function salvaMapfile(){ @@ -252,29 +256,29 @@ function salvaMapfile(){
252 Altera o registro de um mapa 256 Altera o registro de um mapa
253 */ 257 */
254 function alterarMapa(){ 258 function alterarMapa(){
255 - global $esquemaadmin,$publicado_mapa,$ordem_mapa,$id_mapa,$desc_mapa,$ext_mapa,$imagem_mapa,$outros_mapa,$nome_mapa,$linkdireto_mapa,$temas_mapa,$ligados_mapa,$perfil_mapa; 259 + global $esquemaadmin,$id_mapa;
256 //substitui a string do parametro outros 260 //substitui a string do parametro outros
257 - $outros_mapa = str_replace("*","&",$outros_mapa); 261 + $_GET["outros_mapa"] = str_replace("*","&",$_GET["outros_mapa"]);
258 try{ 262 try{
259 require_once("conexao.php"); 263 require_once("conexao.php");
260 if($convUTF){ 264 if($convUTF){
261 - $nome_mapa = utf8_encode($nome_mapa);  
262 - $desc_mapa = utf8_encode($desc_mapa); 265 + $_GET["nome_mapa"] = utf8_encode($_GET["nome_mapa"]);
  266 + $_GET["desc_mapa"] = utf8_encode($_GET["desc_mapa"]);
263 } 267 }
264 $retorna = ""; 268 $retorna = "";
265 if($id_mapa != ""){ 269 if($id_mapa != ""){
266 $dataCol = array( 270 $dataCol = array(
267 - "publicado_mapa" => $publicado_mapa,  
268 - "ordem_mapa" => $ordem_mapa,  
269 - "desc_mapa" => $desc_mapa,  
270 - "ext_mapa" => $ext_mapa,  
271 - "imagem_mapa" => $imagem_mapa,  
272 - "outros_mapa" => $outros_mapa,  
273 - "nome_mapa" => $nome_mapa,  
274 - "linkdireto_mapa" => $linkdireto_mapa,  
275 - "temas_mapa" => $temas_mapa,  
276 - "ligados_mapa" => $ligados_mapa,  
277 - "perfil_mapa" => $perfil_mapa 271 + "publicado_mapa" => $_GET["publicado_mapa"],
  272 + "ordem_mapa" => $_GET["ordem_mapa"],
  273 + "desc_mapa" => $_GET["desc_mapa"],
  274 + "ext_mapa" => $_GET["ext_mapa"],
  275 + "imagem_mapa" => $_GET["imagem_mapa"],
  276 + "outros_mapa" => $_GET["outros_mapa"],
  277 + "nome_mapa" => $_GET["nome_mapa"],
  278 + "linkdireto_mapa" => $_GET["linkdireto_mapa"],
  279 + "temas_mapa" => $_GET["temas_mapa"],
  280 + "ligados_mapa" => $_GET["ligados_mapa"],
  281 + "perfil_mapa" => $_GET["perfil_mapa"]
278 ); 282 );
279 i3GeoAdminUpdate($dbhw,"i3geoadmin_mapas",$dataCol, "WHERE id_mapa =".$id_mapa); 283 i3GeoAdminUpdate($dbhw,"i3geoadmin_mapas",$dataCol, "WHERE id_mapa =".$id_mapa);
280 $retorna = $id_mapa; 284 $retorna = $id_mapa;
admin/php/menutemas.php
@@ -41,8 +41,6 @@ O par&amp;acirc;metro principal &amp;eacute; &quot;funcao&quot;, que define qual opera&amp;ccedil;&amp;ati @@ -41,8 +41,6 @@ O par&amp;acirc;metro principal &amp;eacute; &quot;funcao&quot;, que define qual opera&amp;ccedil;&amp;ati
41 Cada opera&ccedil;&atilde;o possu&iacute; seus proprios par&acirc;metros, que devem ser enviados tamb&eacute;m na requisi&ccedil;&atilde;o da opera&ccedil;&atilde;o. 41 Cada opera&ccedil;&atilde;o possu&iacute; seus proprios par&acirc;metros, que devem ser enviados tamb&eacute;m na requisi&ccedil;&atilde;o da opera&ccedil;&atilde;o.
42 42
43 */ 43 */
44 -  
45 -include_once(dirname(__FILE__)."/admin.php");  
46 include_once(dirname(__FILE__)."/login.php"); 44 include_once(dirname(__FILE__)."/login.php");
47 $funcoesEdicao = array( 45 $funcoesEdicao = array(
48 "ALTERAMENUS", 46 "ALTERAMENUS",
@@ -60,6 +58,10 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){ @@ -60,6 +58,10 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){
60 } 58 }
61 } 59 }
62 60
  61 +$codigo_tema = $_GET["codigo_tema"];
  62 +$id = $_GET["id"];
  63 +
  64 +testaSafeNumerico([$id]);
63 65
64 if(!isset($funcao)) 66 if(!isset($funcao))
65 { 67 {
@@ -455,7 +457,7 @@ switch (strtoupper($funcao)) @@ -455,7 +457,7 @@ switch (strtoupper($funcao))
455 {JSON} 457 {JSON}
456 */ 458 */
457 case "ATUALIZAMINIATURA": 459 case "ATUALIZAMINIATURA":
458 - retornaJSON(atualizaMiniatura($tema)); 460 + retornaJSON(atualizaMiniatura($_GET["tema"]));
459 exit; 461 exit;
460 break; 462 break;
461 /* 463 /*
@@ -548,6 +550,7 @@ switch (strtoupper($funcao)) @@ -548,6 +550,7 @@ switch (strtoupper($funcao))
548 break; 550 break;
549 551
550 case "EXCLUIRREGISTRO": 552 case "EXCLUIRREGISTRO":
  553 + $tabela = $_GET["tabela"];
551 if($tabela == "grupos") 554 if($tabela == "grupos")
552 { 555 {
553 $tabela = "i3geoadmin_grupos"; 556 $tabela = "i3geoadmin_grupos";
@@ -754,7 +757,7 @@ filtro - texto para filtrar os dados @@ -754,7 +757,7 @@ filtro - texto para filtrar os dados
754 */ 757 */
755 function pegaTemas() 758 function pegaTemas()
756 { 759 {
757 - global $filtro,$esquemaadmin; 760 + global $esquemaadmin;
758 try 761 try
759 { 762 {
760 $resultado = array(); 763 $resultado = array();
@@ -762,14 +765,14 @@ function pegaTemas() @@ -762,14 +765,14 @@ function pegaTemas()
762 foreach($dbh->query("SELECT * from ".$esquemaadmin."i3geoadmin_temas order by nome_tema") as $row) 765 foreach($dbh->query("SELECT * from ".$esquemaadmin."i3geoadmin_temas order by nome_tema") as $row)
763 { 766 {
764 $continua = true; 767 $continua = true;
765 - if(isset($filtro) && $filtro != "") 768 + if(isset($_GET["filtro"]) && $_GET["filtro"] != "")
766 { 769 {
767 $continua = false; 770 $continua = false;
768 - if ($row['codigo_tema'] == $filtro) 771 + if ($row['codigo_tema'] == $_GET["filtro"])
769 { 772 {
770 $continua = true; 773 $continua = true;
771 } 774 }
772 - $testanome = mb_convert_encoding($filtro,"UTF-8","ISO-8859-1"); 775 + $testanome = mb_convert_encoding($_GET["filtro"],"UTF-8","ISO-8859-1");
773 if (!stristr($row['nome_tema'],$testanome) === FALSE) 776 if (!stristr($row['nome_tema'],$testanome) === FALSE)
774 { 777 {
775 $continua = true; 778 $continua = true;
@@ -808,7 +811,7 @@ function pegaTemas() @@ -808,7 +811,7 @@ function pegaTemas()
808 } 811 }
809 function pegaTemas2() 812 function pegaTemas2()
810 { 813 {
811 - global $filtro,$esquemaadmin; 814 + global $esquemaadmin;
812 try 815 try
813 { 816 {
814 $resultado = array(); 817 $resultado = array();
@@ -816,14 +819,14 @@ function pegaTemas2() @@ -816,14 +819,14 @@ function pegaTemas2()
816 foreach($dbh->query("SELECT codigo_tema,nome_tema,id_tema from ".$esquemaadmin."i3geoadmin_temas order by nome_tema") as $row) 819 foreach($dbh->query("SELECT codigo_tema,nome_tema,id_tema from ".$esquemaadmin."i3geoadmin_temas order by nome_tema") as $row)
817 { 820 {
818 $continua = true; 821 $continua = true;
819 - if(isset($filtro) && $filtro != "") 822 + if(isset($_GET["filtro"]) && $_GET["filtro"] != "")
820 { 823 {
821 $continua = false; 824 $continua = false;
822 - if ($row['codigo_tema'] == $filtro) 825 + if ($row['codigo_tema'] == $_GET["filtro"])
823 { 826 {
824 $continua = true; 827 $continua = true;
825 } 828 }
826 - $testanome = mb_convert_encoding($filtro,"UTF-8","ISO-8859-1"); 829 + $testanome = mb_convert_encoding($_GET["filtro"],"UTF-8","ISO-8859-1");
827 if (!stristr($row['nome_tema'],$testanome) === FALSE) 830 if (!stristr($row['nome_tema'],$testanome) === FALSE)
828 { 831 {
829 $continua = true; 832 $continua = true;
@@ -853,14 +856,17 @@ Altera o registro de um menu. Se id for vazio acrescenta o registro @@ -853,14 +856,17 @@ Altera o registro de um menu. Se id for vazio acrescenta o registro
853 */ 856 */
854 function alteraMenus() 857 function alteraMenus()
855 { 858 {
856 - global $esquemaadmin,$nome_menu,$desc_menu,$id_menu,$aberto,$perfil_menu,$publicado_menu,$en,$es,$it; 859 + global $esquemaadmin,$id_menu;
  860 + $en = $_GET["en"];
  861 + $es = $_GET["es"];
  862 + $it = $_GET["it"];
857 try 863 try
858 { 864 {
859 $retorna = ""; 865 $retorna = "";
860 include("conexao.php"); 866 include("conexao.php");
861 if($convUTF){ 867 if($convUTF){
862 - $nome_menu = utf8_encode($nome_menu);  
863 - $desc_menu = utf8_encode($desc_menu); 868 + $_GET["nome_menu"] = utf8_encode($_GET["nome_menu"]);
  869 + $_GET["desc_menu"] = utf8_encode($_GET["desc_menu"]);
864 $en = utf8_encode($en); 870 $en = utf8_encode($en);
865 $es = utf8_encode($es); 871 $es = utf8_encode($es);
866 $it = utf8_encode($it); 872 $it = utf8_encode($it);
@@ -870,11 +876,11 @@ function alteraMenus() @@ -870,11 +876,11 @@ function alteraMenus()
870 "en" => $en, 876 "en" => $en,
871 "es" => $es, 877 "es" => $es,
872 "it" => $it, 878 "it" => $it,
873 - "publicado_menu" => $publicado_menu,  
874 - "aberto" => $aberto,  
875 - "nome_menu" => $nome_menu,  
876 - "desc_menu" => $desc_menu,  
877 - "perfil_menu" => $perfil_menu 879 + "publicado_menu" => $_GET["publicado_menu"],
  880 + "aberto" => $_GET["aberto"],
  881 + "nome_menu" => $_GET["nome_menu"],
  882 + "desc_menu" => $_GET["desc_menu"],
  883 + "perfil_menu" => $_GET["perfil_menu"]
878 ); 884 );
879 i3GeoAdminUpdate($dbhw,"i3geoadmin_menus",$dataCol,"WHERE id_menu = $id_menu"); 885 i3GeoAdminUpdate($dbhw,"i3geoadmin_menus",$dataCol,"WHERE id_menu = $id_menu");
880 $retorna = "ok"; 886 $retorna = "ok";
@@ -1038,7 +1044,8 @@ function alteraPerfis(){ @@ -1038,7 +1044,8 @@ function alteraPerfis(){
1038 } 1044 }
1039 } 1045 }
1040 function alteraTags(){ 1046 function alteraTags(){
1041 - global $nome,$id,$esquemaadmin; 1047 + global $id,$esquemaadmin;
  1048 + $nome = $_GET["nome"];
1042 try{ 1049 try{
1043 $dbh = ""; 1050 $dbh = "";
1044 include("conexao.php"); 1051 include("conexao.php");
@@ -1081,29 +1088,29 @@ Altera o registro de um grupo. Se id for vazio acrescenta o registro @@ -1081,29 +1088,29 @@ Altera o registro de um grupo. Se id for vazio acrescenta o registro
1081 */ 1088 */
1082 function alteraGrupos() 1089 function alteraGrupos()
1083 { 1090 {
1084 - global $nome_grupo,$desc_grupo,$id_grupo,$en,$es,$it,$esquemaadmin; 1091 + global $id_grupo,$esquemaadmin;
1085 try{ 1092 try{
1086 require(dirname(__FILE__)."/conexao.php"); 1093 require(dirname(__FILE__)."/conexao.php");
1087 if($convUTF){ 1094 if($convUTF){
1088 - $nome_grupo = utf8_encode($nome_grupo);  
1089 - $desc_grupo = utf8_encode($desc_grupo);  
1090 - $en = utf8_encode($en);  
1091 - $es = utf8_encode($es);  
1092 - $it = utf8_encode($it); 1095 + $_GET["nome_grupo"] = utf8_encode($_GET["nome_grupo"]);
  1096 + $_GET["desc_grupo"] = utf8_encode($_GET["desc_grupo"]);
  1097 + $_GET["en"] = utf8_encode($_GET["en"]);
  1098 + $_GET["es"] = utf8_encode($_GET["es"]);
  1099 + $_GET["it"] = utf8_encode($_GET["it"]);
1093 } 1100 }
1094 if($id_grupo != ""){ 1101 if($id_grupo != ""){
1095 $dataCol = array( 1102 $dataCol = array(
1096 - "en" => $en,  
1097 - "es" => $es,  
1098 - "it" => $it,  
1099 - "nome_grupo" => $nome_grupo,  
1100 - "desc_grupo" => $desc_grupo 1103 + "en" => $_GET["en"],
  1104 + "es" => $_GET["es"],
  1105 + "it" => $_GET["it"],
  1106 + "nome_grupo" => $_GET["nome_grupo"],
  1107 + "desc_grupo" => $_GET["desc_grupo"]
1101 ); 1108 );
1102 i3GeoAdminUpdate($dbhw,"i3geoadmin_grupos",$dataCol,"WHERE id_grupo = $id_grupo"); 1109 i3GeoAdminUpdate($dbhw,"i3geoadmin_grupos",$dataCol,"WHERE id_grupo = $id_grupo");
1103 } 1110 }
1104 else{ 1111 else{
1105 $dataCol = array( 1112 $dataCol = array(
1106 - "nome_grupo" => $nome_grupo, 1113 + "nome_grupo" => $_GET["nome_grupo"],
1107 "desc_grupo" => "", 1114 "desc_grupo" => "",
1108 "en" => "", 1115 "en" => "",
1109 "es" => "", 1116 "es" => "",
@@ -1124,30 +1131,30 @@ Altera o registro de um sub-grupo. Se id for vazio acrescenta o registro @@ -1124,30 +1131,30 @@ Altera o registro de um sub-grupo. Se id for vazio acrescenta o registro
1124 */ 1131 */
1125 function alteraSubGrupos() 1132 function alteraSubGrupos()
1126 { 1133 {
1127 - global $nome_subgrupo,$desc_subgrupo,$id_subgrupo,$en,$es,$it,$esquemaadmin; 1134 + global $id_subgrupo,$esquemaadmin;
1128 try{ 1135 try{
1129 require(dirname(__FILE__)."/conexao.php"); 1136 require(dirname(__FILE__)."/conexao.php");
1130 if($convUTF){ 1137 if($convUTF){
1131 - $nome_subgrupo = utf8_encode($nome_subgrupo);  
1132 - $desc_subgrupo = utf8_encode($desc_subgrupo);  
1133 - $en = utf8_encode($en);  
1134 - $es = utf8_encode($es);  
1135 - $it = utf8_encode($it); 1138 + $_GET["nome_subgrupo"] = utf8_encode($_GET["nome_subgrupo"]);
  1139 + $_GET["desc_subgrupo"] = utf8_encode($_GET["desc_subgrupo"]);
  1140 + $_GET["en"] = utf8_encode($_GET["en"]);
  1141 + $_GET["es"] = utf8_encode($_GET["es"]);
  1142 + $_GET["it"] = utf8_encode($_GET["it"]);
1136 } 1143 }
1137 $retorna = ""; 1144 $retorna = "";
1138 if($id_subgrupo != ""){ 1145 if($id_subgrupo != ""){
1139 $dataCol = array( 1146 $dataCol = array(
1140 - "en" => $en,  
1141 - "es" => $es,  
1142 - "it" => $it,  
1143 - "nome_subgrupo" => $nome_subgrupo,  
1144 - "desc_subgrupo" => $desc_subgrupo 1147 + "en" => $_GET["en"],
  1148 + "es" => $_GET["es"],
  1149 + "it" => $_GET["it"],
  1150 + "nome_subgrupo" => $_GET["nome_subgrupo"],
  1151 + "desc_subgrupo" => $_GET["desc_subgrupo"]
1145 ); 1152 );
1146 i3GeoAdminUpdate($dbhw,"i3geoadmin_subgrupos",$dataCol,"WHERE id_subgrupo = $id_subgrupo"); 1153 i3GeoAdminUpdate($dbhw,"i3geoadmin_subgrupos",$dataCol,"WHERE id_subgrupo = $id_subgrupo");
1147 } 1154 }
1148 else{ 1155 else{
1149 $dataCol = array( 1156 $dataCol = array(
1150 - "nome_subgrupo" => $nome_subgrupo, 1157 + "nome_subgrupo" => $_GET["nome_subgrupo"],
1151 "desc_subgrupo" => "", 1158 "desc_subgrupo" => "",
1152 "en" => "", 1159 "en" => "",
1153 "es" => "", 1160 "es" => "",
@@ -1204,43 +1211,43 @@ Altera o registro de um tema. Se id for vazio acrescenta o registro @@ -1204,43 +1211,43 @@ Altera o registro de um tema. Se id for vazio acrescenta o registro
1204 */ 1211 */
1205 function alteraTemas() 1212 function alteraTemas()
1206 { 1213 {
1207 - global $esquemaadmin,$nome,$desc,$id,$codigo,$tipoa,$download,$ogc,$kml,$link,$tags,$kmz,$locaplic,$es,$it,$en; 1214 + global $esquemaadmin,$id,$locaplic;
1208 //error_reporting(0); 1215 //error_reporting(0);
1209 try{ 1216 try{
1210 $retorna = "ok"; 1217 $retorna = "ok";
1211 include("conexao.php"); 1218 include("conexao.php");
1212 - $nomeo = $nome; 1219 + $nomeo = $_GET["nome"];
1213 if($convUTF){ 1220 if($convUTF){
1214 - $nome = utf8_encode($nome);  
1215 - $desc = utf8_encode($desc);  
1216 - $tags = utf8_encode($tags);  
1217 - $en = utf8_encode($en);  
1218 - $es = utf8_encode($es);  
1219 - $it = utf8_encode($it); 1221 + $_GET["nome"] = utf8_encode($_GET["nome"]);
  1222 + $_GET["desc"] = utf8_encode($_GET["desc"]);
  1223 + $_GET["tags"] = utf8_encode($_GET["tags"]);
  1224 + $_GET["en"] = utf8_encode($_GET["en"]);
  1225 + $_GET["es"] = utf8_encode($_GET["es"]);
  1226 + $_GET["it"] = utf8_encode($_GET["it"]);
1220 } 1227 }
1221 if($id != ""){ 1228 if($id != ""){
1222 $dataCol = array( 1229 $dataCol = array(
1223 - "en" => $en,  
1224 - "es" => $es,  
1225 - "it" => $it,  
1226 - "tags_tema" => $tags,  
1227 - "link_tema" => $link,  
1228 - "nome_tema" => $nome,  
1229 - "desc_tema" => $desc,  
1230 - "codigo_tema" => $codigo,  
1231 - "tipoa_tema" => $tipoa,  
1232 - "download_tema" => $download,  
1233 - "ogc_tema" => $ogc,  
1234 - "kml_tema" => $kml 1230 + "en" => $_GET["en"],
  1231 + "es" => $_GET["es"],
  1232 + "it" => $_GET["it"],
  1233 + "tags_tema" => $_GET["tags"],
  1234 + "link_tema" => $_GET["link"],
  1235 + "nome_tema" => $_GET["nome"],
  1236 + "desc_tema" => $_GET["desc"],
  1237 + "codigo_tema" => $_GET["codigo"],
  1238 + "tipoa_tema" => $_GET["tipoa"],
  1239 + "download_tema" => $_GET["download"],
  1240 + "ogc_tema" => $_GET["ogc"],
  1241 + "kml_tema" => $_GET["kml"]
1235 ); 1242 );
1236 - if(isset($kmz)){  
1237 - $dataCol["kmz_tema"] = $kmz; 1243 + if(isset($_GET["kmz"])){
  1244 + $dataCol["kmz_tema"] = $_GET["kmz"];
1238 } 1245 }
1239 i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE id_tema = $id"); 1246 i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE id_tema = $id");
1240 1247
1241 $retorna = $id; 1248 $retorna = $id;
1242 - if(!isset($kmz)){  
1243 - $kmz = "nao"; 1249 + if(!isset($_GET["kmz"])){
  1250 + $_GET["kmz"] = "nao";
1244 } 1251 }
1245 $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_temas where id_tema = $id"; 1252 $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_temas where id_tema = $id";
1246 $q = $dbh->query($sql,PDO::FETCH_ASSOC); 1253 $q = $dbh->query($sql,PDO::FETCH_ASSOC);
@@ -1253,18 +1260,18 @@ function alteraTemas() @@ -1253,18 +1260,18 @@ function alteraTemas()
1253 $numlayers = $mapa->numlayers; 1260 $numlayers = $mapa->numlayers;
1254 for ($i=0;$i < $numlayers;$i++){ 1261 for ($i=0;$i < $numlayers;$i++){
1255 $layer = $mapa->getlayer($i); 1262 $layer = $mapa->getlayer($i);
1256 - $layer->setmetadata("permitedownload",strtolower($download));  
1257 - $layer->setmetadata("download",strtolower($download));  
1258 - $layer->setmetadata("permiteogc",strtolower($ogc));  
1259 - $layer->setmetadata("permitekml",strtolower($kml));  
1260 - $layer->setmetadata("permitekmz",strtolower($kmz)); 1263 + $layer->setmetadata("permitedownload",strtolower($_GET["download"]));
  1264 + $layer->setmetadata("download",strtolower($_GET["download"]));
  1265 + $layer->setmetadata("permiteogc",strtolower($_GET["ogc"]));
  1266 + $layer->setmetadata("permitekml",strtolower($_GET["kml"]));
  1267 + $layer->setmetadata("permitekmz",strtolower($_GET["kmz"]));
1261 //zera os metadados do sistema METAESTAT 1268 //zera os metadados do sistema METAESTAT
1262 - if($tipoa != "META"){ 1269 + if($_GET["tipoa"] != "META"){
1263 $layer->setmetadata("METAESTAT_CODIGO_TIPO_REGIAO",""); 1270 $layer->setmetadata("METAESTAT_CODIGO_TIPO_REGIAO","");
1264 $layer->setmetadata("METAESTAT_ID_MEDIDA_VARIAVEL",""); 1271 $layer->setmetadata("METAESTAT_ID_MEDIDA_VARIAVEL","");
1265 $layer->setmetadata("metaestat",""); 1272 $layer->setmetadata("metaestat","");
1266 } 1273 }
1267 - if(count($nomes) == 1){ 1274 + if(count($_GET["nomes"]) == 1){
1268 $layer->setmetadata("tema",$nomeo); 1275 $layer->setmetadata("tema",$nomeo);
1269 } 1276 }
1270 } 1277 }
@@ -1294,9 +1301,9 @@ function alteraTemas() @@ -1294,9 +1301,9 @@ function alteraTemas()
1294 $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_temas",$dataCol,"nome_tema","id_tema"); 1301 $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_temas",$dataCol,"nome_tema","id_tema");
1295 } 1302 }
1296 //verifica se &eacute; necess&aacute;rio adicionar algum tag novo 1303 //verifica se &eacute; necess&aacute;rio adicionar algum tag novo
1297 - $tags = explode(" ",$tags); 1304 + $_GET["tags"] = explode(" ",$_GET["tags"]);
1298 1305
1299 - foreach($tags as $tag){ 1306 + foreach($_GET["tags"] as $tag){
1300 if(!(verificaDuplicados("select * from ".$esquemaadmin."i3geoadmin_tags where nome = '$tag'",$dbh))){ 1307 if(!(verificaDuplicados("select * from ".$esquemaadmin."i3geoadmin_tags where nome = '$tag'",$dbh))){
1301 $dataCol = array( 1308 $dataCol = array(
1302 "nome" => $tag 1309 "nome" => $tag
@@ -1318,7 +1325,7 @@ Retorna a lista de mapfiles do diretorio i3geo/temas @@ -1318,7 +1325,7 @@ Retorna a lista de mapfiles do diretorio i3geo/temas
1318 */ 1325 */
1319 function listaMapsTemas() 1326 function listaMapsTemas()
1320 { 1327 {
1321 - global $cp,$locaplic,$letra,$filtro,$esquemaadmin,$checaNomes,$checaNames; 1328 + global $locaplic,$esquemaadmin;
1322 $arquivos = array(); 1329 $arquivos = array();
1323 if (is_dir($locaplic."/temas")) 1330 if (is_dir($locaplic."/temas"))
1324 { 1331 {
@@ -1327,11 +1334,12 @@ function listaMapsTemas() @@ -1327,11 +1334,12 @@ function listaMapsTemas()
1327 $extensao = ""; 1334 $extensao = "";
1328 while (($file = readdir($dh)) !== false) 1335 while (($file = readdir($dh)) !== false)
1329 { 1336 {
  1337 + $extensao = "";
1330 if(!stristr($file, '.map') === FALSE){ 1338 if(!stristr($file, '.map') === FALSE){
1331 $extensao = "map"; 1339 $extensao = "map";
1332 } 1340 }
1333 if(!stristr($file, '.php') === FALSE){ 1341 if(!stristr($file, '.php') === FALSE){
1334 - $extensao = "php"; 1342 + //$extensao = "php";
1335 } 1343 }
1336 if(!stristr($file, '.gvp') === FALSE){ 1344 if(!stristr($file, '.gvp') === FALSE){
1337 $extensao = "gvp"; 1345 $extensao = "gvp";
@@ -1339,9 +1347,9 @@ function listaMapsTemas() @@ -1339,9 +1347,9 @@ function listaMapsTemas()
1339 if($extensao != "") 1347 if($extensao != "")
1340 { 1348 {
1341 $file = str_replace(".".$extensao,"",$file); 1349 $file = str_replace(".".$extensao,"",$file);
1342 - if(isset($letra) && $letra != "") 1350 + if(isset($_GET["letra"]) && $_GET["letra"] != "")
1343 { 1351 {
1344 - if(strtolower(substr(basename($file),0,strlen($letra))) == strtolower($letra)){ 1352 + if(strtolower(substr(basename($file),0,strlen($_GET["letra"]))) == strtolower($_GET["letra"])){
1345 $arquivos[] = array("nome"=>$file,"extensao"=>$extensao); 1353 $arquivos[] = array("nome"=>$file,"extensao"=>$extensao);
1346 } 1354 }
1347 } 1355 }
@@ -1359,6 +1367,7 @@ function listaMapsTemas() @@ -1359,6 +1367,7 @@ function listaMapsTemas()
1359 //pega o nome de cada tema filtrando a listagem se for o caso 1367 //pega o nome de cada tema filtrando a listagem se for o caso
1360 // 1368 //
1361 $sql = "select * from ".$esquemaadmin."i3geoadmin_temas "; 1369 $sql = "select * from ".$esquemaadmin."i3geoadmin_temas ";
  1370 + $filtro = $_GET["filtro"];
1362 if(isset($filtro) && $filtro != ""){ 1371 if(isset($filtro) && $filtro != ""){
1363 $filtro = explode(",",$filtro); 1372 $filtro = explode(",",$filtro);
1364 $filtro = $filtro[0]." ".$filtro[1]." '".$filtro[2]."' or ".$filtro[0]." ".$filtro[1]." '".strtoupper($filtro[2])."'"; 1373 $filtro = $filtro[0]." ".$filtro[1]." '".$filtro[2]."' or ".$filtro[0]." ".$filtro[1]." '".strtoupper($filtro[2])."'";
@@ -1407,7 +1416,7 @@ function listaMapsTemas() @@ -1407,7 +1416,7 @@ function listaMapsTemas()
1407 if(file_exists($locaplic."/temas/miniaturas/".$arq.".map.mini.png")){ 1416 if(file_exists($locaplic."/temas/miniaturas/".$arq.".map.mini.png")){
1408 $imagem = $arq.".map.mini.png"; 1417 $imagem = $arq.".map.mini.png";
1409 } 1418 }
1410 - if($checaNomes == "true"){ 1419 + if($_GET["checaNomes"] == "true"){
1411 if($extensao == "map"){ 1420 if($extensao == "map"){
1412 if(file_exists($locaplic."/temas/".$arq.".map")){ 1421 if(file_exists($locaplic."/temas/".$arq.".map")){
1413 $handle = fopen($locaplic."/temas/".$arq.".map", "r"); 1422 $handle = fopen($locaplic."/temas/".$arq.".map", "r");
@@ -1426,7 +1435,7 @@ function listaMapsTemas() @@ -1426,7 +1435,7 @@ function listaMapsTemas()
1426 } 1435 }
1427 } 1436 }
1428 } 1437 }
1429 - if($checaNames == "true"){ 1438 + if($_GET["checaNames"] == "true"){
1430 if($extensao == "map"){ 1439 if($extensao == "map"){
1431 if(file_exists($locaplic."/temas/".$arq.".map")){ 1440 if(file_exists($locaplic."/temas/".$arq.".map")){
1432 $handle = fopen($locaplic."/temas/".$arq.".map", "r"); 1441 $handle = fopen($locaplic."/temas/".$arq.".map", "r");
@@ -1466,7 +1475,7 @@ Retorna a lista de temas sem mapfiles @@ -1466,7 +1475,7 @@ Retorna a lista de temas sem mapfiles
1466 */ 1475 */
1467 function verificaOrfaos() 1476 function verificaOrfaos()
1468 { 1477 {
1469 - global $cp,$locaplic,$esquemaadmin; 1478 + global $locaplic,$esquemaadmin;
1470 $arquivos = array(); 1479 $arquivos = array();
1471 // 1480 //
1472 //pega o nome de cada tema 1481 //pega o nome de cada tema
@@ -1550,11 +1559,11 @@ function removeCabecalho($arq,$symbolset=true) @@ -1550,11 +1559,11 @@ function removeCabecalho($arq,$symbolset=true)
1550 chmod($arq, 0666); 1559 chmod($arq, 0666);
1551 } 1560 }
1552 function atualizaMiniatura(){ 1561 function atualizaMiniatura(){
1553 - global $tema,$locaplic; 1562 + global $locaplic;
1554 $tipo = "foo"; 1563 $tipo = "foo";
1555 include_once(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php"); 1564 include_once(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php");
1556 require(dirname(__FILE__)."/../../geraminiatura.php"); 1565 require(dirname(__FILE__)."/../../geraminiatura.php");
1557 - verificaMiniatura($tema,"todos",true); 1566 + verificaMiniatura($_GET["tema"],"todos",true);
1558 return "ok"; 1567 return "ok";
1559 } 1568 }
1560 ?> 1569 ?>
admin/php/metaestat.php
@@ -36,9 +36,28 @@ O par&amp;acirc;metro principal &amp;eacute; &quot;funcao&quot;, que define qual opera&amp;ccedil;&amp;ati @@ -36,9 +36,28 @@ O par&amp;acirc;metro principal &amp;eacute; &quot;funcao&quot;, que define qual opera&amp;ccedil;&amp;ati
36 36
37 Cada opera&ccedil;&atilde;o possu&iacute; seus proprios par&acirc;metros, que devem ser enviados tamb&eacute;m na requisi&ccedil;&atilde;o da opera&ccedil;&atilde;o. 37 Cada opera&ccedil;&atilde;o possu&iacute; seus proprios par&acirc;metros, que devem ser enviados tamb&eacute;m na requisi&ccedil;&atilde;o da opera&ccedil;&atilde;o.
38 */ 38 */
39 -include_once(dirname(__FILE__)."/admin.php");  
40 -  
41 include_once(dirname(__FILE__)."/login.php"); 39 include_once(dirname(__FILE__)."/login.php");
  40 +
  41 +$codigo_estat_conexao = $_GET["codigo_estat_conexao"];
  42 +$codigo_variavel = $_GET["codigo_variavel"];
  43 +$codigo_tipo_periodo = $_GET["codigo_tipo_periodo"];
  44 +$codigo_tipo_regiao = $_GET["codigo_tipo_regiao"];
  45 +$codigo_unidade_medida = $_GET["codigo_unidade_medida"];
  46 +$codigo_tipo_regiao_pai = $_GET["codigo_tipo_regiao_pai"];
  47 +$id_medida_variavel = $_GET["id_medida_variavel"];
  48 +$id_classificacao = $_GET["id_classificacao"];
  49 +$id_link = $_GET["id_link"];
  50 +$id_classe = $_GET["id_classe"];
  51 +$id_parametro_medida = $_GET["id_parametro_medida"];
  52 +$id_fonteinfo = $_GET["id_fonteinfo"];
  53 +$id_agregaregiao = $_GET["id_agregaregiao"];
  54 +$id_mapa = $_GET["id_mapa"];
  55 +$id_mapa_grupo = $_GET["id_mapa_grupo"];
  56 +$id_mapa_tema = $_GET["id_mapa_tema"];
  57 +$id_pai = $_GET["id_pai"];
  58 +
  59 +testaSafeNumerico([$codigo_tipo_regiao_pai,$id_pai,$id_mapa_tema,$id_mapa_grupo,$id_mapa,$id_agregaregiao,$codigo_tipo_regiao,$codigo_tipo_periodo,$id_fonteinfo,$codigo_unidade_medida,$codigo_estat_conexao,$codigo_variavel,$id_medida_variavel,$id_classificacao,$id_link,$id_classe,$id_parametro_medida]);
  60 +
42 //lista de funcoes que passam pela validacao de login 61 //lista de funcoes que passam pela validacao de login
43 $funcoesEdicao = array( 62 $funcoesEdicao = array(
44 "ALTERAMAPAGRUPO", 63 "ALTERAMAPAGRUPO",
@@ -147,10 +166,10 @@ switch (strtoupper($funcao)) @@ -147,10 +166,10 @@ switch (strtoupper($funcao))
147 */ 166 */
148 case "LISTAVARIAVEL": 167 case "LISTAVARIAVEL":
149 $m = new Metaestat(); 168 $m = new Metaestat();
150 - if(empty($filtro_esquema)){  
151 - $filtro_esquema = ""; 169 + if(empty($_GET["filtro_esquema"])){
  170 + $_GET["filtro_esquema"] = "";
152 } 171 }
153 - retornaJSON($m->listaVariavel($codigo_variavel,$filtro_esquema)); 172 + retornaJSON($m->listaVariavel($codigo_variavel,$_GET["filtro_esquema"]));
154 exit; 173 exit;
155 break; 174 break;
156 /* 175 /*
@@ -277,7 +296,7 @@ switch (strtoupper($funcao)) @@ -277,7 +296,7 @@ switch (strtoupper($funcao))
277 $valores = ""; 296 $valores = "";
278 //se achou apenas uma regiao, pega os valores 297 //se achou apenas uma regiao, pega os valores
279 if(count($regioes) < 2 && $codigo_tipo_regiao != ""){ 298 if(count($regioes) < 2 && $codigo_tipo_regiao != ""){
280 - $valores = $m->listaDadosRegiao($codigo_tipo_regiao,$codigoregiaopai,$valorregiaopai); 299 + $valores = $m->listaDadosRegiao($codigo_tipo_regiao,$_GET["codigoregiaopai"],$_GET["valorregiaopai"]);
281 } 300 }
282 retornaJSON(array("regiaopai"=>$codigo_tipo_regiao,"regioes"=>$regioes,"valores"=>$valores)); 301 retornaJSON(array("regiaopai"=>$codigo_tipo_regiao,"regioes"=>$regioes,"valores"=>$valores));
283 exit; 302 exit;
@@ -353,7 +372,7 @@ switch (strtoupper($funcao)) @@ -353,7 +372,7 @@ switch (strtoupper($funcao))
353 } 372 }
354 } 373 }
355 else{ 374 else{
356 - $codigo_variavel = $m->alteraVariavel($codigo_variavel,$nome,$descricao); 375 + $codigo_variavel = $m->alteraVariavel($codigo_variavel,$_GET["nome"],$_GET["descricao"]);
357 } 376 }
358 retornaJSON($m->listaVariavel($codigo_variavel)); 377 retornaJSON($m->listaVariavel($codigo_variavel));
359 exit; 378 exit;
@@ -373,7 +392,7 @@ switch (strtoupper($funcao)) @@ -373,7 +392,7 @@ switch (strtoupper($funcao))
373 $m = new Metaestat(); 392 $m = new Metaestat();
374 $default = false; 393 $default = false;
375 //verifica se a criacao da medida esta sendo feita na tabela default 394 //verifica se a criacao da medida esta sendo feita na tabela default
376 - if($codigo_tipo_periodo < 5 && $esquemadb == "i3geo_metaestat" && $colunaidgeo == "codigoregiao" && $tabela = "dados_medidas"){ 395 + if($codigo_tipo_periodo < 5 && $esquemadb == "i3geo_metaestat" && $_GET["colunaidgeo"] == "codigoregiao" && $_GET["tabela"] = "dados_medidas"){
377 $default = true; 396 $default = true;
378 } 397 }
379 if(empty($id_medida_variavel)){ 398 if(empty($id_medida_variavel)){
@@ -385,7 +404,7 @@ switch (strtoupper($funcao)) @@ -385,7 +404,7 @@ switch (strtoupper($funcao))
385 $filtro = " id_medida_variavel = $id_medida_variavel "; 404 $filtro = " id_medida_variavel = $id_medida_variavel ";
386 } 405 }
387 if(!empty($nomemedida)){ 406 if(!empty($nomemedida)){
388 - $m->alteraMedidaVariavel("",$id_medida_variavel,$codigo_unidade_medida,$codigo_tipo_periodo,$codigo_tipo_regiao,$codigo_estat_conexao,$esquemadb,$tabela,$colunavalor,$colunaidgeo,$colunaidunico,$filtro,$nomemedida); 407 + $m->alteraMedidaVariavel("",$id_medida_variavel,$codigo_unidade_medida,$codigo_tipo_periodo,$codigo_tipo_regiao,$codigo_estat_conexao,$_GET["esquemadb"],$_GET["tabela"],$_GET["colunavalor"],$_GET["colunaidgeo"],$_GET["colunaidunico"],$filtro,$_GET["nomemedida"]);
389 } 408 }
390 } 409 }
391 else{ 410 else{
@@ -393,9 +412,9 @@ switch (strtoupper($funcao)) @@ -393,9 +412,9 @@ switch (strtoupper($funcao))
393 if($default == true && $filtro == ""){ 412 if($default == true && $filtro == ""){
394 $filtro = " id_medida_variavel = $id_medida_variavel "; 413 $filtro = " id_medida_variavel = $id_medida_variavel ";
395 } 414 }
396 - $m->alteraMedidaVariavel("",$id_medida_variavel,$codigo_unidade_medida,$codigo_tipo_periodo,$codigo_tipo_regiao,$codigo_estat_conexao,$esquemadb,$tabela,$colunavalor,$colunaidgeo,$colunaidunico,$filtro,$nomemedida); 415 + $m->alteraMedidaVariavel("",$id_medida_variavel,$codigo_unidade_medida,$codigo_tipo_periodo,$codigo_tipo_regiao,$codigo_estat_conexao,$_GET["esquemadb"],$_GET["tabela"],$_GET["colunavalor"],$_GET["colunaidgeo"],$_GET["colunaidunico"],$filtro,$_GET["nomemedida"]);
397 } 416 }
398 - if(!empty($colunaAno) || !empty($colunaMes) || !empty($colunaDia) || !empty($colunaHora)){ 417 + if(!empty($_GET["colunaAno"]) || !empty($_GET["colunaMes"]) || !empty($_GET["colunaDia"]) || !empty($_GET["colunaHora"])){
399 $default = true; 418 $default = true;
400 } 419 }
401 //adiciona os parametros de tempo conforme o tipo de periodo escolhido 420 //adiciona os parametros de tempo conforme o tipo de periodo escolhido
@@ -409,20 +428,20 @@ switch (strtoupper($funcao)) @@ -409,20 +428,20 @@ switch (strtoupper($funcao))
409 $id_pai = 0; 428 $id_pai = 0;
410 //anual 429 //anual
411 if($codigo_tipo_periodo >= 1){ 430 if($codigo_tipo_periodo >= 1){
412 - if(empty($colunaAno)){  
413 - $colunaAno = "ano"; 431 + if(empty($_GET["colunaAno"])){
  432 + $_GET["colunaAno"] = "ano";
414 } 433 }
415 $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel,"","","","","",""); 434 $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel,"","","","","","");
416 - $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Ano","",$colunaAno,$id_pai,1); 435 + $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Ano","",$_GET["colunaAno"],$id_pai,1);
417 $id_pai = $id_parametro_medida; 436 $id_pai = $id_parametro_medida;
418 } 437 }
419 //mensal 438 //mensal
420 if($codigo_tipo_periodo >= 2){ 439 if($codigo_tipo_periodo >= 2){
421 $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel,"","","","","",""); 440 $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel,"","","","","","");
422 - if(empty($colunaMes)){  
423 - $colunaMes = "mes"; 441 + if(empty($_GET["colunaMes"])){
  442 + $_GET["colunaMes"] = "mes";
424 } 443 }
425 - $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Mes","",$colunaMes,$id_pai,2); 444 + $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Mes","",$_GET["colunaMes"],$id_pai,2);
426 $id_pai = $id_parametro_medida; 445 $id_pai = $id_parametro_medida;
427 } 446 }
428 //diario 447 //diario
@@ -431,16 +450,16 @@ switch (strtoupper($funcao)) @@ -431,16 +450,16 @@ switch (strtoupper($funcao))
431 if(empty($colunaDia)){ 450 if(empty($colunaDia)){
432 $colunaDia = "dia"; 451 $colunaDia = "dia";
433 } 452 }
434 - $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Dia","",$colunaDia,$id_pai,3); 453 + $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Dia","",$_GET["colunaDia"],$id_pai,3);
435 $id_pai = $id_parametro_medida; 454 $id_pai = $id_parametro_medida;
436 } 455 }
437 //horario 456 //horario
438 if($codigo_tipo_periodo == 4){ 457 if($codigo_tipo_periodo == 4){
439 $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel,"","","","","",""); 458 $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel,"","","","","","");
440 - if(empty($colunaHora)){  
441 - $colunaHora = "hora"; 459 + if(empty($_GET["colunaHora"])){
  460 + $_GET["colunaHora"] = "hora";
442 } 461 }
443 - $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Hora","",$colunaHora,$id_pai,4); 462 + $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Hora","",$_GET["colunaHora"],$id_pai,4);
444 } 463 }
445 } 464 }
446 retornaJSON($m->listaMedidaVariavel("",$id_medida_variavel)); 465 retornaJSON($m->listaMedidaVariavel("",$id_medida_variavel));
@@ -462,7 +481,7 @@ switch (strtoupper($funcao)) @@ -462,7 +481,7 @@ switch (strtoupper($funcao))
462 $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel); 481 $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel);
463 } 482 }
464 else{ 483 else{
465 - $m->alteraParametroMedida("",$id_parametro_medida,$nome,$descricao,$coluna,$id_pai,$tipo); 484 + $m->alteraParametroMedida("",$id_parametro_medida,$_GET["nome"],$_GET["descricao"],$_GET["coluna"],$id_pai,$_GET["tipo"]);
466 } 485 }
467 retornaJSON($m->listaParametro($id_medida_variavel,$id_parametro_medida)); 486 retornaJSON($m->listaParametro($id_medida_variavel,$id_parametro_medida));
468 exit; 487 exit;
@@ -482,16 +501,20 @@ switch (strtoupper($funcao)) @@ -482,16 +501,20 @@ switch (strtoupper($funcao))
482 //isso ira criar um novo registro 501 //isso ira criar um novo registro
483 $id_classificacao = $m->alteraClassificacaoMedida($id_medida_variavel); 502 $id_classificacao = $m->alteraClassificacaoMedida($id_medida_variavel);
484 if(!empty($nome)){ 503 if(!empty($nome)){
485 - $m->alteraClassificacaoMedida($id_classificacao,$id_classificacao,$nome,$observacao); 504 + $m->alteraClassificacaoMedida($id_classificacao,$id_classificacao,$_GET["nome"],$_GET["observacao"]);
486 } 505 }
487 } 506 }
488 else{ 507 else{
489 - $m->alteraClassificacaoMedida("",$id_classificacao,$nome,$observacao); 508 + $m->alteraClassificacaoMedida("",$id_classificacao,$_GET["nome"],$_GET["observacao"]);
490 } 509 }
491 retornaJSON($m->listaClassificacaoMedida($id_medida_variavel,$id_classificacao)); 510 retornaJSON($m->listaClassificacaoMedida($id_medida_variavel,$id_classificacao));
492 exit; 511 exit;
493 break; 512 break;
494 case "CALCULACLASSIFICACAO": 513 case "CALCULACLASSIFICACAO":
  514 + $cores = $_GET["cores"];
  515 + $limite = $_GET["limite"];
  516 + $numintervalos = $_GET["numintervalos"];
  517 + $tipo = $_GET["tipo"];
495 //as cores vem no formato rgb(0,0,0); 518 //as cores vem no formato rgb(0,0,0);
496 if(!empty($cores)){ 519 if(!empty($cores)){
497 $cores = str_replace("rgb(","",$cores); 520 $cores = str_replace("rgb(","",$cores);
@@ -641,6 +664,8 @@ switch (strtoupper($funcao)) @@ -641,6 +664,8 @@ switch (strtoupper($funcao))
641 exit; 664 exit;
642 break; 665 break;
643 case "ALTERAESTILOSCLASSIFICACAO": 666 case "ALTERAESTILOSCLASSIFICACAO":
  667 + $tipo = $_GET["tipo"];
  668 + $aumentar = $_GET["aumentar"];
644 if($tipo == "tamanho"){ 669 if($tipo == "tamanho"){
645 $m = new Metaestat(); 670 $m = new Metaestat();
646 $classes = $m->listaClasseClassificacao($id_classificacao); 671 $classes = $m->listaClasseClassificacao($id_classificacao);
@@ -690,7 +715,7 @@ switch (strtoupper($funcao)) @@ -690,7 +715,7 @@ switch (strtoupper($funcao))
690 else{ 715 else{
691 $titulo = $_GET["titulo"]; 716 $titulo = $_GET["titulo"];
692 $expressao = $_GET["expressao"]; 717 $expressao = $_GET["expressao"];
693 - $m->alteraClasseClassificacao("",$id_classe,$titulo,$expressao,$vermelho,$verde,$azul,$tamanho,$simbolo,$overmelho,$overde,$oazul,$otamanho); 718 + $m->alteraClasseClassificacao("",$id_classe,$titulo,$expressao,$_GET["vermelho"],$_GET["verde"],$_GET["azul"],$_GET["tamanho"],$_GET["simbolo"],$_GET["overmelho"],$_GET["overde"],$_GET["oazul"],$_GET["otamanho"]);
694 } 719 }
695 retornaJSON($m->listaClasseClassificacao($id_classificacao,$id_classe)); 720 retornaJSON($m->listaClasseClassificacao($id_classificacao,$id_classe));
696 exit; 721 exit;
@@ -702,7 +727,7 @@ switch (strtoupper($funcao)) @@ -702,7 +727,7 @@ switch (strtoupper($funcao))
702 $id_link = $m->alteraLinkMedida($id_medida_variavel); 727 $id_link = $m->alteraLinkMedida($id_medida_variavel);
703 } 728 }
704 else{ 729 else{
705 - $m->alteraLinkMedida("",$id_link,$nome,$link); 730 + $m->alteraLinkMedida("",$id_link,$_GET["nome"],$_GET["link"]);
706 } 731 }
707 retornaJSON($m->listaLinkMedida($id_medida_variavel,$id_link)); 732 retornaJSON($m->listaLinkMedida($id_medida_variavel,$id_link));
708 exit; 733 exit;
@@ -714,7 +739,7 @@ switch (strtoupper($funcao)) @@ -714,7 +739,7 @@ switch (strtoupper($funcao))
714 $id_fonteinfo = $m->alteraFonteinfo(); 739 $id_fonteinfo = $m->alteraFonteinfo();
715 } 740 }
716 else{ 741 else{
717 - $m->alteraFonteinfo($id_fonteinfo,$titulo,$link); 742 + $m->alteraFonteinfo($id_fonteinfo,$_GET["titulo"],$_GET["link"]);
718 } 743 }
719 retornaJSON($m->listaFonteinfo($id_fonteinfo)); 744 retornaJSON($m->listaFonteinfo($id_fonteinfo));
720 exit; 745 exit;
@@ -741,7 +766,7 @@ switch (strtoupper($funcao)) @@ -741,7 +766,7 @@ switch (strtoupper($funcao))
741 $codigo_unidade_medida = $m->alteraUnidadeMedida(); 766 $codigo_unidade_medida = $m->alteraUnidadeMedida();
742 } 767 }
743 else{ 768 else{
744 - $codigo_unidade_medida = $m->alteraUnidadeMedida($codigo_unidade_medida,$nome,$sigla,$permitesoma,$permitemedia); 769 + $codigo_unidade_medida = $m->alteraUnidadeMedida($codigo_unidade_medida,$_GET["nome"],$_GET["sigla"],$_GET["permitesoma"],$_GET["permitemedia"]);
745 } 770 }
746 retornaJSON($m->listaUnidadeMedida($codigo_unidade_medida)); 771 retornaJSON($m->listaUnidadeMedida($codigo_unidade_medida));
747 exit; 772 exit;
@@ -761,7 +786,7 @@ switch (strtoupper($funcao)) @@ -761,7 +786,7 @@ switch (strtoupper($funcao))
761 $codigo_estat_conexao = $m->alteraConexao(); 786 $codigo_estat_conexao = $m->alteraConexao();
762 } 787 }
763 else{ 788 else{
764 - $codigo_estat_conexao = $m->alteraConexao($codigo_estat_conexao,$bancodedados,$host,$porta,$usuario); 789 + $codigo_estat_conexao = $m->alteraConexao($codigo_estat_conexao,$_GET["bancodedados"],$_GET["host"],$_GET["porta"],$_GET["usuario"]);
765 } 790 }
766 retornaJSON($m->listaConexao($codigo_estat_conexao)); 791 retornaJSON($m->listaConexao($codigo_estat_conexao));
767 exit; 792 exit;
@@ -781,7 +806,7 @@ switch (strtoupper($funcao)) @@ -781,7 +806,7 @@ switch (strtoupper($funcao))
781 $codigo_tipo_regiao = $m->alteraTipoRegiao(); 806 $codigo_tipo_regiao = $m->alteraTipoRegiao();
782 } 807 }
783 else{ 808 else{
784 - $codigo_tipo_regiao = $m->alteraTipoRegiao($codigo_tipo_regiao,$nome_tipo_regiao,$descricao_tipo_regiao,$esquemadb,$tabela,$colunageo,$colunacentroide,$data,$identificador,$colunanomeregiao,$srid,$codigo_estat_conexao,$colunasvisiveis,$apelidos); 809 + $codigo_tipo_regiao = $m->alteraTipoRegiao($codigo_tipo_regiao,$_GET["nome_tipo_regiao"],$_GET["descricao_tipo_regiao"],$_GET["esquemadb"],$_GET["tabela"],$_GET["colunageo"],$_GET["colunacentroide"],$_GET["data"],$_GET["identificador"],$_GET["colunanomeregiao"],$_GET["srid"],$codigo_estat_conexao,$_GET["colunasvisiveis"],$_GET["apelidos"]);
785 } 810 }
786 retornaJSON($m->listaTipoRegiao($codigo_tipo_regiao)); 811 retornaJSON($m->listaTipoRegiao($codigo_tipo_regiao));
787 exit; 812 exit;
@@ -792,7 +817,7 @@ switch (strtoupper($funcao)) @@ -792,7 +817,7 @@ switch (strtoupper($funcao))
792 $id_agregaregiao = $m->alteraAgregaRegiao($codigo_tipo_regiao); 817 $id_agregaregiao = $m->alteraAgregaRegiao($codigo_tipo_regiao);
793 } 818 }
794 else{ 819 else{
795 - $id_agregaregiao = $m->alteraAgregaRegiao("",$id_agregaregiao,$codigo_tipo_regiao_pai,$colunaligacao_regiaopai); 820 + $id_agregaregiao = $m->alteraAgregaRegiao("",$id_agregaregiao,$codigo_tipo_regiao_pai,$_GET["colunaligacao_regiaopai"]);
796 $codigo_tipo_regiao = ""; 821 $codigo_tipo_regiao = "";
797 } 822 }
798 retornaJSON($m->listaAgregaRegiao($codigo_tipo_regiao,$id_agregaregiao)); 823 retornaJSON($m->listaAgregaRegiao($codigo_tipo_regiao,$id_agregaregiao));
@@ -815,7 +840,7 @@ switch (strtoupper($funcao)) @@ -815,7 +840,7 @@ switch (strtoupper($funcao))
815 else{ 840 else{
816 //impede a alteracao dos valores reservados 841 //impede a alteracao dos valores reservados
817 if($codigo_tipo_periodo > 4){ 842 if($codigo_tipo_periodo > 4){
818 - $codigo_unidade_medida = $m->alteraTipoPeriodo($codigo_tipo_periodo,$nome,$descricao); 843 + $codigo_unidade_medida = $m->alteraTipoPeriodo($codigo_tipo_periodo,$_GET["nome"],$_GET["descricao"]);
819 } 844 }
820 } 845 }
821 retornaJSON($m->listaTipoPeriodo($codigo_tipo_periodo)); 846 retornaJSON($m->listaTipoPeriodo($codigo_tipo_periodo));
@@ -836,7 +861,7 @@ switch (strtoupper($funcao)) @@ -836,7 +861,7 @@ switch (strtoupper($funcao))
836 $id_mapa = $m->alteraMapa(); 861 $id_mapa = $m->alteraMapa();
837 } 862 }
838 else{ 863 else{
839 - $id_mapa = $m->alteraMapa($id_mapa,$titulo,$template,$logoesquerdo,$logodireito,$publicado); 864 + $id_mapa = $m->alteraMapa($id_mapa,$_GET["titulo"],$_GET["template"],$_GET["logoesquerdo"],$_GET["logodireito"],$_GET["publicado"]);
840 } 865 }
841 retornaJSON($m->listaMapas($id_mapa)); 866 retornaJSON($m->listaMapas($id_mapa));
842 exit; 867 exit;
@@ -856,7 +881,7 @@ switch (strtoupper($funcao)) @@ -856,7 +881,7 @@ switch (strtoupper($funcao))
856 $id_mapa_grupo = $m->alteraMapaGrupo($id_mapa); 881 $id_mapa_grupo = $m->alteraMapaGrupo($id_mapa);
857 } 882 }
858 else{ 883 else{
859 - $id_mapa_grupo = $m->alteraMapaGrupo($id_mapa,$id_mapa_grupo,$titulo); 884 + $id_mapa_grupo = $m->alteraMapaGrupo($id_mapa,$id_mapa_grupo,$_GET["titulo"]);
860 } 885 }
861 retornaJSON($m->listaGruposMapa($id_mapa,$id_mapa_grupo)); 886 retornaJSON($m->listaGruposMapa($id_mapa,$id_mapa_grupo));
862 exit; 887 exit;
@@ -867,7 +892,7 @@ switch (strtoupper($funcao)) @@ -867,7 +892,7 @@ switch (strtoupper($funcao))
867 $id_mapa_tema = $m->alteraMapaTema($id_mapa_grupo); 892 $id_mapa_tema = $m->alteraMapaTema($id_mapa_grupo);
868 } 893 }
869 else{ 894 else{
870 - $id_mapa_tema = $m->alteraMapaTema($id_mapa_grupo,$id_mapa_tema,$titulo,$id_medida_variavel); 895 + $id_mapa_tema = $m->alteraMapaTema($id_mapa_grupo,$id_mapa_tema,$_GET["titulo"],$id_medida_variavel);
871 } 896 }
872 retornaJSON($m->listaTemasMapa($id_mapa_grupo,$id_mapa_tema)); 897 retornaJSON($m->listaTemasMapa($id_mapa_grupo,$id_mapa_tema));
873 exit; 898 exit;
@@ -1210,15 +1235,15 @@ switch (strtoupper($funcao)) @@ -1210,15 +1235,15 @@ switch (strtoupper($funcao))
1210 */ 1235 */
1211 case "DADOSMEDIDAVARIAVEL": 1236 case "DADOSMEDIDAVARIAVEL":
1212 $m = new Metaestat(); 1237 $m = new Metaestat();
1213 - $dados = $m->dadosMedidaVariavel($id_medida_variavel,$filtro,$todasascolunas,$agruparpor);  
1214 - if($formato == "json"){ 1238 + $dados = $m->dadosMedidaVariavel($id_medida_variavel,$_GET["filtro"],$_GET["todasascolunas"],$_GET["agruparpor"]);
  1239 + if($_GET["formato"] == "json"){
1215 retornaJSON($dados); 1240 retornaJSON($dados);
1216 } 1241 }
1217 - if($formato == "xml"){ 1242 + if($_GET["formato"] == "xml"){
1218 header("Content-type: application/xml"); 1243 header("Content-type: application/xml");
1219 echo($m->formataXML($dados)); 1244 echo($m->formataXML($dados));
1220 } 1245 }
1221 - if($formato == "csv"){ 1246 + if($_GET["formato"] == "csv"){
1222 require_once(dirname(__FILE__)."/../../pacotes/parsecsv/parsecsv.lib.php"); 1247 require_once(dirname(__FILE__)."/../../pacotes/parsecsv/parsecsv.lib.php");
1223 $csv = new parseCSV(); 1248 $csv = new parseCSV();
1224 $csv->titles = array_keys($dados[0]); 1249 $csv->titles = array_keys($dados[0]);
@@ -1247,22 +1272,22 @@ switch (strtoupper($funcao)) @@ -1247,22 +1272,22 @@ switch (strtoupper($funcao))
1247 */ 1272 */
1248 case "MAPFILEMEDIDAVARIAVEL": 1273 case "MAPFILEMEDIDAVARIAVEL":
1249 //$filtro usa aspas duplas para enviar os parametros 1274 //$filtro usa aspas duplas para enviar os parametros
1250 - $filtro = str_replace('"',"'",$filtro); 1275 + $filtro = str_replace('"',"'",$_GET["filtro"]);
1251 $m = new Metaestat(); 1276 $m = new Metaestat();
1252 if(!isset($codigo_tipo_regiao)){ 1277 if(!isset($codigo_tipo_regiao)){
1253 $codigo_tipo_regiao = ""; 1278 $codigo_tipo_regiao = "";
1254 } 1279 }
1255 - if(!isset($opacidade)){  
1256 - $opacidade = ""; 1280 + if(!isset($_GET["opacidade"])){
  1281 + $_GET["opacidade"] = "";
1257 } 1282 }
1258 - if($cachemapfile === "nao"){  
1259 - $cachemapfile = false; 1283 + if($_GET["cachemapfile"] === "nao"){
  1284 + $_GET["cachemapfile"] = false;
1260 } 1285 }
1261 else{ 1286 else{
1262 - $cachemapfile = true; 1287 + $_GET["cachemapfile"] = true;
1263 } 1288 }
1264 - if($formato == "json"){  
1265 - retornaJSON($m->mapfileMedidaVariavel($id_medida_variavel,$filtro,$todasascolunas,$tipolayer,$titulolayer,$id_classificacao,$agruparpor,$codigo_tipo_regiao,$opacidade,false,$cachemapfile)); 1289 + if($_GET["formato"] == "json"){
  1290 + retornaJSON($m->mapfileMedidaVariavel($id_medida_variavel,$filtro,$_GET["todasascolunas"],$_GET["tipolayer"],$_GET["titulolayer"],$id_classificacao,$_GET["agruparpor"],$codigo_tipo_regiao,$_GET["opacidade"],false,$_GET["cachemapfile"]));
1266 } 1291 }
1267 exit; 1292 exit;
1268 break; 1293 break;
@@ -1274,16 +1299,16 @@ switch (strtoupper($funcao)) @@ -1274,16 +1299,16 @@ switch (strtoupper($funcao))
1274 */ 1299 */
1275 case "MAPFILETIPOREGIAO": 1300 case "MAPFILETIPOREGIAO":
1276 $m = new Metaestat(); 1301 $m = new Metaestat();
1277 - if(empty($outlinecolor)){  
1278 - $outlinecolor = "255,0,0"; 1302 + if(empty($_GET["outlinecolor"])){
  1303 + $_GET["outlinecolor"] = "255,0,0";
1279 } 1304 }
1280 - if(empty($width)){  
1281 - $width = 1; 1305 + if(empty($_GET["width"])){
  1306 + $_GET["width"] = 1;
1282 } 1307 }
1283 - if(empty($nomes)){  
1284 - $nomes = "nao"; 1308 + if(empty($_GET["nomes"])){
  1309 + $_GET["nomes"] = "nao";
1285 } 1310 }
1286 - retornaJSON($m->mapfileTipoRegiao($codigo_tipo_regiao,$outlinecolor,$width,$nomes)); 1311 + retornaJSON($m->mapfileTipoRegiao($codigo_tipo_regiao,$_GET["outlinecolor"],$_GET["width"],$_GET["nomes"]));
1287 exit; 1312 exit;
1288 break; 1313 break;
1289 /* 1314 /*
@@ -1294,9 +1319,10 @@ switch (strtoupper($funcao)) @@ -1294,9 +1319,10 @@ switch (strtoupper($funcao))
1294 */ 1319 */
1295 case "KMLMEDIDAVARIAVEL": 1320 case "KMLMEDIDAVARIAVEL":
1296 $m = new Metaestat(); 1321 $m = new Metaestat();
1297 - $r = $m->mapfileMedidaVariavel($id_medida_variavel,$filtro,$todasascolunas,$tipolayer,$titulolayer,$id_classificacao,$agruparpor); 1322 + $r = $m->mapfileMedidaVariavel($id_medida_variavel,$_GET["filtro"],$_GET["todasascolunas"],$_GET["tipolayer"],$_GET["titulolayer"],$id_classificacao,$_GET["agruparpor"]);
1298 //cria um mapfile completo, que inclui a camada no mapfile de inicializacao do i3geo 1323 //cria um mapfile completo, que inclui a camada no mapfile de inicializacao do i3geo
1299 $mapfile = $m->mapfileCompleto($r["mapfile"]); 1324 $mapfile = $m->mapfileCompleto($r["mapfile"]);
  1325 + $formato = $_GET["formato"];
1300 if($formato == "kml" || $formato == "kmz"){ 1326 if($formato == "kml" || $formato == "kmz"){
1301 //define as variaveis necessarias ao pacote kmlserver 1327 //define as variaveis necessarias ao pacote kmlserver
1302 set_time_limit(0); 1328 set_time_limit(0);
@@ -1354,11 +1380,11 @@ switch (strtoupper($funcao)) @@ -1354,11 +1380,11 @@ switch (strtoupper($funcao))
1354 */ 1380 */
1355 case "SUMARIOMEDIDAVARIAVEL": 1381 case "SUMARIOMEDIDAVARIAVEL":
1356 $m = new Metaestat(); 1382 $m = new Metaestat();
1357 - $dados = $m->sumarioMedidaVariavel($id_medida_variavel,$filtro,$agruparpor);  
1358 - if($formato == "json"){ 1383 + $dados = $m->sumarioMedidaVariavel($id_medida_variavel,$_GET["filtro"],$_GET["agruparpor"]);
  1384 + if($_GET["formato"] == "json"){
1359 retornaJSON($dados); 1385 retornaJSON($dados);
1360 } 1386 }
1361 - if($formato == "xml"){ 1387 + if($_GET["formato"] == "xml"){
1362 header("Content-type: application/xml"); 1388 header("Content-type: application/xml");
1363 echo($m->formataXML($dados["grupos"])); 1389 echo($m->formataXML($dados["grupos"]));
1364 } 1390 }
@@ -1381,7 +1407,7 @@ switch (strtoupper($funcao)) @@ -1381,7 +1407,7 @@ switch (strtoupper($funcao))
1381 */ 1407 */
1382 case "ESQUEMASCONEXAO": 1408 case "ESQUEMASCONEXAO":
1383 $m = new Metaestat(); 1409 $m = new Metaestat();
1384 - if($formato == "json"){ 1410 + if($_GET["formato"] == "json"){
1385 retornaJSON($m->esquemasConexao($codigo_estat_conexao)); 1411 retornaJSON($m->esquemasConexao($codigo_estat_conexao));
1386 } 1412 }
1387 exit; 1413 exit;
@@ -1405,11 +1431,11 @@ switch (strtoupper($funcao)) @@ -1405,11 +1431,11 @@ switch (strtoupper($funcao))
1405 */ 1431 */
1406 case "TABELASESQUEMA": 1432 case "TABELASESQUEMA":
1407 $m = new Metaestat(); 1433 $m = new Metaestat();
1408 - if(empty($excluigeom)){  
1409 - $excluigeom = ""; 1434 + if(empty($_GET["excluigeom"])){
  1435 + $_GET["excluigeom"] = "";
1410 } 1436 }
1411 - if($formato == "json"){  
1412 - retornaJSON($m->tabelasEsquema($codigo_estat_conexao,$nome_esquema,$excluigeom)); 1437 + if($_GET["formato"] == "json"){
  1438 + retornaJSON($m->tabelasEsquema($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["excluigeom"]));
1413 } 1439 }
1414 exit; 1440 exit;
1415 break; 1441 break;
@@ -1419,35 +1445,35 @@ switch (strtoupper($funcao)) @@ -1419,35 +1445,35 @@ switch (strtoupper($funcao))
1419 retornaJSON("erro"); 1445 retornaJSON("erro");
1420 exit; 1446 exit;
1421 } 1447 }
1422 - retornaJSON($m->criaTabelaDB($codigo_estat_conexao,$nome_esquema,$nome_tabela,$comentario)); 1448 + retornaJSON($m->criaTabelaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["comentario"]));
1423 exit; 1449 exit;
1424 break; 1450 break;
1425 case "CRIAESQUEMADB": 1451 case "CRIAESQUEMADB":
1426 $m = new Metaestat(); 1452 $m = new Metaestat();
1427 - retornaJSON($m->criaEsquemaDB($codigo_estat_conexao,$nome_esquema)); 1453 + retornaJSON($m->criaEsquemaDB($codigo_estat_conexao,$_GET["nome_esquema"]));
1428 exit; 1454 exit;
1429 break; 1455 break;
1430 case "ALTERANOMETABELADB": 1456 case "ALTERANOMETABELADB":
1431 $m = new Metaestat(); 1457 $m = new Metaestat();
1432 - if($nome_esquema != "i3geo_metaestat"){ 1458 + if($_GET["nome_esquema"] != "i3geo_metaestat"){
1433 retornaJSON("erro"); 1459 retornaJSON("erro");
1434 exit; 1460 exit;
1435 } 1461 }
1436 - retornaJSON($m->alteraNomeTabelaDB($codigo_estat_conexao,$nome_esquema,$nome_tabela,$novonome_tabela)); 1462 + retornaJSON($m->alteraNomeTabelaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["novonome_tabela"]));
1437 exit; 1463 exit;
1438 break; 1464 break;
1439 case "ALTERANOMEESQUEMADB": 1465 case "ALTERANOMEESQUEMADB":
1440 $m = new Metaestat(); 1466 $m = new Metaestat();
1441 - retornaJSON($m->alteraNomeEsquemaDB($codigo_estat_conexao,$nome_esquema,$novonome_esquema)); 1467 + retornaJSON($m->alteraNomeEsquemaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["novonome_esquema"]));
1442 exit; 1468 exit;
1443 break; 1469 break;
1444 case "COPIATABELADB": 1470 case "COPIATABELADB":
1445 $m = new Metaestat(); 1471 $m = new Metaestat();
1446 - if($nome_esquema != "i3geo_metaestat"){ 1472 + if($_GET["nome_esquema"] != "i3geo_metaestat"){
1447 retornaJSON("erro"); 1473 retornaJSON("erro");
1448 exit; 1474 exit;
1449 } 1475 }
1450 - retornaJSON($m->copiaTabelaDB($codigo_estat_conexao,$nome_esquema,$nome_tabela,$novonome_tabela)); 1476 + retornaJSON($m->copiaTabelaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["novonome_tabela"]));
1451 exit; 1477 exit;
1452 break; 1478 break;
1453 /* 1479 /*
@@ -1471,19 +1497,19 @@ switch (strtoupper($funcao)) @@ -1471,19 +1497,19 @@ switch (strtoupper($funcao))
1471 */ 1497 */
1472 case "COLUNASTABELA": 1498 case "COLUNASTABELA":
1473 $m = new Metaestat(); 1499 $m = new Metaestat();
1474 - if(empty($tipo)){  
1475 - $tipo = ""; 1500 + if(empty($_GET["tipo"])){
  1501 + $_GET["tipo"] = "";
1476 } 1502 }
1477 - if($formato == "json"){  
1478 - retornaJSON($m->colunasTabela($codigo_estat_conexao,$nome_esquema,$nome_tabela,$tipo)); 1503 + if($_GET["formato"] == "json"){
  1504 + retornaJSON($m->colunasTabela($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["tipo"]));
1479 } 1505 }
1480 exit; 1506 exit;
1481 break; 1507 break;
1482 case "INFOTABELA": 1508 case "INFOTABELA":
1483 $m = new Metaestat(); 1509 $m = new Metaestat();
1484 - $colunas = $m->colunasTabela($codigo_estat_conexao,$nome_esquema,$nome_tabela,"");  
1485 - $comentario = $m->comentarioTabela($codigo_estat_conexao,$nome_esquema,$nome_tabela);  
1486 - if($formato == "json"){ 1510 + $colunas = $m->colunasTabela($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],"");
  1511 + $comentario = $m->comentarioTabela($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"]);
  1512 + if($_GET["formato"] == "json"){
1487 retornaJSON(array( 1513 retornaJSON(array(
1488 "colunas"=>$colunas, 1514 "colunas"=>$colunas,
1489 "comentario"=>$comentario 1515 "comentario"=>$comentario
@@ -1492,34 +1518,34 @@ switch (strtoupper($funcao)) @@ -1492,34 +1518,34 @@ switch (strtoupper($funcao))
1492 exit; 1518 exit;
1493 case "CRIACOLUNADB": 1519 case "CRIACOLUNADB":
1494 $m = new Metaestat(); 1520 $m = new Metaestat();
1495 - if($nome_esquema != "i3geo_metaestat"){ 1521 + if($_GET["nome_esquema"] != "i3geo_metaestat"){
1496 retornaJSON("erro"); 1522 retornaJSON("erro");
1497 exit; 1523 exit;
1498 } 1524 }
1499 - retornaJSON($m->criaColunaDB($codigo_estat_conexao,$nome_esquema,$nome_tabela,$nova_coluna,$tipo)); 1525 + retornaJSON($m->criaColunaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["nova_coluna"],$_GET["tipo"]));
1500 exit; 1526 exit;
1501 break; 1527 break;
1502 case "ALTERANOMECOLUNADB": 1528 case "ALTERANOMECOLUNADB":
1503 $m = new Metaestat(); 1529 $m = new Metaestat();
1504 - if($nome_esquema != "i3geo_metaestat"){ 1530 + if($_GET["nome_esquema"] != "i3geo_metaestat"){
1505 retornaJSON("erro"); 1531 retornaJSON("erro");
1506 exit; 1532 exit;
1507 } 1533 }
1508 - retornaJSON($m->alteraNomeColunaDB($codigo_estat_conexao,$nome_esquema,$nome_tabela,$nome_coluna,$novonome_coluna)); 1534 + retornaJSON($m->alteraNomeColunaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["nome_coluna"],$_GET["novonome_coluna"]));
1509 exit; 1535 exit;
1510 break; 1536 break;
1511 case "OBTEMDADOSTABELADB": 1537 case "OBTEMDADOSTABELADB":
1512 $m = new Metaestat(); 1538 $m = new Metaestat();
1513 - if($formato == "json"){  
1514 - retornaJSON($m->obtemDadosTabelaDB($codigo_estat_conexao,$nome_esquema,$nome_tabela,$geo,$nreg)); 1539 + if($_GET["formato"] == "json"){
  1540 + retornaJSON($m->obtemDadosTabelaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["geo"],$_GET["nreg"]));
1515 } 1541 }
1516 - if($formato == "csv"){  
1517 - $dados = $m->obtemDadosTabelaDB($codigo_estat_conexao,$nome_esquema,$nome_tabela,$geo,$nreg); 1542 + if($_GET["formato"] == "csv"){
  1543 + $dados = $m->obtemDadosTabelaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["geo"],$_GET["nreg"]);
1518 require_once(dirname(__FILE__)."/../../pacotes/parsecsv/parsecsv.lib.php"); 1544 require_once(dirname(__FILE__)."/../../pacotes/parsecsv/parsecsv.lib.php");
1519 $csv = new parseCSV(); 1545 $csv = new parseCSV();
1520 //$csv->encoding('UTF-16', 'UTF-8'); 1546 //$csv->encoding('UTF-16', 'UTF-8');
1521 $csv->titles = $dados["nomescolunas"]; 1547 $csv->titles = $dados["nomescolunas"];
1522 - $csv->output(true, 'mvar'.$nome_tabela.'_'.date('dmY').'.csv', $dados["linhas"]); 1548 + $csv->output(true, 'mvar'.$_GET["nome_tabela"].'_'.date('dmY').'.csv', $dados["linhas"]);
1523 } 1549 }
1524 exit; 1550 exit;
1525 break; 1551 break;
@@ -1544,9 +1570,9 @@ switch (strtoupper($funcao)) @@ -1544,9 +1570,9 @@ switch (strtoupper($funcao))
1544 */ 1570 */
1545 case "DESCREVECOLUNASTABELA": 1571 case "DESCREVECOLUNASTABELA":
1546 $m = new Metaestat(); 1572 $m = new Metaestat();
1547 - if($formato == "json"){  
1548 - $c = $m->descreveColunasTabela($codigo_estat_conexao,$nome_esquema,$nome_tabela);  
1549 - $s = $m->listaTabelaSerial($codigo_estat_conexao,$nome_esquema,$nome_tabela); 1573 + if($_GET["formato"] == "json"){
  1574 + $c = $m->descreveColunasTabela($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"]);
  1575 + $s = $m->listaTabelaSerial($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"]);
1550 for($i=0;$i<count($c);$i++){ 1576 for($i=0;$i<count($c);$i++){
1551 if($c[$i]["field"] == $s){ 1577 if($c[$i]["field"] == $s){
1552 $c[$i]["serial"] = true; 1578 $c[$i]["serial"] = true;
@@ -1556,8 +1582,6 @@ switch (strtoupper($funcao)) @@ -1556,8 +1582,6 @@ switch (strtoupper($funcao))
1556 } 1582 }
1557 } 1583 }
1558 retornaJSON($c); 1584 retornaJSON($c);
1559 -  
1560 -  
1561 } 1585 }
1562 exit; 1586 exit;
1563 break; 1587 break;
@@ -1566,7 +1590,7 @@ switch (strtoupper($funcao)) @@ -1566,7 +1590,7 @@ switch (strtoupper($funcao))
1566 if(empty($codigo_variavel)){ 1590 if(empty($codigo_variavel)){
1567 $codigo_variavel = ""; 1591 $codigo_variavel = "";
1568 } 1592 }
1569 - $dados = $m->relatorioCompleto($codigo_variavel,$dadosGerenciais); 1593 + $dados = $m->relatorioCompleto($codigo_variavel,$_GET["dadosGerenciais"]);
1570 retornaJSON($dados); 1594 retornaJSON($dados);
1571 exit; 1595 exit;
1572 break; 1596 break;
@@ -1575,29 +1599,29 @@ switch (strtoupper($funcao)) @@ -1575,29 +1599,29 @@ switch (strtoupper($funcao))
1575 if(empty($codigo_variavel)){ 1599 if(empty($codigo_variavel)){
1576 $codigo_variavel = ""; 1600 $codigo_variavel = "";
1577 } 1601 }
1578 - $dados = $m->relatorioCompleto($codigo_variavel,$dadosGerenciais);  
1579 - if(empty($detalhes)){  
1580 - $detalhes = "sim"; 1602 + $dados = $m->relatorioCompleto($codigo_variavel,$_GET["dadosGerenciais"]);
  1603 + if(empty($_GET["detalhes"])){
  1604 + $_GET["detalhes"] = "sim";
1581 } 1605 }
1582 - $dados = $m->formataRelatorioHtml($dados,$detalhes); 1606 + $dados = $m->formataRelatorioHtml($dados,$_GET["detalhes"]);
1583 retornaJSON($dados); 1607 retornaJSON($dados);
1584 exit; 1608 exit;
1585 break; 1609 break;
1586 //insere dados com base em um arquivo csv ja existente no servidor 1610 //insere dados com base em um arquivo csv ja existente no servidor
1587 case "INSERIRDADOS": 1611 case "INSERIRDADOS":
1588 $m = new Metaestat(); 1612 $m = new Metaestat();
1589 - retornaJSON($m->inserirDados($nomearquivoserv,$id_medida_variavel,$codigoregiao,$valor,$tipoinclusao,$ano,$mes,$dia,$hora)); 1613 + retornaJSON($m->inserirDados($nomearquivoserv,$id_medida_variavel,$_GET["codigoregiao"],$_GET["valor"],$_GET["tipoinclusao"],$_GET["ano"],$_GET["mes"],$_GET["dia"],$_GET["hora"]));
1590 exit; 1614 exit;
1591 break; 1615 break;
1592 //grava ou cria um registro de uma regiao 1616 //grava ou cria um registro de uma regiao
1593 case "MANTEMDADOSREGIAO": 1617 case "MANTEMDADOSREGIAO":
1594 $m = new Metaestat(); 1618 $m = new Metaestat();
1595 - retornaJSON($m->mantemDadosRegiao($codigo_tipo_regiao,$identificador,$identificadornovo,$nome,$wkt,$tipo)); 1619 + retornaJSON($m->mantemDadosRegiao($codigo_tipo_regiao,$_GET["identificador"],$_GET["identificadornovo"],$_GET["nome"],$_GET["wkt"],$_GET["tipo"]));
1596 exit; 1620 exit;
1597 break; 1621 break;
1598 case "LISTAATRIBUTOSMEDIDAVARIAVELXY": 1622 case "LISTAATRIBUTOSMEDIDAVARIAVELXY":
1599 $m = new Metaestat(); 1623 $m = new Metaestat();
1600 - $regiao = $m->xy2regiao($codigo_tipo_regiao, $x, $y); 1624 + $regiao = $m->xy2regiao($codigo_tipo_regiao, $_GET["x"], $_GET["y"]);
1601 $identificador_regiao = $regiao["identificador_regiao"]; 1625 $identificador_regiao = $regiao["identificador_regiao"];
1602 $resultado = array(); 1626 $resultado = array();
1603 if($regiao != ""){ 1627 if($regiao != ""){
@@ -1613,7 +1637,7 @@ switch (strtoupper($funcao)) @@ -1613,7 +1637,7 @@ switch (strtoupper($funcao))
1613 case "LISTATODOSATRIBUTOSMEDIDAVARIAVELXY": 1637 case "LISTATODOSATRIBUTOSMEDIDAVARIAVELXY":
1614 $lista = array(); 1638 $lista = array();
1615 $m = new Metaestat(); 1639 $m = new Metaestat();
1616 - $regiao = $m->xy2regiao($codigo_tipo_regiao, $x, $y); 1640 + $regiao = $m->xy2regiao($codigo_tipo_regiao, $_GET["x"], $_GET["y"]);
1617 $identificador_regiao = $regiao["identificador_regiao"]; 1641 $identificador_regiao = $regiao["identificador_regiao"];
1618 $variaveis = $m->listaVariavel(); 1642 $variaveis = $m->listaVariavel();
1619 $dadosVariavel = array(); 1643 $dadosVariavel = array();
@@ -1643,24 +1667,24 @@ switch (strtoupper($funcao)) @@ -1643,24 +1667,24 @@ switch (strtoupper($funcao))
1643 case "SALVAATRIBUTOSMEDIDAVARIAVEL": 1667 case "SALVAATRIBUTOSMEDIDAVARIAVEL":
1644 /* "&codigo_tipo_regiao="+codigo_tipo_regiao+"&identificador_regiao="+identificador_regiao+"&id_medida_variavel="+id_medida_variavel+"&colunas="+colunasT[0]+"&valores="+valoresT.join("|")+"&idsunicos="+idsunicosT[0] 1668 /* "&codigo_tipo_regiao="+codigo_tipo_regiao+"&identificador_regiao="+identificador_regiao+"&id_medida_variavel="+id_medida_variavel+"&colunas="+colunasT[0]+"&valores="+valoresT.join("|")+"&idsunicos="+idsunicosT[0]
1645 */ 1669 */
1646 - $valores = explode("#",$valores);//array de uma lista de strings com valores separados por ;  
1647 - $idsunicos = explode("|",$idsunicos);//array  
1648 - $colunas = explode("|",$colunas);//array 1670 + $_GET["valores"] = explode("#",$_GET["valores"]);//array de uma lista de strings com valores separados por ;
  1671 + $_GET["idsunicos"] = explode("|",$_GET["idsunicos"]);//array
  1672 + $_GET["colunas"] = explode("|",$_GET["colunas"]);//array
1649 $m = new Metaestat(); 1673 $m = new Metaestat();
1650 - $resultado = $m->salvaAtributosMedidaVariavel($id_medida_variavel,$codigo_tipo_regiao,$identificador_regiao,$idsunicos,$colunas,$valores); 1674 + $resultado = $m->salvaAtributosMedidaVariavel($id_medida_variavel,$codigo_tipo_regiao,$_GET["identificador_regiao"],$_GET["idsunicos"],$_GET["colunas"],$_GET["valores"]);
1651 retornaJSON($resultado); 1675 retornaJSON($resultado);
1652 exit; 1676 exit;
1653 break; 1677 break;
1654 //utilizado na ferramenta de identificacao 1678 //utilizado na ferramenta de identificacao
1655 case "SALVAATRIBUTOSTIPOREGIAO": 1679 case "SALVAATRIBUTOSTIPOREGIAO":
1656 $m = new Metaestat(); 1680 $m = new Metaestat();
1657 - $resultado = $m->mantemDadosRegiao($codigo_tipo_regiao,$identificador_regiao,$identificador_regiao,$valores,"","alterar",$colunas); 1681 + $resultado = $m->mantemDadosRegiao($codigo_tipo_regiao,$_GET["identificador_regiao"],$_GET["identificador_regiao"],$_GET["valores"],"","alterar",$_GET["colunas"]);
1658 retornaJSON($resultado); 1682 retornaJSON($resultado);
1659 exit; 1683 exit;
1660 break; 1684 break;
1661 case "EXCLUIATRIBUTOSMEDIDAVARIAVEL": 1685 case "EXCLUIATRIBUTOSMEDIDAVARIAVEL":
1662 $m = new Metaestat(); 1686 $m = new Metaestat();
1663 - $resultado = $m->excluiAtributosMedidaVariavel($id_medida_variavel,$codigo_tipo_regiao,$identificador_regiao,$id); 1687 + $resultado = $m->excluiAtributosMedidaVariavel($id_medida_variavel,$codigo_tipo_regiao,$_GET["identificador_regiao"],$id);
1664 retornaJSON($resultado); 1688 retornaJSON($resultado);
1665 exit; 1689 exit;
1666 break; 1690 break;
admin/php/metaestat_mapa_uploadimagem.php
1 <?php 1 <?php
  2 +exit;
2 /* 3 /*
3 * Faz o upload de imagens para a pasta templates/logos 4 * Faz o upload de imagens para a pasta templates/logos
4 * Essas imagens sao utilizadas nos mapas e sao escolhidas pelo usuario no formulario de publicacao dos mapas 5 * Essas imagens sao utilizadas nos mapas e sao escolhidas pelo usuario no formulario de publicacao dos mapas
5 */ 6 */
6 -include_once("admin.php");  
7 include_once("login.php"); 7 include_once("login.php");
8 if(verificaOperacaoSessao("admin/metaestat/geral") == false){ 8 if(verificaOperacaoSessao("admin/metaestat/geral") == false){
9 echo "Vc nao pode realizar essa operacao.";exit; 9 echo "Vc nao pode realizar essa operacao.";exit;
@@ -31,7 +31,6 @@ if (isset($_FILES[&#39;uploadimagem&#39;][&#39;name&#39;])){ @@ -31,7 +31,6 @@ if (isset($_FILES[&#39;uploadimagem&#39;][&#39;name&#39;])){
31 } 31 }
32 //sobe arquivo 32 //sobe arquivo
33 $Arquivo = $_FILES['uploadimagem']['tmp_name']; 33 $Arquivo = $_FILES['uploadimagem']['tmp_name'];
34 - //echo $Arquivo;  
35 $status = move_uploaded_file($Arquivo,str_replace(".png","",$arq).".png"); 34 $status = move_uploaded_file($Arquivo,str_replace(".png","",$arq).".png");
36 if($status != 1) 35 if($status != 1)
37 {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo. Verifique as permissoes de escrita";exit;} 36 {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo. Verifique as permissoes de escrita";exit;}
admin/php/metaestat_templates.php
1 <?php 1 <?php
  2 + include_once (dirname(__FILE__)."/../../classesphp/sani_request.php");
2 include(dirname(__FILE__)."/../../ms_configura.php"); 3 include(dirname(__FILE__)."/../../ms_configura.php");
3 include(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php"); 4 include(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php");
4 //parser do arquivo para envio como imagem diretamente ao navegador 5 //parser do arquivo para envio como imagem diretamente ao navegador
5 if(!empty($_GET)){ 6 if(!empty($_GET)){
6 - //echo $_GET["nomeimg"];exit;  
7 ob_clean(); 7 ob_clean();
8 echoimg($_GET["nomeimg"],$_GET["tipo"]); 8 echoimg($_GET["nomeimg"],$_GET["tipo"]);
9 exit; 9 exit;
admin/php/metaestat_uploadcsv_submit.php
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 /* 2 /*
3 * Faz o upload de csv e insere no banco de dados criando uma nova tabela 3 * Faz o upload de csv e insere no banco de dados criando uma nova tabela
4 */ 4 */
5 -include_once("admin.php");  
6 include_once("login.php"); 5 include_once("login.php");
7 if(verificaOperacaoSessao("admin/metaestat/editorbanco") == false){ 6 if(verificaOperacaoSessao("admin/metaestat/editorbanco") == false){
8 echo "Vc nao pode realizar essa operacao.";exit; 7 echo "Vc nao pode realizar essa operacao.";exit;
@@ -31,13 +30,18 @@ if (ob_get_level() == 0) ob_start(); @@ -31,13 +30,18 @@ if (ob_get_level() == 0) ob_start();
31 exit; 30 exit;
32 } 31 }
33 if (isset($_FILES['i3GEOuploadcsv']['name'])){ 32 if (isset($_FILES['i3GEOuploadcsv']['name'])){
34 - require_once (dirname(__FILE__)."/../../ms_configura.php");  
35 echo "<p class='paragrafo' >Carregando o arquivo...</p>"; 33 echo "<p class='paragrafo' >Carregando o arquivo...</p>";
36 ob_flush(); 34 ob_flush();
37 flush(); 35 flush();
38 sleep(1); 36 sleep(1);
39 $arqcsv = $_FILES['i3GEOuploadcsv']['tmp_name']; 37 $arqcsv = $_FILES['i3GEOuploadcsv']['tmp_name'];
40 $nomePrefixo = str_replace(" ","_",removeAcentos($_FILES['i3GEOuploadcsv']['name'])); 38 $nomePrefixo = str_replace(" ","_",removeAcentos($_FILES['i3GEOuploadcsv']['name']));
  39 +
  40 + $nomePrefixo = str_replace(".","",$nomePrefixo);
  41 + $nomePrefixo = strip_tags($nomePrefixo);
  42 + $nomePrefixo = htmlspecialchars($nomePrefixo, ENT_QUOTES);
  43 + $nomePrefixo = $nomePrefixo . md5(uniqid(rand(), true));
  44 +
41 $nomePrefixo = $nomePrefixo."_".(nomeRandomico(4)).".csv"; 45 $nomePrefixo = $nomePrefixo."_".(nomeRandomico(4)).".csv";
42 46
43 $Arquivo = $_FILES['i3GEOuploadcsv']['tmp_name']; 47 $Arquivo = $_FILES['i3GEOuploadcsv']['tmp_name'];
@@ -49,6 +53,13 @@ if (ob_get_level() == 0) ob_start(); @@ -49,6 +53,13 @@ if (ob_get_level() == 0) ob_start();
49 echo "<p class='paragrafo' >Ocorreu algum problema no envio do arquivo ".$dir_tmp."/".$nomePrefixo;paraAguarde();exit; 53 echo "<p class='paragrafo' >Ocorreu algum problema no envio do arquivo ".$dir_tmp."/".$nomePrefixo;paraAguarde();exit;
50 } 54 }
51 $arqcsv = $dir_tmp."/".$nomePrefixo; 55 $arqcsv = $dir_tmp."/".$nomePrefixo;
  56 +
  57 + $checkphp = fileContemString($dirmap."/".$nomePrefixo,"<?");
  58 + if($checkphp == true){
  59 + unlink($dirmap."/".$nomePrefixo);
  60 + exit;
  61 + }
  62 +
52 //pega os parametros de conexao 63 //pega os parametros de conexao
53 include("classe_metaestat.php"); 64 include("classe_metaestat.php");
54 $m = new Metaestat(); 65 $m = new Metaestat();
admin/php/metaestat_uploaddados_submit.php
@@ -2,12 +2,25 @@ @@ -2,12 +2,25 @@
2 $colunasarquivo = ""; 2 $colunasarquivo = "";
3 $nomearquivoserv = ""; 3 $nomearquivoserv = "";
4 error_reporting(0); 4 error_reporting(0);
5 -//var_dump($_FILES);exit; 5 +include_once(dirname(__FILE__)."/login.php");
6 if (isset($_FILES['i3GEOuploadArquivo']['name'])) 6 if (isset($_FILES['i3GEOuploadArquivo']['name']))
7 -{  
8 - require_once (dirname(__FILE__)."/../../ms_configura.php"); 7 +{
9 $Arquivoup = $_FILES['i3GEOuploadArquivo']['tmp_name']; 8 $Arquivoup = $_FILES['i3GEOuploadArquivo']['tmp_name'];
10 - $nomearquivoserv = $dir_tmp."/upload".basename($Arquivoup).".csv"; 9 +
  10 + $nomePrefixo = str_replace(" ","_",str_replace(".csv","",$_FILES['i3GEOuploadArquivo']['name']));
  11 + $nomePrefixo = str_replace(".","",$nomePrefixo);
  12 + $nomePrefixo = strip_tags($nomePrefixo);
  13 + $nomePrefixo = htmlspecialchars($nomePrefixo, ENT_QUOTES);
  14 + $nomePrefixo = $nomePrefixo . md5(uniqid(rand(), true));
  15 +
  16 + $nomearquivoserv = $dir_tmp."/uploaddados".$nomePrefixo.".csv";
  17 +
  18 + $checkphp = fileContemString($nomearquivoserv,"<?");
  19 + if($checkphp == true){
  20 + unlink($nomearquivoserv);
  21 + exit;
  22 + }
  23 +
11 //echo $nomearquivoserv; 24 //echo $nomearquivoserv;
12 if(file_exists($nomearquivoserv)){ 25 if(file_exists($nomearquivoserv)){
13 unlink($nomearquivoserv); 26 unlink($nomearquivoserv);
@@ -34,10 +47,12 @@ if (isset($_FILES[&#39;i3GEOuploadArquivo&#39;][&#39;name&#39;])) @@ -34,10 +47,12 @@ if (isset($_FILES[&#39;i3GEOuploadArquivo&#39;][&#39;name&#39;]))
34 <script> 47 <script>
35 48
36 <?php echo "c = '$colunasarquivo';";?> 49 <?php echo "c = '$colunasarquivo';";?>
37 -<?php echo "d = '$nomearquivoserv';";?> 50 +<?php
  51 +//echo "d = '$nomearquivoserv';";
  52 +echo "d = '';";
  53 +?>
38 window.parent.i3GEOadmin.uploaddados.COLUNASARQUIVO = c; 54 window.parent.i3GEOadmin.uploaddados.COLUNASARQUIVO = c;
39 window.parent.i3GEOadmin.uploaddados.NOMEARQUIVOSERV = d; 55 window.parent.i3GEOadmin.uploaddados.NOMEARQUIVOSERV = d;
40 window.parent.i3GEOadmin.uploaddados.upload.fimsubmit(); 56 window.parent.i3GEOadmin.uploaddados.upload.fimsubmit();
41 -  
42 </script> 57 </script>
43 </html> 58 </html>
44 \ No newline at end of file 59 \ No newline at end of file
admin/php/metaestat_uploadshp_submit.php
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 /* 2 /*
3 * Faz o upload de shapefile e insere no banco de dados 3 * Faz o upload de shapefile e insere no banco de dados
4 */ 4 */
5 -include_once("admin.php");  
6 include_once("login.php"); 5 include_once("login.php");
7 set_time_limit(0); 6 set_time_limit(0);
8 if(verificaOperacaoSessao("admin/metaestat/editorbanco") == false){ 7 if(verificaOperacaoSessao("admin/metaestat/editorbanco") == false){
@@ -37,15 +36,25 @@ if ($_FILES[&#39;i3GEOuploadshp&#39;][&#39;name&#39;] == &quot;&quot;){ @@ -37,15 +36,25 @@ if ($_FILES[&#39;i3GEOuploadshp&#39;][&#39;name&#39;] == &quot;&quot;){
37 } 36 }
38 if (isset($_FILES['i3GEOuploadshp']['name'])){ 37 if (isset($_FILES['i3GEOuploadshp']['name'])){
39 require_once (dirname(__FILE__)."/../../ms_configura.php"); 38 require_once (dirname(__FILE__)."/../../ms_configura.php");
  39 + if(isset($logExec) && $logExec["upload"] == true){
  40 + i3GeoLog("prog: metaestat_uploadshp_submit filename:" . $_FILES['i3GEOuploadshp']['name'],$dir_tmp);
  41 + }
  42 +
40 echo "<p class='paragrafo' >Carregando o arquivo...</p>"; 43 echo "<p class='paragrafo' >Carregando o arquivo...</p>";
41 ob_flush(); 44 ob_flush();
42 flush(); 45 flush();
43 sleep(1); 46 sleep(1);
  47 +
  48 +
44 $arqshp = $_FILES['i3GEOuploadshp']['tmp_name']; 49 $arqshp = $_FILES['i3GEOuploadshp']['tmp_name'];
45 //verifica nomes e sobe arquivo 50 //verifica nomes e sobe arquivo
46 verificaNome($_FILES['i3GEOuploadshp']['name'],"shp"); 51 verificaNome($_FILES['i3GEOuploadshp']['name'],"shp");
47 $nomePrefixo = str_replace(" ","_",removeAcentos(str_replace(".shp","",$_FILES['i3GEOuploadshp']['name']))); 52 $nomePrefixo = str_replace(" ","_",removeAcentos(str_replace(".shp","",$_FILES['i3GEOuploadshp']['name'])));
48 - $nomePrefixo = $nomePrefixo."_".(nomeRandomico(4)); 53 +
  54 + $nomePrefixo = str_replace(".","",$nomePrefixo);
  55 + $nomePrefixo = strip_tags($nomePrefixo);
  56 + $nomePrefixo = htmlspecialchars($nomePrefixo, ENT_QUOTES);
  57 + $nomePrefixo = $nomePrefixo . md5(uniqid(rand(), true));
49 58
50 $Arquivo = $_FILES['i3GEOuploadshp']['tmp_name']; 59 $Arquivo = $_FILES['i3GEOuploadshp']['tmp_name'];
51 $status = move_uploaded_file($Arquivo,$dir_tmp."/".$nomePrefixo.".shp"); 60 $status = move_uploaded_file($Arquivo,$dir_tmp."/".$nomePrefixo.".shp");
@@ -73,6 +82,32 @@ if (isset($_FILES[&#39;i3GEOuploadshp&#39;][&#39;name&#39;])){ @@ -73,6 +82,32 @@ if (isset($_FILES[&#39;i3GEOuploadshp&#39;][&#39;name&#39;])){
73 echo "<p class='paragrafo' >Ocorreu algum problema no envio do arquivo ".$dir_tmp."/".$nomePrefixo;paraAguarde(); 82 echo "<p class='paragrafo' >Ocorreu algum problema no envio do arquivo ".$dir_tmp."/".$nomePrefixo;paraAguarde();
74 exit; 83 exit;
75 } 84 }
  85 +
  86 + $checkphp = fileContemString($dirmap."/".$nomePrefixo.".prj","<?");
  87 + if($checkphp == true){
  88 + unlink($dirmap."/".$nomePrefixo.".prj");
  89 + unlink($dirmap."/".$nomePrefixo.".shx");
  90 + unlink($dirmap."/".$nomePrefixo.".dbf");
  91 + unlink($dirmap."/".$nomePrefixo.".shp");
  92 + exit;
  93 + }
  94 + $checkphp = fileContemString($dirmap."/".$nomePrefixo.".shx","<?");
  95 + if($checkphp == true){
  96 + unlink($dirmap."/".$nomePrefixo.".prj");
  97 + unlink($dirmap."/".$nomePrefixo.".shx");
  98 + unlink($dirmap."/".$nomePrefixo.".dbf");
  99 + unlink($dirmap."/".$nomePrefixo.".shp");
  100 + exit;
  101 + }
  102 + $checkphp = fileContemString($dirmap."/".$nomePrefixo.".dbf","<?");
  103 + if($checkphp == true){
  104 + unlink($dirmap."/".$nomePrefixo.".prj");
  105 + unlink($dirmap."/".$nomePrefixo.".shx");
  106 + unlink($dirmap."/".$nomePrefixo.".dbf");
  107 + unlink($dirmap."/".$nomePrefixo.".shp");
  108 + exit;
  109 + }
  110 +
76 $arqshp = $dir_tmp."/".$nomePrefixo.".shp"; 111 $arqshp = $dir_tmp."/".$nomePrefixo.".shp";
77 112
78 //pega os parametros de conexao 113 //pega os parametros de conexao
@@ -363,6 +398,9 @@ else{ @@ -363,6 +398,9 @@ else{
363 echo "<p class='paragrafo' >Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</p>"; 398 echo "<p class='paragrafo' >Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</p>";
364 } 399 }
365 function verificaNome($nome,$ext){ 400 function verificaNome($nome,$ext){
  401 + if(strlen(basename($nome)) > 200){
  402 + exit;
  403 + }
366 $nome = strtolower($nome); 404 $nome = strtolower($nome);
367 $lista = explode(".",$nome); 405 $lista = explode(".",$nome);
368 $extensao = $lista[count($lista) - 1]; 406 $extensao = $lista[count($lista) - 1];
admin/php/ogcws.php
@@ -49,67 +49,7 @@ $web = $mapa-&gt;web; @@ -49,67 +49,7 @@ $web = $mapa-&gt;web;
49 //faz a busca da fun&ccedil;&atilde;o que deve ser executada 49 //faz a busca da fun&ccedil;&atilde;o que deve ser executada
50 switch (strtoupper($funcao)) 50 switch (strtoupper($funcao))
51 { 51 {
52 - /*  
53 - Note:  
54 52
55 - Valores que o par&acirc;metro &funcao pode receber. Os par&acirc;metros devem ser enviados na requisi&ccedil;&atilde;o em AJAX.  
56 - */  
57 - /*  
58 - Valor: PEGAPARAMETROSCONFIGURA  
59 -  
60 - Lista os valores atuais das vari&aacute;veis registradas no ms_configura  
61 -  
62 - Retorno:  
63 -  
64 - {JSON}  
65 - */  
66 - case "PEGAPARAMETROSCONFIGURA":  
67 - $vs = array(  
68 - "ows_abstract",  
69 - "ows_keywordlist",  
70 - "ows_fees",  
71 - "ows_accessconstraints",  
72 - "ows_contactperson",  
73 - "ows_contactorganization",  
74 - "ows_contactposition",  
75 - "ows_addresstype",  
76 - "ows_address",  
77 - "ows_city",  
78 - "ows_stateorprovince",  
79 - "ows_postcode",  
80 - "ows_country",  
81 - "ows_contactelectronicmailaddress",  
82 - "ows_name"  
83 - );  
84 - $par = array();  
85 - foreach ($vs as $v){  
86 - $par[$v] = utf8_encode($mapa->getmetadata($v));  
87 - }  
88 - $par["mapfile"] = $map_file;  
89 - retornaJSON($par);  
90 - exit;  
91 - break;  
92 - /*  
93 - Valor: SALVACONFIGURA  
94 -  
95 - Salva um novo valor de uma vari&aacute;vel no ms_configura.php  
96 -  
97 - Parameters:  
98 -  
99 - variavel - nome da vari&aacute;vel  
100 -  
101 - valor - novo valor  
102 -  
103 - Retorno:  
104 -  
105 - {JSON}  
106 - */  
107 - case "SALVACONFIGURA":  
108 - $web->metadata->set($variavel,$valor);  
109 - $mapa->save($map_file);  
110 - retornaJSON("ok");  
111 - exit;  
112 - break;  
113 } 53 }
114 54
115 ?> 55 ?>
116 \ No newline at end of file 56 \ No newline at end of file
admin/php/operacoes.php
@@ -63,6 +63,13 @@ error_reporting(0); @@ -63,6 +63,13 @@ error_reporting(0);
63 //pega as variaveis passadas com get ou post 63 //pega as variaveis passadas com get ou post
64 // 64 //
65 include_once(dirname(__FILE__)."/login.php"); 65 include_once(dirname(__FILE__)."/login.php");
  66 +
  67 +$id = $_GET["id"];
  68 +$id_operacao = $_GET["id_operacao"];
  69 +$id_papel = $_GET["id_papel"];
  70 +
  71 +testaSafeNumerico([$id,$id_operacao]);
  72 +
66 $funcoesEdicao = array( 73 $funcoesEdicao = array(
67 "ALTERAROPERACOES", 74 "ALTERAROPERACOES",
68 "ADICIONAPAPELOPERACOES", 75 "ADICIONAPAPELOPERACOES",
@@ -113,16 +120,16 @@ switch (strtoupper($funcao)) @@ -113,16 +120,16 @@ switch (strtoupper($funcao))
113 } 120 }
114 cpjson($retorno); 121 cpjson($retorno);
115 function alterarOperacoes(){ 122 function alterarOperacoes(){
116 - global $id_operacao,$codigo,$descricao; 123 + global $id_operacao;
117 try{ 124 try{
118 include(dirname(__FILE__)."/conexao.php"); 125 include(dirname(__FILE__)."/conexao.php");
119 if($convUTF){ 126 if($convUTF){
120 - $descricao = utf8_encode($descricao); 127 + $_GET["descricao"] = utf8_encode($_GET["descricao"]);
121 } 128 }
122 if($id_operacao != ""){ 129 if($id_operacao != ""){
123 $dataCol = array( 130 $dataCol = array(
124 - "codigo" => $codigo,  
125 - "descricao" => $descricao 131 + "codigo" => $_GET["codigo"],
  132 + "descricao" => $_GET["descricao"]
126 ); 133 );
127 i3GeoAdminUpdate($dbhw,"i3geousr_operacoes",$dataCol,"WHERE id_operacao = $id_operacao"); 134 i3GeoAdminUpdate($dbhw,"i3geousr_operacoes",$dataCol,"WHERE id_operacao = $id_operacao");
128 $retorna = $id_operacao; 135 $retorna = $id_operacao;
admin/php/parsemapfile.php
@@ -37,10 +37,12 @@ Arquivo: @@ -37,10 +37,12 @@ Arquivo:
37 37
38 i3geo/admin/php/parsemapfile.php 38 i3geo/admin/php/parsemapfile.php
39 */ 39 */
  40 +include_once (dirname(__FILE__)."/../../classesphp/sani_request.php");
  41 +$_GET = array_merge($_GET,$_POST);
40 include(dirname(__FILE__)."/../../ms_configura.php"); 42 include(dirname(__FILE__)."/../../ms_configura.php");
41 include_once(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php"); 43 include_once(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php");
42 include_once(dirname(__FILE__)."/../../classesphp/carrega_ext.php"); 44 include_once(dirname(__FILE__)."/../../classesphp/carrega_ext.php");
43 -include_once(dirname(__FILE__)."/../../classesphp/pega_variaveis.php"); 45 +
44 // 46 //
45 //essa variavel indica se a senha do banco e bloqueada ou nao caso 47 //essa variavel indica se a senha do banco e bloqueada ou nao caso
46 //o tema seja do tipo postgis 48 //o tema seja do tipo postgis
@@ -48,6 +50,7 @@ include_once(dirname(__FILE__).&quot;/../../classesphp/pega_variaveis.php&quot;); @@ -48,6 +50,7 @@ include_once(dirname(__FILE__).&quot;/../../classesphp/pega_variaveis.php&quot;);
48 // 50 //
49 $bloqueiaStringConexao = true; 51 $bloqueiaStringConexao = true;
50 // 52 //
  53 +$forcawms = $_GET["forcawms"];
51 error_reporting(0); 54 error_reporting(0);
52 if(!isset($forcawms)){$forcawms = "nao";} 55 if(!isset($forcawms)){$forcawms = "nao";}
53 $objcontype[0] = "MS_INLINE"; 56 $objcontype[0] = "MS_INLINE";
@@ -75,7 +78,7 @@ $objlayertypes[6] = &quot;MS_LAYER_CIRCLE&quot;; @@ -75,7 +78,7 @@ $objlayertypes[6] = &quot;MS_LAYER_CIRCLE&quot;;
75 $objlayertypes[7] = "MS_LAYER_TILEINDEX"; 78 $objlayertypes[7] = "MS_LAYER_TILEINDEX";
76 $objlayertypes[8] = "MS_LAYER_CHART"; 79 $objlayertypes[8] = "MS_LAYER_CHART";
77 80
78 -$codigoLayer = $id; 81 +$codigoLayer = $_GET(["id"]);
79 $mapfile = $locaplic."/temas/".$codigoLayer.".map"; 82 $mapfile = $locaplic."/temas/".$codigoLayer.".map";
80 //remove temas restritos pelo sistema de controle de usuarios 83 //remove temas restritos pelo sistema de controle de usuarios
81 $indevidos = validaAcessoTemas($mapfile,false); 84 $indevidos = validaAcessoTemas($mapfile,false);
@@ -85,11 +88,12 @@ if($indevidos == true){ @@ -85,11 +88,12 @@ if($indevidos == true){
85 } 88 }
86 // 89 //
87 $mapa = ms_newMapObj($mapfile); 90 $mapa = ms_newMapObj($mapfile);
  91 +$tipoparse = $_GET(["tipoparse"]);
88 if(!isset($tipoparse) || $tipoparse==""){ 92 if(!isset($tipoparse) || $tipoparse==""){
89 mapfile($_GET["output"]); 93 mapfile($_GET["output"]);
90 exit; 94 exit;
91 } 95 }
92 - 96 +$layername = $_GET(["layername"]);
93 if($tipoparse == "legenda") 97 if($tipoparse == "legenda")
94 { 98 {
95 $tipoLegenda = tipoLegenda($layername); 99 $tipoLegenda = tipoLegenda($layername);
@@ -408,16 +412,16 @@ function mapfile($output=&quot;xml&quot;) @@ -408,16 +412,16 @@ function mapfile($output=&quot;xml&quot;)
408 else{ 412 else{
409 $xml .= "<user>".preg_replace('/.*user\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con)."</user>\n"; 413 $xml .= "<user>".preg_replace('/.*user\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con)."</user>\n";
410 $json["layer"]["connection"]["user"] = preg_replace('/.*user\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con); 414 $json["layer"]["connection"]["user"] = preg_replace('/.*user\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con);
411 - 415 +
412 $xml .= "<password>".preg_replace('/.*password\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con)."</password>\n"; 416 $xml .= "<password>".preg_replace('/.*password\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con)."</password>\n";
413 $json["layer"]["connection"]["password"] = preg_replace('/.*password\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con); 417 $json["layer"]["connection"]["password"] = preg_replace('/.*password\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con);
414 - 418 +
415 $xml .= "<dbname>".preg_replace('/.*dbname\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con)."</dbname>\n"; 419 $xml .= "<dbname>".preg_replace('/.*dbname\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con)."</dbname>\n";
416 $json["layer"]["connection"]["dbname"] = preg_replace('/.*dbname\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con); 420 $json["layer"]["connection"]["dbname"] = preg_replace('/.*dbname\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con);
417 - 421 +
418 $xml .= "<host>".preg_replace('/.*host\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con)."</host>\n"; 422 $xml .= "<host>".preg_replace('/.*host\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con)."</host>\n";
419 $json["layer"]["connection"]["host"] = preg_replace('/.*host\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con); 423 $json["layer"]["connection"]["host"] = preg_replace('/.*host\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con);
420 - 424 +
421 $xml .= "<port>".preg_replace('/.*port\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con)."</port>\n"; 425 $xml .= "<port>".preg_replace('/.*port\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con)."</port>\n";
422 $json["layer"]["connection"]["port"] = preg_replace('/.*port\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con); 426 $json["layer"]["connection"]["port"] = preg_replace('/.*port\s*=\s*([a-zA-Z0-9_.]+).*/i', '\1', $con);
423 } 427 }
@@ -446,7 +450,7 @@ function mapfile($output=&quot;xml&quot;) @@ -446,7 +450,7 @@ function mapfile($output=&quot;xml&quot;)
446 $xml .= "<labelmaxscale>$layer->labelmaxscaledenom</labelmaxscale>\n"; 450 $xml .= "<labelmaxscale>$layer->labelmaxscaledenom</labelmaxscale>\n";
447 $xml .= "<labelminscale>$layer->labelminscaledenom</labelminscale>\n"; 451 $xml .= "<labelminscale>$layer->labelminscaledenom</labelminscale>\n";
448 $xml .= "<labelsizeitem></labelsizeitem>\n"; 452 $xml .= "<labelsizeitem></labelsizeitem>\n";
449 - 453 +
450 $json["layer"]["esquema"] = $esquemaTabela[0]; 454 $json["layer"]["esquema"] = $esquemaTabela[0];
451 $json["layer"]["tabela"] = $esquemaTabela[1]; 455 $json["layer"]["tabela"] = $esquemaTabela[1];
452 $json["layer"]["where"] = $s[1]; 456 $json["layer"]["where"] = $s[1];
@@ -463,13 +467,13 @@ function mapfile($output=&quot;xml&quot;) @@ -463,13 +467,13 @@ function mapfile($output=&quot;xml&quot;)
463 $xml .= "<minscale>$layer->minscaledenom</minscale>\n"; 467 $xml .= "<minscale>$layer->minscaledenom</minscale>\n";
464 $xml .= "<offsite>".$layer->offsite->red.",".$layer->offsite->green.",".$layer->offsite->blue."</offsite>\n"; 468 $xml .= "<offsite>".$layer->offsite->red.",".$layer->offsite->green.",".$layer->offsite->blue."</offsite>\n";
465 $xml .= "<opacity>$layer->opacity</opacity>\n"; 469 $xml .= "<opacity>$layer->opacity</opacity>\n";
466 - 470 +
467 $json["layer"]["group"] = $layer->group; 471 $json["layer"]["group"] = $layer->group;
468 $json["layer"]["maxscale"] = $layer->maxscaledenom; 472 $json["layer"]["maxscale"] = $layer->maxscaledenom;
469 $json["layer"]["minscale"] = $layer->minscaledenom; 473 $json["layer"]["minscale"] = $layer->minscaledenom;
470 $json["layer"]["offsite"] = $layer->offsite->red.",".$layer->offsite->green.",".$layer->offsite->blue; 474 $json["layer"]["offsite"] = $layer->offsite->red.",".$layer->offsite->green.",".$layer->offsite->blue;
471 $json["layer"]["opacity"] = $layer->opacity; 475 $json["layer"]["opacity"] = $layer->opacity;
472 - 476 +
473 if($ct != "xMS_WMS") 477 if($ct != "xMS_WMS")
474 { 478 {
475 $xml .= "<symbolscale>$layer->symbolscaledenom</symbolscale>\n"; 479 $xml .= "<symbolscale>$layer->symbolscaledenom</symbolscale>\n";
@@ -482,7 +486,7 @@ function mapfile($output=&quot;xml&quot;) @@ -482,7 +486,7 @@ function mapfile($output=&quot;xml&quot;)
482 $xml .= "<classes>\n"; 486 $xml .= "<classes>\n";
483 $xml .= pegaClasses($layer,"xml"); 487 $xml .= pegaClasses($layer,"xml");
484 $xml .= "</classes>\n"; 488 $xml .= "</classes>\n";
485 - 489 +
486 $json["layer"]["symbolscale"] = $layer->symbolscaledenom; 490 $json["layer"]["symbolscale"] = $layer->symbolscaledenom;
487 $json["layer"]["tileindex"] = $layer->tileindex; 491 $json["layer"]["tileindex"] = $layer->tileindex;
488 $json["layer"]["tileitem"] = $layer->tileitem; 492 $json["layer"]["tileitem"] = $layer->tileitem;
@@ -520,7 +524,7 @@ function pegaClasses($layer,$output=&quot;xml&quot;) @@ -520,7 +524,7 @@ function pegaClasses($layer,$output=&quot;xml&quot;)
520 $xml .= pegaEstilos($classe,$output); 524 $xml .= pegaEstilos($classe,$output);
521 $xml .= "</estilos>\n"; 525 $xml .= "</estilos>\n";
522 $xml .= "</classe>\n"; 526 $xml .= "</classe>\n";
523 - 527 +
524 $j = array(); 528 $j = array();
525 $j["name"] = mb_convert_encoding(($classe->name),"UTF-8","ISO-8859-1"); 529 $j["name"] = mb_convert_encoding(($classe->name),"UTF-8","ISO-8859-1");
526 $j["expression"] = $classe->getExpressionString(); 530 $j["expression"] = $classe->getExpressionString();
@@ -549,7 +553,7 @@ function pegaEstilos($classe,$output = &quot;xml&quot;) @@ -549,7 +553,7 @@ function pegaEstilos($classe,$output = &quot;xml&quot;)
549 $xml .= "<backgroundcolor>".$estilo->backgroundcolor->red.",".$estilo->backgroundcolor->green.",".$estilo->backgroundcolor->blue."</backgroundcolor>\n"; 553 $xml .= "<backgroundcolor>".$estilo->backgroundcolor->red.",".$estilo->backgroundcolor->green.",".$estilo->backgroundcolor->blue."</backgroundcolor>\n";
550 $xml .= "<outlinecolor>".$estilo->outlinecolor->red.",".$estilo->outlinecolor->green.",".$estilo->outlinecolor->blue."</outlinecolor>\n"; 554 $xml .= "<outlinecolor>".$estilo->outlinecolor->red.",".$estilo->outlinecolor->green.",".$estilo->outlinecolor->blue."</outlinecolor>\n";
551 $xml .= "</estilo>\n"; 555 $xml .= "</estilo>\n";
552 - 556 +
553 $e = array(); 557 $e = array();
554 $e["symbolname"] = $estilo->symbolname; 558 $e["symbolname"] = $estilo->symbolname;
555 $e["color"] = $estilo->color->red.",".$estilo->color->green.",".$estilo->color->blue; 559 $e["color"] = $estilo->color->red.",".$estilo->color->green.",".$estilo->color->blue;
admin/php/preview.php
@@ -4,9 +4,6 @@ Esse programa e uma adaptacao do codigo i3geo/ogc.php @@ -4,9 +4,6 @@ Esse programa e uma adaptacao do codigo i3geo/ogc.php
4 E utilizado no preview de camadas no editor de mapfiles 4 E utilizado no preview de camadas no editor de mapfiles
5 Evita bloqueios de OGC e nao faz cache 5 Evita bloqueios de OGC e nao faz cache
6 */ 6 */
7 -include(dirname(__FILE__)."/../../ms_configura.php");  
8 -include(dirname(__FILE__)."/../../classesphp/pega_variaveis.php");  
9 -include(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php");  
10 include(dirname(__FILE__)."/login.php"); 7 include(dirname(__FILE__)."/login.php");
11 if(verificaOperacaoSessao("admin/php/editortexto") == false){ 8 if(verificaOperacaoSessao("admin/php/editortexto") == false){
12 //echo "Vc nao pode realizar essa operacao.";exit; 9 //echo "Vc nao pode realizar essa operacao.";exit;
@@ -35,7 +32,7 @@ if(isset($_GET[&quot;BBOX&quot;])){ @@ -35,7 +32,7 @@ if(isset($_GET[&quot;BBOX&quot;])){
35 $_GET["BBOX"] = str_replace(" ",",",$_GET["BBOX"]); 32 $_GET["BBOX"] = str_replace(" ",",",$_GET["BBOX"]);
36 } 33 }
37 $req = ms_newowsrequestobj(); 34 $req = ms_newowsrequestobj();
38 -$_GET = array_merge($_GET,$_POST); 35 +
39 if(!isset($_GET["srs"]) && !isset($_GET["SRS"])){ 36 if(!isset($_GET["srs"]) && !isset($_GET["SRS"])){
40 $_GET["srs"] = "EPSG:4326"; 37 $_GET["srs"] = "EPSG:4326";
41 } 38 }
admin/php/sistemas.php
@@ -39,6 +39,13 @@ O par&amp;acirc;metro principal &amp;eacute; &quot;funcao&quot;, que define qual opera&amp;ccedil;&amp;ati @@ -39,6 +39,13 @@ O par&amp;acirc;metro principal &amp;eacute; &quot;funcao&quot;, que define qual opera&amp;ccedil;&amp;ati
39 Cada opera&ccedil;&atilde;o possu&iacute; seus próprios par&acirc;metros, que devem ser enviados tamb&eacute;m na requisi&ccedil;&atilde;o da opera&ccedil;&atilde;o. 39 Cada opera&ccedil;&atilde;o possu&iacute; seus próprios par&acirc;metros, que devem ser enviados tamb&eacute;m na requisi&ccedil;&atilde;o da opera&ccedil;&atilde;o.
40 */ 40 */
41 include_once(dirname(__FILE__)."/login.php"); 41 include_once(dirname(__FILE__)."/login.php");
  42 +
  43 +$id_sistema = $_GET["id_sistema"];
  44 +$id_funcao = $_GET["id_funcao"];
  45 +$id = $_GET["id"];
  46 +
  47 +testaSafeNumerico([$id_sistema,$id_funcao,$id]);
  48 +
42 $funcoesEdicao = array( 49 $funcoesEdicao = array(
43 "ALTERARSISTEMAS", 50 "ALTERARSISTEMAS",
44 "ALTERARFUNCOES", 51 "ALTERARFUNCOES",
@@ -229,17 +236,17 @@ switch (strtoupper($funcao)) @@ -229,17 +236,17 @@ switch (strtoupper($funcao))
229 Altera o registro de um WS 236 Altera o registro de um WS
230 */ 237 */
231 function alterarSistemas(){ 238 function alterarSistemas(){
232 - global $esquemaadmin,$id_sistema,$perfil_sistema,$nome_sistema,$publicado_sistema; 239 + global $esquemaadmin,$id_sistema;
233 try { 240 try {
234 require_once("conexao.php"); 241 require_once("conexao.php");
235 if($convUTF){ 242 if($convUTF){
236 - $nome_sistema = utf8_encode($nome_sistema); 243 + $_GET["nome_sistema"] = utf8_encode($_GET["nome_sistema"]);
237 } 244 }
238 if($id_sistema != ""){ 245 if($id_sistema != ""){
239 $dataCol = array( 246 $dataCol = array(
240 - "publicado_sistema" => $publicado_sistema,  
241 - "nome_sistema" => $nome_sistema,  
242 - "perfil_sistema" => $perfil_sistema 247 + "publicado_sistema" => $_GET["publicado_sistema"],
  248 + "nome_sistema" => $_GET["nome_sistema"],
  249 + "perfil_sistema" => $_GET["perfil_sistema"]
243 ); 250 );
244 i3GeoAdminUpdate($dbhw,"i3geoadmin_sistemas",$dataCol,"WHERE id_sistema = $id_sistema"); 251 i3GeoAdminUpdate($dbhw,"i3geoadmin_sistemas",$dataCol,"WHERE id_sistema = $id_sistema");
245 $retorna = $id_sistema; 252 $retorna = $id_sistema;
@@ -261,25 +268,25 @@ function alterarSistemas(){ @@ -261,25 +268,25 @@ function alterarSistemas(){
261 } 268 }
262 } 269 }
263 function alterarFuncoes(){ 270 function alterarFuncoes(){
264 - global $esquemaadmin,$id_sistema,$id_funcao,$perfil_funcao,$nome_funcao,$w_funcao,$h_funcao,$abrir_funcao;  
265 - if(empty($w_funcao)){  
266 - $w_funcao = 200; 271 + global $esquemaadmin,$id_sistema,$id_funcao;
  272 + if(empty($_GET["w_funcao"])){
  273 + $_GET["w_funcao"] = 200;
267 } 274 }
268 - if(empty($h_funcao)){  
269 - $h_funcao = 200; 275 + if(empty($_GET["h_funcao"])){
  276 + $_GET["h_funcao"] = 200;
270 } 277 }
271 try{ 278 try{
272 require_once("conexao.php"); 279 require_once("conexao.php");
273 if($convUTF){ 280 if($convUTF){
274 - $nome_funcao = utf8_encode($nome_funcao); 281 + $_GET["nome_funcao"] = utf8_encode($_GET["nome_funcao"]);
275 } 282 }
276 if($id_funcao != ""){ 283 if($id_funcao != ""){
277 $dataCol = array( 284 $dataCol = array(
278 - "nome_funcao" => $nome_funcao,  
279 - "perfil_funcao" => $perfil_funcao,  
280 - "w_funcao" => $w_funcao,  
281 - "h_funcao" => $h_funcao,  
282 - "abrir_funcao" => $abrir_funcao 285 + "nome_funcao" => $_GET["nome_funcao"],
  286 + "perfil_funcao" => $_GET["perfil_funcao"],
  287 + "w_funcao" => $_GET["w_funcao"],
  288 + "h_funcao" => $_GET["h_funcao"],
  289 + "abrir_funcao" => $_GET["abrir_funcao"]
283 ); 290 );
284 i3GeoAdminUpdate($dbhw,"i3geoadmin_sistemasf",$dataCol,"WHERE id_funcao = $id_funcao"); 291 i3GeoAdminUpdate($dbhw,"i3geoadmin_sistemasf",$dataCol,"WHERE id_funcao = $id_funcao");
285 $retorna = $id_sistema; 292 $retorna = $id_sistema;
admin/php/subirshapefile.php 0 → 100755
@@ -0,0 +1,186 @@ @@ -0,0 +1,186 @@
  1 +<?php
  2 +include_once(dirname(__FILE__)."/login.php");
  3 +
  4 +if(in_array(strtoupper($funcao),$funcoesEdicao)){
  5 + if(verificaOperacaoSessao("admin/html/subirshapefile") == false){
  6 + retornaJSON("Vc nao pode realizar essa operacao.");exit;
  7 + }
  8 +}
  9 +if(isset($_GET["tipo"])){
  10 + $tipo = $_GET["tipo"];
  11 +}
  12 +//locaplic e usado para definir a pasta de destino
  13 +if(empty($locaplic)){
  14 + exit;
  15 +}
  16 +error_reporting(0);
  17 +?>
  18 +<html>
  19 +<head>
  20 +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
  21 +<link rel="stylesheet" type="text/css" href="../../css/input.css" />
  22 +<link rel="stylesheet" type="text/css" href="../../css/geral.css" />
  23 +<script src="../../classesjs/classe_util.js"></script>
  24 +<title></title>
  25 +</head>
  26 +<body bgcolor="white" style="background-color:white;text-align:left;">
  27 +<p>
  28 +<?php
  29 +if (isset($_FILES['i3GEOuploadshp']['name']))
  30 +{
  31 + $dirDestino = $_POST["dirDestino"];
  32 + if(empty($dirDestino)){
  33 + echo "Pasta nao encontrada"; exit;
  34 + }
  35 + $checaDestino = dirname($locaplic);
  36 + $dirDestino = str_replace($checaDestino,"",$dirDestino);
  37 + $dirDestino = $checaDestino."/".$dirDestino;
  38 +
  39 + if(isset($logExec) && $logExec["upload"] == true){
  40 + i3GeoLog("prog: upload filename:" . $_FILES['i3GEOuploadshp']['name'],$dir_tmp);
  41 + }
  42 +
  43 + echo "<p class='paragrafo' >Carregando o arquivo...</p>";
  44 + ob_flush();
  45 + flush();
  46 + sleep(1);
  47 + $dirmap = $dirDestino;
  48 + if(!file_exists($dirmap)){
  49 + echo "<p class='paragrafo' >Pasta n&atilde;o existe no servidor";
  50 + paraAguarde();
  51 + exit;
  52 + }
  53 + //verifica nomes
  54 + verificaNome($_FILES['i3GEOuploadshp']['name']);
  55 + verificaNome($_FILES['i3GEOuploadshx']['name']);
  56 + verificaNome($_FILES['i3GEOuploaddbf']['name']);
  57 +
  58 + if($_FILES['i3GEOuploadprj']['name'] != ""){
  59 + verificaNome($_FILES['i3GEOuploadprj']['name']);
  60 + }
  61 +
  62 + //remove acentos
  63 + $nomePrefixo = str_replace(" ","_",removeAcentos(str_replace(".shp","",$_FILES['i3GEOuploadshp']['name'])));
  64 +
  65 + $nomePrefixo = str_replace(".","",$nomePrefixo);
  66 + $nomePrefixo = strip_tags($nomePrefixo);
  67 + $nomePrefixo = htmlspecialchars($nomePrefixo, ENT_QUOTES);
  68 +
  69 + //sobe arquivo
  70 + $Arquivo = $_FILES['i3GEOuploadshp']['tmp_name'];
  71 + if(file_exists($dirmap."/".$nomePrefixo.".shp")){
  72 + echo "<p class='paragrafo' >J&aacute; existe um SHP com o nome ";
  73 + paraAguarde();
  74 + exit;
  75 + }
  76 + $status = move_uploaded_file($Arquivo,$dirmap."/".$nomePrefixo.".shp");
  77 + if($status != 1)
  78 + {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo SHP. Pode ser uma limita&ccedil;&atilde;o quanto ao tamanho do arquivo ou permiss&atilde;o de escrita na pasta indicada.";paraAguarde();exit;}
  79 +
  80 + $Arquivo = $_FILES['i3GEOuploadshx']['tmp_name'];
  81 + $status = move_uploaded_file($Arquivo,$dirmap."/".$nomePrefixo.".shx");
  82 + if($status != 1)
  83 + {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo SHX";paraAguarde();exit;}
  84 +
  85 + $Arquivo = $_FILES['i3GEOuploaddbf']['tmp_name'];
  86 + $status = move_uploaded_file($Arquivo,$dirmap."/".$nomePrefixo.".dbf");
  87 + if($status != 1)
  88 + {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo DBF";paraAguarde();exit;}
  89 +
  90 + if($_FILES['i3GEOuploadprj']['name'] != ""){
  91 + $Arquivo = $_FILES['i3GEOuploadprj']['tmp_name'];
  92 + $status = move_uploaded_file($Arquivo,$dirmap."/".$nomePrefixo.".prj");
  93 + if($status != 1){
  94 + echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo PRJ";paraAguarde();exit;
  95 + }
  96 + }
  97 +
  98 + if(!file_exists($dirmap."/".$nomePrefixo.".shp"))
  99 + {echo "<p class='paragrafo' >Ocorreu algum problema no envio do arquivo ";paraAguarde();exit;}
  100 +
  101 +
  102 + $checkphp = fileContemString($dirmap."/".$nomePrefixo.".prj","<?");
  103 + if($checkphp == true){
  104 + echo "Arquivo prj invalido";
  105 + unlink($dirmap."/".$nomePrefixo.".shp");
  106 + unlink($dirmap."/".$nomePrefixo.".dbf");
  107 + unlink($dirmap."/".$nomePrefixo.".shx");
  108 + unlink($dirmap."/".$nomePrefixo.".prj");
  109 + exit;
  110 + }
  111 + $checkphp = fileContemString($dirmap."/".$nomePrefixo.".shx","<?");
  112 + if($checkphp == true){
  113 + echo "Arquivo shx invalido";
  114 + unlink($dirmap."/".$nomePrefixo.".shp");
  115 + unlink($dirmap."/".$nomePrefixo.".dbf");
  116 + unlink($dirmap."/".$nomePrefixo.".shx");
  117 + unlink($dirmap."/".$nomePrefixo.".prj");
  118 + exit;
  119 + }
  120 + $checkphp = fileContemString($dirmap."/".$nomePrefixo.".dbf","<?");
  121 + if($checkphp == true){
  122 + echo "Arquivo dbf invalido";
  123 + unlink($dirmap."/".$nomePrefixo.".shp");
  124 + unlink($dirmap."/".$nomePrefixo.".dbf");
  125 + unlink($dirmap."/".$nomePrefixo.".shx");
  126 + unlink($dirmap."/".$nomePrefixo.".prj");
  127 + exit;
  128 + }
  129 + echo "<p class='paragrafo' >Arquivo enviado.</p>";
  130 + echo "<p class='paragrafo'></p>";
  131 + if($i3GEOuploadCriaMapfile == "on"){
  132 + //verifica se o usuario marcou a opcao de cria mapfile
  133 + //nesse caso o aplicativo de upload esta sendo executado de dentro do sistema de administracao, e o mapfile devera
  134 + //ser criado e registrado no sistema
  135 + $nome = $nomePrefixo;
  136 + $codigo = $nomePrefixo;
  137 + $it = $nomePrefixo;
  138 + $en = $nomePrefixo;
  139 + $es = $nomePrefixo;
  140 + $sfileObj = ms_newShapefileObj($dirmap."/".$nomePrefixo.".shp", -1);
  141 + if(!isset($tipo) || $tipo == ""){
  142 + $tipo = $sfileObj->type;
  143 + }
  144 + if ($tipo == 1){
  145 + $tipoLayer = "point";
  146 + }
  147 + if ($tipo == 3){
  148 + $tipoLayer = "line";
  149 + }
  150 + if ($tipo == 5){
  151 + $tipoLayer = "polygon";
  152 + }
  153 + $funcao = "CRIARNOVOMAP";
  154 + $output = "retorno";
  155 + $data = $dirmap."/".$nomePrefixo.".shp";
  156 + include_once($locaplic."/admin/php/editormapfile.php");
  157 + echo "<b><p class='paragrafo' >Criado!!!<br>";
  158 + echo "Para editar clique: <a href='../../admin/html/editormapfile.html' target=_blank >editar</a>";
  159 + echo "<script>window.scrollTo(0,10000);i3GEO.util.insereCookie('I3GEOletraAdmin','".$nomePrefixo."');</script>";
  160 + }
  161 +}
  162 +else
  163 +{
  164 + echo "<p class='paragrafo' >Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</p>";
  165 +}
  166 +paraAguarde();
  167 +function paraAguarde(){
  168 + echo "<script>try{window.scrollTo(0,10000);window.parent.i3GEOF.upload.aguarde.visibility='hidden';}catch(e){};</script>";
  169 +}
  170 +function verificaNome($nome){
  171 + if(strlen(basename($nome)) > 200){
  172 + exit;
  173 + }
  174 + $nome = strtolower($nome);
  175 + $lista = explode(".",$nome);
  176 + $extensao = $lista[count($lista) - 1];
  177 + if(($extensao != "dbf") && ($extensao != "shx") && ($extensao != "shp") && ($extensao != "prj"))
  178 + {
  179 + echo "Nome de arquivo inv&aacute;lido. $nome";
  180 + paraAguarde();
  181 + exit;
  182 + }
  183 +}
  184 +?>
  185 +</body>
  186 +</html>
admin/php/subirsimbolo.php 0 → 100755
@@ -0,0 +1,104 @@ @@ -0,0 +1,104 @@
  1 +<?php
  2 +include_once(dirname(__FILE__)."/login.php");
  3 +
  4 +if(in_array(strtoupper($funcao),$funcoesEdicao)){
  5 + if(verificaOperacaoSessao("admin/html/editortexto") == false){
  6 + retornaJSON("Vc nao pode realizar essa operacao.");exit;
  7 + }
  8 +}
  9 +//locaplic e usado para definir a pasta de destino
  10 +if(empty($locaplic)){
  11 + exit;
  12 +}
  13 +?>
  14 +<html>
  15 +<head>
  16 +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
  17 +<link rel="stylesheet" type="text/css" href="../../css/input.css" />
  18 +<link rel="stylesheet" type="text/css" href="../../css/geral.css" />
  19 +<title></title>
  20 +</head>
  21 +<body bgcolor="white" style="background-color:white;text-align:left;">
  22 +<p>
  23 +<?php
  24 +if (isset($_FILES['i3GEOuploadsimboloarq']['name']) && strlen(basename($_FILES['i3GEOuploadsimboloarq']['name'])) < 200){
  25 + $dirDestino = $_GET["dirDestino"];
  26 + $dirDestino = str_replace(".","",$dirDestino);
  27 + $dirDestino = $locaplic."/".$dirDestino;
  28 +
  29 + $checkphp = fileContemString($_FILES['i3GEOuploadsimboloarq']['tmp_name'],"<?php");
  30 + if($checkphp == true){
  31 + echo "Arquivo invalido";
  32 + exit;
  33 + }
  34 +
  35 + if(isset($logExec) && $logExec["upload"] == true){
  36 + i3GeoLog("prog: uploadsimbolo filename:" . $_FILES['i3GEOuploadsimboloarq']['name'],$dir_tmp);
  37 + }
  38 +
  39 + echo "<p class='paragrafo' >Carregando o arquivo...</p>";
  40 + ob_flush();
  41 + flush();
  42 + sleep(1);
  43 +
  44 + if(!file_exists($dirDestino)){
  45 + if(!file_exists($dirDestino)){
  46 + echo "<p class='paragrafo' >Pasta n&atilde;o existe no servidor";
  47 + paraAguarde();
  48 + exit;
  49 + }
  50 + }
  51 + //verifica nomes
  52 + $nome = $_FILES['i3GEOuploadsimboloarq']['name'];
  53 +
  54 + $nome = str_replace(".png","",$nome);
  55 + $nome = str_replace(".","",$nome).".png";
  56 +
  57 + $nome = strip_tags($nome);
  58 + $nome = htmlspecialchars($nome, ENT_QUOTES);
  59 +
  60 + //$nome = $nome . md5(uniqid(rand(), true));
  61 +
  62 + verificaNome($nome);
  63 + //sobe arquivo
  64 + $Arquivo = $_FILES['i3GEOuploadsimboloarq']['tmp_name'];
  65 + $destino = $dirDestino."/".$nome;
  66 +
  67 + $check = getimagesize($Arquivo);
  68 + if($check === false) {
  69 + exit;
  70 + }
  71 +
  72 + if(file_exists($destino))
  73 + {echo "<p class='paragrafo' >J&aacute; existe um arquivo com o nome ";paraAguarde();exit;}
  74 + $status = move_uploaded_file($Arquivo,$destino);
  75 + if($status != 1)
  76 + {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo. Pode ser uma limita&ccedil;&atilde;o quanto ao tamanho do arquivo.";paraAguarde();exit;}
  77 + if(!file_exists($destino))
  78 + {echo "<p class='paragrafo' >Ocorreu algum problema no envio do arquivo ";paraAguarde();exit;}
  79 +
  80 + echo "<p class='paragrafo' >Arquivo enviado.</p>";
  81 +}
  82 +else
  83 +{
  84 + echo "<p class='paragrafo' >Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</p>";
  85 +}
  86 +paraAguarde();
  87 +function paraAguarde(){
  88 + echo "<script>try{window.scrollTo(0,10000);window.parent.i3GEOF.upload.aguarde.visibility='hidden';}catch(e){};</script>";
  89 +}
  90 +function verificaNome($nome)
  91 +{
  92 + $nome = strtolower($nome);
  93 + $lista = explode(".",$nome);
  94 + $extensao = $lista[count($lista) - 1];
  95 + if(($extensao != "png") && ($extensao != "jpg"))
  96 + {
  97 + echo "Nome de arquivo inv&aacute;lido.";
  98 + paraAguarde();
  99 + exit;
  100 + }
  101 +}
  102 +?>
  103 +</body>
  104 +</html>
0 \ No newline at end of file 105 \ No newline at end of file
admin/php/upgradebanco46_47.php
@@ -57,8 +57,6 @@ if(!empty($esquemaadmin)){ @@ -57,8 +57,6 @@ if(!empty($esquemaadmin)){
57 } 57 }
58 if(empty($_POST["senha"]) || empty($_POST["usuario"])){ 58 if(empty($_POST["senha"]) || empty($_POST["usuario"])){
59 formularioLoginMaster("upgradebanco46_47.php"); 59 formularioLoginMaster("upgradebanco46_47.php");
60 - echo "<br><input type=checkbox name=mostraSoSQL /> Mostra apenas o SQL";  
61 - exit;  
62 } 60 }
63 else{ 61 else{
64 $continua = verificaMaster($_POST["usuario"],$_POST["senha"],$i3geomaster); 62 $continua = verificaMaster($_POST["usuario"],$_POST["senha"],$i3geomaster);
@@ -101,15 +99,6 @@ foreach($tabelas as $tabela){ @@ -101,15 +99,6 @@ foreach($tabelas as $tabela){
101 if($drivename == "pgsql"){ 99 if($drivename == "pgsql"){
102 $tabela = str_replace("INTEGER PRIMARY KEY","SERIAL PRIMARY KEY NOT NULL",$tabela); 100 $tabela = str_replace("INTEGER PRIMARY KEY","SERIAL PRIMARY KEY NOT NULL",$tabela);
103 } 101 }
104 - if($_POST["mostraSoSQL"] != "on"){  
105 - $q = $dbhw->query($tabela);  
106 - if($q){  
107 - echo "<br>Feito!!!<br>";  
108 - }  
109 - else{  
110 - echo "<br><br>Ocorreu algum problema na cria&ccedil;&atilde;o da tabela (ou j&aacute; existe)<br> $tabela \n";  
111 - }  
112 - }  
113 } 102 }
114 echo "<br><br>Tabelas:<br><br>"; 103 echo "<br><br>Tabelas:<br><br>";
115 foreach($tabelas as $tabela){ 104 foreach($tabelas as $tabela){
@@ -122,88 +111,88 @@ foreach($tabelas as $tabela){ @@ -122,88 +111,88 @@ foreach($tabelas as $tabela){
122 echo "<br><br>Inserindo os registros default<br><br>"; 111 echo "<br><br>Inserindo os registros default<br><br>";
123 $teste = lista("select * from ".$esquemaadmin."i3geousr_papeis","id_papel"); 112 $teste = lista("select * from ".$esquemaadmin."i3geousr_papeis","id_papel");
124 $sql = array(); 113 $sql = array();
125 -if(!in_array(1,$teste) || $_POST["mostraSoSQL"] == "on") 114 +if(!in_array(1,$teste))
126 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem executar qualquer tarefa, inclusive cadastrar novos administradores',1,'admin')"; 115 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem executar qualquer tarefa, inclusive cadastrar novos administradores',1,'admin')";
127 -if(!in_array(2,$teste) || $_POST["mostraSoSQL"] == "on") 116 +if(!in_array(2,$teste))
128 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem criar/editar qualquer tema (mapfile) mas nao podem editar a arvore do catalogo de temas',2,'editores')"; 117 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem criar/editar qualquer tema (mapfile) mas nao podem editar a arvore do catalogo de temas',2,'editores')";
129 -if(!in_array(3,$teste) || $_POST["mostraSoSQL"] == "on") 118 +if(!in_array(3,$teste))
130 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem alterar a arvore do catalogo e dos atlas',3,'publicadores')"; 119 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem alterar a arvore do catalogo e dos atlas',3,'publicadores')";
131 -if(!in_array(4,$teste) || $_POST["mostraSoSQL"] == "on") 120 +if(!in_array(4,$teste))
132 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem editar dados geograficos',4,'editoresgeo')"; 121 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES('Podem editar dados geograficos',4,'editoresgeo')";
133 -if(!in_array(5,$teste) || $_POST["mostraSoSQL"] == "on") 122 +if(!in_array(5,$teste))
134 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES ('Podem administrar o sistema METAESTAT','5', 'adminmetaestat')"; 123 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papeis VALUES ('Podem administrar o sistema METAESTAT','5', 'adminmetaestat')";
135 $teste = lista("select * from ".$esquemaadmin."i3geousr_usuarios","id_usuario"); 124 $teste = lista("select * from ".$esquemaadmin."i3geousr_usuarios","id_usuario");
136 -if(!in_array(1,$teste) || $_POST["mostraSoSQL"] == "on") 125 +if(!in_array(1,$teste))
137 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_usuarios VALUES(1,'','',0,'admingeral','admingeral','admingeral')"; 126 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_usuarios VALUES(1,'','',0,'admingeral','admingeral','admingeral')";
138 127
139 $teste = lista("select * from ".$esquemaadmin."i3geousr_papelusuario","id_usuario","id_papel"); 128 $teste = lista("select * from ".$esquemaadmin."i3geousr_papelusuario","id_usuario","id_papel");
140 -if(!in_array("1-1",$teste) || $_POST["mostraSoSQL"] == "on") 129 +if(!in_array("1-1",$teste))
141 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papelusuario VALUES(1,1)"; 130 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_papelusuario VALUES(1,1)";
142 131
143 $teste = lista("select * from ".$esquemaadmin."i3geousr_operacoes","id_operacao"); 132 $teste = lista("select * from ".$esquemaadmin."i3geousr_operacoes","id_operacao");
144 -if(!in_array(1,$teste) || $_POST["mostraSoSQL"] == "on") 133 +if(!in_array(1,$teste))
145 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(1,'admin/html/editormapfile','editor de mapfiles do sistema de administracao')"; 134 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(1,'admin/html/editormapfile','editor de mapfiles do sistema de administracao')";
146 -if(!in_array(2,$teste) || $_POST["mostraSoSQL"] == "on") 135 +if(!in_array(2,$teste))
147 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(2,'admin/html/operacoes','abre o editor de operacoes')"; 136 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(2,'admin/html/operacoes','abre o editor de operacoes')";
148 if(!in_array(3,$teste)) 137 if(!in_array(3,$teste))
149 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(3,'teste/','teste')"; 138 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(3,'teste/','teste')";
150 -if(!in_array(4,$teste) || $_POST["mostraSoSQL"] == "on") 139 +if(!in_array(4,$teste))
151 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(4,'admin/html/arvore','edicao da arvore do catalogo de temas')"; 140 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(4,'admin/html/arvore','edicao da arvore do catalogo de temas')";
152 -if(!in_array(5,$teste) || $_POST["mostraSoSQL"] == "on") 141 +if(!in_array(5,$teste))
153 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(5,'admin/html/menus','edicao da lista de menus')"; 142 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(5,'admin/html/menus','edicao da lista de menus')";
154 -if(!in_array(6,$teste) || $_POST["mostraSoSQL"] == "on") 143 +if(!in_array(6,$teste))
155 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(6,'admin/html/ogcws','edicao das preferencias do servico WMS')"; 144 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(6,'admin/html/ogcws','edicao das preferencias do servico WMS')";
156 -if(!in_array(7,$teste) || $_POST["mostraSoSQL"] == "on") 145 +if(!in_array(7,$teste))
157 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(7,'admin/html/atlas','edicao de atlas')"; 146 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(7,'admin/html/atlas','edicao de atlas')";
158 -if(!in_array(8,$teste) || $_POST["mostraSoSQL"] == "on") 147 +if(!in_array(8,$teste))
159 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(8,'admin/html/identifica','lista de sistemas incluidos na ferramenta de identificacao')"; 148 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(8,'admin/html/identifica','lista de sistemas incluidos na ferramenta de identificacao')";
160 -if(!in_array(9,$teste) || $_POST["mostraSoSQL"] == "on") 149 +if(!in_array(9,$teste))
161 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(9,'admin/html/incluimap','adapta mapfiles antigos para versoes novas do Mapserver')"; 150 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(9,'admin/html/incluimap','adapta mapfiles antigos para versoes novas do Mapserver')";
162 -if(!in_array(10,$teste) || $_POST["mostraSoSQL"] == "on") 151 +if(!in_array(10,$teste))
163 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(10,'admin/html/mapas','lista de links para mapas')"; 152 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(10,'admin/html/mapas','lista de links para mapas')";
164 -if(!in_array(11,$teste) || $_POST["mostraSoSQL"] == "on") 153 +if(!in_array(11,$teste))
165 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(11,'admin/html/perfis','lista controlada de perfis')"; 154 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(11,'admin/html/perfis','lista controlada de perfis')";
166 -if(!in_array(12,$teste) || $_POST["mostraSoSQL"] == "on") 155 +if(!in_array(12,$teste))
167 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(12,'admin/html/sistemas','lista de sistemas complementares que sao mostrados no catalogo')"; 156 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(12,'admin/html/sistemas','lista de sistemas complementares que sao mostrados no catalogo')";
168 -if(!in_array(13,$teste) || $_POST["mostraSoSQL"] == "on") 157 +if(!in_array(13,$teste))
169 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(13,'admin/html/subirshapefile','upload de shapefile para uma pasta especifica no servidor')"; 158 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(13,'admin/html/subirshapefile','upload de shapefile para uma pasta especifica no servidor')";
170 if(!in_array(14,$teste)) 159 if(!in_array(14,$teste))
171 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(14,'admin/html/tags','edicao da lista controlada de tags')"; 160 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(14,'admin/html/tags','edicao da lista controlada de tags')";
172 -if(!in_array(15,$teste) || $_POST["mostraSoSQL"] == "on") 161 +if(!in_array(15,$teste))
173 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(15,'admin/html/webservices','cadastro de links para webservices')"; 162 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(15,'admin/html/webservices','cadastro de links para webservices')";
174 if(!in_array(16,$teste)) 163 if(!in_array(16,$teste))
175 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(16,'admin/php/editortexto','editor de texto para mapfiles')"; 164 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES(16,'admin/php/editortexto','editor de texto para mapfiles')";
176 -if(!in_array(17,$teste) || $_POST["mostraSoSQL"] == "on") 165 +if(!in_array(17,$teste))
177 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('17', 'admin/html/usuarios', 'cadastro de usuarios')"; 166 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('17', 'admin/html/usuarios', 'cadastro de usuarios')";
178 -if(!in_array(18,$teste) || $_POST["mostraSoSQL"] == "on") 167 +if(!in_array(18,$teste))
179 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('18', 'admin/metaestat/geral', 'permite edicoes mais comuns do sistema de metadados estatisticos')"; 168 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('18', 'admin/metaestat/geral', 'permite edicoes mais comuns do sistema de metadados estatisticos')";
180 -if(!in_array(19,$teste) || $_POST["mostraSoSQL"] == "on") 169 +if(!in_array(19,$teste))
181 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('19', 'admin/metaestat/editorbanco', 'permite gerenciar as tabelas do banco')"; 170 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoes VALUES('19', 'admin/metaestat/editorbanco', 'permite gerenciar as tabelas do banco')";
182 171
183 $teste = lista("select * from ".$esquemaadmin."i3geousr_operacoespapeis","id_operacao","id_papel"); 172 $teste = lista("select * from ".$esquemaadmin."i3geousr_operacoespapeis","id_operacao","id_papel");
184 -if(!in_array('1-2',$teste) || $_POST["mostraSoSQL"] == "on") 173 +if(!in_array('1-2',$teste))
185 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(1,2)"; 174 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(1,2)";
186 -if(!in_array('1-3',$teste) || $_POST["mostraSoSQL"] == "on") 175 +if(!in_array('1-3',$teste))
187 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(1,3)"; 176 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(1,3)";
188 -if(!in_array('4-3',$teste) || $_POST["mostraSoSQL"] == "on") 177 +if(!in_array('4-3',$teste))
189 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(4,3)"; 178 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(4,3)";
190 -if(!in_array('5-3',$teste) || $_POST["mostraSoSQL"] == "on") 179 +if(!in_array('5-3',$teste))
191 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(5,3)"; 180 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(5,3)";
192 -if(!in_array('7-3',$teste) || $_POST["mostraSoSQL"] == "on") 181 +if(!in_array('7-3',$teste))
193 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(7,3)"; 182 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(7,3)";
194 -if(!in_array('10-3',$teste) || $_POST["mostraSoSQL"] == "on") 183 +if(!in_array('10-3',$teste))
195 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(10,3)"; 184 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(10,3)";
196 -if(!in_array('13-2',$teste) || $_POST["mostraSoSQL"] == "on") 185 +if(!in_array('13-2',$teste))
197 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(13,2)"; 186 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(13,2)";
198 -if(!in_array('13-4',$teste) || $_POST["mostraSoSQL"] == "on") 187 +if(!in_array('13-4',$teste))
199 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(13,4)"; 188 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(13,4)";
200 -if(!in_array('15-3',$teste) || $_POST["mostraSoSQL"] == "on") 189 +if(!in_array('15-3',$teste))
201 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(15,3)"; 190 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(15,3)";
202 -if(!in_array('16-2',$teste) || $_POST["mostraSoSQL"] == "on") 191 +if(!in_array('16-2',$teste))
203 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(16,2)"; 192 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(16,2)";
204 -if(!in_array('18-1',$teste) || $_POST["mostraSoSQL"] == "on") 193 +if(!in_array('18-1',$teste))
205 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(18,1)"; 194 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES(18,1)";
206 -if(!in_array('18-5',$teste) || $_POST["mostraSoSQL"] == "on") 195 +if(!in_array('18-5',$teste))
207 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES (18,5)"; 196 $sql[] = "INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis VALUES (18,5)";
208 197
209 $sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('1', 'Anual', '')"; 198 $sql[] = "INSERT INTO ".$esquemaadmin."i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUES ('1', 'Anual', '')";
@@ -213,9 +202,6 @@ $sql[] = &quot;INSERT INTO &quot;.$esquemaadmin.&quot;i3geoestat_tipo_periodo (codigo_tipo_peri @@ -213,9 +202,6 @@ $sql[] = &quot;INSERT INTO &quot;.$esquemaadmin.&quot;i3geoestat_tipo_periodo (codigo_tipo_peri
213 202
214 echo "<br>Inserts:<br><br>"; 203 echo "<br>Inserts:<br><br>";
215 foreach($sql as $s){ 204 foreach($sql as $s){
216 - if($_POST["mostraSoSQL"] != "on"){  
217 - $dbhw->query($s);  
218 - }  
219 echo $s.";<br>"; 205 echo $s.";<br>";
220 } 206 }
221 207
admin/php/uploadgvp.php
1 <?php 1 <?php
  2 +exit;
2 include_once("admin.php"); 3 include_once("admin.php");
3 include_once("login.php"); 4 include_once("login.php");
4 if(verificaOperacaoSessao("admin/metaestat/geral") == false){ 5 if(verificaOperacaoSessao("admin/metaestat/geral") == false){
admin/php/usuarios.php
@@ -72,6 +72,13 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){ @@ -72,6 +72,13 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){
72 retornaJSON("Vc nao pode realizar essa operacao.");exit; 72 retornaJSON("Vc nao pode realizar essa operacao.");exit;
73 } 73 }
74 } 74 }
  75 +
  76 +$id = $_GET["id"];
  77 +$id_usuario = $_GET["id_usuario"];
  78 +$id_papel = $_GET["id_papel"];
  79 +
  80 +testaSafeNumerico([$id,$id_usuario,$id_papel]);
  81 +
75 switch (strtoupper($funcao)) 82 switch (strtoupper($funcao))
76 { 83 {
77 case "ALTERARUSUARIOS": 84 case "ALTERARUSUARIOS":
@@ -151,29 +158,29 @@ function enviarSenhaEmail(){ @@ -151,29 +158,29 @@ function enviarSenhaEmail(){
151 } 158 }
152 function alterarUsuarios() 159 function alterarUsuarios()
153 { 160 {
154 - global $id_usuario,$ativo,$data_cadastro,$email,$login,$nome_usuario,$senha; 161 + global $id_usuario;
155 try 162 try
156 { 163 {
157 include(dirname(__FILE__)."/conexao.php"); 164 include(dirname(__FILE__)."/conexao.php");
158 if($convUTF){ 165 if($convUTF){
159 - $nome_usuario = utf8_encode($nome_usuario); 166 + $_GET["nome_usuario"] = utf8_encode($_GET["nome_usuario"]);
160 } 167 }
161 if($id_usuario != ""){ 168 if($id_usuario != ""){
162 //verifica uniciade de login 169 //verifica uniciade de login
163 - $dados = pegaDados("select login from ".$esquemaadmin."i3geousr_usuarios where login = '$login'"); 170 + $dados = pegaDados("select login from ".$esquemaadmin."i3geousr_usuarios where login = '".$_GET["login"]."'");
164 if(count($dados) > 0){ 171 if(count($dados) > 0){
165 $retorna = false; 172 $retorna = false;
166 } 173 }
167 $dataCol = array( 174 $dataCol = array(
168 - "nome_usuario" => $nome_usuario,  
169 - "login" => $login,  
170 - "email" => $email,  
171 - "ativo" => $ativo,  
172 - "data_cadastro" => $data_cadastro 175 + "nome_usuario" => $_GET["nome_usuario"],
  176 + "login" => $_GET["login"],
  177 + "email" => $_GET["email"],
  178 + "ativo" => $_GET["ativo"],
  179 + "data_cadastro" => $_GET["data_cadastro"]
173 ); 180 );
174 //se a senha foi enviada, ela sera trocada 181 //se a senha foi enviada, ela sera trocada
175 - if($senha != ""){  
176 - $dataCol["senha"] = md5($senha); 182 + if($_GET["senha"] != ""){
  183 + $dataCol["senha"] = md5($_GET["senha"]);
177 } 184 }
178 i3GeoAdminUpdate($dbhw,"i3geousr_usuarios",$dataCol,"WHERE id_usuario = $id_usuario"); 185 i3GeoAdminUpdate($dbhw,"i3geousr_usuarios",$dataCol,"WHERE id_usuario = $id_usuario");
179 $retorna = $id_usuario; 186 $retorna = $id_usuario;
admin/php/webservices.php
@@ -43,8 +43,13 @@ error_reporting(0); @@ -43,8 +43,13 @@ error_reporting(0);
43 // 43 //
44 //n&atilde;o sei pq mas ob_start e clean s&atilde;o necess&aacute;rios no Linux para n&atilde;o gerar erro indesejado 44 //n&atilde;o sei pq mas ob_start e clean s&atilde;o necess&aacute;rios no Linux para n&atilde;o gerar erro indesejado
45 // 45 //
46 -ob_start();  
47 include_once(dirname(__FILE__)."/login.php"); 46 include_once(dirname(__FILE__)."/login.php");
  47 +
  48 +$id_ws = $_GET["id_ws"];
  49 +$id = $_GET["id"];
  50 +
  51 +testaSafeNumerico([$id,$id_ws]);
  52 +
48 $funcoesEdicao = array( 53 $funcoesEdicao = array(
49 "ALTERARWS", 54 "ALTERARWS",
50 "EXCLUIR" 55 "EXCLUIR"
@@ -54,7 +59,6 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){ @@ -54,7 +59,6 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){
54 retornaJSON("Vc nao pode realizar essa operacao.");exit; 59 retornaJSON("Vc nao pode realizar essa operacao.");exit;
55 } 60 }
56 } 61 }
57 -ob_clean();  
58 //faz a busca da fun&ccedil;&atilde;o que deve ser executada 62 //faz a busca da fun&ccedil;&atilde;o que deve ser executada
59 switch (strtoupper($funcao)) 63 switch (strtoupper($funcao))
60 { 64 {
@@ -73,12 +77,11 @@ switch (strtoupper($funcao)) @@ -73,12 +77,11 @@ switch (strtoupper($funcao))
73 {JSON} 77 {JSON}
74 */ 78 */
75 case "PEGAWS": 79 case "PEGAWS":
76 - if(isset($tipows) && $tipows != "")  
77 - {  
78 - $sql = "SELECT id_ws,nome_ws,tipo_ws from ".$esquemaadmin."i3geoadmin_ws where tipo_ws = '".strtoupper($tipows)."' order by tipo_ws,nome_ws "; 80 + if(isset($tipows) && $tipows != "") {
  81 + $sql = "SELECT id_ws,nome_ws,tipo_ws from ".$esquemaadmin."i3geoadmin_ws where tipo_ws = '".strtoupper($_GET["tipows"])."' order by tipo_ws,nome_ws ";
79 } 82 }
80 - else  
81 - {$sql = "SELECT id_ws,nome_ws,tipo_ws from ".$esquemaadmin."i3geoadmin_ws order by tipo_ws,nome_ws"; 83 + else{
  84 + $sql = "SELECT id_ws,nome_ws,tipo_ws from ".$esquemaadmin."i3geoadmin_ws order by tipo_ws,nome_ws";
82 } 85 }
83 retornaJSON(pegaDados($sql)); 86 retornaJSON(pegaDados($sql));
84 exit; 87 exit;
@@ -152,7 +155,12 @@ switch (strtoupper($funcao)) @@ -152,7 +155,12 @@ switch (strtoupper($funcao))
152 Altera o registro de um WS 155 Altera o registro de um WS
153 */ 156 */
154 function alterarWS(){ 157 function alterarWS(){
155 - global $esquemaadmin,$id_ws,$desc_ws,$nome_ws,$link_ws,$autor_ws,$tipo_ws; 158 + global $esquemaadmin,$id_ws;
  159 + $desc_ws = $_GET["desc_ws"];
  160 + $nome_ws = $_GET["nome_ws"];
  161 + $link_ws = $_GET["link_ws"];
  162 + $autor_ws = $_GET["autor_ws"];
  163 + $tipo_ws = $_GET["tipo_ws"];
156 try{ 164 try{
157 require_once("conexao.php"); 165 require_once("conexao.php");
158 if($convUTF){ 166 if($convUTF){
admin/safe.php 0 → 100755
@@ -0,0 +1,69 @@ @@ -0,0 +1,69 @@
  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 + $editores = $_SESSION['editores'];
  25 +}
  26 +else{
  27 + $g_sid = "";
  28 +}
  29 +//variaveis mais comuns
  30 +$funcao = $_GET["funcao"];
  31 +$perfil = $_GET["perfil"];
  32 +$tipo = $_GET["tipo"];
  33 +$tipoRetorno = $_GET["tipoRetorno"];
  34 +$idioma = $_GET["idioma"];
  35 +$movimento = $_GET["movimento"];
  36 +$tabela = $_GET["tabela"];
  37 +$publicado = $_GET["publicado"];
  38 +
  39 +$nivel = $_GET["nivel"];
  40 +$id_menu = $_GET["id_menu"];
  41 +$id_grupo = $_GET["id_grupo"];
  42 +$id_subgrupo = $_GET["id_subgrupo"];
  43 +
  44 +$id_n1 = $_GET["id_n1"];
  45 +$id_n2 = $_GET["id_n2"];
  46 +$id_n3 = $_GET["id_n3"];
  47 +$id_raiz = $_GET["id_raiz"];
  48 +$id_tema = $_GET["id_tema"];
  49 +$ordem = $_GET["ordem"];
  50 +
  51 +testaSafeNumerico([$id_subgrupo,$id_grupo,$ordem,$nivel,$id_menu,$id_n1,$id_n2,$id_n3,$id_raiz,$id_tema]);
  52 +
  53 +if(isset($fingerprint) && !empty($g_sid)) {
  54 + $f = explode(",",$fingerprint);
  55 + if($f[0] != md5('I3GEOSEC' . $_SERVER['HTTP_USER_AGENT'] . session_id())){
  56 + cpjson(". Tentativa de acesso nao permitida. Inicie um novo mapa.");
  57 + return;
  58 + }
  59 +}
  60 +function testaSafeNumerico($valores){
  61 + foreach ($valores as $valor) {
  62 + if(!empty($valor) && !is_numeric($valor)) {
  63 + ob_clean();
  64 + header ( "HTTP/1.1 403 valor nao numerico" );
  65 + exit;
  66 + }
  67 + }
  68 +}
  69 +?>
0 \ No newline at end of file 70 \ No newline at end of file
classesphp/classe_menutemas.php
@@ -156,12 +156,12 @@ array @@ -156,12 +156,12 @@ array
156 else 156 else
157 {$tipo = "gruposeraiz";} 157 {$tipo = "gruposeraiz";}
158 $tempm = $this->pegaListaDeMenus($filtraOgc,$filtraDown); 158 $tempm = $this->pegaListaDeMenus($filtraOgc,$filtraDown);
  159 + include_once(dirname(__FILE__)."/../admin/php/classe_arvore.php");
  160 + $arvore = new Arvore($this->locaplic,$this->idioma,$this->filtro);
159 foreach($tempm as $menu) 161 foreach($tempm as $menu)
160 { 162 {
161 if($menu["idmenu"] == $idmenu || $idmenu == "") 163 if($menu["idmenu"] == $idmenu || $idmenu == "")
162 { 164 {
163 - include_once(dirname(__FILE__)."/../admin/php/classe_arvore.php");  
164 - $arvore = new Arvore($this->locaplic,$this->idioma,$this->filtro);  
165 $grupos = $arvore->formataGruposMenu($idmenu,$this->perfil,$listasgrupos,$ordenaNome,$filtraOgc,$filtraDown); 165 $grupos = $arvore->formataGruposMenu($idmenu,$this->perfil,$listasgrupos,$ordenaNome,$filtraOgc,$filtraDown);
166 unset($arvore); 166 unset($arvore);
167 } 167 }
classesphp/funcoes_gerais.php
@@ -1508,7 +1508,6 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE,$prj=&quot;&quot;,$proj @@ -1508,7 +1508,6 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE,$prj=&quot;&quot;,$proj
1508 else{ 1508 else{
1509 $novonomelayer = $tema; 1509 $novonomelayer = $tema;
1510 } 1510 }
1511 -  
1512 $novonomelayer = str_replace(".","-",$novonomelayer); 1511 $novonomelayer = str_replace(".","-",$novonomelayer);
1513 $nomeshp = $dir_tmp."/".$novonomelayer; 1512 $nomeshp = $dir_tmp."/".$novonomelayer;
1514 1513
@@ -1807,12 +1806,12 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa) @@ -1807,12 +1806,12 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa)
1807 //salva o mapfile com um outro nome para evitar que o mapa atual, se estiver aberto, seja modificado 1806 //salva o mapfile com um outro nome para evitar que o mapa atual, se estiver aberto, seja modificado
1808 // 1807 //
1809 //verifica se tem query e copia o arquivo 1808 //verifica se tem query e copia o arquivo
1810 - $qyfile = str_replace(".map",".qy",$map_file);  
1811 - $nr = nomerandomico(10); 1809 + $qyfile = str_replace(".map","_qy.map",$map_file);
  1810 + $nr = nomerandomico(5);
1812 $map_file = str_replace(".map",$nr."tmp.map",$map_file); 1811 $map_file = str_replace(".map",$nr."tmp.map",$map_file);
1813 if(file_exists($qyfile)){ 1812 if(file_exists($qyfile)){
1814 - $nqyfile = str_replace(".map",".qy",$map_file);  
1815 - $nqyfile = str_replace(".qy","",$nqyfile).".qy"; 1813 + $nqyfile = str_replace(".map","_qy.map",$map_file);
  1814 + $nqyfile = str_replace("_qy.map","",$nqyfile)."_qy.map";
1816 copy($qyfile,$nqyfile); 1815 copy($qyfile,$nqyfile);
1817 } 1816 }
1818 $map->save($map_file); 1817 $map->save($map_file);
@@ -1918,6 +1917,8 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa) @@ -1918,6 +1917,8 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa)
1918 $sel = New Selecao($map_file,$tema); 1917 $sel = New Selecao($map_file,$tema);
1919 //carrega a query para ver se o layer possui selecao ou nao 1918 //carrega a query para ver se o layer possui selecao ou nao
1920 $numSel = 0; 1919 $numSel = 0;
  1920 + $nomeRand = true;
  1921 +
1921 if(file_exists($sel->qyfile)){ 1922 if(file_exists($sel->qyfile)){
1922 $map->loadquery($sel->qyfile); 1923 $map->loadquery($sel->qyfile);
1923 $numSel = $l->getNumresults(); 1924 $numSel = $l->getNumresults();
@@ -1926,12 +1927,13 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa) @@ -1926,12 +1927,13 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa)
1926 //se nao existir selecao seleciona por box 1927 //se nao existir selecao seleciona por box
1927 //o box vem do mapfile original 1928 //o box vem do mapfile original
1928 // 1929 //
1929 - if(!file_exists($sel->qyfile) || $numSel < 1){ 1930 + if(!file_exists($sel->qyfile)){
1930 $box = $rectextent->minx." ".$rectextent->miny." ".$rectextent->maxx." ".$rectextent->maxy; 1931 $box = $rectextent->minx." ".$rectextent->miny." ".$rectextent->maxx." ".$rectextent->maxy;
1931 $sel->selecaoBOX("novo",$box); 1932 $sel->selecaoBOX("novo",$box);
1932 //reaproveita arquivo anterior 1933 //reaproveita arquivo anterior
1933 $nomeRand = false; 1934 $nomeRand = false;
1934 } 1935 }
  1936 +
1935 $nomeshp = criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand,$projecao["prj"]); 1937 $nomeshp = criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand,$projecao["prj"]);
1936 //remove o arquivo de selecao se ele foi criado apenas para pegar todos os elementos 1938 //remove o arquivo de selecao se ele foi criado apenas para pegar todos os elementos
1937 if($nomeRand == false){ 1939 if($nomeRand == false){
classesphp/mapa_googlemaps.php
@@ -148,7 +148,7 @@ include_once(&quot;funcoes_gerais.php&quot;); @@ -148,7 +148,7 @@ include_once(&quot;funcoes_gerais.php&quot;);
148 148
149 $logExec = $_SESSION["logExec"]; 149 $logExec = $_SESSION["logExec"];
150 if(isset($logExec) && $logExec["mapa_"] == true){ 150 if(isset($logExec) && $logExec["mapa_"] == true){
151 - i3GeoLog("mapa_googlemaps ".implode("&",array_merge($_GET,$_POST)),$_SESSION["dir_tmp"]); 151 + i3GeoLog("prog: mapa_googlemaps url: ".implode("&",array_merge($_GET,$_POST)),$_SESSION["dir_tmp"]);
152 } 152 }
153 153
154 restauraCon($map_fileX,$postgis_mapa); 154 restauraCon($map_fileX,$postgis_mapa);
classesphp/mapa_inicia.php
@@ -113,7 +113,7 @@ function iniciaMapa() @@ -113,7 +113,7 @@ function iniciaMapa()
113 validaAcessoTemas($map_file); 113 validaAcessoTemas($map_file);
114 114
115 if($dir_tmp != "" && isset($logExec) && $logExec["init"] == true){ 115 if($dir_tmp != "" && isset($logExec) && $logExec["init"] == true){
116 - i3GeoLog("iniciaMapa $interface",$dir_tmp); 116 + i3GeoLog("prog: iniciaMapa interface: $interface",$dir_tmp);
117 } 117 }
118 118
119 if(!isset($kmlurl)){ 119 if(!isset($kmlurl)){
classesphp/mapa_openlayers.php
@@ -167,8 +167,9 @@ $postgis_mapa = $_SESSION[&quot;postgis_mapa&quot;]; @@ -167,8 +167,9 @@ $postgis_mapa = $_SESSION[&quot;postgis_mapa&quot;];
167 include_once("funcoes_gerais.php"); 167 include_once("funcoes_gerais.php");
168 168
169 $logExec = $_SESSION["logExec"]; 169 $logExec = $_SESSION["logExec"];
  170 +
170 if(isset($logExec) && $logExec["mapa_"] == true){ 171 if(isset($logExec) && $logExec["mapa_"] == true){
171 - i3GeoLog("mapa_openlayers ".implode("&",array_merge($_GET,$_POST)),$_SESSION["dir_tmp"]); 172 + i3GeoLog("prog: mapa_openlayers url: ".implode("&",array_merge($_GET,$_POST)),$_SESSION["dir_tmp"]);
172 } 173 }
173 174
174 restauraCon($map_fileX,$postgis_mapa); 175 restauraCon($map_fileX,$postgis_mapa);
init/index.php
@@ -73,6 +73,7 @@ include &quot;head.php&quot;; @@ -73,6 +73,7 @@ include &quot;head.php&quot;;
73 <li><a href="#topo" onclick="$('.cartao').hide();$('.cogs').fadeIn(600);">{{{admin}}}</a></li> 73 <li><a href="#topo" onclick="$('.cartao').hide();$('.cogs').fadeIn(600);">{{{admin}}}</a></li>
74 <li><a href="#topo" onclick="$('.cartao').hide();$('.book').fadeIn(600);">{{{docs}}}</a></li> 74 <li><a href="#topo" onclick="$('.cartao').hide();$('.book').fadeIn(600);">{{{docs}}}</a></li>
75 <li><a href="#topo" onclick="$('.cartao').hide();$('.group').fadeIn(600);">{{{comunidade}}}</a></li> 75 <li><a href="#topo" onclick="$('.cartao').hide();$('.group').fadeIn(600);">{{{comunidade}}}</a></li>
  76 + <li><a role="button" href="../social/index.php" >Social</a></li>
76 </ul> 77 </ul>
77 </div> 78 </div>
78 </div> 79 </div>
@@ -144,49 +145,20 @@ include &quot;head.php&quot;; @@ -144,49 +145,20 @@ include &quot;head.php&quot;;
144 </div> 145 </div>
145 </div> 146 </div>
146 </div> 147 </div>
147 - <div class="center-block col-xs-12 hidden" id="tt"  
148 - style="width: 260px; min-width: 260px; max-width: 260px;">  
149 - <div class="panel panel-default">  
150 - <div class="panel-body">  
151 - <a class="twitter-timeline tline" href="" data-widget-id="288061915689787392" height="320">Tweets  
152 - @i3Geo</a>  
153 - </div>  
154 - </div>  
155 - </div>  
156 - <div class="center-block col-xs-12 hidden"  
157 - style="width: 260px; min-width: 260px; max-width: 260px;">  
158 - <div class="panel panel-default">  
159 - <div class="panel-body">  
160 - <a class="twitter-timeline htag" href="" data-widget-id="643417277208133633" height="320">i3geo  
161 - Tweets</a>  
162 - </div>  
163 - </div>  
164 - </div>  
165 </div> 148 </div>
166 149
167 </div> 150 </div>
168 - <div class="container-fluid"  
169 - style="background-color: rgb(250, 250, 250); margin-top: 10px; padding-top: 10px;">  
170 - 151 + <div tabindex="-1" class="container-fluid"
  152 + style="background-color: #fff; margin-top: 10px; padding-top: 10px;">
171 <div class="row text-center hidden"> 153 <div class="row text-center hidden">
172 -  
173 - <div class="col-lg-4 center-block">  
174 - <a rel="license" href="http://creativecommons.org/licenses/GPL/2.0/legalcode.pt" target="_blank"><img 154 + <div class="col-lg-12 center-block">
  155 + <a tabindex="-1" rel="license" href="http://creativecommons.org/licenses/GPL/2.0/legalcode.pt" target="_blank"><img
175 alt="Licen&ccedil;a Creative Commons" style="border-width: 0" 156 alt="Licen&ccedil;a Creative Commons" style="border-width: 0"
176 src="https://i.creativecommons.org/l/GPL/2.0/88x62.png" /></a><br />O i3Geo est&aacute; 157 src="https://i.creativecommons.org/l/GPL/2.0/88x62.png" /></a><br />O i3Geo est&aacute;
177 - licenciado com uma Licen&ccedil;a <a rel="license"  
178 - href="http://creativecommons.org/licenses/GPL/2.0/legalcode.pt" target="_blank">Creative 158 + licenciado com uma Licen&ccedil;a <a tabindex="-1" rel="license"
  159 + href="http://creativecommons.org/licenses/GPL/2.0/legalcode.pt" style="color:#008579;" target="_blank">Creative
179 Commons - Licen&ccedil;a P&uacute;blica Geral GNU (&#34;GNU General Public License&#34;)</a> 160 Commons - Licen&ccedil;a P&uacute;blica Geral GNU (&#34;GNU General Public License&#34;)</a>
180 </div> 161 </div>
181 - <div class="col-lg-4 center-block">  
182 -  
183 - <script type='text/javascript'  
184 - src='https://www.openhub.net/p/i3geo/widgets/project_users?format=js&style=blue'></script>  
185 - </div>  
186 - <div class="col-lg-4 text-center">  
187 - <script type="text/javascript"  
188 - src="http://www.openhub.net/p/150688/widgets/project_basic_stats.js"></script>  
189 - </div>  
190 </div> 162 </div>
191 </div> 163 </div>
192 164
ms_configura.php
@@ -507,10 +507,7 @@ Tipo: @@ -507,10 +507,7 @@ Tipo:
507 */ 507 */
508 //TODO verificar ao fechar versao 508 //TODO verificar ao fechar versao
509 $postgis_mapa = array( 509 $postgis_mapa = array(
510 - "teste"=>"user=postgres password=postgres dbname=teste host=localhost port=5432",  
511 - "postgres"=>"user=postgres password=postgres dbname=postgres host=localhost port=5432",  
512 - "i3geosaude"=>"user=postgres password=postgres dbname=i3geosaude host=localhost port=5432 options='-c client_encoding=LATIN1'",  
513 - "i3geosaudeUtf"=>"user=postgres password=postgres dbname=i3geosaude host=localhost port=5432" 510 + "teste"=>"user=postgres password= dbname=teste host=localhost port=5432"
514 ); 511 );
515 /* 512 /*
516 Variable: utilizacgi 513 Variable: utilizacgi
social/index.js 0 → 100755
social/index.php 0 → 100755
@@ -0,0 +1,82 @@ @@ -0,0 +1,82 @@
  1 +<?php
  2 +define ( ONDEI3GEO, ".." );
  3 +include (dirname ( __FILE__ ) . "/../ms_configura.php");
  4 +error_reporting ( 0 );
  5 +include "../init/head.php";
  6 +?>
  7 +<style>
  8 +.list-group .list-group-separator::before {
  9 + width: calc(100% - 45px);
  10 +}
  11 +
  12 +.list-group-item-heading {
  13 + line-height: 2;
  14 + left: 5px;
  15 + margin-left: 45px;
  16 +}
  17 +
  18 +.list-group {
  19 + margin: auto;
  20 +}
  21 +</style>
  22 +<body style="padding-top: 55px;">
  23 + <nav class="navbar navbar-default navbar-fixed-top">
  24 + <div class="container-fluid">
  25 + <div class="navbar-header">
  26 + <a class="navbar-brand" href="../init/index.php"><?php echo $mensagemInicia;?> <i
  27 + class="fa fa-home fa-1x"></i></a>
  28 + </div>
  29 + </div>
  30 + </nav>
  31 + <div class="container-fluid">
  32 + <div class="row">
  33 + <ol class="breadcrumb">
  34 + <li><a href="../init/index.php?home=">i3Geo</a></li>
  35 + <li class="active">Social</li>
  36 + </ol>
  37 + </div>
  38 + </div>
  39 + <div class="container">
  40 + <div class="row center-block">
  41 + <div class="center-block col-xs-6">
  42 + <div class="panel panel-default">
  43 + <div class="panel-body">
  44 + <a class="twitter-timeline tline" href="https://twitter.com/i3geo"
  45 + data-widget-id="288061915689787392" height="320">Tweets @i3Geo</a>
  46 + </div>
  47 + </div>
  48 + </div>
  49 + <div class="center-block col-xs-6">
  50 + <div class="panel panel-default">
  51 + <div class="panel-body">
  52 + <a class="twitter-timeline htag" href="https://twitter.com/hashtag/i3geo"
  53 + data-widget-id="643417277208133633" height="320">i3geo Tweets</a>
  54 + </div>
  55 + </div>
  56 + </div>
  57 + </div>
  58 + <div class="row center-block">
  59 + <div tabindex="-1" class="col-xs-6 text-center">
  60 + <script type='text/javascript'
  61 + src='https://www.openhub.net/p/i3geo/widgets/project_users?format=js&style=blue'></script>
  62 + </div>
  63 + <div tabindex="-1" class="col-xs-6 text-center">
  64 + <script type="text/javascript"
  65 + src="http://www.openhub.net/p/150688/widgets/project_basic_stats.js"></script>
  66 + </div>
  67 + </div>
  68 + </div>
  69 + <script src='../classesjs/compactados/mustache.js'></script>
  70 + <script src='../classesjs/compactados/dicionario_compacto.js'></script>
  71 + <script src='../classesjs/compactados/classe_util_compacto.js'></script>
  72 + <script src='../classesjs/compactados/classe_idioma_compacto.js'></script>
  73 + <script src="https://platform.twitter.com/widgets.js"></script>
  74 + <script>
  75 + $(document).ready(function(){
  76 + i3GEO.configura = {"locaplic" : "..","sid": ""};
  77 + $.material.init();
  78 + });
  79 + </script>
  80 +
  81 +</body>
  82 +</html>
@@ -2,5 +2,6 @@ @@ -2,5 +2,6 @@
2 /* 2 /*
3 Utilizado como um include em ms_configura.php 3 Utilizado como um include em ms_configura.php
4 */ 4 */
5 -$mensagemInicia = 'i3Geo 6.0'; 5 +$mensagemInicia = 'i3Geo 6.0.1';
  6 +//a versao 6.0.1 incorpora melhorias de seguranca
6 ?> 7 ?>