]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/lib.php
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / lib / lib.php
index e548dc3af3abe35fd82efc1e6df040ab63632e23..d1afedbd68414278f90dbcb1906c6c067c06147c 100644 (file)
                exit;
        }
 
+       function getParamBool($name, $default=false)
+       {
+               if (!isset($_GET[$name])) return $default;
+
+               return (bool) $_GET[$name];
+       }
 
        function fail($sError, $sUserError = false)
        {
        }
 
 
-       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']))
                }
                // 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))
                {