]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/log.php
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / lib / log.php
index 7515cbbd9abd09b037f94e0cd4584cb621b505f7..d81ef46db55393f5d563ca5183b6575ea2f7e6f9 100644 (file)
@@ -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);
                }