Commit d123a78977fc3b868d938eb893f03cea8f07e364

Authored by Edmar Moretti
1 parent 79f6bdba

Log de transações #62

admin/admin.db
No preview for this file type
admin/php/admin.php
@@ -129,7 +129,7 @@ function verificaDuplicados($sql,$dbh) @@ -129,7 +129,7 @@ function verificaDuplicados($sql,$dbh)
129 129
130 Exlcui um registro de uma tabela do banco de dados de administra��o 130 Exlcui um registro de uma tabela do banco de dados de administra��o
131 131
132 -Utiliza vari�veis globais para fazer a consulta ao banco 132 +Utiliza variaveis globais para fazer a consulta ao banco
133 133
134 Globals: 134 Globals:
135 135
@@ -139,22 +139,28 @@ coluna - nome da coluna @@ -139,22 +139,28 @@ coluna - nome da coluna
139 139
140 id - valor 140 id - valor
141 */ 141 */
142 -function exclui()  
143 -{  
144 - global $tabela,$coluna,$id,$esquemaadmin;  
145 - try  
146 - { 142 +function exclui($tabela,$coluna,$id){
  143 + try {
147 include("conexao.php"); 144 include("conexao.php");
  145 + /*
148 $tabela = $esquemaadmin.$tabela; 146 $tabela = $esquemaadmin.$tabela;
149 - $sql = "DELETE from $tabela WHERE $coluna = $id"; 147 + $sql = "DELETE from $tabela WHERE $coluna = :id";
150 $dbhw->query($sql); 148 $dbhw->query($sql);
151 i3GeoAdminInsertLog($dbhw,$sql); 149 i3GeoAdminInsertLog($dbhw,$sql);
152 $dbhw = null; 150 $dbhw = null;
153 $dbh = null; 151 $dbh = null;
154 return "ok"; 152 return "ok";
  153 + */
  154 +
  155 + $sql = "DELETE from $tabela WHERE $coluna = ?";
  156 + $prep = $dbhw->prepare($sql);
  157 + $prep->execute(array($id));
  158 + i3GeoAdminInsertLog($dbhw,$sql,array($id));
  159 + $dbhw = null;
  160 + $dbh = null;
  161 + return "ok";
155 } 162 }
156 - catch (PDOException $e)  
157 - { 163 + catch (PDOException $e) {
158 return "Error!: " . $e->getMessage(); 164 return "Error!: " . $e->getMessage();
159 } 165 }
160 } 166 }
@@ -220,7 +226,7 @@ function i3GeoAdminUpdate($pdo,$tabela,$data,$filtro=""){ @@ -220,7 +226,7 @@ function i3GeoAdminUpdate($pdo,$tabela,$data,$filtro=""){
220 foreach($keys as $k){ 226 foreach($keys as $k){
221 $sset[] = $k."=?"; 227 $sset[] = $k."=?";
222 } 228 }
223 - $sql = "UPDATE ".$esquemaadmin."$tabela SET ".implode($sset,",")." ".$filtro; 229 + $sql = "UPDATE ".$esquemaadmin."$tabela SET ".implode($sset,",")." ".$filtro;
224 $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 230 $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
225 try { 231 try {
226 $prep = $pdo->prepare($sql); 232 $prep = $pdo->prepare($sql);
admin/php/arvore.php
@@ -530,7 +530,7 @@ switch (strtoupper($funcao)) @@ -530,7 +530,7 @@ switch (strtoupper($funcao))
530 } 530 }
531 } 531 }
532 retornaJSON( 532 retornaJSON(
533 - exclui() 533 + exclui($tabela,$coluna,$id)
534 ); 534 );
535 exit; 535 exit;
536 break; 536 break;
admin/php/editormapfile.php
@@ -333,7 +333,7 @@ switch (strtoupper($funcao)) @@ -333,7 +333,7 @@ switch (strtoupper($funcao))
333 } 333 }
334 $tabela = "i3geoadmin_temas"; 334 $tabela = "i3geoadmin_temas";
335 if($id){ 335 if($id){
336 - exclui(); 336 + exclui($tabela,$coluna,$id);
337 } 337 }
338 retornaJSON("ok"); 338 retornaJSON("ok");
339 exit; 339 exit;
@@ -1298,7 +1298,22 @@ function criarNovoMap(){ @@ -1298,7 +1298,22 @@ function criarNovoMap(){
1298 $nome = utf8_encode($nome); 1298 $nome = utf8_encode($nome);
1299 $desc = utf8_encode($desc); 1299 $desc = utf8_encode($desc);
1300 } 1300 }
1301 - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geoadmin_temas (link_tema,kml_tema,kmz_tema,ogc_tema,download_tema,desc_tema,tipoa_tema,tags_tema,nome_tema,codigo_tema,it,es,en) VALUES ('','$acessopublico','$acessopublico', '$acessopublico','$acessopublico','','$tipoa_tema','','$nome','$codigo','$it','$es','$en')"); 1301 + $dataCol = array(
  1302 + "link_tema" => '',
  1303 + "kml_tema" => $acessopublico,
  1304 + "kmz_tema" => $acessopublico,
  1305 + "ogc_tema" => $acessopublico,
  1306 + "download_tema" => $acessopublico,
  1307 + "desc_tema" => '',
  1308 + "tipoa_tema" => $tipoa_tema,
  1309 + "tags_tema" => '',
  1310 + "nome_tema" => $nome,
  1311 + "codigo_tema" => $codigo,
  1312 + "it" => $it,
  1313 + "es" => $es,
  1314 + "en" => $en
  1315 + );
  1316 + i3GeoAdminInsert($dbhw,"i3geoadmin_temas",$dataCol);
1302 $dbh = null; 1317 $dbh = null;
1303 $dbhw = null; 1318 $dbhw = null;
1304 return "ok"; 1319 return "ok";
@@ -1455,7 +1470,11 @@ function adicionaGrupoUsrTema(){ @@ -1455,7 +1470,11 @@ function adicionaGrupoUsrTema(){
1455 if($q){ 1470 if($q){
1456 $teste = $q->fetchAll(); 1471 $teste = $q->fetchAll();
1457 if(count($teste) == 0){ 1472 if(count($teste) == 0){
1458 - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_grupotema (id_tema,id_grupo) VALUES ($id_tema , $id_grupo)"); 1473 + $dataCol = array(
  1474 + "id_tema" => $id_tema,
  1475 + "id_grupo" => $id_grupo
  1476 + );
  1477 + i3GeoAdminInsert($dbhw,"i3geousr_grupotema",$dataCol);
1459 } 1478 }
1460 } 1479 }
1461 return "ok"; 1480 return "ok";
@@ -1463,7 +1482,10 @@ function adicionaGrupoUsrTema(){ @@ -1463,7 +1482,10 @@ function adicionaGrupoUsrTema(){
1463 function excluirGrupoUsrTema(){ 1482 function excluirGrupoUsrTema(){
1464 global $id_tema,$id_grupo,$locaplic,$esquemaadmin; 1483 global $id_tema,$id_grupo,$locaplic,$esquemaadmin;
1465 include($locaplic."/admin/php/conexao.php"); 1484 include($locaplic."/admin/php/conexao.php");
1466 - $q = $dbhw->query("delete from ".$esquemaadmin."i3geousr_grupotema where id_tema = $id_tema and id_grupo = $id_grupo "); 1485 + $sql = "DELETE from ".$esquemaadmin."i3geousr_grupotema where id_tema = ? and id_grupo = ? ";
  1486 + $prep = $dbhw->prepare($sql);
  1487 + $prep->execute(array($id_tema,$id_grupo));
  1488 + i3GeoAdminInsertLog($dbhw,$sql,array($id_tema,$id_grupo));
1467 return "ok"; 1489 return "ok";
1468 } 1490 }
1469 function pegaLayers() 1491 function pegaLayers()
@@ -1654,13 +1676,12 @@ function pegaTitulo() @@ -1654,13 +1676,12 @@ function pegaTitulo()
1654 $dados["name"] = $layer->name; 1676 $dados["name"] = $layer->name;
1655 $dados["tema"] = mb_convert_encoding($layer->getmetadata("tema"),"UTF-8","ISO-8859-1"); 1677 $dados["tema"] = mb_convert_encoding($layer->getmetadata("tema"),"UTF-8","ISO-8859-1");
1656 $dados["iconetema"] = $layer->getmetadata("iconetema"); 1678 $dados["iconetema"] = $layer->getmetadata("iconetema");
1657 - $dados["mensagem"] = mb_convert_encoding($layer->getmetadata("mensagem"),"UTF-8","ISO-8859-1");//$layer->getmetadata("mensagem"); 1679 + $dados["mensagem"] = mb_convert_encoding($layer->getmetadata("mensagem"),"UTF-8","ISO-8859-1");
1658 $dados["escala"] = $layer->getmetadata("escala"); 1680 $dados["escala"] = $layer->getmetadata("escala");
1659 $dados["extensao"] = $layer->getmetadata("extensao"); 1681 $dados["extensao"] = $layer->getmetadata("extensao");
1660 $dados["group"] = $layer->group; 1682 $dados["group"] = $layer->group;
1661 $dados["codigoMap"] = $codigoMap; 1683 $dados["codigoMap"] = $codigoMap;
1662 $dados["codigoLayer"] = $codigoLayer; 1684 $dados["codigoLayer"] = $codigoLayer;
1663 -  
1664 return $dados; 1685 return $dados;
1665 } 1686 }
1666 function alterarNomeTema(){ 1687 function alterarNomeTema(){
@@ -1669,7 +1690,6 @@ function alterarNomeTema(){ @@ -1669,7 +1690,6 @@ function alterarNomeTema(){
1669 $mapa = ms_newMapObj($mapfile); 1690 $mapa = ms_newMapObj($mapfile);
1670 $layer = $mapa->getlayerbyname($codigoMap); 1691 $layer = $mapa->getlayerbyname($codigoMap);
1671 if($layer){ 1692 if($layer){
1672 -  
1673 $layer->setmetadata("tema",$novoNome); 1693 $layer->setmetadata("tema",$novoNome);
1674 $mapa->save($mapfile); 1694 $mapa->save($mapfile);
1675 removeCabecalho($mapfile); 1695 removeCabecalho($mapfile);
@@ -1677,7 +1697,10 @@ function alterarNomeTema(){ @@ -1677,7 +1697,10 @@ function alterarNomeTema(){
1677 if($convUTF){ 1697 if($convUTF){
1678 $novoNome = utf8_encode($novoNome); 1698 $novoNome = utf8_encode($novoNome);
1679 } 1699 }
1680 - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_temas SET nome_tema='$novoNome' WHERE codigo_tema='$codigoMap'"); 1700 + $dataCol = array(
  1701 + "nome_tema" => $novoNome
  1702 + );
  1703 + i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol," WHERE codigo_tema='$codigoMap'");
1681 $dbhw = null; 1704 $dbhw = null;
1682 $dbh = null; 1705 $dbh = null;
1683 } 1706 }
@@ -1770,11 +1793,16 @@ function alterarDispo() @@ -1770,11 +1793,16 @@ function alterarDispo()
1770 return "ok"; 1793 return "ok";
1771 } 1794 }
1772 //essa funcao existe tambem em menutemas.php 1795 //essa funcao existe tambem em menutemas.php
1773 -function alteraTemas()  
1774 -{ 1796 +function alteraTemas(){
1775 global $esquemaadmin,$codigoLayer,$ogc_tema,$kml_tema,$kmz_tema,$locaplic,$download_tema; 1797 global $esquemaadmin,$codigoLayer,$ogc_tema,$kml_tema,$kmz_tema,$locaplic,$download_tema;
1776 include("conexao.php"); 1798 include("conexao.php");
1777 - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_temas SET download_tema = '$download_tema.', ogc_tema='$ogc_tema',kml_tema='$kml_tema',kmz_tema='$kmz_tema' WHERE codigo_tema = '$codigoLayer'"); 1799 + $dataCol = array(
  1800 + "download_tema" => $download_tema,
  1801 + "ogc_tema" => $ogc_tema,
  1802 + "kml_tema" => $kml_tema,
  1803 + "kmz_tema" => $kmz_tema
  1804 + );
  1805 + i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE codigo_tema = '$codigoLayer'");
1778 $dbhw = null; 1806 $dbhw = null;
1779 $dbh = null; 1807 $dbh = null;
1780 } 1808 }
@@ -1848,7 +1876,19 @@ function alterarConexao() @@ -1848,7 +1876,19 @@ function alterarConexao()
1848 $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_temas where codigo_tema = '$codigoMap'"; 1876 $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_temas where codigo_tema = '$codigoMap'";
1849 $dados = pegaDados($sql); 1877 $dados = pegaDados($sql);
1850 if(count($dados) == 0){ 1878 if(count($dados) == 0){
1851 - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geoadmin_temas (tipoa_tema,nome_tema,codigo_tema,kml_tema,kmz_tema,ogc_tema,download_tema,tags_tema,link_tema,desc_tema) VALUES ('META','$codigoMap','$codigoMap','SIM','NAO','SIM','SIM','','','')"); 1879 + $dataCol = array(
  1880 + "tipoa_tema" => "META",
  1881 + "nome_tema" => $codigoMap,
  1882 + "codigo_tema" => $codigoMap,
  1883 + "kml_tema" => "SIM",
  1884 + "kmz_tema" => "NAO",
  1885 + "ogc_tema" => "SIM",
  1886 + "download_tema" => "SIM",
  1887 + "tags_tema" => "",
  1888 + "link_tema" => "",
  1889 + "desc_tema" => ""
  1890 + );
  1891 + i3GeoAdminInsert($dbhw,"i3geoadmin_temas",$dataCol);
1852 } 1892 }
1853 if(strtoupper($metaestat) == "SIM"){ 1893 if(strtoupper($metaestat) == "SIM"){
1854 $connectiontype = 6; 1894 $connectiontype = 6;
@@ -1856,8 +1896,10 @@ function alterarConexao() @@ -1856,8 +1896,10 @@ function alterarConexao()
1856 $filter = ""; 1896 $filter = "";
1857 $data = ""; 1897 $data = "";
1858 $connection = ""; 1898 $connection = "";
1859 - //echo "UPDATE ".$esquemaadmin."i3geoadmin_temas SET tipoa_tema='META' WHERE codigo_tema = '$codigoMap'";exit;  
1860 - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_temas SET tipoa_tema='META' WHERE codigo_tema = '$codigoMap'"); 1899 + $dataCol = array(
  1900 + "tipoa_tema" => "META"
  1901 + );
  1902 + i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE codigo_tema = '$codigoMap'");
1861 $layer->setmetadata("metaestat","SIM"); 1903 $layer->setmetadata("metaestat","SIM");
1862 $layer->setmetadata("METAESTAT_ID_MEDIDA_VARIAVEL",$metaestat_id_medida_variavel); 1904 $layer->setmetadata("METAESTAT_ID_MEDIDA_VARIAVEL",$metaestat_id_medida_variavel);
1863 } 1905 }
@@ -1865,7 +1907,10 @@ function alterarConexao() @@ -1865,7 +1907,10 @@ function alterarConexao()
1865 $layer->setmetadata("METAESTAT_CODIGO_TIPO_REGIAO",""); 1907 $layer->setmetadata("METAESTAT_CODIGO_TIPO_REGIAO","");
1866 $layer->setmetadata("METAESTAT_ID_MEDIDA_VARIAVEL",""); 1908 $layer->setmetadata("METAESTAT_ID_MEDIDA_VARIAVEL","");
1867 $layer->setmetadata("metaestat",""); 1909 $layer->setmetadata("metaestat","");
1868 - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_temas SET tipoa_tema='' WHERE codigo_tema = '$codigoMap'"); 1910 + $dataCol = array(
  1911 + "tipoa_tema" => ""
  1912 + );
  1913 + i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE codigo_tema = '$codigoMap'");
1869 } 1914 }
1870 $layer->set("connection",$connection); 1915 $layer->set("connection",$connection);
1871 if(ms_GetVersionInt() > 50201){ 1916 if(ms_GetVersionInt() > 50201){
admin/php/menutemas.php
@@ -604,7 +604,7 @@ switch (strtoupper($funcao)) @@ -604,7 +604,7 @@ switch (strtoupper($funcao))
604 exit; 604 exit;
605 } 605 }
606 } 606 }
607 - retornaJSON(exclui()); 607 + retornaJSON(exclui($tabela,$coluna,$id));
608 exit; 608 exit;
609 break; 609 break;
610 610
temas/_a.map 0 → 100644
@@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
  1 +MAP
  2 + FONTSET "../symbols/fontes.txt"
  3 + SYMBOLSET "../symbols/simbolosv6.sym"
  4 + LAYER
  5 + CONNECTION ""
  6 + DATA ""
  7 + METADATA
  8 + "cache" ""
  9 + "CLASSE" "SIM"
  10 + "permitekmz" "SIM"
  11 + "permitedownload" "SIM"
  12 + "download" "SIM"
  13 + "permiteogc" "SIM"
  14 + "permitekml" "SIM"
  15 + "cortepixels" "0"
  16 + END # METADATA
  17 + NAME "_a"
  18 + STATUS DEFAULT
  19 + TEMPLATE "none.htm"
  20 + TILEITEM "location"
  21 + TYPE LINE
  22 + UNITS METERS
  23 + CLASS
  24 + NAME ""
  25 + STYLE
  26 + COLOR 0 0 0
  27 + SIZE 12
  28 + SYMBOL "linha"
  29 + END # STYLE
  30 + END # CLASS
  31 + END # LAYER
  32 +END # MAP
temas/_lbairros.map
@@ -6,16 +6,17 @@ MAP @@ -6,16 +6,17 @@ MAP
6 CONNECTIONTYPE POSTGIS 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 /*FW*//*FW*/) as foo using unique co_bairro using srid=4326"
8 METADATA 8 METADATA
9 - "TIP" "no_bairro"  
10 "cache" "SIM" 9 "cache" "SIM"
  10 + "TIP" "no_bairro"
11 "CLASSE" "SIM" 11 "CLASSE" "SIM"
  12 + "iconetema" ""
12 "ITENSDESC" "id,Código bairro,Nome,Distrito,Município" 13 "ITENSDESC" "id,Código bairro,Nome,Distrito,Município"
13 "EDITAVEL" "SIM" 14 "EDITAVEL" "SIM"
14 "ESQUEMATABELAEDITAVEL" "i3geo_metaestat" 15 "ESQUEMATABELAEDITAVEL" "i3geo_metaestat"
15 "ITENS" "gid,co_bairro,no_bairro,no_distr,no_municip" 16 "ITENS" "gid,co_bairro,no_bairro,no_distr,no_municip"
16 "TEMA" "_Bairros POSTGIS" 17 "TEMA" "_Bairros POSTGIS"
17 - "COLUNAIDUNICO" "gid"  
18 "COLUNAGEOMETRIA" "the_geom" 18 "COLUNAGEOMETRIA" "the_geom"
  19 + "COLUNAIDUNICO" "gid"
19 "TABELAEDITAVEL" "bairros" 20 "TABELAEDITAVEL" "bairros"
20 END # METADATA 21 END # METADATA
21 NAME "_lbairros" 22 NAME "_lbairros"