Commit 33b60dd5966811f364654dc4165440982c41ed2e

Authored by Edmar Moretti
1 parent cf4334c5

--no commit message

admin/html/mapfiles.html
... ... @@ -34,6 +34,8 @@
34 34 </div>
35 35 <br>
36 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 39 <div id="tabela" style="left:-5px;"></div>
38 40 <script>
39 41 /*
... ...
admin/js/mapfiles.js
... ... @@ -62,6 +62,7 @@ Pega os parâmetros do mapfiles.php
62 62 */
63 63 function pegaParametros(retorno)
64 64 {
  65 + $i("mapfilebase").innerHTML = retorno.mapfile;
65 66 var ins = ""
66 67 for (i=0;i<$parametros.simples.length;i++)
67 68 {
... ...
admin/php/admin.php
... ... @@ -59,14 +59,7 @@ error_reporting(0);
59 59 include_once ($locaplic."/classesphp/carrega_ext.php");
60 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 64 Function: retornaJSON
72 65  
... ... @@ -342,4 +335,35 @@ function resolveAcentos($palavra,$tipo)
342 335 $palavra = urldecode($palavra);
343 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 370 \ No newline at end of file
... ...
admin/php/mapfiles.php
... ... @@ -72,7 +72,7 @@ switch (strtoupper($funcao))
72 72 $par = array();
73 73 foreach ($vs as $v)
74 74 {
75   - $handle = fopen ($locaplic."/aplicmap/".$mapfile.".map", "r");
  75 + $handle = fopen ($mapfile, "r");
76 76 while (!feof ($handle)) {
77 77 $buffer = fgets($handle);
78 78 if(!(stristr($buffer, $v) === FALSE))
... ... @@ -88,19 +88,10 @@ switch (strtoupper($funcao))
88 88 }
89 89 }
90 90 }
  91 + $par["mapfile"] = $mapfile;
91 92 retornaJSON($par);
92 93 exit;
93 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 96 Valor: SALVACONFIGURA
106 97  
... ... @@ -129,7 +120,7 @@ Salva um novo valor de uma variável no ms_configura.php
129 120 */
130 121 function salvaConfigura($variavel,$valor,$mapfile,$locaplic)
131 122 {
132   - $handle = fopen ($locaplic."/aplicmap/".$mapfile.".map", "r");
  123 + $handle = fopen ($mapfile, "r");
133 124 $linhas = array();
134 125 $valor = str_replace("\\\"",'"',$valor);
135 126 while (!feof ($handle)) {
... ... @@ -151,8 +142,8 @@ function salvaConfigura($variavel,$valor,$mapfile,$locaplic)
151 142 $linhas[] = $buffer;
152 143 }
153 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 147 foreach ($linhas as $linha)
157 148 {
158 149 fwrite($handle, $linha);
... ...