Commit 33b60dd5966811f364654dc4165440982c41ed2e
1 parent
cf4334c5
Exists in
master
and in
7 other branches
--no commit message
Showing
4 changed files
with
40 additions
and
22 deletions
Show diff stats
admin/html/mapfiles.html
| @@ -34,6 +34,8 @@ | @@ -34,6 +34,8 @@ | ||
| 34 | </div> | 34 | </div> |
| 35 | <br> | 35 | <br> |
| 36 | <input id=botao2 type=button value="Testar a instalação" /><br><br> | 36 | <input id=botao2 type=button value="Testar a instalação" /><br><br> |
| 37 | +<p>Parâmetros obtidos do mapfile de inicialização:</p> | ||
| 38 | +<b><div id=mapfilebase style=color:navy ></div></b><br> | ||
| 37 | <div id="tabela" style="left:-5px;"></div> | 39 | <div id="tabela" style="left:-5px;"></div> |
| 38 | <script> | 40 | <script> |
| 39 | /* | 41 | /* |
admin/js/mapfiles.js
| @@ -62,6 +62,7 @@ Pega os parâmetros do mapfiles.php | @@ -62,6 +62,7 @@ Pega os parâmetros do mapfiles.php | ||
| 62 | */ | 62 | */ |
| 63 | function pegaParametros(retorno) | 63 | function pegaParametros(retorno) |
| 64 | { | 64 | { |
| 65 | + $i("mapfilebase").innerHTML = retorno.mapfile; | ||
| 65 | var ins = "" | 66 | var ins = "" |
| 66 | for (i=0;i<$parametros.simples.length;i++) | 67 | for (i=0;i<$parametros.simples.length;i++) |
| 67 | { | 68 | { |
admin/php/admin.php
| @@ -59,14 +59,7 @@ error_reporting(0); | @@ -59,14 +59,7 @@ error_reporting(0); | ||
| 59 | include_once ($locaplic."/classesphp/carrega_ext.php"); | 59 | include_once ($locaplic."/classesphp/carrega_ext.php"); |
| 60 | include_once ($locaplic."/classesphp/funcoes_gerais.php"); | 60 | include_once ($locaplic."/classesphp/funcoes_gerais.php"); |
| 61 | 61 | ||
| 62 | -// | ||
| 63 | -//verifica se o cliente pode editar | ||
| 64 | -//se funcao for verificaEditores vai para case específico | ||
| 65 | -// | ||
| 66 | -if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) | ||
| 67 | -{$mapfile = "geral1windows";} | ||
| 68 | -else | ||
| 69 | -{$mapfile = "geral1";} | 62 | +$mapfile = mapfilebase($base,$locaplic); |
| 70 | /* | 63 | /* |
| 71 | Function: retornaJSON | 64 | Function: retornaJSON |
| 72 | 65 | ||
| @@ -342,4 +335,35 @@ function resolveAcentos($palavra,$tipo) | @@ -342,4 +335,35 @@ function resolveAcentos($palavra,$tipo) | ||
| 342 | $palavra = urldecode($palavra); | 335 | $palavra = urldecode($palavra); |
| 343 | return $palavra; | 336 | return $palavra; |
| 344 | } | 337 | } |
| 338 | +function mapfilebase($base,$locaplic){ | ||
| 339 | + $versao = versao(); | ||
| 340 | + $versao = $versao["principal"]; | ||
| 341 | + if(isset($base) && $base != ""){ | ||
| 342 | + if(file_exists($base)) | ||
| 343 | + {$f = $base;} | ||
| 344 | + else | ||
| 345 | + {$f = $locaplic."/aplicmap/".$base.".map";} | ||
| 346 | + } | ||
| 347 | + else | ||
| 348 | + { | ||
| 349 | + $f = ""; | ||
| 350 | + if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) | ||
| 351 | + {$f = $locaplic."/aplicmap/geral1windowsv".$versao.".map";} | ||
| 352 | + else | ||
| 353 | + { | ||
| 354 | + if($f == "" && file_exists('/var/www/i3geo/aplicmap/geral1debianv'.$versao.'.map')){ | ||
| 355 | + $f = "/var/www/i3geo/aplicmap/geral1debianv".$versao.".map"; | ||
| 356 | + } | ||
| 357 | + if($f == "" && file_exists('/var/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){ | ||
| 358 | + $f = "/var/www/html/i3geo/aplicmap/geral1fedorav".$versao.".map"; | ||
| 359 | + } | ||
| 360 | + if($f == "" && file_exists('/opt/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){ | ||
| 361 | + $f = "/opt/www/html/i3geo/aplicmap/geral1v".$versao.".map"; | ||
| 362 | + } | ||
| 363 | + if($f == "") | ||
| 364 | + {$f = $locaplic."/aplicmap/geral1v".$versao.".map";} | ||
| 365 | + } | ||
| 366 | + } | ||
| 367 | + return $f; | ||
| 368 | +} | ||
| 345 | ?> | 369 | ?> |
| 346 | \ No newline at end of file | 370 | \ No newline at end of file |
admin/php/mapfiles.php
| @@ -72,7 +72,7 @@ switch (strtoupper($funcao)) | @@ -72,7 +72,7 @@ switch (strtoupper($funcao)) | ||
| 72 | $par = array(); | 72 | $par = array(); |
| 73 | foreach ($vs as $v) | 73 | foreach ($vs as $v) |
| 74 | { | 74 | { |
| 75 | - $handle = fopen ($locaplic."/aplicmap/".$mapfile.".map", "r"); | 75 | + $handle = fopen ($mapfile, "r"); |
| 76 | while (!feof ($handle)) { | 76 | while (!feof ($handle)) { |
| 77 | $buffer = fgets($handle); | 77 | $buffer = fgets($handle); |
| 78 | if(!(stristr($buffer, $v) === FALSE)) | 78 | if(!(stristr($buffer, $v) === FALSE)) |
| @@ -88,19 +88,10 @@ switch (strtoupper($funcao)) | @@ -88,19 +88,10 @@ switch (strtoupper($funcao)) | ||
| 88 | } | 88 | } |
| 89 | } | 89 | } |
| 90 | } | 90 | } |
| 91 | + $par["mapfile"] = $mapfile; | ||
| 91 | retornaJSON($par); | 92 | retornaJSON($par); |
| 92 | exit; | 93 | exit; |
| 93 | break; | 94 | break; |
| 94 | - //depreciado | ||
| 95 | - case "RESTAURACONFIGURA": | ||
| 96 | - if(verificaEditores($editores) == "nao") | ||
| 97 | - {echo "Vc nao e um editor cadastrado. Apenas os editores definidos em i3geo/ms_configura.php podem acessar o sistema de administracao.";exit;} | ||
| 98 | - $cp->register('restauraConfigura'); | ||
| 99 | - unlink($locaplic."/aplicmap/".$mapfile.".map"); | ||
| 100 | - copy ($locaplic."/aplicmap/".$mapfile.".default",$locaplic."/aplicmap/".$mapfile.".map"); | ||
| 101 | - $cp->set_data("ok"); | ||
| 102 | - $cp->return_data(); | ||
| 103 | - break; | ||
| 104 | /* | 95 | /* |
| 105 | Valor: SALVACONFIGURA | 96 | Valor: SALVACONFIGURA |
| 106 | 97 | ||
| @@ -129,7 +120,7 @@ Salva um novo valor de uma variável no ms_configura.php | @@ -129,7 +120,7 @@ Salva um novo valor de uma variável no ms_configura.php | ||
| 129 | */ | 120 | */ |
| 130 | function salvaConfigura($variavel,$valor,$mapfile,$locaplic) | 121 | function salvaConfigura($variavel,$valor,$mapfile,$locaplic) |
| 131 | { | 122 | { |
| 132 | - $handle = fopen ($locaplic."/aplicmap/".$mapfile.".map", "r"); | 123 | + $handle = fopen ($mapfile, "r"); |
| 133 | $linhas = array(); | 124 | $linhas = array(); |
| 134 | $valor = str_replace("\\\"",'"',$valor); | 125 | $valor = str_replace("\\\"",'"',$valor); |
| 135 | while (!feof ($handle)) { | 126 | while (!feof ($handle)) { |
| @@ -151,8 +142,8 @@ function salvaConfigura($variavel,$valor,$mapfile,$locaplic) | @@ -151,8 +142,8 @@ function salvaConfigura($variavel,$valor,$mapfile,$locaplic) | ||
| 151 | $linhas[] = $buffer; | 142 | $linhas[] = $buffer; |
| 152 | } | 143 | } |
| 153 | fclose ($handle); | 144 | fclose ($handle); |
| 154 | - unlink($locaplic."/aplicmap/".$mapfile.".map"); | ||
| 155 | - $handle = fopen ($locaplic."/aplicmap/".$mapfile.".map", "w"); | 145 | + unlink($mapfile); |
| 146 | + $handle = fopen ($mapfile, "w"); | ||
| 156 | foreach ($linhas as $linha) | 147 | foreach ($linhas as $linha) |
| 157 | { | 148 | { |
| 158 | fwrite($handle, $linha); | 149 | fwrite($handle, $linha); |