X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/db3ced17bbfff00411f506d8c84419c875959d5e..111cca8c9ab882d554b072a05d1dfe4afe58657e:/lib-php/website/details.php diff --git a/lib-php/website/details.php b/lib-php/website/details.php index 91440b54..bd7df12c 100644 --- a/lib-php/website/details.php +++ b/lib-php/website/details.php @@ -53,7 +53,7 @@ if ($sOsmType && $iOsmId > 0) { // Be nice about our error messages for broken geometry - if (!$sPlaceId) { + if (!$sPlaceId && $oDB->tableExists('import_polygon_error')) { $sSQL = 'SELECT '; $sSQL .= ' osm_type, '; $sSQL .= ' osm_id, '; @@ -81,10 +81,15 @@ if ($sOsmType && $iOsmId > 0) { exit; } } -} - -if ($sPlaceId === false) userError('Please select a place id'); + if ($sPlaceId === false) { + throw new Exception('No place with that OSM ID found.', 404); + } +} else { + if ($sPlaceId === false) { + userError('Required parameters missing. Need either osmtype/osmid or place_id.'); + } +} $iPlaceID = (int)$sPlaceId; @@ -140,11 +145,10 @@ $sSQL .= " WHERE place_id = $iPlaceID"; $aPointDetails = $oDB->getRow($sSQL, null, 'Could not get details of place object.'); if (!$aPointDetails) { - userError('Unknown place id.'); + throw new Exception('No place with that place ID found.', 404); } $aPointDetails['localname'] = $aPointDetails['localname']?$aPointDetails['localname']:$aPointDetails['housenumber']; -$aPointDetails['rank_search_label'] = getSearchRankLabel($aPointDetails['rank_search']); // only used in HTML format // Get all alternative names (languages, etc) $sSQL = 'SELECT (each(name)).key,(each(name)).value FROM placex ';