3 function logStart(&$oDB, $sType = '', $sQuery = '', $aLanguageList = array())
5 $aStartTime = explode('.',microtime(true));
6 if (!$aStartTime[1]) $aStartTime[1] = '0';
9 if (isset($_GET['format'])) $sOutputFormat = $_GET['format'];
12 date('Y-m-d H:i:s',$aStartTime[0]).'.'.$aStartTime[1],
13 $_SERVER["REMOTE_ADDR"],
14 $_SERVER['QUERY_STRING'],
20 $sSQL = 'insert into new_query_log (type,starttime,query,ipaddress,useragent,language,format,searchterm)';
21 $sSQL .= ' values ('.getDBQuoted($sType).','.getDBQuoted($hLog[0]).','.getDBQuoted($hLog[2]);
22 $sSQL .= ','.getDBQuoted($hLog[1]).','.getDBQuoted($_SERVER['HTTP_USER_AGENT']).','.getDBQuoted(join(',',$aLanguageList)).','.getDBQuoted($_GET['format']).','.getDBQuoted($hLog[3]).')';
26 if (CONST_Log_File && CONST_Log_File_ReverseLog != '')
28 if ($sType == 'reverse')
30 $aStartTime = explode('.',$hLog[0]);
31 file_put_contents(CONST_Log_File_ReverseLog,
32 $aStartTime[0].','.$aStartTime[1].','.
34 '"'.addslashes(isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:'').'",'.
35 '"'.addslashes($hLog[1]).'",'.
39 '"'.addslashes($_SERVER['HTTP_USER_AGENT']).'",'.
40 '"'.addslashes($sOutputFormat).'"'."\n",
48 function logEnd(&$oDB, $hLog, $iNumResults)
50 $aEndTime = explode('.',microtime(true));
51 if (!$aEndTime[1]) $aEndTime[1] = '0';
52 $sEndTime = date('Y-m-d H:i:s',$aEndTime[0]).'.'.$aEndTime[1];
56 $sSQL = 'update new_query_log set endtime = '.getDBQuoted($sEndTime).', results = '.$iNumResults;
57 $sSQL .= ' where starttime = '.getDBQuoted($hLog[0]);
58 $sSQL .= ' and ipaddress = '.getDBQuoted($hLog[1]);
59 $sSQL .= ' and query = '.getDBQuoted($hLog[2]);
63 if (CONST_Log_File && CONST_Log_File_SearchLog != '')
65 $aStartTime = explode('.',$hLog[0]);
66 file_put_contents(CONST_Log_File_SearchLog,
67 $aStartTime[0].','.$aStartTime[1].','.
69 '"'.addslashes(isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:'').'",'.
70 '"'.addslashes($hLog[1]).'",'.
71 '"'.addslashes($hLog[3]).'",'.
72 '"'.addslashes($_SERVER['HTTP_USER_AGENT']).'",'.
73 '"'.addslashes((isset($_GET['format']))?$_GET['format']:'').'",'.