Commit d76d6d6533484f21041174eadc83cc83619e5219

Authored by Edmar Moretti
1 parent 88b52b42

Remoção de erro no programa que carrega os dados do visualizador da INDE e que e…

…stava gerando mensagens de warning no log do Apache
Showing 1 changed file with 16 additions and 17 deletions   Show diff stats
ferramentas/vinde/wmsindejson.php
... ... @@ -18,7 +18,7 @@ echo
18 18  
19 19 include(dirname(__FILE__)."/../../ms_configura.php");
20 20 include($locaplic."/classesphp/funcoes_gerais.php");
21   -$agora = intval(time() / 1000);
  21 +$agora = intval(time() / 10000);
22 22 $arq = $dir_tmp."/inde$agora.html";
23 23 if(!file_exists($arq)){
24 24 $ch = curl_init();
... ... @@ -92,13 +92,10 @@ for ($i=0;$i<$n;$i++){
92 92 $linhas = ($matches[2][0]);
93 93 $parametros[$b[0]] = $linhas;
94 94 if($b[0] == "groupOfKeeper"){
95   - if($gruposUnicos[$linhas] == ""){
  95 + if(empty($gruposUnicos[$linhas])){
96 96 $gruposUnicos[$linhas] = "a";
97   -
98 97 $linhas = $linhas." #$i";
99 98 $grupos[$linhas] = "";
100   - //echo "<pre>";
101   - //var_dump($matches);
102 99 if($grupos[$linhas]){
103 100 $grupos[$linhas] = array_merge($grupos[$linhas],array("l_".$i));
104 101 }
... ... @@ -110,11 +107,6 @@ for ($i=0;$i&lt;$n;$i++){
110 107 }
111 108 $layer[] = $parametros;
112 109 $layers[$i] = $layer;
113   - //$parametros = "{".implode($novalinha,",")."}";
114   - //$linha = str_replace('new OpenLayers.Layer.WMS(','',$linha);
115   - //$linha = str_replace('})','}',$linha);
116   - //$linha = str_replace("'",'"',$linha);
117   - //$novalinha[] = "[".trim($linha,",")."]";
118 110 }
119 111 }
120 112  
... ... @@ -131,7 +123,7 @@ foreach($chaves as $chave){
131 123 //echo count($hs);
132 124 $d = $hs;
133 125 array_shift($d);
134   - if($arvore[$hs[0]]){
  126 + if(array_key_exists(0,$hs) && array_key_exists($hs[0],$arvore)){
135 127 $arvore[$hs[0]] = array_merge($arvore[$hs[0]],noi($d,$arvore[$hs[0]]));
136 128 }
137 129 else{
... ... @@ -146,12 +138,14 @@ $final = array(
146 138 );
147 139 error_reporting(0);
148 140 ob_end_clean();
149   -if(extension_loaded('zlib'))
150   -{ob_start('ob_gzhandler');}
  141 +if(extension_loaded('zlib')){
  142 + ob_start('ob_gzhandler');
  143 +}
151 144 header("Content-type: text/html");
152 145 echo json_encode($final,true);
153   -if(extension_loaded('zlib'))
154   -{ob_end_flush();}
  146 +if(extension_loaded('zlib')){
  147 + ob_end_flush();
  148 +}
155 149  
156 150 //echo json_encode($novalinha,true);
157 151 //echo "{".implode($novalinha,",")."}";
... ... @@ -163,8 +157,13 @@ function noi($n,$l){
163 157 array_shift($d);
164 158 //echo count($n);
165 159 if(count($n) > 1){
166   - if($l[$n[0]]){
167   - $l[$n[0]] = array_merge($l[$n[0]],$n[1]);
  160 + if(array_key_exists(0,$n) && array_key_exists($n[0],$l)){
  161 + if(is_array($n[1])){
  162 + $l[$n[0]] = array_merge($l[$n[0]],$n[1]);
  163 + }
  164 + else{
  165 + $l[$n[0]] = $l[$n[0]];
  166 + }
168 167 }
169 168 else{
170 169 $l[$n[0]] = $n[1];
... ...