]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/lib.php
move deletable and polygons into default website
[nominatim.git] / lib / lib.php
index 5d02ef89a1c530a7f3e0b0fa53accdde394963af..f34b09b7a51fbef8285d4a19bd9fb9de5b1704ab 100644 (file)
 
        }
 
 
        }
 
+       function userError($sError) 
+       {
+               header('HTTP/1.0 400 Bad Request');
+               header('Content-type: text/html; charset=utf-8');
+               echo "<html><body><h1>Bad Request</h1>";
+               echo '<p>Nominatim has encountered an error with your request.</p>';
+               echo "<p><b>Details:</b> ".$sError,"</p>";
+               echo '<p>If you feel this error is incorrect feel free to report the bug in the <a href="http://trac.openstreetmap.org">OSM bug database</a>. Please include the error message above and the URL you used.</p>';
+               echo "\n</body></html>\n";
+               exit;
+
+       }
+
        function fail($sError, $sUserError = false)
        {
                if (!$sUserError) $sUserError = $sError;
        function fail($sError, $sUserError = false)
        {
                if (!$sUserError) $sUserError = $sError;
                return ($a['foundorder'] < $b['foundorder']?-1:1);
        }
 
                return ($a['foundorder'] < $b['foundorder']?-1:1);
        }
 
-       function getPrefferedLangauges()
+       function getPreferredLanguages()
        {
                // If we have been provided the value in $_GET it overrides browser value
                if (isset($_GET['accept-language']) && $_GET['accept-language'])
        {
                // If we have been provided the value in $_GET it overrides browser value
                if (isset($_GET['accept-language']) && $_GET['accept-language'])
                return false;
 
                /*
                return false;
 
                /*
-                       $fTotalFac is a suprisingly good indicator of accuracy
+                       $fTotalFac is a surprisingly good indicator of accuracy
                        $iZoom = 18 + round(log($fTotalFac,32));
                        $iZoom = max(13,min(18,$iZoom));
                */
                        $iZoom = 18 + round(log($fTotalFac,32));
                        $iZoom = max(13,min(18,$iZoom));
                */
 
                return $iPlaceID;
        }
 
                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;
+        }
+