X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/f45b3fa3f243de8894c03d8c9377157d01092c8c..b612b9942109a08c6ff8f49e3327e015fec08e67:/lib/AddressDetails.php diff --git a/lib/AddressDetails.php b/lib/AddressDetails.php index e6501b57..b62335d1 100644 --- a/lib/AddressDetails.php +++ b/lib/AddressDetails.php @@ -17,7 +17,7 @@ class AddressDetails $mLangPref = 'ARRAY['.join(',', array_map('getDBQuoted', $mLangPref)).']'; } - if (!$sHousenumber) { + if (!isset($sHousenumber)) { $sHousenumber = -1; } @@ -26,12 +26,12 @@ class AddressDetails $sSQL .= ' FROM get_addressdata('.$iPlaceID.','.$sHousenumber.')'; $sSQL .= ' ORDER BY rank_address DESC, isaddress DESC'; - $this->aAddressLines = chksql($oDB->getAll($sSQL)); + $this->aAddressLines = $oDB->getAll($sSQL); } 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; } @@ -103,7 +103,7 @@ class AddressDetails public function getAdminLevels() { $aAddress = array(); - foreach ($this->aAddressLines as $aLine) { + foreach (array_reverse($this->aAddressLines) as $aLine) { if (self::isAddress($aLine) && isset($aLine['admin_level']) && $aLine['admin_level'] < 15