Commit 0165c046e603b47feba159b0e49e3a8837a71a47
1 parent
21d5d2f1
Exists in
master
and in
7 other branches
Ativacao da funcao parametrossql e correção no endereço da aplicação no testamapfile.php
Showing
7 changed files
with
61 additions
and
44 deletions
Show diff stats
aplicmap/dados/listaano.php
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 | // |
@@ -130,19 +131,19 @@ switch (strtoupper($funcao)) | @@ -130,19 +131,19 @@ switch (strtoupper($funcao)) | ||
130 | * Utilizado para pegar a lista de valores que sera apresentada ao usuario | 131 | * Utilizado para pegar a lista de valores que sera apresentada ao usuario |
131 | */ | 132 | */ |
132 | case "INCLUDEPROG": | 133 | 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 | - } | 134 | + $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); |
135 | + $protocolo = $protocolo[0]; | ||
136 | + $protocolo1 = strtolower($protocolo) . '://'.$_SERVER['SERVER_NAME']; | ||
137 | + $protocolo = strtolower($protocolo) . '://'.$_SERVER['SERVER_NAME'] .":". $_SERVER['SERVER_PORT']; | ||
138 | + $urli3geo = str_replace("/ferramentas/parametrossql/exec.php","",$protocolo.$_SERVER["PHP_SELF"]); | ||
139 | + $handle = curl_init(); | ||
140 | + curl_setopt( $handle, CURLOPT_URL, $urli3geo."/".$_GET["prog"]); | ||
141 | + curl_setopt( $handle, CURLOPT_HEADER, false ); | ||
142 | + curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); | ||
143 | + $retorno = curl_exec( $handle ); | ||
144 | + curl_close( $handle ); | ||
145 | + $retorno = json_decode($retorno,true); | ||
139 | break; | 146 | break; |
140 | } | 147 | } |
141 | -if (!connection_aborted()){ | ||
142 | - cpjson($retorno); | ||
143 | -} | ||
144 | -else{ | ||
145 | - exit(); | ||
146 | -} | ||
147 | - | 148 | +cpjson($retorno); |
148 | ?> | 149 | ?> |
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 | ?> |
json.php
@@ -440,7 +440,7 @@ function processaPluginI3geo(){ | @@ -440,7 +440,7 @@ function processaPluginI3geo(){ | ||
440 | $plugin[] = $temp[0]; | 440 | $plugin[] = $temp[0]; |
441 | } | 441 | } |
442 | elseif ($c["prog"] != ""){ | 442 | elseif ($c["prog"] != ""){ |
443 | - $plugin[] = execProg($locaplic."/".$c["prog"]); | 443 | + $plugin[] = execProg($c["prog"]); |
444 | } | 444 | } |
445 | } | 445 | } |
446 | } | 446 | } |
@@ -467,9 +467,16 @@ function processaPluginI3geo(){ | @@ -467,9 +467,16 @@ function processaPluginI3geo(){ | ||
467 | } | 467 | } |
468 | //utilizada para obter os dados default quando se utiliza o plugin parametrossql | 468 | //utilizada para obter os dados default quando se utiliza o plugin parametrossql |
469 | function execProg($prog){ | 469 | function execProg($prog){ |
470 | - include($prog); | ||
471 | //$retorno variavel deve ser retornada pelo programa $prog | 470 | //$retorno variavel deve ser retornada pelo programa $prog |
472 | //veja como exemplo i3geo/aplicmap/daods/listaano.php | 471 | //veja como exemplo i3geo/aplicmap/daods/listaano.php |
472 | + global $urli3geo; | ||
473 | + $handle = curl_init(); | ||
474 | + curl_setopt( $handle, CURLOPT_URL, $urli3geo."/".$prog); | ||
475 | + curl_setopt( $handle, CURLOPT_HEADER, false ); | ||
476 | + curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); | ||
477 | + $str = curl_exec( $handle ); | ||
478 | + curl_close( $handle ); | ||
479 | + $retorno = json_decode($str,true); | ||
473 | return $retorno[0]["v"]; | 480 | return $retorno[0]["v"]; |
474 | } | 481 | } |
475 | function converteenc($texto){ | 482 | function converteenc($texto){ |
ogc.php
@@ -78,6 +78,7 @@ ogc.php?tema=/var/www/i3geo/aplicmap/geral1debianv6.map&layers=mundo | @@ -78,6 +78,7 @@ ogc.php?tema=/var/www/i3geo/aplicmap/geral1debianv6.map&layers=mundo | ||
78 | 78 | ||
79 | */ | 79 | */ |
80 | include(dirname(__FILE__)."/classesphp/sani_request.php"); | 80 | include(dirname(__FILE__)."/classesphp/sani_request.php"); |
81 | +include_once (dirname(__FILE__)."/classesphp/carrega_ext.php"); | ||
81 | include(dirname(__FILE__)."/ms_configura.php"); | 82 | include(dirname(__FILE__)."/ms_configura.php"); |
82 | $_GET = array_merge($_GET,$_POST); | 83 | $_GET = array_merge($_GET,$_POST); |
83 | 84 | ||
@@ -768,7 +769,6 @@ else{ | @@ -768,7 +769,6 @@ else{ | ||
768 | $oMap->setSymbolSet($locaplic."/symbols/".basename($oMap->symbolsetfilename)); | 769 | $oMap->setSymbolSet($locaplic."/symbols/".basename($oMap->symbolsetfilename)); |
769 | $oMap->setFontSet($locaplic."/symbols/".basename($oMap->fontsetfilename)); | 770 | $oMap->setFontSet($locaplic."/symbols/".basename($oMap->fontsetfilename)); |
770 | //verifica se existem layers com plugin definido e processa conforme o tipo de plugin | 771 | //verifica se existem layers com plugin definido e processa conforme o tipo de plugin |
771 | - | ||
772 | processaPluginI3geo(); | 772 | processaPluginI3geo(); |
773 | // | 773 | // |
774 | //caso seja download ou json ou csv | 774 | //caso seja download ou json ou csv |
@@ -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{ |
@@ -1540,14 +1540,13 @@ function converteenc($texto){ | @@ -1540,14 +1540,13 @@ function converteenc($texto){ | ||
1540 | } | 1540 | } |
1541 | function processaPluginI3geo(){ | 1541 | function processaPluginI3geo(){ |
1542 | global $oMap, $locaplic; | 1542 | global $oMap, $locaplic; |
1543 | - return; | ||
1544 | $numlayers = $oMap->numlayers; | 1543 | $numlayers = $oMap->numlayers; |
1545 | for ($i=0;$i < $numlayers;$i++){ | 1544 | for ($i=0;$i < $numlayers;$i++){ |
1546 | - $l = $oMap->getlayer($i); | ||
1547 | - $c = $l->getmetadata("PLUGINI3GEO"); | 1545 | + $l = $oMap->getlayer($i); |
1546 | + $c = $l->getmetadata("PLUGINI3GEO"); | ||
1548 | if($c != ""){ | 1547 | if($c != ""){ |
1549 | $cs = json_decode($c,true); | 1548 | $cs = json_decode($c,true); |
1550 | - if($cs["plugin"] == "parametrossql"){ | 1549 | + if($cs["plugin"] == "parametrossql"){ |
1551 | $data = $l->data; | 1550 | $data = $l->data; |
1552 | $cs = $cs["parametros"]; | 1551 | $cs = $cs["parametros"]; |
1553 | $chaves = array(); | 1552 | $chaves = array(); |
@@ -1572,8 +1571,8 @@ function processaPluginI3geo(){ | @@ -1572,8 +1571,8 @@ function processaPluginI3geo(){ | ||
1572 | $temp = explode(",",$c["valores"]); | 1571 | $temp = explode(",",$c["valores"]); |
1573 | $plugin[] = $temp[0]; | 1572 | $plugin[] = $temp[0]; |
1574 | } | 1573 | } |
1575 | - elseif ($c["prog"] != ""){ | ||
1576 | - $plugin[] = execProg($locaplic."/".$c["prog"]); | 1574 | + elseif ($c["prog"] != ""){ |
1575 | + $plugin[] = execProg($c["prog"]); | ||
1577 | } | 1576 | } |
1578 | } | 1577 | } |
1579 | } | 1578 | } |
@@ -1593,7 +1592,7 @@ function processaPluginI3geo(){ | @@ -1593,7 +1592,7 @@ function processaPluginI3geo(){ | ||
1593 | } | 1592 | } |
1594 | if($filtro != ""){ | 1593 | if($filtro != ""){ |
1595 | $l->setfilter($filtro); | 1594 | $l->setfilter($filtro); |
1596 | - } | 1595 | + } |
1597 | $l->set("data",$data); | 1596 | $l->set("data",$data); |
1598 | } | 1597 | } |
1599 | } | 1598 | } |
@@ -1601,10 +1600,16 @@ function processaPluginI3geo(){ | @@ -1601,10 +1600,16 @@ function processaPluginI3geo(){ | ||
1601 | } | 1600 | } |
1602 | //utilizada para obter os dados default quando se utiliza o plugin parametrossql | 1601 | //utilizada para obter os dados default quando se utiliza o plugin parametrossql |
1603 | function execProg($prog){ | 1602 | function execProg($prog){ |
1604 | - return; | ||
1605 | - include($prog); | ||
1606 | - //$retorno variavel deve ser retornada pelo programa $prog | ||
1607 | - //veja como exemplo i3geo/aplicmap/daods/listaano.php | 1603 | + //$retorno variavel deve ser retornada pelo programa $prog |
1604 | + //veja como exemplo i3geo/aplicmap/daods/listaano.php | ||
1605 | + global $urli3geo; | ||
1606 | + $handle = curl_init(); | ||
1607 | + curl_setopt( $handle, CURLOPT_URL, $urli3geo."/".$prog); | ||
1608 | + curl_setopt( $handle, CURLOPT_HEADER, false ); | ||
1609 | + curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); | ||
1610 | + $str = curl_exec( $handle ); | ||
1611 | + curl_close( $handle ); | ||
1612 | + $retorno = json_decode($str,true); | ||
1608 | return $retorno[0]["v"]; | 1613 | return $retorno[0]["v"]; |
1609 | } | 1614 | } |
1610 | ?> | 1615 | ?> |
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>'; |