X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/f5dfd93c5cc0800b14548f07a1d25c7350a49fbe..bde251f2a244b87334528f0b01281f8bd96d1ebf:/lib/lib.php diff --git a/lib/lib.php b/lib/lib.php index 1959ded3..f34b09b7 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -25,6 +25,19 @@ } + function userError($sError) + { + header('HTTP/1.0 400 Bad Request'); + header('Content-type: text/html; charset=utf-8'); + echo "
Nominatim has encountered an error with your request.
'; + echo "Details: ".$sError,"
"; + echo 'If you feel this error is incorrect feel free to report the bug in the OSM bug database. Please include the error message above and the URL you used.
'; + echo "\n\n"; + exit; + + } + function fail($sError, $sUserError = false) { if (!$sUserError) $sUserError = $sError; @@ -890,3 +903,17 @@ return $iPlaceID; } + + function loadStructuredAddressElement(&$aStructuredQuery, &$iMinAddressRank, &$iMaxAddressRank, $aParams, $sKey, $iNewMinAddressRank, $iNewMaxAddressRank) + { + if (!isset($_GET[$sKey])) return false; + $sValue = trim($_GET[$sKey]); + if (!$sValue) return false; + $aStructuredQuery[$sKey] = $sValue; + if ($iMinAddressRank == 0 && $iMaxAddressRank == 30) { + $iMinAddressRank = $iNewMinAddressRank; + $iMaxAddressRank = $iNewMaxAddressRank; + } + return true; + } +