X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/890d415e1ffd997d11ed35dee04cb01b94ca133f..e171f90d81cb1a21eb6cda537a68b338052f2bce:/lib/AddressDetails.php diff --git a/lib/AddressDetails.php b/lib/AddressDetails.php index f5293586..61823b4c 100644 --- a/lib/AddressDetails.php +++ b/lib/AddressDetails.php @@ -14,10 +14,10 @@ class AddressDetails public function __construct(&$oDB, $iPlaceID, $sHousenumber, $mLangPref) { if (is_array($mLangPref)) { - $mLangPref = 'ARRAY['.join(',', array_map('getDBQuoted', $mLangPref)).']'; + $mLangPref = $oDB->getArraySQL($oDB->getDBQuotedList($mLangPref)); } - if (!$sHousenumber) { + if (!isset($sHousenumber)) { $sHousenumber = -1; } @@ -31,7 +31,7 @@ class AddressDetails private static function isAddress($aLine) { - return $aLine['isaddress'] == 't' || $aLine['type'] == 'country_code'; + return $aLine['isaddress'] || $aLine['type'] == 'country_code'; } public function getAddressDetails($bAll = false) @@ -49,7 +49,7 @@ class AddressDetails $sPrevResult = ''; foreach ($this->aAddressLines as $aLine) { - if ($aLine['isaddress'] == 't' && $sPrevResult != $aLine['localname']) { + if ($aLine['isaddress'] && $sPrevResult != $aLine['localname']) { $sPrevResult = $aLine['localname']; $aParts[] = $sPrevResult; } @@ -76,14 +76,14 @@ class AddressDetails $bFallback = true; } - $sName = false; - if (isset($aLine['localname']) && $aLine['localname']) { + $sName = null; + if (isset($aLine['localname']) && $aLine['localname']!=='') { $sName = $aLine['localname']; - } elseif (isset($aLine['housenumber']) && $aLine['housenumber']) { + } elseif (isset($aLine['housenumber']) && $aLine['housenumber']!=='') { $sName = $aLine['housenumber']; } - if ($sName) { + if (isset($sName)) { $sTypeLabel = strtolower(isset($aTypeLabel['simplelabel']) ? $aTypeLabel['simplelabel'] : $aTypeLabel['label']); $sTypeLabel = str_replace(' ', '_', $sTypeLabel); if (!isset($aAddress[$sTypeLabel]) @@ -97,6 +97,7 @@ class AddressDetails } } } + return $aAddress; }