Commit 267a15281ef01ed460b2d8a772270f24369ce4ba

Authored by Edmar Moretti
1 parent 624f9b34

funcao de log

admin/admin.db
No preview for this file type
classesphp/funcoes_gerais.php
@@ -3044,9 +3044,9 @@ function i3GeoLog($txt,$dir_tmp=""){ @@ -3044,9 +3044,9 @@ function i3GeoLog($txt,$dir_tmp=""){
3044 if(empty($dir_tmp)){ 3044 if(empty($dir_tmp)){
3045 include(dirname(__FILE__)."/../ms_configura.php"); 3045 include(dirname(__FILE__)."/../ms_configura.php");
3046 } 3046 }
3047 - $log = "User: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL. 3047 + $log = "Ip: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL.
3048 $txt.PHP_EOL. 3048 $txt.PHP_EOL.
3049 "-------------------------".PHP_EOL; 3049 "-------------------------".PHP_EOL;
3050 - file_put_contents($dir_tmp.'/log_i3geo_'.date("j.n.Y").'.txt', $log, FILE_APPEND); 3050 + file_put_contents($dir_tmp.'/.log_i3geo_'.date("j.n.Y"), $log, FILE_APPEND);
3051 } 3051 }
3052 ?> 3052 ?>
classesphp/mapa_googlemaps.php
@@ -146,7 +146,10 @@ elseif(isset($_GET["BBOX"])){ @@ -146,7 +146,10 @@ elseif(isset($_GET["BBOX"])){
146 //por seguranca 146 //por seguranca
147 include_once("funcoes_gerais.php"); 147 include_once("funcoes_gerais.php");
148 148
149 -i3GeoLog("mapa_googlemaps",$_SESSION["dir_tmp"]); 149 +$logExec = $_SESSION["logExec"];
  150 +if(isset($logExec) && $logExec["mapa_"] == true){
  151 + i3GeoLog("mapa_googlemaps ".implode("&",array_merge($_GET,$_POST)),$_SESSION["dir_tmp"]);
  152 +}
150 153
151 restauraCon($map_fileX,$postgis_mapa); 154 restauraCon($map_fileX,$postgis_mapa);
152 155
classesphp/mapa_inicia.php
@@ -102,7 +102,7 @@ Retorno: @@ -102,7 +102,7 @@ Retorno:
102 */ 102 */
103 function iniciaMapa() 103 function iniciaMapa()
104 { 104 {
105 - global $postgis_mapa,$statusFerramentas,$saikuUrl,$emailInstituicao,$openid,$interfacePadrao,$mensagemInicia,$kmlurl,$tituloInstituicao,$tempo,$navegadoresLocais,$locaplic,$embedLegenda,$map_file,$mapext,$w,$h,$R_path,$locmapserv,$utilizacgi,$expoeMapfile,$interface; 105 + global $dir_tmp, $logExec, $postgis_mapa,$statusFerramentas,$saikuUrl,$emailInstituicao,$openid,$interfacePadrao,$mensagemInicia,$kmlurl,$tituloInstituicao,$tempo,$navegadoresLocais,$locaplic,$embedLegenda,$map_file,$mapext,$w,$h,$R_path,$locmapserv,$utilizacgi,$expoeMapfile,$interface;
106 // 106 //
107 //verifica se algum tema e restrito a determinado usuario 107 //verifica se algum tema e restrito a determinado usuario
108 //as funcoes de validacao encontram-se em funcoes_gerais.php 108 //as funcoes de validacao encontram-se em funcoes_gerais.php
@@ -111,6 +111,11 @@ function iniciaMapa() @@ -111,6 +111,11 @@ function iniciaMapa()
111 include_once("funcoes_gerais.php"); 111 include_once("funcoes_gerais.php");
112 } 112 }
113 validaAcessoTemas($map_file); 113 validaAcessoTemas($map_file);
  114 +
  115 + if($dir_tmp != "" && isset($logExec) && $logExec["init"] == true){
  116 + i3GeoLog("iniciaMapa $interface",$dir_tmp);
  117 + }
  118 +
114 if(!isset($kmlurl)){ 119 if(!isset($kmlurl)){
115 $kmlurl = ""; 120 $kmlurl = "";
116 } 121 }
classesphp/mapa_openlayers.php
@@ -166,7 +166,10 @@ $postgis_mapa = $_SESSION["postgis_mapa"]; @@ -166,7 +166,10 @@ $postgis_mapa = $_SESSION["postgis_mapa"];
166 //por seguranca 166 //por seguranca
167 include_once("funcoes_gerais.php"); 167 include_once("funcoes_gerais.php");
168 168
169 -i3GeoLog("mapa_openlayers",$_SESSION["dir_tmp"]); 169 +$logExec = $_SESSION["logExec"];
  170 +if(isset($logExec) && $logExec["mapa_"] == true){
  171 + i3GeoLog("mapa_openlayers ".implode("&",array_merge($_GET,$_POST)),$_SESSION["dir_tmp"]);
  172 +}
170 173
171 restauraCon($map_fileX,$postgis_mapa); 174 restauraCon($map_fileX,$postgis_mapa);
172 175
ms_configura.php
@@ -86,6 +86,12 @@ false @@ -86,6 +86,12 @@ false
86 86
87 */ 87 */
88 $logTransacoes = false; 88 $logTransacoes = false;
  89 +//TODO documentar
  90 +$logExec = array(
  91 + "mapa_" => true, //mapa_openlayers e mapa_googlemaps
  92 + "init" => true, //ms_criamapa mapa_inicia
  93 + "ogc" => true
  94 +);
89 /* 95 /*
90 Variable: $i3GeoProjDefault 96 Variable: $i3GeoProjDefault
91 97
ms_criamapa.php
@@ -286,7 +286,9 @@ $versao = $versao["principal"]; @@ -286,7 +286,9 @@ $versao = $versao["principal"];
286 if(!isset($dir_tmp)){ 286 if(!isset($dir_tmp)){
287 include_once (dirname(__FILE__)."/ms_configura.php"); 287 include_once (dirname(__FILE__)."/ms_configura.php");
288 } 288 }
289 -i3GeoLog("ms_criamapa",$dir_tmp); 289 +if(isset($logExec) && $logExec["init"] == true){
  290 + i3GeoLog("ms_criamapa ".implode("&",array_merge($_GET,$_POST)),$_SESSION["dir_tmp"]);
  291 +}
290 if(!empty($restauramapa)){ 292 if(!empty($restauramapa)){
291 $base = restauraMapaAdmin($restauramapa,$dir_tmp); 293 $base = restauraMapaAdmin($restauramapa,$dir_tmp);
292 $m = ms_newMapObj($base); 294 $m = ms_newMapObj($base);
@@ -604,6 +606,7 @@ $_SESSION["imgurl"] = strtolower($protocolo[0])."://".$_SERVER['HTTP_HOST'].$atu @@ -604,6 +606,7 @@ $_SESSION["imgurl"] = strtolower($protocolo[0])."://".$_SERVER['HTTP_HOST'].$atu
604 $_SESSION["tmpurl"] = strtolower($protocolo[0])."://".$_SERVER['HTTP_HOST'].$atual; 606 $_SESSION["tmpurl"] = strtolower($protocolo[0])."://".$_SERVER['HTTP_HOST'].$atual;
605 $_SESSION["map_file"] = $tmpfname; 607 $_SESSION["map_file"] = $tmpfname;
606 $_SESSION["mapext"] = $mapext; 608 $_SESSION["mapext"] = $mapext;
  609 +$_SESSION["logExec"] = $logExec;
607 if (isset($executa)){ 610 if (isset($executa)){
608 if (file_exists($executa)){ 611 if (file_exists($executa)){
609 //include_once ($executa); 612 //include_once ($executa);
@@ -130,7 +130,9 @@ $cache = true; @@ -130,7 +130,9 @@ $cache = true;
130 include(dirname(__FILE__)."/ms_configura.php"); 130 include(dirname(__FILE__)."/ms_configura.php");
131 include(dirname(__FILE__)."/classesphp/funcoes_gerais.php"); 131 include(dirname(__FILE__)."/classesphp/funcoes_gerais.php");
132 132
133 -i3GeoLog("ogc ".implode("&",$_GET),$_SESSION["dir_tmp"]); 133 +if(isset($logExec) && $logExec["ogc"] == true){
  134 + i3GeoLog("ogc ".implode("&",$_GET),$_SESSION["dir_tmp"]);
  135 +}
134 // 136 //
135 //ajusta o default 137 //ajusta o default
136 // 138 //