Commit 09d3bedf841949034c8a88bd47ad23d257cdd582

Authored by Edmar Moretti
1 parent 76f1ce06
Exists in master

Ativacao da funcao parametrossql passando a usar libcurl para obtenção dos dados…

… utilizados nos parâmetros
classesphp/funcoes_gerais.php
... ... @@ -2879,7 +2879,7 @@ mapa - objeto mapa destino do simbolo clonado
2879 2879 function cloneInlineSymbol($layern,$nmapa,$mapa){
2880 2880 $versao = versao();
2881 2881 if($versao["principal"] > 5){
2882   - $numclasses = $layern->numclasses;
  2882 + $numclasses = $layern->numclasses;
2883 2883 for($ci=0;$ci < $numclasses;$ci++){
2884 2884 $classe = $layern->getclass($ci);
2885 2885 $numestilos = $classe->numstyles;
... ... @@ -2891,13 +2891,15 @@ function cloneInlineSymbol($layern,$nmapa,$mapa){
2891 2891 if($simbolo->inmapfile == MS_TRUE || file_exists($nomesimbolo)){
2892 2892 $simbolon = new symbolObj($mapa, $nomesimbolo);
2893 2893 $simbolon->set("inmapfile",MS_TRUE);
  2894 +
2894 2895 $simbolon->setImagePath($simbolo->imagepath);
2895 2896 $simbolon->setPoints($simbolo->getPointsArray());
2896 2897 //$simbolon->setPattern($simbolo->getPatternArray());
2897 2898 $simbolon->set("type",$simbolo->type);
2898   - $simbolon->set("antialias",$simbolo->antialias);
  2899 + //$simbolon->set("antialias",$simbolo->antialias);
2899 2900 $simbolon->set("character",$simbolo->character);
2900 2901 $simbolon->set("filled",$simbolo->filled);
  2902 +
2901 2903 //$simbolon->set("font",$simbolo->font);
2902 2904 //$simbolon->set("position",$simbolo->position);
2903 2905 $simbolon->set("sizex",$simbolo->sizex);
... ...
classesphp/sani_request.php
... ... @@ -3,7 +3,7 @@ if (basename(__FILE__) == basename($_SERVER[&#39;SCRIPT_FILENAME&#39;])){
3 3 exit;
4 4 }
5 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 7 if (isset($_GET)){
8 8 foreach(array_keys($_GET) as $k) {
9 9 $k = str_ireplace($bl,"",$k);
... ... @@ -16,7 +16,6 @@ if (isset($_GET)){
16 16 }
17 17 }
18 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 19 if (isset($_POST)){
21 20 if (isset($_POST["cpaint_argument"]) && $_POST["cpaint_argument"][0] != "")
22 21 {
... ... @@ -28,7 +27,6 @@ if (isset($_POST)){
28 27 else{
29 28 $argumento_ = str_replace("\"","",$argumento_);
30 29 }
31   -
32 30 $argumento_ = explode('"',$argumento_);
33 31 $argumento_ = implode("&",$argumento_);
34 32 $parametros_ = explode("&",$argumento_);
... ...
ferramentas/parametrossql/exec.php
1 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 6 //faz a busca da fun&ccedil;&atilde;o que deve ser executada
6 7 //
... ... @@ -55,6 +56,7 @@ switch (strtoupper($funcao))
55 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 58 case "APLICAR":
  59 + $valores = $_GET["valores"];
58 60 $map = ms_newMapObj($map_file);
59 61 //pega o layer
60 62 $layer = $map->getlayerbyname($tema);
... ... @@ -130,19 +132,19 @@ switch (strtoupper($funcao))
130 132 * Utilizado para pegar a lista de valores que sera apresentada ao usuario
131 133 */
132 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 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 1 <?php
2   -exit;
3 2 /**
4 3 Esse programa e uma adaptacao do codigo i3geo/ogc.php
5 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 &quot;plugin&quot;, aplicando os filtr
9 8 no plugin parametrossql
10 9 */
11 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 13 include(dirname(__FILE__)."/../../ms_configura.php");
14 14 include(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php");
15 15 $_GET = array_merge($_GET,$_POST);
  16 +$plugin = $_GET["plugin"];
16 17 $projDefault = pegaProjecaoDefault();
17 18  
18 19 $tema = basename($_GET["tema"]);
... ... @@ -156,7 +157,7 @@ else{
156 157 }
157 158 }
158 159 //aplica os parametros especificos do plugin
159   - $data = $l->data;
  160 + $data = $l->data;
160 161 $c = $l->getmetadata("PLUGINI3GEO");
161 162 if($c != ""){
162 163 $cs = json_decode($c,true);
... ... @@ -167,7 +168,6 @@ else{
167 168 }
168 169 $chaves = implode(",",$chaves);
169 170 $filtro = $l->getFilterString();
170   -
171 171 $chaves = str_ireplace(array(" and ", " or ", "select","from","where","update","delete","insert","--"),"",$chaves);
172 172 $chaves = explode(",",$chaves);
173 173 $n = count($chaves);
... ... @@ -185,7 +185,7 @@ else{
185 185 $plugin[] = $temp[0];
186 186 }
187 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 206 if($filtro != ""){
207 207 $l->setfilter($filtro);
208 208 }
209   -
210 209 $l->set("data",$data);
211 210 //acrecenta-se um md5 apos o nome caso seja necessario gerar cache
212 211 if($cache == true){
... ... @@ -577,11 +576,17 @@ function salvaCacheImagem($cachedir,$map,$tms, $plugin, $tema){
577 576 exit;
578 577 }
579 578 function execProg($prog){
580   - $prog = str_replace(".php","",$prog);
581   - $prog = str_replace(".","",$prog).".php";
582   - include($prog);
583 579 //$retorno variavel deve ser retornada pelo programa $prog
584 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 590 return $retorno[0]["v"];
586 591 }
587 592 ?>
... ...
ogc.php
... ... @@ -1455,7 +1455,7 @@ function exportaCsv(){
1455 1455 $linhas[] = implode(",",$items).",wkt";
1456 1456 }
1457 1457 for ($i = 0; $i < $res_count; $i++){
1458   - if($versao == 6){
  1458 + if($versao >= 6){
1459 1459 $shape = $layer->getShape($layer->getResult($i));
1460 1460 }
1461 1461 else{
... ... @@ -1497,7 +1497,7 @@ function exportaGeojson(){
1497 1497  
1498 1498 $features = array();
1499 1499 for ($i = 0; $i < $res_count; $i++){
1500   - if($versao == 6){
  1500 + if($versao >= 6){
1501 1501 $shape = $layer->getShape($layer->getResult($i));
1502 1502 }
1503 1503 else{
... ...
testamapfile.php
... ... @@ -104,7 +104,7 @@ if ($tipo == &quot;&quot;)
104 104 echo '<script>';
105 105 echo 'function roda(){window.location.href = "?map="+document.getElementById("nomemap").value;}';
106 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 108 echo '</script>';
109 109 echo '<script src="admin/js/core.js"></script>';
110 110 echo '<script src="admin/dicionario/core.js"></script>';
... ...