X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/9b7f0627eabba2aaeaf5d31b8a36a7dc2ff8d45a..5f19b23f49aee9989267ac03b488049f9d681166:/lib/PlaceLookup.php diff --git a/lib/PlaceLookup.php b/lib/PlaceLookup.php index 46b17882..fce49701 100644 --- a/lib/PlaceLookup.php +++ b/lib/PlaceLookup.php @@ -52,7 +52,7 @@ class PlaceLookup { $aLangs = $oParams->getPreferredLanguages(); $this->aLangPrefOrderSql = - 'ARRAY['.join(',', array_map('getDBQuoted', $aLangs)).']'; + 'ARRAY['.join(',', $this->oDB->getDBQuotedList($aLangs)).']'; $this->bExtraTags = $oParams->getBool('extratags', false); $this->bNameDetails = $oParams->getBool('namedetails', false); @@ -132,8 +132,9 @@ class PlaceLookup public function setLanguagePreference($aLangPrefOrder) { - $this->aLangPrefOrderSql = - 'ARRAY['.join(',', array_map('getDBQuoted', $aLangPrefOrder)).']'; + $this->aLangPrefOrderSql = $this->oDB->getArraySQL( + $this->oDB->getDBQuotedList($aLangPrefOrder) + ); } private function addressImportanceSql($sGeometry, $sPlaceId) @@ -162,8 +163,8 @@ class PlaceLookup public function lookupOSMID($sType, $iID) { - $sSQL = "select place_id from placex where osm_type = '".$sType."' and osm_id = ".$iID; - $iPlaceID = chksql($this->oDB->getOne($sSQL)); + $sSQL = 'select place_id from placex where osm_type = :type and osm_id = :id'; + $iPlaceID = $this->oDB->getOne($sSQL, array(':type' => $sType, ':id' => $iID)); if (!$iPlaceID) { return null; @@ -424,9 +425,10 @@ class PlaceLookup $sSQL = join(' UNION ', $aSubSelects); Debug::printSQL($sSQL); - $aPlaces = chksql($this->oDB->getAll($sSQL), 'Could not lookup place'); + $aPlaces = $this->oDB->getAll($sSQL, null, 'Could not lookup place'); foreach ($aPlaces as &$aPlace) { + $aPlace['importance'] = (float) $aPlace['importance']; if ($this->bAddressDetails) { // to get addressdetails for tiger data, the housenumber is needed $aPlace['address'] = new AddressDetails( @@ -513,9 +515,9 @@ class PlaceLookup $sSQL .= $sFrom; } - $aPointPolygon = chksql($this->oDB->getRow($sSQL), 'Could not get outline'); + $aPointPolygon = $this->oDB->getRow($sSQL, null, 'Could not get outline'); - if ($aPointPolygon['place_id']) { + if ($aPointPolygon && $aPointPolygon['place_id']) { if ($aPointPolygon['centrelon'] !== null && $aPointPolygon['centrelat'] !== null) { $aOutlineResult['lat'] = $aPointPolygon['centrelat']; $aOutlineResult['lon'] = $aPointPolygon['centrelon'];