Commit 09d3bedf841949034c8a88bd47ad23d257cdd582
1 parent
76f1ce06
Exists in
master
Ativacao da funcao parametrossql passando a usar libcurl para obtenção dos dados…
… utilizados nos parâmetros
Showing
6 changed files
with
39 additions
and
32 deletions
Show diff stats
classesphp/funcoes_gerais.php
@@ -2879,7 +2879,7 @@ mapa - objeto mapa destino do simbolo clonado | @@ -2879,7 +2879,7 @@ mapa - objeto mapa destino do simbolo clonado | ||
2879 | function cloneInlineSymbol($layern,$nmapa,$mapa){ | 2879 | function cloneInlineSymbol($layern,$nmapa,$mapa){ |
2880 | $versao = versao(); | 2880 | $versao = versao(); |
2881 | if($versao["principal"] > 5){ | 2881 | if($versao["principal"] > 5){ |
2882 | - $numclasses = $layern->numclasses; | 2882 | + $numclasses = $layern->numclasses; |
2883 | for($ci=0;$ci < $numclasses;$ci++){ | 2883 | for($ci=0;$ci < $numclasses;$ci++){ |
2884 | $classe = $layern->getclass($ci); | 2884 | $classe = $layern->getclass($ci); |
2885 | $numestilos = $classe->numstyles; | 2885 | $numestilos = $classe->numstyles; |
@@ -2891,13 +2891,15 @@ function cloneInlineSymbol($layern,$nmapa,$mapa){ | @@ -2891,13 +2891,15 @@ function cloneInlineSymbol($layern,$nmapa,$mapa){ | ||
2891 | if($simbolo->inmapfile == MS_TRUE || file_exists($nomesimbolo)){ | 2891 | if($simbolo->inmapfile == MS_TRUE || file_exists($nomesimbolo)){ |
2892 | $simbolon = new symbolObj($mapa, $nomesimbolo); | 2892 | $simbolon = new symbolObj($mapa, $nomesimbolo); |
2893 | $simbolon->set("inmapfile",MS_TRUE); | 2893 | $simbolon->set("inmapfile",MS_TRUE); |
2894 | + | ||
2894 | $simbolon->setImagePath($simbolo->imagepath); | 2895 | $simbolon->setImagePath($simbolo->imagepath); |
2895 | $simbolon->setPoints($simbolo->getPointsArray()); | 2896 | $simbolon->setPoints($simbolo->getPointsArray()); |
2896 | //$simbolon->setPattern($simbolo->getPatternArray()); | 2897 | //$simbolon->setPattern($simbolo->getPatternArray()); |
2897 | $simbolon->set("type",$simbolo->type); | 2898 | $simbolon->set("type",$simbolo->type); |
2898 | - $simbolon->set("antialias",$simbolo->antialias); | 2899 | + //$simbolon->set("antialias",$simbolo->antialias); |
2899 | $simbolon->set("character",$simbolo->character); | 2900 | $simbolon->set("character",$simbolo->character); |
2900 | $simbolon->set("filled",$simbolo->filled); | 2901 | $simbolon->set("filled",$simbolo->filled); |
2902 | + | ||
2901 | //$simbolon->set("font",$simbolo->font); | 2903 | //$simbolon->set("font",$simbolo->font); |
2902 | //$simbolon->set("position",$simbolo->position); | 2904 | //$simbolon->set("position",$simbolo->position); |
2903 | $simbolon->set("sizex",$simbolo->sizex); | 2905 | $simbolon->set("sizex",$simbolo->sizex); |
classesphp/sani_request.php
@@ -3,7 +3,7 @@ if (basename(__FILE__) == basename($_SERVER['SCRIPT_FILENAME'])){ | @@ -3,7 +3,7 @@ if (basename(__FILE__) == basename($_SERVER['SCRIPT_FILENAME'])){ | ||
3 | exit; | 3 | exit; |
4 | } | 4 | } |
5 | error_reporting(0); | 5 | error_reporting(0); |
6 | -$bl = array("password","select","_decode","php","eval","passthru","shell_exec","escapeshellarg","escapeshellcmd","proc_close","proc_open","dl","popen","contents","delete","drop","update","insert","exec","system",";"); | 6 | +$bl = array("exec ","exec(","password","select","_decode","passthru","shell_exec","escapeshellarg","escapeshellcmd","proc_close","proc_open","dl","popen","contents","delete","drop","update","insert","system",";"); |
7 | if (isset($_GET)){ | 7 | if (isset($_GET)){ |
8 | foreach(array_keys($_GET) as $k) { | 8 | foreach(array_keys($_GET) as $k) { |
9 | $k = str_ireplace($bl,"",$k); | 9 | $k = str_ireplace($bl,"",$k); |
@@ -16,7 +16,6 @@ if (isset($_GET)){ | @@ -16,7 +16,6 @@ if (isset($_GET)){ | ||
16 | } | 16 | } |
17 | } | 17 | } |
18 | //array(3) { ["cpaint_function"]=> string(8) "criaMapa" ["cpaint_argument"]=> array(1) { [0]=> string(54) ""funcao=criaMapa&&desligar=mundo&interface=openlayers"" } ["cpaint_response_type"]=> string(4) "JSON" } | 18 | //array(3) { ["cpaint_function"]=> string(8) "criaMapa" ["cpaint_argument"]=> array(1) { [0]=> string(54) ""funcao=criaMapa&&desligar=mundo&interface=openlayers"" } ["cpaint_response_type"]=> string(4) "JSON" } |
19 | - | ||
20 | if (isset($_POST)){ | 19 | if (isset($_POST)){ |
21 | if (isset($_POST["cpaint_argument"]) && $_POST["cpaint_argument"][0] != "") | 20 | if (isset($_POST["cpaint_argument"]) && $_POST["cpaint_argument"][0] != "") |
22 | { | 21 | { |
@@ -28,7 +27,6 @@ if (isset($_POST)){ | @@ -28,7 +27,6 @@ if (isset($_POST)){ | ||
28 | else{ | 27 | else{ |
29 | $argumento_ = str_replace("\"","",$argumento_); | 28 | $argumento_ = str_replace("\"","",$argumento_); |
30 | } | 29 | } |
31 | - | ||
32 | $argumento_ = explode('"',$argumento_); | 30 | $argumento_ = explode('"',$argumento_); |
33 | $argumento_ = implode("&",$argumento_); | 31 | $argumento_ = implode("&",$argumento_); |
34 | $parametros_ = explode("&",$argumento_); | 32 | $parametros_ = explode("&",$argumento_); |
ferramentas/parametrossql/exec.php
1 | <?php | 1 | <?php |
2 | -exit; | ||
3 | -include_once(dirname(__FILE__)."/../inicia.php"); | 2 | +include(dirname(__FILE__)."/../safe.php"); |
3 | +verificaBlFerramentas(basename(dirname(__FILE__)),$i3geoBlFerramentas,false); | ||
4 | +$tema = basename($_GET["tema"]); | ||
4 | // | 5 | // |
5 | //faz a busca da função que deve ser executada | 6 | //faz a busca da função que deve ser executada |
6 | // | 7 | // |
@@ -55,6 +56,7 @@ switch (strtoupper($funcao)) | @@ -55,6 +56,7 @@ switch (strtoupper($funcao)) | ||
55 | Aplica a substituicao de chaves pelos valores enviados no parametro $valores com os valores separados por virgulas na sequencia das chaves | 56 | Aplica a substituicao de chaves pelos valores enviados no parametro $valores com os valores separados por virgulas na sequencia das chaves |
56 | */ | 57 | */ |
57 | case "APLICAR": | 58 | case "APLICAR": |
59 | + $valores = $_GET["valores"]; | ||
58 | $map = ms_newMapObj($map_file); | 60 | $map = ms_newMapObj($map_file); |
59 | //pega o layer | 61 | //pega o layer |
60 | $layer = $map->getlayerbyname($tema); | 62 | $layer = $map->getlayerbyname($tema); |
@@ -130,19 +132,19 @@ switch (strtoupper($funcao)) | @@ -130,19 +132,19 @@ switch (strtoupper($funcao)) | ||
130 | * Utilizado para pegar a lista de valores que sera apresentada ao usuario | 132 | * Utilizado para pegar a lista de valores que sera apresentada ao usuario |
131 | */ | 133 | */ |
132 | case "INCLUDEPROG": | 134 | case "INCLUDEPROG": |
133 | - //evita redirecoina o programa para algum lugar indevido | ||
134 | - $prog = str_replace(".php","",$prog); | ||
135 | - $prog = str_replace(".","",$prog).".php"; | ||
136 | - if(file_exists($locaplic."/".$prog)){ | ||
137 | - include($locaplic."/".$prog); | ||
138 | - } | 135 | + $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); |
136 | + $protocolo = $protocolo[0]; | ||
137 | + $protocolo1 = strtolower($protocolo) . '://'.$_SERVER['SERVER_NAME']; | ||
138 | + $protocolo = strtolower($protocolo) . '://'.$_SERVER['SERVER_NAME'] .":". $_SERVER['SERVER_PORT']; | ||
139 | + $urli3geo = str_replace("/ferramentas/parametrossql/exec.php","",$protocolo.$_SERVER["PHP_SELF"]); | ||
140 | + $handle = curl_init(); | ||
141 | + curl_setopt( $handle, CURLOPT_URL, $urli3geo."/".$_GET["prog"]); | ||
142 | + curl_setopt( $handle, CURLOPT_HEADER, false ); | ||
143 | + curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); | ||
144 | + $retorno = curl_exec( $handle ); | ||
145 | + curl_close( $handle ); | ||
146 | + $retorno = json_decode($retorno,true); | ||
139 | break; | 147 | break; |
140 | } | 148 | } |
141 | -if (!connection_aborted()){ | ||
142 | - cpjson($retorno); | ||
143 | -} | ||
144 | -else{ | ||
145 | - exit(); | ||
146 | -} | ||
147 | - | 149 | +cpjson($retorno); |
148 | ?> | 150 | ?> |
ferramentas/parametrossql/ogc.php
1 | <?php | 1 | <?php |
2 | -exit; | ||
3 | /** | 2 | /** |
4 | Esse programa e uma adaptacao do codigo i3geo/ogc.php | 3 | Esse programa e uma adaptacao do codigo i3geo/ogc.php |
5 | E utilizado no mashup (i3geo/mashup) nas camadas que sao configuradas cm o plugin parametrossql | 4 | E utilizado no mashup (i3geo/mashup) nas camadas que sao configuradas cm o plugin parametrossql |
@@ -9,10 +8,12 @@ A diferenca e que esse servico processa o parametro "plugin", aplicando os filtr | @@ -9,10 +8,12 @@ A diferenca e que esse servico processa o parametro "plugin", aplicando os filtr | ||
9 | no plugin parametrossql | 8 | no plugin parametrossql |
10 | */ | 9 | */ |
11 | $cache = true; | 10 | $cache = true; |
12 | -include(dirname(__FILE__)."/classesphp/sani_request.php"); | 11 | +include(dirname(__FILE__)."/../../classesphp/sani_request.php"); |
12 | +include_once (dirname(__FILE__)."/../../classesphp/carrega_ext.php"); | ||
13 | include(dirname(__FILE__)."/../../ms_configura.php"); | 13 | include(dirname(__FILE__)."/../../ms_configura.php"); |
14 | include(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php"); | 14 | include(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php"); |
15 | $_GET = array_merge($_GET,$_POST); | 15 | $_GET = array_merge($_GET,$_POST); |
16 | +$plugin = $_GET["plugin"]; | ||
16 | $projDefault = pegaProjecaoDefault(); | 17 | $projDefault = pegaProjecaoDefault(); |
17 | 18 | ||
18 | $tema = basename($_GET["tema"]); | 19 | $tema = basename($_GET["tema"]); |
@@ -156,7 +157,7 @@ else{ | @@ -156,7 +157,7 @@ else{ | ||
156 | } | 157 | } |
157 | } | 158 | } |
158 | //aplica os parametros especificos do plugin | 159 | //aplica os parametros especificos do plugin |
159 | - $data = $l->data; | 160 | + $data = $l->data; |
160 | $c = $l->getmetadata("PLUGINI3GEO"); | 161 | $c = $l->getmetadata("PLUGINI3GEO"); |
161 | if($c != ""){ | 162 | if($c != ""){ |
162 | $cs = json_decode($c,true); | 163 | $cs = json_decode($c,true); |
@@ -167,7 +168,6 @@ else{ | @@ -167,7 +168,6 @@ else{ | ||
167 | } | 168 | } |
168 | $chaves = implode(",",$chaves); | 169 | $chaves = implode(",",$chaves); |
169 | $filtro = $l->getFilterString(); | 170 | $filtro = $l->getFilterString(); |
170 | - | ||
171 | $chaves = str_ireplace(array(" and ", " or ", "select","from","where","update","delete","insert","--"),"",$chaves); | 171 | $chaves = str_ireplace(array(" and ", " or ", "select","from","where","update","delete","insert","--"),"",$chaves); |
172 | $chaves = explode(",",$chaves); | 172 | $chaves = explode(",",$chaves); |
173 | $n = count($chaves); | 173 | $n = count($chaves); |
@@ -185,7 +185,7 @@ else{ | @@ -185,7 +185,7 @@ else{ | ||
185 | $plugin[] = $temp[0]; | 185 | $plugin[] = $temp[0]; |
186 | } | 186 | } |
187 | elseif ($c["prog"] != ""){ | 187 | elseif ($c["prog"] != ""){ |
188 | - $plugin[] = execProg($locaplic."/".$c["prog"]); | 188 | + $plugin[] = execProg($c["prog"]); |
189 | } | 189 | } |
190 | } | 190 | } |
191 | } | 191 | } |
@@ -206,7 +206,6 @@ else{ | @@ -206,7 +206,6 @@ else{ | ||
206 | if($filtro != ""){ | 206 | if($filtro != ""){ |
207 | $l->setfilter($filtro); | 207 | $l->setfilter($filtro); |
208 | } | 208 | } |
209 | - | ||
210 | $l->set("data",$data); | 209 | $l->set("data",$data); |
211 | //acrecenta-se um md5 apos o nome caso seja necessario gerar cache | 210 | //acrecenta-se um md5 apos o nome caso seja necessario gerar cache |
212 | if($cache == true){ | 211 | if($cache == true){ |
@@ -577,11 +576,17 @@ function salvaCacheImagem($cachedir,$map,$tms, $plugin, $tema){ | @@ -577,11 +576,17 @@ function salvaCacheImagem($cachedir,$map,$tms, $plugin, $tema){ | ||
577 | exit; | 576 | exit; |
578 | } | 577 | } |
579 | function execProg($prog){ | 578 | function execProg($prog){ |
580 | - $prog = str_replace(".php","",$prog); | ||
581 | - $prog = str_replace(".","",$prog).".php"; | ||
582 | - include($prog); | ||
583 | //$retorno variavel deve ser retornada pelo programa $prog | 579 | //$retorno variavel deve ser retornada pelo programa $prog |
584 | //veja como exemplo i3geo/aplicmap/daods/listaano.php | 580 | //veja como exemplo i3geo/aplicmap/daods/listaano.php |
581 | + global $urli3geo; | ||
582 | + $u = str_replace("/ferramentas/parametrossql","",$urli3geo); | ||
583 | + $handle = curl_init(); | ||
584 | + curl_setopt( $handle, CURLOPT_URL, $u."/".$prog); | ||
585 | + curl_setopt( $handle, CURLOPT_HEADER, false ); | ||
586 | + curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); | ||
587 | + $str = curl_exec( $handle ); | ||
588 | + curl_close( $handle ); | ||
589 | + $retorno = json_decode($str,true); | ||
585 | return $retorno[0]["v"]; | 590 | return $retorno[0]["v"]; |
586 | } | 591 | } |
587 | ?> | 592 | ?> |
ogc.php
@@ -1455,7 +1455,7 @@ function exportaCsv(){ | @@ -1455,7 +1455,7 @@ function exportaCsv(){ | ||
1455 | $linhas[] = implode(",",$items).",wkt"; | 1455 | $linhas[] = implode(",",$items).",wkt"; |
1456 | } | 1456 | } |
1457 | for ($i = 0; $i < $res_count; $i++){ | 1457 | for ($i = 0; $i < $res_count; $i++){ |
1458 | - if($versao == 6){ | 1458 | + if($versao >= 6){ |
1459 | $shape = $layer->getShape($layer->getResult($i)); | 1459 | $shape = $layer->getShape($layer->getResult($i)); |
1460 | } | 1460 | } |
1461 | else{ | 1461 | else{ |
@@ -1497,7 +1497,7 @@ function exportaGeojson(){ | @@ -1497,7 +1497,7 @@ function exportaGeojson(){ | ||
1497 | 1497 | ||
1498 | $features = array(); | 1498 | $features = array(); |
1499 | for ($i = 0; $i < $res_count; $i++){ | 1499 | for ($i = 0; $i < $res_count; $i++){ |
1500 | - if($versao == 6){ | 1500 | + if($versao >= 6){ |
1501 | $shape = $layer->getShape($layer->getResult($i)); | 1501 | $shape = $layer->getShape($layer->getResult($i)); |
1502 | } | 1502 | } |
1503 | else{ | 1503 | else{ |
testamapfile.php
@@ -104,7 +104,7 @@ if ($tipo == "") | @@ -104,7 +104,7 @@ if ($tipo == "") | ||
104 | echo '<script>'; | 104 | echo '<script>'; |
105 | echo 'function roda(){window.location.href = "?map="+document.getElementById("nomemap").value;}'; | 105 | echo 'function roda(){window.location.href = "?map="+document.getElementById("nomemap").value;}'; |
106 | echo 'function rodaTabela(){window.location.href = window.location.href+"&tabela";}'; | 106 | echo 'function rodaTabela(){window.location.href = window.location.href+"&tabela";}'; |
107 | - echo 'i3GEO.configura.locaplic = i3GEO.util.protocolo() + "://" + window.location.host + "/i3geo";'; | 107 | + echo 'i3GEO.configura.locaplic = i3GEO.util.protocolo() + "://" + window.location.host + "/'.basename(dirname(__FILE__)).'";'; |
108 | echo '</script>'; | 108 | echo '</script>'; |
109 | echo '<script src="admin/js/core.js"></script>'; | 109 | echo '<script src="admin/js/core.js"></script>'; |
110 | echo '<script src="admin/dicionario/core.js"></script>'; | 110 | echo '<script src="admin/dicionario/core.js"></script>'; |