]> git.openstreetmap.org Git - nominatim.git/blobdiff - website/reverse.php
introduce chksql function for website code and move other fail functions
[nominatim.git] / website / reverse.php
index 75eb26779550c31da55f6a7e17fb499383e68e1f..17b8a2ca08178a6eb1c15d3f69fce3fabedcafff 100755 (executable)
@@ -6,6 +6,7 @@
        require_once(CONST_BasePath.'/lib/log.php');
        require_once(CONST_BasePath.'/lib/PlaceLookup.php');
        require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
+       require_once(CONST_BasePath.'/lib/output.php');
 
        if (strpos(CONST_BulkUserIPs, ','.$_SERVER["REMOTE_ADDR"].',') !== false)
        {
        }
 
 
-       $bAsPoints = false;
        $bAsGeoJSON = getParamBool('polygon_geojson');
        $bAsKML = getParamBool('polygon_kml');
        $bAsSVG = getParamBool('polygon_svg');
        $bAsText = getParamBool('polygon_text');
        if ((($bAsGeoJSON?1:0) + ($bAsKML?1:0) + ($bAsSVG?1:0)
-               + ($bAsText?1:0) + ($bAsPoints?1:0)) > CONST_PolygonOutput_MaximumTypes)
+               + ($bAsText?1:0)) > CONST_PolygonOutput_MaximumTypes)
        {
                if (CONST_PolygonOutput_MaximumTypes)
                {
                $oReverseGeocode->setLanguagePreference($aLangPrefOrder);
 
                $oReverseGeocode->setLatLon($fLat, $fLon);
-               $oReverseGeocode->setZoom(getParamInt('zoom'));
+               $oReverseGeocode->setZoom(getParamInt('zoom', 18));
 
                $aLookup = $oReverseGeocode->lookup();
                if (CONST_Debug) var_dump($aLookup);
        }
-       else
+       else if ($sOutputFormat != 'html')
        {
                userError("Need coordinates or OSM object to lookup.");
        }
@@ -90,7 +90,7 @@
 
                $aPlace = $oPlaceLookup->lookupPlace($aLookup);
 
-               $oPlaceLookup->setIncludePolygonAsPoints($bAsPoints);
+               $oPlaceLookup->setIncludePolygonAsPoints(false);
                $oPlaceLookup->setIncludePolygonAsText($bAsText);
                $oPlaceLookup->setIncludePolygonAsGeoJSON($bAsGeoJSON);
                $oPlaceLookup->setIncludePolygonAsKML($bAsKML);
 
        if ($sOutputFormat=='html')
        {
-               $sDataDate = $oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1");
+               $sDataDate = chksql($oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1"));
                $sTileURL = CONST_Map_Tile_URL;
                $sTileAttribution = CONST_Map_Tile_Attribution;
        }