Commit ddb3012e126377791210386bc831668a28285d26
1 parent
897094af
Exists in
master
and in
7 other branches
Correção na obtenção do código da conexão e inclusão de maior restrição ao uso d…
…a ferramenta de upload de shapefile
Showing
6 changed files
with
28 additions
and
16 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin/html/estat_editor.html
@@ -91,6 +91,6 @@ body { | @@ -91,6 +91,6 @@ body { | ||
91 | document.getElementById("formulario").style.display = "block"; | 91 | document.getElementById("formulario").style.display = "block"; |
92 | i3GEOadmin.editor.inicia(); | 92 | i3GEOadmin.editor.inicia(); |
93 | }; | 93 | }; |
94 | - i3GEO.login.verificaOperacao("admin/metaestat/geral",i3GEO.configura.locaplic, temp, "sessao",i3GEO.login.dialogo.abreLogin); | 94 | + i3GEO.login.verificaOperacao("admin/metaestat/editorbanco",i3GEO.configura.locaplic, temp, "sessao",i3GEO.login.dialogo.abreLogin); |
95 | </script> | 95 | </script> |
96 | </body> | 96 | </body> |
admin/html/estat_editor_.html
@@ -89,6 +89,6 @@ body { | @@ -89,6 +89,6 @@ body { | ||
89 | document.getElementById("formulario").style.display = "block"; | 89 | document.getElementById("formulario").style.display = "block"; |
90 | i3GEOadmin.editor.inicia(); | 90 | i3GEOadmin.editor.inicia(); |
91 | }; | 91 | }; |
92 | - i3GEO.login.verificaOperacao("admin/metaestat/geral",i3GEO.configura.locaplic, temp, "sessao",i3GEO.login.dialogo.abreLogin); | 92 | + i3GEO.login.verificaOperacao("admin/metaestat/editorbanco",i3GEO.configura.locaplic, temp, "sessao",i3GEO.login.dialogo.abreLogin); |
93 | </script> | 93 | </script> |
94 | </body> | 94 | </body> |
admin/js/estat_editor.js
@@ -600,7 +600,7 @@ i3GEOadmin.editor = { | @@ -600,7 +600,7 @@ i3GEOadmin.editor = { | ||
600 | '</fieldset>' + | 600 | '</fieldset>' + |
601 | '<fieldset class=subbloco >' + | 601 | '<fieldset class=subbloco >' + |
602 | '<legend>Projeção</legend>' + | 602 | '<legend>Projeção</legend>' + |
603 | - '<p class="paragrafo" >Se voc� n�o escolheu o arquivo PRJ escolha o código da projeção (SRID) do arquivo</p>' + | 603 | + '<p class="paragrafo" >Se você não escolheu o arquivo PRJ escolha o código da projeção (SRID) do arquivo</p>' + |
604 | '<input class=digitar type="text" value="4326" size=20 id="insrid" name="insrid" style="top:0px;left:0px;cursor:pointer;float:left;margin-right:10px;"><div id=selInSrid ></div>' + | 604 | '<input class=digitar type="text" value="4326" size=20 id="insrid" name="insrid" style="top:0px;left:0px;cursor:pointer;float:left;margin-right:10px;"><div id=selInSrid ></div>' + |
605 | '<p class="paragrafo" >Projetar o arquivo para (deixe em branco se você não quiser aplicar nenhuma transformação de projeção):</p>' + | 605 | '<p class="paragrafo" >Projetar o arquivo para (deixe em branco se você não quiser aplicar nenhuma transformação de projeção):</p>' + |
606 | '<input class=digitar type="text" value="" size=20 id="outsrid" name="outsrid" style="top:0px;left:0px;cursor:pointer;float:left;margin-right:10px;"><div id=selOutSrid ></div>' + | 606 | '<input class=digitar type="text" value="" size=20 id="outsrid" name="outsrid" style="top:0px;left:0px;cursor:pointer;float:left;margin-right:10px;"><div id=selOutSrid ></div>' + |
admin/php/classe_metaestat.php
@@ -2220,7 +2220,7 @@ class Metaestat{ | @@ -2220,7 +2220,7 @@ class Metaestat{ | ||
2220 | * @return execSQLDB | 2220 | * @return execSQLDB |
2221 | */ | 2221 | */ |
2222 | function esquemasConexao($codigo_estat_conexao){ | 2222 | function esquemasConexao($codigo_estat_conexao){ |
2223 | - return $this->execSQLDB($codigo_estat_conexao,"SELECT oid,nspname as esquema FROM pg_namespace group by nspname,oid order by nspname"); | 2223 | + return $this->execSQLDB($codigo_estat_conexao,"SELECT oid,nspname as esquema FROM pg_namespace WHERE nspname NOT LIKE 'pg_%' AND nspname NOT LIKE '%_schema%' group by nspname,oid order by nspname"); |
2224 | } | 2224 | } |
2225 | /** | 2225 | /** |
2226 | * Cria um novo esquema no banco de dados | 2226 | * Cria um novo esquema no banco de dados |
@@ -2239,9 +2239,9 @@ class Metaestat{ | @@ -2239,9 +2239,9 @@ class Metaestat{ | ||
2239 | * @return execSQLDB | 2239 | * @return execSQLDB |
2240 | */ | 2240 | */ |
2241 | function tabelasEsquema($codigo_estat_conexao,$nome_esquema,$excluigeom=""){ | 2241 | function tabelasEsquema($codigo_estat_conexao,$nome_esquema,$excluigeom=""){ |
2242 | - $sql = "SELECT table_name as tabela FROM information_schema.tables where table_schema = '$nome_esquema'"; | 2242 | + $sql = "SELECT table_name as tabela FROM information_schema.tables where table_schema = '$nome_esquema' AND table_schema NOT LIKE 'i3geo%' AND table_schema NOT LIKE 'pg_%' AND table_schema NOT LIKE '%_schema%'"; |
2243 | if(strtolower($excluigeom) == "sim"){ | 2243 | if(strtolower($excluigeom) == "sim"){ |
2244 | - $sql = "SELECT c.table_name as tabela FROM information_schema.tables as c left join (SELECT distinct a.table_name FROM information_schema.tables as a left join information_schema.columns as b on a.table_name = b.table_name where a.table_schema = '$nome_esquema' and udt_name = 'geometry' ) as d on c.table_name = d.table_name where c.table_schema = '$nome_esquema' and d.table_name is null"; | 2244 | + $sql = "SELECT c.table_name as tabela FROM information_schema.tables as c left join (SELECT distinct a.table_name FROM information_schema.tables as a left join information_schema.columns as b on a.table_name = b.table_name where a.table_schema = '$nome_esquema' and udt_name = 'geometry' ) as d on c.table_name = d.table_name where c.table_schema = '$nome_esquema' AND c.table_schema NOT LIKE 'i3geo%' AND c.table_schema NOT LIKE 'pg_%' AND c.table_schema NOT LIKE '%_schema%' and d.table_name is null"; |
2245 | } | 2245 | } |
2246 | return $this->execSQLDB($codigo_estat_conexao,$sql); | 2246 | return $this->execSQLDB($codigo_estat_conexao,$sql); |
2247 | } | 2247 | } |
admin/php/metaestat.php
@@ -38,7 +38,7 @@ Cada opera&ccedil;&atilde;o possu&iacute; seus proprios par&acirc;metros, que de | @@ -38,7 +38,7 @@ Cada opera&ccedil;&atilde;o possu&iacute; seus proprios par&acirc;metros, que de | ||
38 | */ | 38 | */ |
39 | include_once(dirname(__FILE__)."/login.php"); | 39 | include_once(dirname(__FILE__)."/login.php"); |
40 | 40 | ||
41 | -$codigo_estat_conexao = $_GET["codigo_estat_conexao"]; | 41 | +$codigo_estat_conexao = $_GET["codigo_estat_conexao"];//pode ser string ou numerico |
42 | $codigo_variavel = $_GET["codigo_variavel"]; | 42 | $codigo_variavel = $_GET["codigo_variavel"]; |
43 | $codigo_tipo_periodo = $_GET["codigo_tipo_periodo"]; | 43 | $codigo_tipo_periodo = $_GET["codigo_tipo_periodo"]; |
44 | $codigo_tipo_regiao = $_GET["codigo_tipo_regiao"]; | 44 | $codigo_tipo_regiao = $_GET["codigo_tipo_regiao"]; |
@@ -56,7 +56,7 @@ $id_mapa_grupo = $_GET["id_mapa_grupo"]; | @@ -56,7 +56,7 @@ $id_mapa_grupo = $_GET["id_mapa_grupo"]; | ||
56 | $id_mapa_tema = $_GET["id_mapa_tema"]; | 56 | $id_mapa_tema = $_GET["id_mapa_tema"]; |
57 | $id_pai = $_GET["id_pai"]; | 57 | $id_pai = $_GET["id_pai"]; |
58 | 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]); | 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_variavel,$id_medida_variavel,$id_classificacao,$id_link,$id_classe,$id_parametro_medida]); |
60 | 60 | ||
61 | //lista de funcoes que passam pela validacao de login | 61 | //lista de funcoes que passam pela validacao de login |
62 | $funcoesEdicao = array( | 62 | $funcoesEdicao = array( |
@@ -93,13 +93,6 @@ $funcoesEdicao = array( | @@ -93,13 +93,6 @@ $funcoesEdicao = array( | ||
93 | "EXCLUIRCLASSIFICACAOMEDIDA", | 93 | "EXCLUIRCLASSIFICACAOMEDIDA", |
94 | "EXCLUIRCLASSECLASSIFICACAO", | 94 | "EXCLUIRCLASSECLASSIFICACAO", |
95 | "EXCLUIRLINKMEDIDA", | 95 | "EXCLUIRLINKMEDIDA", |
96 | - "CRIATABELADB", | ||
97 | - "CRIAESQUEMADB", | ||
98 | - "ALTERANOMETABELADB", | ||
99 | - "ALTERANOMEESQUEMADB", | ||
100 | - "COPIATABELADB", | ||
101 | - "CRIACOLUNADB", | ||
102 | - "ALTERANOMECOLUNADB", | ||
103 | "OBTEMDADOSTABELADB", | 96 | "OBTEMDADOSTABELADB", |
104 | "INSERIRDADOS", | 97 | "INSERIRDADOS", |
105 | "MANTEMDADOSREGIAO", | 98 | "MANTEMDADOSREGIAO", |
@@ -122,7 +115,7 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){ | @@ -122,7 +115,7 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
122 | retornaJSON($esquema);exit; | 115 | retornaJSON($esquema);exit; |
123 | } | 116 | } |
124 | if(strtoupper($funcao) == "TABELASESQUEMA"){ | 117 | if(strtoupper($funcao) == "TABELASESQUEMA"){ |
125 | - if($nome_esquema != "public"){ | 118 | + if($_GET["nome_esquema"] != "public"){ |
126 | retornaJSON("Vc nao pode realizar essa operacao.");exit; | 119 | retornaJSON("Vc nao pode realizar essa operacao.");exit; |
127 | } | 120 | } |
128 | } | 121 | } |
@@ -131,6 +124,25 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){ | @@ -131,6 +124,25 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
131 | } | 124 | } |
132 | } | 125 | } |
133 | } | 126 | } |
127 | +//verifica as funcoes que manipulam o banco de dados | ||
128 | +$funcoesEdicao = array( | ||
129 | + "CRIATABELADB", | ||
130 | + "CRIAESQUEMADB", | ||
131 | + "ALTERANOMETABELADB", | ||
132 | + "ALTERANOMEESQUEMADB", | ||
133 | + "COPIATABELADB", | ||
134 | + "CRIACOLUNADB", | ||
135 | + "ALTERANOMECOLUNADB", | ||
136 | +); | ||
137 | +if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
138 | + if(verificaOperacaoSessao("admin/metaestat/editorbanco") == false){ | ||
139 | + retornaJSON("Vc nao pode realizar essa operacao.");exit; | ||
140 | + } | ||
141 | +} | ||
142 | + | ||
143 | + | ||
144 | + | ||
145 | + | ||
134 | include(dirname(__FILE__)."/classe_metaestat.php"); | 146 | include(dirname(__FILE__)."/classe_metaestat.php"); |
135 | error_reporting(0); | 147 | error_reporting(0); |
136 | //faz a busca da função que deve ser executada | 148 | //faz a busca da função que deve ser executada |