X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/79f11073910df4801b9c96b5b0d7700d9c2607fe..fb7d65b8c377fd5c9a74fef1ef800c9bc8e2abc3:/lib/lib.php diff --git a/lib/lib.php b/lib/lib.php index c68f04eb..50cf3dc4 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -39,6 +39,12 @@ exit; } + function getParamBool($name, $default=false) + { + if (!isset($_GET[$name])) return $default; + + return (bool) $_GET[$name]; + } function fail($sError, $sUserError = false) { @@ -668,12 +674,11 @@ } - function javascript_renderData($xVal) + function javascript_renderData($xVal, $iOptions = 0) { header("Access-Control-Allow-Origin: *"); - $iOptions = 0; if (defined('PHP_VERSION_ID') && PHP_VERSION_ID > 50400) - $iOptions = JSON_UNESCAPED_UNICODE; + $iOptions |= JSON_UNESCAPED_UNICODE; $jsonout = json_encode($xVal, $iOptions); if( ! isset($_GET['json_callback'])) @@ -965,7 +970,7 @@ } // degrees decimal seconds // N 40 26 46 W 79 58 56 - // N 40° 26′ 46″ W, 79° 58′ 56″ + // N 40° 26′ 46″, W 79° 58′ 56″ // 1 2 3 4 5 6 7 8 elseif (preg_match('/\\b([NS])[ ]([0-9]+)[° ]+([0-9]+)[′\' ]+([0-9]+)[″"]*[, ]+([EW])[ ]([0-9]+)[° ]+([0-9]+)[′\' ]+([0-9]+)[″"]*\\b/', $sQuery, $aData)) {