Commit 7387aa788bb267069e50e9f9ab7269a2b0730b43
1 parent
b6833c18
Exists in
master
and in
7 other branches
--no commit message
Showing
3 changed files
with
205 additions
and
42 deletions
Show diff stats
admin/js/estat_editor.js
| ... | ... | @@ -592,7 +592,7 @@ i3GEOadmin.editor = { |
| 592 | 592 | '<p class="paragrafo" ><input type=checkbox name=i3GEOuploadCriaMapfile id=i3GEOuploadCriaMapfile style="cursor:pointer;position:relative;top:2px;" /> Marque para criar o arquivo de configuração (mapfile) e visualizar os dados no mapa interativo (você poderá editar esse arquivo posteriormente no editor de mapfiles)' + |
| 593 | 593 | '<p class="paragrafo" ><input type="checkbox" id="incluiserialshp" name="incluiserialshp" style="cursor:pointer;position:relative;top:2px;"> Inclui uma coluna gid do tipo serial e chave primária com código único</p>' + |
| 594 | 594 | '<p class="paragrafo" ><input id=i3GEOuploadsubmit type="button" value="Enviar shapefile" size=12 />' + |
| 595 | - '<input type="hidden" name="MAX_FILE_SIZE" value="1000000">' + | |
| 595 | + '<input type="hidden" name="MAX_FILE_SIZE" value="100000000">' + | |
| 596 | 596 | '<input type="hidden" id="i3GEOuploadcodigoconexao" name="i3GEOuploadcodigoconexao" value="">' + |
| 597 | 597 | '<input type="hidden" id="i3GEOuploadesquema" name="i3GEOuploadesquema" value="">' + |
| 598 | 598 | "<p class='paragrafo' style=color:red >Não utilize '_' no nome do arquivo. Apenas letras e números são aceitos!!!</p>" + | ... | ... |
admin/php/metaestat_uploadshp_submit.php
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | */ |
| 5 | 5 | include_once("admin.php"); |
| 6 | 6 | include_once("login.php"); |
| 7 | +set_time_limit(0); | |
| 7 | 8 | if(verificaOperacaoSessao("admin/metaestat/editorbanco") == false){ |
| 8 | 9 | echo "Vc nao pode realizar essa operacao.";exit; |
| 9 | 10 | } |
| ... | ... | @@ -19,6 +20,7 @@ if (ob_get_level() == 0) ob_start(); |
| 19 | 20 | </head> |
| 20 | 21 | <body bgcolor="white" style="background-color:white;text-align:left;"> |
| 21 | 22 | <p> |
| 23 | + | |
| 22 | 24 | <?php |
| 23 | 25 | if($_POST["tabelaDestino"] == ""){ |
| 24 | 26 | echo "Nome da tabela não definido"; |
| ... | ... | @@ -93,8 +95,8 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ |
| 93 | 95 | //verifica o tipo de coluna |
| 94 | 96 | $tipoColuna = array(); |
| 95 | 97 | $testar = $numshapes; |
| 96 | - if($numshapes > 500){ | |
| 97 | - $testar = 500; | |
| 98 | + if($numshapes > 50){ | |
| 99 | + $testar = 50; | |
| 98 | 100 | } |
| 99 | 101 | foreach($colunas as $coluna){ |
| 100 | 102 | $tipo = "numeric"; |
| ... | ... | @@ -190,23 +192,27 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ |
| 190 | 192 | for ($i=0; $i<$numshapes;$i++){ |
| 191 | 193 | $s = $layer->getShape(new resultObj($i)); |
| 192 | 194 | $vs = array(); |
| 195 | + $escape = ""; | |
| 193 | 196 | foreach($colunas as $coluna){ |
| 194 | 197 | if($tipoColuna[$coluna] == "varchar"){ |
| 195 | 198 | $texto = $s->getValue($layer,$coluna); |
| 196 | 199 | //echo $i." - ".mb_detect_encoding($texto)."<br>"; |
| 197 | 200 | //$texto = str_replace("'","",$texto); |
| 198 | 201 | $enc = mb_detect_encoding($texto); |
| 199 | - $texto = addcslashes($texto,$escapar); | |
| 200 | - if($enc != ""){ | |
| 201 | - $texto = "'".mb_convert_encoding($texto,$encodingdb,$enc)."'"; | |
| 202 | + $textosl = addcslashes($texto,$escapar); | |
| 203 | + if($textosl != $texto){ | |
| 204 | + $escape = "E"; | |
| 205 | + } | |
| 206 | + if($enc != "" && $enc != $encodingdb){ | |
| 207 | + $textosl = "'".mb_convert_encoding($textosl,$encodingdb,$enc)."'"; | |
| 202 | 208 | } |
| 203 | 209 | else{ |
| 204 | - $texto = "'".$texto."'"; | |
| 210 | + $textosl = "'".$textosl."'"; | |
| 205 | 211 | } |
| 206 | - if($texto == "''"){ | |
| 207 | - $texto = 'null'; | |
| 212 | + if($textosl == "''"){ | |
| 213 | + $textosl = 'null'; | |
| 208 | 214 | } |
| 209 | - $vs[] = $texto; | |
| 215 | + $vs[] = $textosl; | |
| 210 | 216 | } |
| 211 | 217 | else{ |
| 212 | 218 | $valor = $s->getValue($layer,$coluna); |
| ... | ... | @@ -226,7 +232,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ |
| 226 | 232 | } |
| 227 | 233 | $str = implode(",",$vs); |
| 228 | 234 | $str = str_replace("nulo",'null',$str); |
| 229 | - $linhas[] = $insert."VALUES(".$str.")"; | |
| 235 | + $linhas[] = $insert."VALUES(".$escape."".$str.")"; | |
| 230 | 236 | } |
| 231 | 237 | //echo $linhas[0];exit; |
| 232 | 238 | //echo "<pre>".var_dump($linhas);exit; |
| ... | ... | @@ -248,53 +254,68 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ |
| 248 | 254 | echo 'Erro: ' . $e->getMessage(); |
| 249 | 255 | } |
| 250 | 256 | } |
| 257 | + $bdcon = pg_connect('dbname='.$conexao["bancodedados"].' user='.$conexao["usuario"].' password='.$conexao["senha"].' host='.$conexao["host"].' port='.$conexao["porta"]."options='-c client_encoding=LATIN1'"); | |
| 251 | 258 | foreach($linhas as $linha){ |
| 252 | 259 | try { |
| 253 | 260 | $res = $dbh->query($linha); |
| 254 | 261 | if($res == false){ |
| 255 | - echo "<br><br><span style=color:red >Erro em: </span>".$linha; | |
| 262 | + $res = pg_query($bdcon,$linha); | |
| 263 | + if($res == false){ | |
| 264 | + $linha = remove_accents($linha); | |
| 265 | + $res = $dbh->query($linha); | |
| 266 | + if($res == false){ | |
| 267 | + echo "<br><br><span style=color:red >Erro em: </span>".$linha; | |
| 268 | + } | |
| 269 | + else{ | |
| 270 | + echo "<br><br><span style=color:red >Linha com acentos removidos: </span>".$linha; | |
| 271 | + } | |
| 272 | + } | |
| 256 | 273 | } |
| 257 | 274 | } catch (PDOException $e) { |
| 258 | 275 | echo 'Erro: ' . $e->getMessage(); |
| 259 | 276 | } |
| 260 | 277 | } |
| 261 | - echo "<br>Registros existentes no SHP: ". $numshapes; | |
| 262 | 278 | $sql = "select * from ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]; |
| 263 | 279 | $q = $dbh->query($sql,PDO::FETCH_ASSOC); |
| 264 | 280 | $r = $q->fetchAll(); |
| 281 | + if($numshapes != count($r)){ | |
| 282 | + echo "<span style='color:red'>"; | |
| 283 | + } | |
| 284 | + echo "<br>Registros existentes no SHP: ". $numshapes; | |
| 285 | + | |
| 265 | 286 | echo "<br>Registros na tabela final: ". count($r); |
| 266 | - echo "<br>Diferenças podem ocorrer em função de caracteres acentuados não suportados pelo banco de dados"; | |
| 287 | + echo "</span><br>Diferenças podem ocorrer em função de caracteres acentuados não suportados pelo banco de dados"; | |
| 267 | 288 | echo "<br><b>Feito!!!<br>Faça o reload da página"; |
| 268 | - if($_POST["i3GEOuploadCriaMapfile"] == "on"){ | |
| 269 | - //verifica se o usuario marcou a opcao de cria mapfile | |
| 270 | - //nesse caso o aplicativo de upload esta sendo executado de dentro do sistema de administracao, e o mapfile devera | |
| 271 | - //ser criado e registrado no sistema | |
| 272 | - $nome = $_POST["tabelaDestino"]; | |
| 273 | - $codigo = $_POST["tabelaDestino"]; | |
| 274 | - $it = $_POST["tabelaDestino"]; | |
| 275 | - $en = $_POST["tabelaDestino"]; | |
| 276 | - $es = $_POST["tabelaDestino"]; | |
| 289 | + if($_POST["i3GEOuploadCriaMapfile"] == "on"){ | |
| 290 | + //verifica se o usuario marcou a opcao de cria mapfile | |
| 291 | + //nesse caso o aplicativo de upload esta sendo executado de dentro do sistema de administracao, e o mapfile devera | |
| 292 | + //ser criado e registrado no sistema | |
| 293 | + $nome = $_POST["tabelaDestino"]; | |
| 294 | + $codigo = $_POST["tabelaDestino"]; | |
| 295 | + $it = $_POST["tabelaDestino"]; | |
| 296 | + $en = $_POST["tabelaDestino"]; | |
| 297 | + $es = $_POST["tabelaDestino"]; | |
| 277 | 298 | //descobre o tipo de geometria |
| 278 | - $tipo = "select ST_Dimension(the_geom) as d from ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]." limit 1"; | |
| 279 | - $q = $dbh->query($tipo,PDO::FETCH_ASSOC); | |
| 299 | + $tipo = "select ST_Dimension(the_geom) as d from ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]." limit 1"; | |
| 300 | + $q = $dbh->query($tipo,PDO::FETCH_ASSOC); | |
| 280 | 301 | $tipo = $q->fetchAll(); |
| 281 | - $tipo = $tipo[0]["d"]; | |
| 282 | - $tipoLayer = "polygon"; | |
| 283 | - if ($tipo == 0){ | |
| 284 | - $tipoLayer = "point"; | |
| 285 | - } | |
| 286 | - if ($tipo == 1){ | |
| 287 | - $tipoLayer = "line"; | |
| 288 | - } | |
| 289 | - $funcao = "CRIARNOVOMAP"; | |
| 290 | - $output = "retorno"; | |
| 302 | + $tipo = $tipo[0]["d"]; | |
| 303 | + $tipoLayer = "polygon"; | |
| 304 | + if ($tipo == 0){ | |
| 305 | + $tipoLayer = "point"; | |
| 306 | + } | |
| 307 | + if ($tipo == 1){ | |
| 308 | + $tipoLayer = "line"; | |
| 309 | + } | |
| 310 | + $funcao = "CRIARNOVOMAP"; | |
| 311 | + $output = "retorno"; | |
| 291 | 312 | $data = "the_geom from ($sql) as foo using unique gid using srid=$srid "; |
| 292 | - $conexao = 'dbname='.$conexao["bancodedados"].' user='.$conexao["usuario"].' password='.$conexao["senha"].' host='.$conexao["host"].' port='.$conexao["porta"]; | |
| 293 | - include_once("editormapfile.php"); | |
| 294 | - echo "<b><p class='paragrafo' >Criado o mapfile!!!<br>"; | |
| 295 | - echo "Para editar clique: <a href='../../admin/html/editormapfile.html' target=_blank >".$nome."</a>"; | |
| 296 | - echo "<script>window.scrollTo(0,10000);i3GEO.util.insereCookie('I3GEOletraAdmin','".$nome."');</script>"; | |
| 297 | - } | |
| 313 | + $conexao = 'dbname='.$conexao["bancodedados"].' user='.$conexao["usuario"].' password='.$conexao["senha"].' host='.$conexao["host"].' port='.$conexao["porta"]; | |
| 314 | + include_once("editormapfile.php"); | |
| 315 | + echo "<b><p class='paragrafo' >Criado o mapfile!!!<br>"; | |
| 316 | + echo "Para editar clique: <a href='../../admin/html/editormapfile.html' target=_blank >".$nome."</a>"; | |
| 317 | + echo "<script>window.scrollTo(0,10000);i3GEO.util.insereCookie('I3GEOletraAdmin','".$nome."');</script>"; | |
| 318 | + } | |
| 298 | 319 | echo "<br><br>Fim"; |
| 299 | 320 | } |
| 300 | 321 | else{ |
| ... | ... | @@ -309,6 +330,147 @@ function verificaNome($nome,$ext){ |
| 309 | 330 | exit; |
| 310 | 331 | } |
| 311 | 332 | } |
| 333 | +function remove_accents($string) { | |
| 334 | + if (!preg_match('/[\x80-\xff]/', $string)) | |
| 335 | + return $string; | |
| 336 | + if (seems_utf8($string)) { | |
| 337 | + $chars = array( | |
| 338 | + // Decompositions for Latin-1 Supplement | |
| 339 | + chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', | |
| 340 | + chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', | |
| 341 | + chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', | |
| 342 | + chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', | |
| 343 | + chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', | |
| 344 | + chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', | |
| 345 | + chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', | |
| 346 | + chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', | |
| 347 | + chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', | |
| 348 | + chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', | |
| 349 | + chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', | |
| 350 | + chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', | |
| 351 | + chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', | |
| 352 | + chr(195).chr(159) => 's', chr(195).chr(160) => 'a', | |
| 353 | + chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', | |
| 354 | + chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', | |
| 355 | + chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', | |
| 356 | + chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', | |
| 357 | + chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', | |
| 358 | + chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', | |
| 359 | + chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', | |
| 360 | + chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', | |
| 361 | + chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', | |
| 362 | + chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', | |
| 363 | + chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', | |
| 364 | + chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', | |
| 365 | + chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', | |
| 366 | + chr(195).chr(191) => 'y', | |
| 367 | + // Decompositions for Latin Extended-A | |
| 368 | + chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', | |
| 369 | + chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', | |
| 370 | + chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', | |
| 371 | + chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', | |
| 372 | + chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', | |
| 373 | + chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', | |
| 374 | + chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', | |
| 375 | + chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', | |
| 376 | + chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', | |
| 377 | + chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', | |
| 378 | + chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', | |
| 379 | + chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', | |
| 380 | + chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', | |
| 381 | + chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', | |
| 382 | + chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', | |
| 383 | + chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', | |
| 384 | + chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', | |
| 385 | + chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', | |
| 386 | + chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', | |
| 387 | + chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', | |
| 388 | + chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', | |
| 389 | + chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', | |
| 390 | + chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', | |
| 391 | + chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', | |
| 392 | + chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', | |
| 393 | + chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', | |
| 394 | + chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', | |
| 395 | + chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', | |
| 396 | + chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', | |
| 397 | + chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', | |
| 398 | + chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', | |
| 399 | + chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', | |
| 400 | + chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', | |
| 401 | + chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', | |
| 402 | + chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', | |
| 403 | + chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', | |
| 404 | + chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', | |
| 405 | + chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', | |
| 406 | + chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', | |
| 407 | + chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', | |
| 408 | + chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', | |
| 409 | + chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', | |
| 410 | + chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', | |
| 411 | + chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', | |
| 412 | + chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', | |
| 413 | + chr(197).chr(154) => 'S',chr(197).chr(155) => 's', | |
| 414 | + chr(197).chr(156) => 'S',chr(197).chr(157) => 's', | |
| 415 | + chr(197).chr(158) => 'S',chr(197).chr(159) => 's', | |
| 416 | + chr(197).chr(160) => 'S', chr(197).chr(161) => 's', | |
| 417 | + chr(197).chr(162) => 'T', chr(197).chr(163) => 't', | |
| 418 | + chr(197).chr(164) => 'T', chr(197).chr(165) => 't', | |
| 419 | + chr(197).chr(166) => 'T', chr(197).chr(167) => 't', | |
| 420 | + chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', | |
| 421 | + chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', | |
| 422 | + chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', | |
| 423 | + chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', | |
| 424 | + chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', | |
| 425 | + chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', | |
| 426 | + chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', | |
| 427 | + chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', | |
| 428 | + chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', | |
| 429 | + chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', | |
| 430 | + chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', | |
| 431 | + chr(197).chr(190) => 'z', chr(197).chr(191) => 's', | |
| 432 | + // Euro Sign | |
| 433 | + chr(226).chr(130).chr(172) => 'E', | |
| 434 | + // GBP (Pound) Sign | |
| 435 | + chr(194).chr(163) => ''); | |
| 436 | + $string = strtr($string, $chars); | |
| 437 | + } else { | |
| 438 | + // Assume ISO-8859-1 if not UTF-8 | |
| 439 | + $chars['in'] = chr(128).chr(131).chr(138).chr(142).chr(154).chr(158) | |
| 440 | + .chr(159).chr(162).chr(165).chr(181).chr(192).chr(193).chr(194) | |
| 441 | + .chr(195).chr(196).chr(197).chr(199).chr(200).chr(201).chr(202) | |
| 442 | + .chr(203).chr(204).chr(205).chr(206).chr(207).chr(209).chr(210) | |
| 443 | + .chr(211).chr(212).chr(213).chr(214).chr(216).chr(217).chr(218) | |
| 444 | + .chr(219).chr(220).chr(221).chr(224).chr(225).chr(226).chr(227) | |
| 445 | + .chr(228).chr(229).chr(231).chr(232).chr(233).chr(234).chr(235) | |
| 446 | + .chr(236).chr(237).chr(238).chr(239).chr(241).chr(242).chr(243) | |
| 447 | + .chr(244).chr(245).chr(246).chr(248).chr(249).chr(250).chr(251) | |
| 448 | + .chr(252).chr(253).chr(255); | |
| 449 | + $chars['out'] = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy"; | |
| 450 | + $string = strtr($string, $chars['in'], $chars['out']); | |
| 451 | + $double_chars['in'] = array(chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254)); | |
| 452 | + $double_chars['out'] = array('OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th'); | |
| 453 | + $string = str_replace($double_chars['in'], $double_chars['out'], $string); | |
| 454 | + } | |
| 455 | + return $string; | |
| 456 | +} | |
| 457 | +function seems_utf8($Str) { # by bmorel at ssi dot fr | |
| 458 | + $length = strlen($Str); | |
| 459 | + for ($i = 0; $i < $length; $i++) { | |
| 460 | + if (ord($Str[$i]) < 0x80) continue; # 0bbbbbbb | |
| 461 | + elseif ((ord($Str[$i]) & 0xE0) == 0xC0) $n = 1; # 110bbbbb | |
| 462 | + elseif ((ord($Str[$i]) & 0xF0) == 0xE0) $n = 2; # 1110bbbb | |
| 463 | + elseif ((ord($Str[$i]) & 0xF8) == 0xF0) $n = 3; # 11110bbb | |
| 464 | + elseif ((ord($Str[$i]) & 0xFC) == 0xF8) $n = 4; # 111110bb | |
| 465 | + elseif ((ord($Str[$i]) & 0xFE) == 0xFC) $n = 5; # 1111110b | |
| 466 | + else return false; # Does not match any model | |
| 467 | + for ($j = 0; $j < $n; $j++) { # n bytes matching 10bbbbbb follow ? | |
| 468 | + if ((++$i == $length) || ((ord($Str[$i]) & 0xC0) != 0x80)) | |
| 469 | + return false; | |
| 470 | + } | |
| 471 | + } | |
| 472 | + return true; | |
| 473 | +} | |
| 312 | 474 | ?> |
| 313 | 475 | <script>window.scrollTo(0,10000);</script> |
| 314 | 476 | </body> | ... | ... |
ms_configura.php
| ... | ... | @@ -435,7 +435,8 @@ Tipo: |
| 435 | 435 | $postgis_mapa = array( |
| 436 | 436 | "teste"=>"user=postgres password=postgres dbname=teste host=localhost port=5432", |
| 437 | 437 | "postgres"=>"user=postgres password=postgres dbname=postgres host=localhost port=5432", |
| 438 | - "i3geosaude"=>"user=postgres password=postgres dbname=i3geosaude host=localhost port=5432 options='-c client_encoding=LATIN1'" | |
| 438 | + "i3geosaude"=>"user=postgres password=postgres dbname=i3geosaude host=localhost port=5432 options='-c client_encoding=LATIN1'", | |
| 439 | + "i3geosaudeUtf"=>"user=postgres password=postgres dbname=i3geosaude host=localhost port=5432" | |
| 439 | 440 | ); |
| 440 | 441 | /* |
| 441 | 442 | Variable: utilizacgi | ... | ... |