fix miss-parsed regex with - sign in lat,lon query

This commit is contained in:
Brian Quinion 2011-08-02 19:39:32 +00:00
parent 4d16677d2e
commit 5e2b901106

View File

@ -101,7 +101,6 @@
$aPhrases = array_reverse($aPhrases); $aPhrases = array_reverse($aPhrases);
$sQuery = join(', ',$aPhrases); $sQuery = join(', ',$aPhrases);
} }
if ($sQuery) if ($sQuery)
{ {
$hLog = logStart($oDB, 'search', $sQuery, $aLangPrefOrder); $hLog = logStart($oDB, 'search', $sQuery, $aLangPrefOrder);
@ -192,7 +191,7 @@
$_GET['nearlon'] = ($aData[6]=='E'?1:-1) * ($aData[4] + $aData[5]/60); $_GET['nearlon'] = ($aData[6]=='E'?1:-1) * ($aData[4] + $aData[5]/60);
$sQuery = trim(str_replace($aData[0], ' ', $sQuery)); $sQuery = trim(str_replace($aData[0], ' ', $sQuery));
} }
elseif (preg_match('/(\\[|\\b)(-?[0-9]+[0-9.]*)[, ]+(-?[0-9]+[0-9.]*)(\\]|\\b)/', $sQuery, $aData)) elseif (preg_match('/(\\[|^|\\b)(-?[0-9]+[0-9.]*)[, ]+(-?[0-9]+[0-9.]*)(\\]|$|\\b)/', $sQuery, $aData))
{ {
$_GET['nearlat'] = $aData[2]; $_GET['nearlat'] = $aData[2];
$_GET['nearlon'] = $aData[3]; $_GET['nearlon'] = $aData[3];