Commit 86278010f4d7a67762c0f682c7e9d29a993b160e

Authored by Edmar Moretti
1 parent eb11205a

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

admin/admin.db
No preview for this file type
admin/dicionario/subirsimbolo.js 100644 → 100755
1 1 //+$trad(1,i3GEOF.uploadsimbolo.dicionario)+
2 2 i3GEOF.uploadsimbolo.dicionario = {
3 3 'pastaArmazenamento' : [ {
4   - pt : "Pasta no servidor onde os dados serão armazenados (deixe em branco para usar a pasta i3geo/symbols/images). A pasta deve ter permissões adequadas para permitir o upload, consulte o administrador do sistema caso ocorra algum problema. Para facilitar, o i3Geo sugere a pasta indicada abaixo",
  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 5 en : "",
6 6 es : ""
7 7 } ],
... ...
admin/html/subirsimbolo.html
... ... @@ -16,7 +16,7 @@ body {
16 16 </style>
17 17 <script type="text/javascript" src="../js/core.js"></script>
18 18 <script type="text/javascript" src="../../classesjs/i3geo.js"></script>
19   -<script type="text/javascript" src="../js/subirsimbolo.js.js"></script>
  19 +<script type="text/javascript" src="../js/subirsimbolo.js"></script>
20 20 <script type="text/javascript" src="../dicionario/subirsimbolo.js"></script>
21 21  
22 22 <script type="text/javascript" src="../dicionario/core.js"></script>
... ...
admin/js/subirsimbolo.js 100644 → 100755
... ... @@ -86,7 +86,6 @@ i3GEOF.uploadsimbolo = {
86 86 );
87 87 b.addClass("rodar");
88 88 //pega a pasta default
89   - i3GEOF.uploadsimbolo.pegaPastaDefault();
90 89 }
91 90 catch(erro){i3GEO.janela.tempoMsg(erro);}
92 91 },
... ... @@ -100,7 +99,7 @@ i3GEOF.uploadsimbolo = {
100 99 String com o c&oacute;digo html
101 100 */
102 101 html:function(){
103   - var ins = '<form id=i3GEOuploadsimbolof target="i3GEOuploadsimboloiframe" action="'+i3GEO.configura.locaplic+'/ferramentas/uploadsimbolo/upload.php" method="post" ENCTYPE="multipart/form-data">' +
  102 + var ins = '<form id=i3GEOuploadsimbolof target="i3GEOuploadsimboloiframe" action="../php/subirsimbolo.php" method="post" ENCTYPE="multipart/form-data">' +
104 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>';
105 104 if(i3GEO.parametros.editor === "sim"){
106 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>';
... ... @@ -161,16 +160,6 @@ i3GEOF.uploadsimbolo = {
161 160 i3GEOF.uploadsimbolo.aguarde.visibility="visible";
162 161 $i("i3GEOuploadsimbolof").submit();
163 162 },
164   - pegaPastaDefault: function(){
165   - var fim, p;
166   - fim = function(retorno){
167   - $i("dirDestino").value = retorno.data;
168   - };
169   - p = i3GEO.configura.locaplic+"/ferramentas/uploadsimbolo/exec.php?funcao=NOMEPASTA";
170   - cp = new cpaint();
171   - cp.set_response_type("JSON");
172   - cp.call(p,"foo",fim);
173   - },
174 163 selNavegador: function(onde){
175 164 i3GEO.util.navegadorDir(onde,false,false,false);
176 165 }
... ...
admin/php/identifica.php
... ... @@ -50,6 +50,11 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){
50 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 58 error_reporting(0);
54 59 //faz a busca da fun&ccedil;&atilde;o que deve ser executada
55 60 switch (strtoupper($funcao))
... ... @@ -127,19 +132,19 @@ switch (strtoupper($funcao))
127 132 Altera o registro de um WS
128 133 */
129 134 function alterarFuncoes(){
130   - global $id_i,$abrir_i,$nome_i,$target_i,$publicado_i,$esquemaadmin;
  135 + global $id_i,$esquemaadmin;
131 136 try{
132 137 //$nome_i = mb_convert_encoding($nome_i,"UTF-8","ISO-8859-1");
133 138 require_once("conexao.php");
134 139 if($convUTF){
135   - $nome_i = utf8_encode($nome_i);
  140 + $_GET["nome_i"] = utf8_encode($_GET["nome_i"]);
136 141 }
137 142 if($id_i != ""){
138 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 149 i3GeoAdminUpdate($dbhw,"i3geoadmin_identifica",$dataCol,"WHERE id_i = $id_i");
145 150 $retorna = $id_i;
... ...
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 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 42 include_once(dirname(__FILE__)."/login.php");
44 43 $funcoesEdicao = array(
45 44 "ALTERARMAPA",
... ... @@ -51,6 +50,11 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){
51 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 58 error_reporting(0);
55 59 //faz a busca da fun&ccedil;&atilde;o que deve ser executada
56 60 switch (strtoupper($funcao))
... ... @@ -174,7 +178,7 @@ switch (strtoupper($funcao))
174 178 break;
175 179 }
176 180 function salvaMapfile(){
177   - global $esquemaadmin,$nome_mapa,$arqmapfile,$url,$id_mapa,$preferenciasbase64,$geometriasbase64,$graficosbase64,$tabelasbase64,$ext;
  181 + global $esquemaadmin,$id_mapa;
178 182 //as preferencias sao criadas via javascript e guardadas junto com o mapa
179 183 try{
180 184 //
... ... @@ -186,24 +190,24 @@ function salvaMapfile(){
186 190 //o parser para reconstruir os valores e feito em javascript, no cliente
187 191 //
188 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 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 205 $extatual = $m->extent;
202 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 211 fclose ($handle);
208 212 $conteudo = base64_encode($conteudo);
209 213 if($conteudo == false){
... ... @@ -211,7 +215,7 @@ function salvaMapfile(){
211 215 }
212 216 require_once("conexao.php");
213 217 if($convUTF){
214   - $nome_mapa = utf8_encode($nome_mapa);
  218 + $_GET["nome_mapa"] = utf8_encode($_GET["nome_mapa"]);
215 219 }
216 220 $retorna = "";
217 221 if(empty($id_mapa)){
... ... @@ -236,8 +240,8 @@ function salvaMapfile(){
236 240 $dataCol = array(
237 241 "mapfile" => $conteudo,
238 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 246 i3GeoAdminUpdate($dbhw,"i3geoadmin_mapas",$dataCol, "WHERE id_mapa =".$id);
243 247 $dbhw = null;
... ... @@ -252,29 +256,29 @@ function salvaMapfile(){
252 256 Altera o registro de um mapa
253 257 */
254 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 260 //substitui a string do parametro outros
257   - $outros_mapa = str_replace("*","&",$outros_mapa);
  261 + $_GET["outros_mapa"] = str_replace("*","&",$_GET["outros_mapa"]);
258 262 try{
259 263 require_once("conexao.php");
260 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 268 $retorna = "";
265 269 if($id_mapa != ""){
266 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 283 i3GeoAdminUpdate($dbhw,"i3geoadmin_mapas",$dataCol, "WHERE id_mapa =".$id_mapa);
280 284 $retorna = $id_mapa;
... ...
admin/php/sistemas.php
... ... @@ -240,7 +240,7 @@ function alterarSistemas(){
240 240 try {
241 241 require_once("conexao.php");
242 242 if($convUTF){
243   - $_GET["nome_sistema"] = utf8_encode($_GET["$nome_sistema"]);
  243 + $_GET["nome_sistema"] = utf8_encode($_GET["nome_sistema"]);
244 244 }
245 245 if($id_sistema != ""){
246 246 $dataCol = array(
... ...
admin/php/subirsimbolo.php 100644 → 100755
1 1 <?php
2   -//
3   -//caso o usu&aacute;rio seja um administrador, ele pode enviar um nome de diret&oacute;rio onde os arquivos ser&atilde;o armazenados
4   -//na vari&aacute;vel $dirDestino
5   -//
6   -require_once(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php");
7   -include_once (dirname(__FILE__)."/../../classesphp/carrega_ext.php");
8   -error_reporting(0);
9   -if (ob_get_level() == 0) ob_start();
  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 +}
10 13 ?>
11 14 <html>
12 15 <head>
... ... @@ -19,14 +22,16 @@ if (ob_get_level() == 0) ob_start();
19 22 <p>
20 23 <?php
21 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;
22 28  
23   - $checkphp = fileContemString($_FILES['i3GEOuploadsimboloarq']['tmp_name'],"<?");
  29 + $checkphp = fileContemString($_FILES['i3GEOuploadsimboloarq']['tmp_name'],"<?php");
24 30 if($checkphp == true){
  31 + echo "Arquivo invalido";
25 32 exit;
26 33 }
27 34  
28   - require_once (dirname(__FILE__)."/../../ms_configura.php");
29   -
30 35 if(isset($logExec) && $logExec["upload"] == true){
31 36 i3GeoLog("prog: uploadsimbolo filename:" . $_FILES['i3GEOuploadsimboloarq']['name'],$dir_tmp);
32 37 }
... ... @@ -35,22 +40,16 @@ if (isset($_FILES[&#39;i3GEOuploadsimboloarq&#39;][&#39;name&#39;]) &amp;&amp; strlen(basename($_FILES[&#39;
35 40 ob_flush();
36 41 flush();
37 42 sleep(1);
38   - include_once(dirname(__FILE__)."/../../admin/php/login.php");
39   - if(verificaOperacaoSessao("admin/php/editortexto") == false){
40   - echo "Vc nao pode salvar os dados no servidor em uma pasta espec&iacute;fica";exit;
41   - }
42   - if(!isset($dirDestino) || $dirDestino == ""){
43   - $dirDestino = $locaplic."/symbols/images";
44   - }
  43 +
45 44 if(!file_exists($dirDestino)){
46   - $dirDestino = dirname($locaplic)."/".$dirDestino;
47 45 if(!file_exists($dirDestino)){
48   - echo "<p class='paragrafo' >Pasta n&atilde;o existe no servidor";paraAguarde();exit;
  46 + echo "<p class='paragrafo' >Pasta n&atilde;o existe no servidor";
  47 + paraAguarde();
  48 + exit;
49 49 }
50 50 }
51 51 //verifica nomes
52   -
53   - $nome = basename($_FILES['i3GEOuploadsimboloarq']['name']);
  52 + $nome = $_FILES['i3GEOuploadsimboloarq']['name'];
54 53  
55 54 $nome = str_replace(".png","",$nome);
56 55 $nome = str_replace(".","",$nome).".png";
... ... @@ -58,7 +57,7 @@ if (isset($_FILES[&#39;i3GEOuploadsimboloarq&#39;][&#39;name&#39;]) &amp;&amp; strlen(basename($_FILES[&#39;
58 57 $nome = strip_tags($nome);
59 58 $nome = htmlspecialchars($nome, ENT_QUOTES);
60 59  
61   - $nome = $nome . md5(uniqid(rand(), true));
  60 + //$nome = $nome . md5(uniqid(rand(), true));
62 61  
63 62 verificaNome($nome);
64 63 //sobe arquivo
... ...
admin/php/webservices.php
... ... @@ -48,7 +48,7 @@ include_once(dirname(__FILE__).&quot;/login.php&quot;);
48 48 $id_ws = $_GET["id_ws"];
49 49 $id = $_GET["id"];
50 50  
51   -testaSafeNumerico([$id]);
  51 +testaSafeNumerico([$id,$id_ws]);
52 52  
53 53 $funcoesEdicao = array(
54 54 "ALTERARWS",
... ...
admin1/cadastros/identifica/exec.php
... ... @@ -40,10 +40,15 @@ if (in_array ( strtoupper ( $funcao ), $funcoesEdicao )) {
40 40 }
41 41 }
42 42 include (dirname ( __FILE__ ) . "/../../../admin/php/conexao.php");
  43 +
  44 +$id_i = $_POST["id_i"];
  45 +$id = $_POST["id"];
  46 +testaSafeNumerico([$id_i,$id]);
  47 +
43 48 $funcao = strtoupper ( $funcao );
44 49 switch ($funcao) {
45 50 case "ADICIONAR" :
46   - $novo = adicionar( $publicado_i, $abrir_i, $nome_i, $target_i, $dbhw );
  51 + $novo = adicionar( $_POST["publicado_i"], $_POST["abrir_i"], $_POST["nome_i"], $_POST["target_i"], $dbhw );
47 52 if ($novo === false) {
48 53 header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
49 54 exit ();
... ... @@ -51,7 +56,7 @@ switch ($funcao) {
51 56 exit ();
52 57 break;
53 58 case "ALTERAR" :
54   - $novo = alterar ( $id_i, $publicado_i, $abrir_i, $nome_i, $target_i, $dbhw );
  59 + $novo = alterar ( $id_i, $_POST["publicado_i"], $_POST["abrir_i"], $_POST["nome_i"], $_POST["target_i"], $dbhw );
55 60 if ($novo === false) {
56 61 header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
57 62 exit ();
... ...
admin1/cadastros/identifica/index.js
... ... @@ -196,7 +196,7 @@ Obt&amp;eacute;m a lista de Identifica
196 196 salvarDialogo: function(id_i){
197 197 var hash = {
198 198 "mensagem": i3GEOadmin.identifica.dicionario.confirma,
199   - "onBotao1": "i3GEOadmin.identifica.salvarIdentifica('"+id_i+"')",
  199 + "onBotao1": "i3GEOadmin.identifica.salvar('"+id_i+"')",
200 200 "botao1": i3GEOadmin.identifica.dicionario.sim,
201 201 "onBotao2": "i3GEOadmin.core.fechaModalConfirma();",
202 202 "botao2": i3GEOadmin.identifica.dicionario.nao
... ...
admin1/cadastros/perfis/exec.php
... ... @@ -23,9 +23,6 @@
23 23 * 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
24 24 */
25 25 error_reporting ( 0 );
26   -//
27   -// pega as variaveis passadas com get ou post
28   -//
29 26  
30 27 include_once (dirname ( __FILE__ ) . "/../../../admin/php/login.php");
31 28 $funcoesEdicao = array (
... ... @@ -45,6 +42,10 @@ if(!isset($idioma) || $idioma == &quot;&quot;){
45 42 }
46 43 //remove espaco em branco do nome do perfil
47 44 $perfil = str_replace(" ","",$perfil);
  45 +
  46 +$id_perfil = $_POST["id_perfil"];
  47 +testaSafeNumerico([$id_perfil]);
  48 +
48 49 $funcao = strtoupper ( $funcao );
49 50 switch ($funcao) {
50 51 case "ADICIONAR" :
... ... @@ -128,7 +129,7 @@ function alterar($id_perfil, $perfil,$dbhw) {
128 129 return false;
129 130 }
130 131  
131   - $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_mapas");
  132 + $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_mapas WHERE perfil_mapa != ''");
132 133 foreach($q as $row){
133 134 $t = $row['perfil_mapa'];
134 135 $i = $row['id_mapa'];
... ... @@ -140,7 +141,7 @@ function alterar($id_perfil, $perfil,$dbhw) {
140 141 i3GeoAdminUpdate($dbhw,"i3geoadmin_mapas",$dataCol,"WHERE id_mapa = $i");
141 142 }
142 143 }
143   - $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_menus");
  144 + $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_menus WHERE perfil_menu != ''");
144 145 foreach($q as $row){
145 146 $t = $row['perfil_menu'];
146 147 $i = $row['id_menu'];
... ... @@ -152,7 +153,7 @@ function alterar($id_perfil, $perfil,$dbhw) {
152 153 i3GeoAdminUpdate($dbhw,"i3geoadmin_menus",$dataCol,"WHERE id_menu = $i");
153 154 }
154 155 }
155   - $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_n1");
  156 + $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_n1 WHERE n1_perfil != ''");
156 157 foreach($q as $row){
157 158 $t = $row['n1_perfil'];
158 159 $i = $row['id_n1'];
... ... @@ -164,7 +165,7 @@ function alterar($id_perfil, $perfil,$dbhw) {
164 165 i3GeoAdminUpdate($dbhw,"i3geoadmin_n1",$dataCol,"WHERE id_n1 = $i");
165 166 }
166 167 }
167   - $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_n2");
  168 + $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_n2 WHERE n2_perfil != ''");
168 169 foreach($q as $row){
169 170 $t = $row['n2_perfil'];
170 171 $i = $row['id_n2'];
... ... @@ -176,7 +177,7 @@ function alterar($id_perfil, $perfil,$dbhw) {
176 177 i3GeoAdminUpdate($dbhw,"i3geoadmin_n2",$dataCol,"WHERE id_n2 = $i");
177 178 }
178 179 }
179   - $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_n3");
  180 + $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_n3 WHERE n3_perfil != ''");
180 181 foreach($q as $row){
181 182 $t = $row['n3_perfil'];
182 183 $i = $row['id_n3'];
... ... @@ -188,7 +189,7 @@ function alterar($id_perfil, $perfil,$dbhw) {
188 189 i3GeoAdminUpdate($dbhw,"i3geoadmin_n3",$dataCol,"WHERE id_n3 = $i");
189 190 }
190 191 }
191   - $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_raiz");
  192 + $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_raiz WHERE perfil != ''");
192 193 foreach($q as $row){
193 194 $t = $row['perfil'];
194 195 $i = $row['id_raiz'];
... ... @@ -200,7 +201,7 @@ function alterar($id_perfil, $perfil,$dbhw) {
200 201 i3GeoAdminUpdate($dbhw,"i3geoadmin_raiz",$dataCol,"WHERE id_raiz = $i");
201 202 }
202 203 }
203   - $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_sistemas");
  204 + $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_sistemas WHERE perfil_sistema != ''");
204 205 foreach($q as $row)
205 206 {
206 207 $t = $row['perfil_sistema'];
... ... @@ -213,7 +214,7 @@ function alterar($id_perfil, $perfil,$dbhw) {
213 214 i3GeoAdminUpdate($dbhw,"i3geoadmin_sistemas",$dataCol,"WHERE id_sistema = $i");
214 215 }
215 216 }
216   - $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_sistemasf");
  217 + $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_sistemasf WHERE perfil_funcao != ''");
217 218 foreach($q as $row){
218 219 $t = $row['perfil_funcao'];
219 220 $i = $row['id_funcao'];
... ... @@ -263,36 +264,36 @@ function excluir($id_perfil, $dbhw) {
263 264 }
264 265 $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_n1");
265 266 foreach($q as $row){
266   - $t = $row['perfil_n1'];
  267 + $t = $row['n1_perfil'];
267 268 $i = $row['id_n1'];
268 269 $ts = trim(str_replace(" ".$perfil." ",""," ".$t." "));
269 270 if($t != $ts){
270 271 $dataCol = array(
271   - "perfil_n1" => $ts
  272 + "n1_perfil" => $ts
272 273 );
273 274 i3GeoAdminUpdate($dbhw,"i3geoadmin_n1",$dataCol,"WHERE id_n1 = $i");
274 275 }
275 276 }
276 277 $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_n2");
277 278 foreach($q as $row){
278   - $t = $row['perfil_n2'];
  279 + $t = $row['n2_perfil'];
279 280 $i = $row['id_n2'];
280 281 $ts = trim(str_replace(" ".$perfil." ",""," ".$t." "));
281 282 if($t != $ts){
282 283 $dataCol = array(
283   - "perfil_n2" => $ts
  284 + "n2_perfil" => $ts
284 285 );
285 286 i3GeoAdminUpdate($dbhw,"i3geoadmin_n2",$dataCol,"WHERE id_n2 = $i");
286 287 }
287 288 }
288 289 $q = $dbhw->query("select * from ".$esquemaadmin."i3geoadmin_n3");
289 290 foreach($q as $row){
290   - $t = $row['perfil_n3'];
  291 + $t = $row['n2_perfil'];
291 292 $i = $row['id_n3'];
292 293 $ts = trim(str_replace(" ".$perfil." ",""," ".$t." "));
293 294 if($t != $ts){
294 295 $dataCol = array(
295   - "perfil_n3" => $ts
  296 + "n2_perfil" => $ts
296 297 );
297 298 i3GeoAdminUpdate($dbhw,"i3geoadmin_n3",$dataCol,"WHERE id_n3 = $i");
298 299 }
... ...
admin1/cadastros/servicos/exec.php
... ... @@ -23,10 +23,6 @@
23 23 * 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
24 24 */
25 25 error_reporting ( 0 );
26   -//
27   -// pega as variaveis passadas com get ou post
28   -//
29   -
30 26 include_once (dirname ( __FILE__ ) . "/../../../admin/php/login.php");
31 27 $funcoesEdicao = array (
32 28 "ADICIONAR",
... ... @@ -40,10 +36,16 @@ if (in_array ( strtoupper ( $funcao ), $funcoesEdicao )) {
40 36 }
41 37 }
42 38 include (dirname ( __FILE__ ) . "/../../../admin/php/conexao.php");
  39 +
  40 +$id_ws = $_POST["id_ws"];
  41 +$id = $_POST["id"];
  42 +
  43 +testaSafeNumerico([$id,$id_ws]);
  44 +
43 45 $funcao = strtoupper ( $funcao );
44 46 switch ($funcao) {
45 47 case "ADICIONAR" :
46   - $novo = adicionar( $autor_ws, $desc_ws, $link_ws, $nome_ws, $tipo_ws,$dbhw );
  48 + $novo = adicionar( $_POST["autor_ws"], $_POST["desc_ws"], $_POST["link_ws"], $_POST["nome_ws"], $_POST["tipo_ws"],$dbhw );
47 49 if ($novo === false) {
48 50 header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
49 51 exit ();
... ... @@ -51,7 +53,7 @@ switch ($funcao) {
51 53 exit ();
52 54 break;
53 55 case "ALTERAR" :
54   - $novo = alterar ( $id_ws,$autor_ws, $desc_ws, $link_ws, $nome_ws, $tipo_ws,$dbhw );
  56 + $novo = alterar ( $id_ws,$_POST["autor_ws"], $_POST["desc_ws"], $_POST["link_ws"], $_POST["nome_ws"], $_POST["tipo_ws"],$dbhw );
55 57 if ($novo === false) {
56 58 header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
57 59 exit ();
... ...
admin1/cadastros/servicos/index.js
... ... @@ -182,7 +182,7 @@ Obt&amp;eacute;m a lista de Webservices
182 182 i3GEOadmin.core.fechaModalGeral();
183 183 i3GEOadmin.core.modalAguarde(true);
184 184 $.post(
185   - "exec.php?funcao=alterarWs",
  185 + "exec.php?funcao=alterar",
186 186 "id_ws="+ id+"&"+parametros
187 187 )
188 188 .done(
... ...
admin1/cadastros/servicos/index.php
... ... @@ -82,15 +82,15 @@ include &quot;../../head.php&quot;;
82 82 </div>
83 83 </div>
84 84 <div class="form-group form-group-lg">
85   - <label class="col-md-2 control-label" for="login">{{{descricaoTxt}}}</label>
  85 + <label class="col-md-2 control-label" for="desc_ws">{{{descricaoTxt}}}</label>
86 86 <div class="col-md-10">
87 87 <input title="{{{descricaoTxt}}}" type="text" value="{{{desc_ws}}}" class="form-control" name="desc_ws" >
88 88 </div>
89 89 </div>
90 90 <div class="form-group form-group-lg">
91   - <label class="col-md-2 control-label" for="email">{{{autor}}}</label>
  91 + <label class="col-md-2 control-label" for="autor_ws">{{{autor}}}</label>
92 92 <div class="col-md-10">
93   - <input title="{{{autor}}}" type="email" value="{{{autor_ws}}}" class="form-control" name="autor_ws" required>
  93 + <input title="{{{autor}}}" type="text" value="{{{autor_ws}}}" class="form-control" name="autor_ws" required>
94 94 </div>
95 95 </div>
96 96 <div class="form-group form-group-lg">
... ...
admin1/cadastros/tags/exec.php
... ... @@ -42,7 +42,10 @@ if (in_array ( strtoupper ( $funcao ), $funcoesEdicao )) {
42 42 include (dirname ( __FILE__ ) . "/../../../admin/php/conexao.php");
43 43  
44 44 //remove espaco em branco do nome do tag
45   -$nome = str_replace(" ","",$nome);
  45 +$nome = str_replace(" ","",$_POST["nome"]);
  46 +$id_tag = $_POST["id_tag"];
  47 +testaSafeNumerico([$id_tag]);
  48 +
46 49 $funcao = strtoupper ( $funcao );
47 50 switch ($funcao) {
48 51 case "ADICIONAR" :
... ...
admin1/catalogo/atlas/exec.php
... ... @@ -41,10 +41,16 @@ if (in_array ( strtoupper ( $funcao ), $funcoesEdicao )) {
41 41 }
42 42 include (dirname ( __FILE__ ) . "/../../../admin/php/conexao.php");
43 43  
  44 +$id = $_POST["id"];
  45 +$id_atlas = $_POST["id_atlas"];
  46 +$id_prancha = $_POST["id_prancha"];
  47 +
  48 +testaSafeNumerico([$id,$id_atlas,$id_prancha]);
  49 +
44 50 $funcao = strtoupper ( $funcao );
45 51 switch ($funcao) {
46 52 case "ADICIONAR" :
47   - $novo = adicionar( $titulo_atlas, $publicado_atlas, $ordem_atlas, $basemapfile_atlas, $desc_atlas, $h_atlas, $w_atlas, $icone_atlas, $link_atlas, $pranchadefault_atlas, $template_atlas, $tipoguias_atlas, $dbhw );
  53 + $novo = adicionar( $_POST["titulo_atlas"], $_POST["publicado_atlas"], $_POST["ordem_atlas"], $_POST["basemapfile_atlas"], $_POST["desc_atlas"], $_POST["h_atlas"], $_POST["w_atlas"], $_POST["icone_atlas"], $_POST["link_atlas"], $_POST["pranchadefault_atlas"], $_POST["template_atlas"], $_POST["tipoguias_atlas"], $dbhw );
48 54 if ($novo === false) {
49 55 header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
50 56 exit ();
... ... @@ -52,7 +58,7 @@ switch ($funcao) {
52 58 exit ();
53 59 break;
54 60 case "ALTERAR" :
55   - $novo = alterar ( $id_atlas, $titulo_atlas, $publicado_atlas, $ordem_atlas, $basemapfile_atlas, $desc_atlas, $h_atlas, $w_atlas, $icone_atlas, $link_atlas, $pranchadefault_atlas, $template_atlas, $tipoguias_atlas, $dbhw );
  61 + $novo = alterar ( $id_atlas, $_POST["titulo_atlas"], $_POST["publicado_atlas"], $_POST["ordem_atlas"], $_POST["basemapfile_atlas"], $_POST["desc_atlas"], $_POST["h_atlas"], $_POST["w_atlas"], $_POST["icone_atlas"], $_POST["link_atlas"], $_POST["pranchadefault_atlas"], $_POST["template_atlas"], $_POST["tipoguias_atlas"], $dbhw );
56 62 if ($novo === false) {
57 63 header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
58 64 exit ();
... ...
admin1/catalogo/atlas/index.php
... ... @@ -89,7 +89,7 @@ include &quot;../../head.php&quot;;
89 89 <div class="form-group form-group-lg">
90 90 <label class="col-md-4 control-label" for="link_atlas" >{{{linkTxt}}}</label>
91 91 <div class="col-md-8">
92   - <input title="{{{linkTxt}}}" type="text" value="{{{link_atlas}}}" class="form-control" name="link_atlas" required>
  92 + <input title="{{{linkTxt}}}" type="text" value="{{{link_atlas}}}" class="form-control" name="link_atlas" >
93 93 </div>
94 94 </div>
95 95 </div>
... ... @@ -107,7 +107,7 @@ include &quot;../../head.php&quot;;
107 107 <div class="form-group form-group-lg">
108 108 <label class="col-md-4 control-label" for="ordem_atlas" >{{{ordem}}}</label>
109 109 <div class="col-md-8">
110   - <input title="{{{ordem}}}" type="text" value="{{{ordem_atlas}}}" class="form-control" name="ordem_atlas" required>
  110 + <input title="{{{ordem}}}" type="text" value="{{{ordem_atlas}}}" class="form-control" name="ordem_atlas" >
111 111 </div>
112 112 </div>
113 113 </div>
... ... @@ -115,7 +115,7 @@ include &quot;../../head.php&quot;;
115 115 <div class="form-group form-group-lg">
116 116 <label class="col-md-4 control-label" for="basemapfile_atlas" >{{{mapfileInicia}}}</label>
117 117 <div class="col-md-8">
118   - <input title="{{{mapfileInicia}}}" type="text" value="{{{basemapfile_atlas}}}" class="form-control" name="basemapfile_atlas" required>
  118 + <input title="{{{mapfileInicia}}}" type="text" value="{{{basemapfile_atlas}}}" class="form-control" name="basemapfile_atlas" >
119 119 </div>
120 120 </div>
121 121 </div>
... ... @@ -123,7 +123,7 @@ include &quot;../../head.php&quot;;
123 123 <div class="form-group form-group-lg">
124 124 <label class="col-md-4 control-label" for="h_atlas" >{{{altura}}}</label>
125 125 <div class="col-md-8">
126   - <input title="{{{altura}}}" type="text" value="{{{h_atlas}}}" class="form-control" name="h_atlas" required>
  126 + <input title="{{{altura}}}" type="text" value="{{{h_atlas}}}" class="form-control" name="h_atlas" >
127 127 </div>
128 128 </div>
129 129 </div>
... ... @@ -131,7 +131,7 @@ include &quot;../../head.php&quot;;
131 131 <div class="form-group form-group-lg">
132 132 <label class="col-md-4 control-label" for="w_atlas" >{{{largura}}}</label>
133 133 <div class="col-md-8">
134   - <input title="{{{largura}}}" type="text" value="{{{w_atlas}}}" class="form-control" name="w_atlas" required>
  134 + <input title="{{{largura}}}" type="text" value="{{{w_atlas}}}" class="form-control" name="w_atlas" >
135 135 </div>
136 136 </div>
137 137 </div>
... ... @@ -139,7 +139,7 @@ include &quot;../../head.php&quot;;
139 139 <div class="form-group form-group-lg">
140 140 <label class="col-md-4 control-label" for="icone_atlas" >{{{iconeAtlas}}}</label>
141 141 <div class="col-md-8">
142   - <input title="{{{iconeAtlas}}}" type="text" value="{{{icone_atlas}}}" class="form-control" name="icone_atlas" required>
  142 + <input title="{{{iconeAtlas}}}" type="text" value="{{{icone_atlas}}}" class="form-control" name="icone_atlas" >
143 143 </div>
144 144 </div>
145 145 </div>
... ... @@ -147,7 +147,7 @@ include &quot;../../head.php&quot;;
147 147 <div class="form-group form-group-lg">
148 148 <label class="col-md-4 control-label" for="pranchadefault_atlas" >{{{pranchaInicia}}}</label>
149 149 <div class="col-md-8">
150   - <input title="{{{pranchaInicia}}}" type="text" value="{{{pranchadefault_atlas}}}" class="form-control" name="pranchadefault_atlas" required>
  150 + <input title="{{{pranchaInicia}}}" type="text" value="{{{pranchadefault_atlas}}}" class="form-control" name="pranchadefault_atlas" >
151 151 </div>
152 152 </div>
153 153 </div>
... ... @@ -155,7 +155,7 @@ include &quot;../../head.php&quot;;
155 155 <div class="form-group form-group-lg">
156 156 <label class="col-md-4 control-label" for="template_atlas" >{{{template}}}</label>
157 157 <div class="col-md-8">
158   - <input title="{{{template}}}" type="text" value="{{{template_atlas}}}" class="form-control" name="template_atlas" required>
  158 + <input title="{{{template}}}" type="text" value="{{{template_atlas}}}" class="form-control" name="template_atlas" >
159 159 </div>
160 160 </div>
161 161 </div>
... ... @@ -175,7 +175,7 @@ include &quot;../../head.php&quot;;
175 175 </div>
176 176 </form>
177 177 </div>
178   - <div class="panel-footer" style="padding-top: 0px; padding-bottom: 0px;">
  178 + <div class="panel-footer {{{escondido}}}" style="padding-top: 0px; padding-bottom: 0px;">
179 179 <div class="pull-right">
180 180 <button style="color:#007a6f;" onclick="i3GEOadmin.atlas.editarPranchas('{{id_atlas}}','{{{titulo_atlas}}}')" class="btn btn-primary btn-xs" style="margin-top: 2px; margin-bottom: 2px;">
181 181 <i class="material-icons">folder_open</i> {{{pranchas}}}
... ...
admin1/catalogo/atlas/pranchas/exec.php
... ... @@ -41,10 +41,16 @@ if (in_array ( strtoupper ( $funcao ), $funcoesEdicao )) {
41 41 }
42 42 include (dirname ( __FILE__ ) . "/../../../../admin/php/conexao.php");
43 43  
  44 +$id = $_POST["id"];
  45 +$id_atlas = $_POST["id_atlas"];
  46 +$id_prancha = $_POST["id_prancha"];
  47 +
  48 +testaSafeNumerico([$id,$id_atlas,$id_prancha]);
  49 +
44 50 $funcao = strtoupper ( $funcao );
45 51 switch ($funcao) {
46 52 case "ADICIONAR" :
47   - $novo = adicionar( $id_atlas, $titulo_prancha, $ordem_prancha, $desc_prancha, $h_prancha, $icone_prancha, $link_prancha, $mapext_prancha, $w_prancha, $dbhw );
  53 + $novo = adicionar( $id_atlas, $_POST["titulo_prancha"], $_POST["ordem_prancha"], $_POST["desc_prancha"], $_POST["h_prancha"], $_POST["icone_prancha"], $_POST["link_prancha"], $_POST["mapext_prancha"], $_POST["w_prancha"], $dbhw );
48 54 if ($novo === false) {
49 55 header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
50 56 exit ();
... ... @@ -52,7 +58,7 @@ switch ($funcao) {
52 58 exit ();
53 59 break;
54 60 case "ALTERAR" :
55   - $novo = alterar ( $id_atlas, $id_prancha, $titulo_prancha, $ordem_prancha, $desc_prancha, $h_prancha, $icone_prancha, $link_prancha, $mapext_prancha, $w_prancha, $dbhw );
  61 + $novo = alterar ( $id_atlas, $id_prancha, $_POST["titulo_prancha"], $_POST["ordem_prancha"], $_POST["desc_prancha"], $_POST["h_prancha"], $_POST["icone_prancha"], $_POST["link_prancha"], $_POST["mapext_prancha"], $_POST["w_prancha"], $dbhw );
56 62 if ($novo === false) {
57 63 header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
58 64 exit ();
... ... @@ -69,7 +75,7 @@ switch ($funcao) {
69 75 exit ();
70 76 break;
71 77 case "LISTA" :
72   - $dados = pegaDados("SELECT id_atlas, id_prancha, titulo_prancha, ordem_prancha, desc_prancha, h_prancha, icone_prancha, link_prancha, mapext_prancha, w_prancha from ".$esquemaadmin."i3geoadmin_atlasp WHERE id_atlas = '{$id_atlas}'", $dbh, false);
  78 + $dados = pegaDados("SELECT id_atlas, id_prancha, titulo_prancha, ordem_prancha, desc_prancha, h_prancha, icone_prancha, link_prancha, mapext_prancha, w_prancha from ".$esquemaadmin."i3geoadmin_atlasp WHERE id_atlas = '$id_atlas'", $dbh, false);
73 79 if ($dados === false) {
74 80 $dbhw = null;
75 81 $dbh = null;
... ...
admin1/catalogo/atlas/pranchas/index.js
... ... @@ -40,7 +40,8 @@ Obt&amp;eacute;m a lista
40 40 lista: function(){
41 41 i3GEOadmin.core.iconeAguarde(i3GEOadmin.prancha.ondeLista);
42 42 $.post(
43   - "exec.php?funcao=lista&id_atlas=" + i3GEOadmin.prancha.id_atlas
  43 + "exec.php?funcao=lista",
  44 + "id_atlas=" + i3GEOadmin.prancha.id_atlas
44 45 )
45 46 .done(
46 47 function(data, status){
... ...
admin1/catalogo/atlas/pranchas/index.php
... ... @@ -84,7 +84,7 @@ $titulo_atlas = filter_var($_GET[&quot;titulo_atlas&quot;], FILTER_SANITIZE_STRING);
84 84 <div class="form-group form-group-lg">
85 85 <label class="col-md-4 control-label" for="desc_prancha" >{{{descricao}}}</label>
86 86 <div class="col-md-8">
87   - <input title="{{{descricao}}}" type="text" value="{{{desc_prancha}}}" class="form-control" name="desc_prancha" required>
  87 + <input title="{{{descricao}}}" type="text" value="{{{desc_prancha}}}" class="form-control" name="desc_prancha" >
88 88 </div>
89 89 </div>
90 90 </div>
... ... @@ -92,7 +92,7 @@ $titulo_atlas = filter_var($_GET[&quot;titulo_atlas&quot;], FILTER_SANITIZE_STRING);
92 92 <div class="form-group form-group-lg">
93 93 <label class="col-md-4 control-label" for="link_prancha" >{{{linkTxt}}}</label>
94 94 <div class="col-md-8">
95   - <input title="{{{linkTxt}}}" type="text" value="{{{link_prancha}}}" class="form-control" name="link_prancha" required>
  95 + <input title="{{{linkTxt}}}" type="text" value="{{{link_prancha}}}" class="form-control" name="link_prancha" >
96 96 </div>
97 97 </div>
98 98 </div>
... ... @@ -100,7 +100,7 @@ $titulo_atlas = filter_var($_GET[&quot;titulo_atlas&quot;], FILTER_SANITIZE_STRING);
100 100 <div class="form-group form-group-lg">
101 101 <label class="col-md-4 control-label" for="ordem_prancha" >{{{ordem}}}</label>
102 102 <div class="col-md-8">
103   - <input title="{{{ordem}}}" type="text" value="{{{ordem_prancha}}}" class="form-control" name="ordem_prancha" required>
  103 + <input title="{{{ordem}}}" type="text" value="{{{ordem_prancha}}}" class="form-control" name="ordem_prancha" >
104 104 </div>
105 105 </div>
106 106 </div>
... ... @@ -108,7 +108,7 @@ $titulo_atlas = filter_var($_GET[&quot;titulo_atlas&quot;], FILTER_SANITIZE_STRING);
108 108 <div class="form-group form-group-lg">
109 109 <label class="col-md-4 control-label" for="h_prancha" >{{{altura}}}</label>
110 110 <div class="col-md-8">
111   - <input title="{{{altura}}}" type="text" value="{{{h_prancha}}}" class="form-control" name="h_prancha" required>
  111 + <input title="{{{altura}}}" type="text" value="{{{h_prancha}}}" class="form-control" name="h_prancha" >
112 112 </div>
113 113 </div>
114 114 </div>
... ... @@ -116,7 +116,7 @@ $titulo_atlas = filter_var($_GET[&quot;titulo_atlas&quot;], FILTER_SANITIZE_STRING);
116 116 <div class="form-group form-group-lg">
117 117 <label class="col-md-4 control-label" for="w_prancha" >{{{largura}}}</label>
118 118 <div class="col-md-8">
119   - <input title="{{{largura}}}" type="text" value="{{{w_prancha}}}" class="form-control" name="w_prancha" required>
  119 + <input title="{{{largura}}}" type="text" value="{{{w_prancha}}}" class="form-control" name="w_prancha" >
120 120 </div>
121 121 </div>
122 122 </div>
... ... @@ -124,7 +124,7 @@ $titulo_atlas = filter_var($_GET[&quot;titulo_atlas&quot;], FILTER_SANITIZE_STRING);
124 124 <div class="form-group form-group-lg">
125 125 <label class="col-md-4 control-label" for="icone_prancha" >{{{icone}}}</label>
126 126 <div class="col-md-8">
127   - <input title="{{{icone}}}" type="text" value="{{{icone_prancha}}}" class="form-control" name="icone_prancha" required>
  127 + <input title="{{{icone}}}" type="text" value="{{{icone_prancha}}}" class="form-control" name="icone_prancha" >
128 128 </div>
129 129 </div>
130 130 </div>
... ... @@ -132,7 +132,7 @@ $titulo_atlas = filter_var($_GET[&quot;titulo_atlas&quot;], FILTER_SANITIZE_STRING);
132 132 <div class="form-group form-group-lg">
133 133 <label class="col-md-4 control-label" for="mapext_prancha" >{{{extGeo}}}</label>
134 134 <div class="col-md-8">
135   - <input title="{{{extGeo}}}" type="text" value="{{{mapext_prancha}}}" class="form-control" name="mapext_prancha" required>
  135 + <input title="{{{extGeo}}}" type="text" value="{{{mapext_prancha}}}" class="form-control" name="mapext_prancha" >
136 136 </div>
137 137 </div>
138 138 </div>
... ... @@ -142,7 +142,7 @@ $titulo_atlas = filter_var($_GET[&quot;titulo_atlas&quot;], FILTER_SANITIZE_STRING);
142 142 </div>
143 143 </form>
144 144 </div>
145   - <div class="panel-footer" style="padding-top: 0px; padding-bottom: 0px;">
  145 + <div class="panel-footer {{{escondido}}}" style="padding-top: 0px; padding-bottom: 0px;">
146 146 <div class="pull-right">
147 147 <button style="color:#007a6f;" onclick="i3GEOadmin.prancha.editarTemas('{{id_atlas}}','{{id_prancha}}','{{{titulo_prancha}}}')" class="btn btn-primary btn-xs" style="margin-top: 2px; margin-bottom: 2px;">
148 148 <i class="material-icons">folder_open</i> {{{editarTema}}}
... ...
admin1/catalogo/atlas/pranchas/temas/exec.php
... ... @@ -41,10 +41,16 @@ if (in_array ( strtoupper ( $funcao ), $funcoesEdicao )) {
41 41 }
42 42 include (dirname ( __FILE__ ) . "/../../../../../admin/php/conexao.php");
43 43  
  44 +$id_atlas = $_POST["id_atlas"];
  45 +$id_prancha = $_POST["id_prancha"];
  46 +$id_tema = $_POST["id_tema"];
  47 +
  48 +testaSafeNumerico([$id,$id_atlas,$id_prancha]);
  49 +
44 50 $funcao = strtoupper ( $funcao );
45 51 switch ($funcao) {
46 52 case "ADICIONAR" :
47   - $novo = adicionar( $id_prancha, $ordem_tema, $ligado_tema, $codigo_tema, $dbhw );
  53 + $novo = adicionar( $id_prancha, $_POST["ordem_tema"], $_POST["ligado_tema"], $_POST["codigo_tema"], $dbhw );
48 54 if ($novo === false) {
49 55 header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
50 56 exit ();
... ... @@ -52,7 +58,7 @@ switch ($funcao) {
52 58 exit ();
53 59 break;
54 60 case "ALTERAR" :
55   - $novo = alterar ( $id_tema, $ordem_tema, $ligado_tema, $codigo_tema, $dbhw );
  61 + $novo = alterar ( $id_tema, $_POST["ordem_tema"], $_POST["ligado_tema"], $_POST["codigo_tema"], $dbhw );
56 62 if ($novo === false) {
57 63 header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
58 64 exit ();
... ... @@ -69,7 +75,7 @@ switch ($funcao) {
69 75 exit ();
70 76 break;
71 77 case "LISTA" :
72   - $dados = pegaDados("SELECT id_tema, ordem_tema, codigo_tema, ligado_tema from ".$esquemaadmin."i3geoadmin_atlast WHERE id_prancha = '{$id_prancha}'", $dbh, false);
  78 + $dados = pegaDados("SELECT id_tema, ordem_tema, codigo_tema, ligado_tema from ".$esquemaadmin."i3geoadmin_atlast WHERE id_prancha = '$id_prancha'", $dbh, false);
73 79 if ($dados === false) {
74 80 $dbhw = null;
75 81 $dbh = null;
... ...
admin1/catalogo/atlas/pranchas/temas/index.js
... ... @@ -40,7 +40,8 @@ Obt&amp;eacute;m a lista
40 40 lista: function(){
41 41 i3GEOadmin.core.iconeAguarde(i3GEOadmin.tema.ondeLista);
42 42 $.post(
43   - "exec.php?funcao=lista&id_prancha=" + i3GEOadmin.tema.id_prancha
  43 + "exec.php?funcao=lista",
  44 + "id_prancha=" + i3GEOadmin.tema.id_prancha
44 45 )
45 46 .done(
46 47 function(data, status){
... ...
admin1/catalogo/atlas/pranchas/temas/index.php
... ... @@ -59,7 +59,7 @@ $id_atlas = filter_var($_GET[&quot;id_atlas&quot;], FILTER_SANITIZE_NUMBER_INT);
59 59 </h3>
60 60 </div>
61 61 <div class="panel-body panel-collapse collapse" id="body-form-{{id_tema}}">
62   - <form style="" action="#" onsubmit="{{onSalvar}}('{{id_tema}}');return false;" onchange="this.style.boxShadow='2px 2px 5px 0 #009688';" class="form-horizontal" role="form" method="post" >
  62 + <form style="" action="#" onsubmit="{{onSalvar}}('{{id_tema}}','{{{codigo_tema}}}');return false;" onchange="this.style.boxShadow='2px 2px 5px 0 #009688';" class="form-horizontal" role="form" method="post" >
63 63 <div class="row">
64 64 <div class="col-md-12 {{esconde}}">
65 65 <div class="form-group form-group-lg">
... ... @@ -75,7 +75,7 @@ $id_atlas = filter_var($_GET[&quot;id_atlas&quot;], FILTER_SANITIZE_NUMBER_INT);
75 75 <div class="form-group form-group-lg">
76 76 <label class="col-md-4 control-label" for="ordem_tema" >{{{ordem}}}</label>
77 77 <div class="col-md-8">
78   - <input title="{{{ordem}}}" type="text" value="{{{ordem_tema}}}" class="form-control" name="ordem_tema" required>
  78 + <input title="{{{ordem}}}" type="text" value="{{{ordem_tema}}}" class="form-control" name="ordem_tema" >
79 79 </div>
80 80 </div>
81 81 </div>
... ...
admin1/catalogo/mapas/exec.php
... ... @@ -41,6 +41,9 @@ if (in_array ( strtoupper ( $funcao ), $funcoesEdicao )) {
41 41 }
42 42 include (dirname ( __FILE__ ) . "/../../../admin/php/conexao.php");
43 43  
  44 +$id_mapa = $_POST["id_mapa"];
  45 +testaSafeNumerico([$id_mapa]);
  46 +
44 47 $funcao = strtoupper ( $funcao );
45 48 switch ($funcao) {
46 49 case "ADICIONAR" :
... ... @@ -52,7 +55,7 @@ switch ($funcao) {
52 55 exit ();
53 56 break;
54 57 case "ALTERAR" :
55   - $novo = alterar ( $id_mapa, $publicado_mapa, $ordem_mapa, $perfil_mapa, $ligados_mapa, $temas_mapa, $desc_mapa, $ext_mapa, $imagem_mapa, $linkdireto_mapa, $nome_mapa, $outros_mapa, $mapfile , $dbhw );
  58 + $novo = alterar ( $id_mapa, $_POST["publicado_mapa"], $_POST["ordem_mapa"], $_POST["perfil_mapa"], $_POST["ligados_mapa"], $_POST["temas_mapa"], $_POST["desc_mapa"], $_POST["ext_mapa"], $_POST["imagem_mapa"], $_POST["linkdireto_mapa"], $_POST["nome_mapa"], $_POST["outros_mapa"], $_POST["mapfile"] , $dbhw );
56 59 if ($novo === false) {
57 60 header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
58 61 exit ();
... ...
admin1/catalogo/mapas/index.php
... ... @@ -85,7 +85,7 @@ include &quot;../../head.php&quot;;
85 85 <div class="form-group form-group-lg">
86 86 <label class="col-md-4 control-label" for="contemmapfile" >{{{contemMapfile}}}</label>
87 87 <div class="col-md-8">
88   - <input title="{{{contemMapfile}}}" type="text" value="{{{contemmapfile}}}" disabled="" class="form-control" name="contemmapfile" required>
  88 + <input title="{{{contemMapfile}}}" type="text" value="{{{contemmapfile}}}" disabled="" class="form-control" name="contemmapfile" >
89 89 </div>
90 90 </div>
91 91 <div class="form-group form-group-lg">
... ...
classesphp/funcoes_gerais.php
... ... @@ -1508,7 +1508,6 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE,$prj=&quot;&quot;,$proj
1508 1508 else{
1509 1509 $novonomelayer = $tema;
1510 1510 }
1511   -
1512 1511 $novonomelayer = str_replace(".","-",$novonomelayer);
1513 1512 $nomeshp = $dir_tmp."/".$novonomelayer;
1514 1513  
... ... @@ -1807,12 +1806,12 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa)
1807 1806 //salva o mapfile com um outro nome para evitar que o mapa atual, se estiver aberto, seja modificado
1808 1807 //
1809 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 1811 $map_file = str_replace(".map",$nr."tmp.map",$map_file);
1813 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 1815 copy($qyfile,$nqyfile);
1817 1816 }
1818 1817 $map->save($map_file);
... ... @@ -1918,6 +1917,8 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa)
1918 1917 $sel = New Selecao($map_file,$tema);
1919 1918 //carrega a query para ver se o layer possui selecao ou nao
1920 1919 $numSel = 0;
  1920 + $nomeRand = true;
  1921 +
1921 1922 if(file_exists($sel->qyfile)){
1922 1923 $map->loadquery($sel->qyfile);
1923 1924 $numSel = $l->getNumresults();
... ... @@ -1926,12 +1927,13 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa)
1926 1927 //se nao existir selecao seleciona por box
1927 1928 //o box vem do mapfile original
1928 1929 //
1929   - if(!file_exists($sel->qyfile) || $numSel < 1){
  1930 + if(!file_exists($sel->qyfile)){
1930 1931 $box = $rectextent->minx." ".$rectextent->miny." ".$rectextent->maxx." ".$rectextent->maxy;
1931 1932 $sel->selecaoBOX("novo",$box);
1932 1933 //reaproveita arquivo anterior
1933 1934 $nomeRand = false;
1934 1935 }
  1936 +
1935 1937 $nomeshp = criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand,$projecao["prj"]);
1936 1938 //remove o arquivo de selecao se ele foi criado apenas para pegar todos os elementos
1937 1939 if($nomeRand == false){
... ...
... ... @@ -1 +0,0 @@
1   -i3geo
2 0 \ No newline at end of file
ms_configura.php
... ... @@ -511,7 +511,7 @@ Tipo:
511 511 $postgis_mapa = array(
512 512 "teste"=>"user=postgres password=postgres dbname=teste host=localhost port=5432",
513 513 "postgres"=>"user=postgres password=postgres dbname=postgres host=localhost port=5432",
514   - //"i3geosaude"=>"user=postgres password=postgres dbname=i3geosaude host=localhost port=5432 options='-c client_encoding=LATIN1'",
  514 + "i3geosaude"=>"user=postgres password=postgres dbname=i3geosaude host=localhost port=5432 options='-c client_encoding=LATIN1'",
515 515 "i3geosaudeUtf"=>"user=postgres password=postgres dbname=i3geosaude host=localhost port=5432"
516 516 );
517 517 /*
... ...
temas/_lbairros.map
... ... @@ -4,7 +4,7 @@ MAP
4 4 LAYER
5 5 CONNECTION "i3geosaude"
6 6 CONNECTIONTYPE POSTGIS
7   - DATA "the_geom from (select gid, st_setsrid(the_geom,4326) as the_geom,co_bairro,no_bairro,no_distr,no_municip from i3geo_metaestat.bairros /*FW*//*FW*/) as foo using unique co_bairro using srid=4326"
  7 + DATA "the_geom from (select gid, st_setsrid(the_geom,4326) as the_geom,co_bairro,no_bairro,no_distr,no_municip from i3geo_metaestat.bairros limit 10/*FW*//*FW*/) as foo using unique co_bairro using srid=4326"
8 8 METADATA
9 9 "cache" "nao"
10 10 "TIP" "no_bairro"
... ...
temas/_lbiomashp.map
... ... @@ -6,14 +6,13 @@ MAP
6 6 DATA "/var/www/i3geo/aplicmap/dados/biomas.shp"
7 7 METADATA
8 8 "METAESTAT_ID_MEDIDA_VARIAVEL" ""
9   - "CACHE" "sim"
10 9 "TIP" "CD_LEGENDA"
  10 + "CACHE" "sim"
11 11 "CLASSE" "SIM"
12 12 "permitekmz" "sim"
13   - "iconetema" ""
14 13 "ITENSDESC" "Bioma Teste de acentuação"
15   - "TILES" "SIM"
16 14 "ESCALA" "1000000"
  15 + "TILES" "SIM"
17 16 "METAESTAT_CODIGO_TIPO_REGIAO" ""
18 17 "extensao" "-76 -39 -29 9"
19 18 "permitedownload" "sim"
... ... @@ -21,10 +20,10 @@ MAP
21 20 "download" "sim"
22 21 "itembuscarapida" "CD_LEGENDA"
23 22 "ITENS" "CD_LEGENDA"
24   - "permitekml" "sim"
25   - "permiteogc" "sim"
26 23 "transitioneffect" "SIM"
27   - "TEMA" "_Biomas SHP (acentução) teste"
  24 + "permiteogc" "sim"
  25 + "permitekml" "sim"
  26 + "TEMA" "Biomas SHP (acentução) teste"
28 27 END # METADATA
29 28 NAME "_lbiomashp"
30 29 PROCESSING "ITEMS=CD_LEGENDA"
... ...