X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/111f0d229532ade32fa01d1af2fceaae070885ee..ccdce35322a605e6665adbb32a804ef7476ac6fd:/lib/log.php?ds=sidebyside diff --git a/lib/log.php b/lib/log.php index 7515cbbd..d81ef46d 100644 --- a/lib/log.php +++ b/lib/log.php @@ -5,6 +5,9 @@ $aStartTime = explode('.',microtime(true)); if (!$aStartTime[1]) $aStartTime[1] = '0'; + $sOutputFormat = ''; + if (isset($_GET['format'])) $sOutputFormat = $_GET['format']; + $hLog = array( date('Y-m-d H:i:s',$aStartTime[0]).'.'.$aStartTime[1], $_SERVER["REMOTE_ADDR"], @@ -20,7 +23,8 @@ $oDB->query($sSQL); } - if (CONST_Log_File && CONST_Log_File_ReverseLog != '') { + if (CONST_Log_File && CONST_Log_File_ReverseLog != '') + { if ($sType == 'reverse') { $aStartTime = explode('.',$hLog[0]); @@ -33,7 +37,7 @@ $_GET['lon'].','. $_GET['zoom'].','. '"'.addslashes($_SERVER['HTTP_USER_AGENT']).'",'. - '"'.addslashes($_GET['format']).'"'."\n", + '"'.addslashes($sOutputFormat).'"'."\n", FILE_APPEND); } } @@ -43,9 +47,9 @@ function logEnd(&$oDB, $hLog, $iNumResults) { - $aEndTime = explode('.',microtime(true)); - if (!$aEndTime[1]) $aEndTime[1] = '0'; - $sEndTime = date('Y-m-d H:i:s',$aEndTime[0]).'.'.$aEndTime[1]; + $aEndTime = explode('.',microtime(true)); + if (!$aEndTime[1]) $aEndTime[1] = '0'; + $sEndTime = date('Y-m-d H:i:s',$aEndTime[0]).'.'.$aEndTime[1]; if (CONST_Log_DB) { @@ -56,7 +60,8 @@ $oDB->query($sSQL); } - if (CONST_Log_File && CONST_Log_File_SearchLog != '') { + if (CONST_Log_File && CONST_Log_File_SearchLog != '') + { $aStartTime = explode('.',$hLog[0]); file_put_contents(CONST_Log_File_SearchLog, $aStartTime[0].','.$aStartTime[1].','. @@ -65,7 +70,7 @@ '"'.addslashes($hLog[1]).'",'. '"'.addslashes($hLog[3]).'",'. '"'.addslashes($_SERVER['HTTP_USER_AGENT']).'",'. - '"'.addslashes($_GET['format']).'",'. + '"'.addslashes((isset($_GET['format']))?$_GET['format']:'').'",'. $iNumResults."\n", FILE_APPEND); }