]> git.openstreetmap.org Git - nominatim.git/blobdiff - website/search.php
Merge pull request #499 from mtmail/travis-ci
[nominatim.git] / website / search.php
index 4baf3ef5572b9b9fc288b7e7485aa3778eb1f30c..4c283d1aa40827798334aa99f30a34b5d9e65643 100755 (executable)
@@ -32,6 +32,7 @@
        if ($sOutputFormat == 'html')
        {
                $oGeocode->setIncludePolygonAsText(getParamBool('polygon'));
+               $bAsText = false;
        }
        else
        {
                include(CONST_BasePath.'/lib/template/search-batch-json.php');
                exit;
        }
-       else
+
+       if (!getParamString('q') && isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'][0] == '/')
        {
-               if (!getParamString('q') && isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'][0] == '/')
-               {
-                       $sQuery = substr(rawurldecode($_SERVER['PATH_INFO']), 1);
+               $sQuery = substr(rawurldecode($_SERVER['PATH_INFO']), 1);
 
-                       // reverse order of '/' separated string
-                       $aPhrases = explode('/', $sQuery);
-                       $aPhrases = array_reverse($aPhrases);
-                       $sQuery = join(', ',$aPhrases);
-                       $oGeocode->setQuery($sQuery);
-               }
-               else
-               {
-                       $oGeocode->setQueryFromParams($_GET);
-               }
+               // reverse order of '/' separated string
+               $aPhrases = explode('/', $sQuery);
+               $aPhrases = array_reverse($aPhrases);
+               $sQuery = join(', ',$aPhrases);
+               $oGeocode->setQuery($sQuery);
+       }
+       else
+       {
+               $oGeocode->setQueryFromParams($_GET);
        }
 
        $hLog = logStart($oDB, 'search', $oGeocode->getQueryString(), $aLangPrefOrder);
        }
        logEnd($oDB, $hLog, sizeof($aSearchResults));
 
-       $bAsText = $oGeocode->getIncludePolygonAsText();
        $sQuery = $oGeocode->getQueryString();
        $sViewBox = $oGeocode->getViewBoxString();
        $bShowPolygons = (isset($_GET['polygon']) && $_GET['polygon']);
        $aExcludePlaceIDs = $oGeocode->getExcludedPlaceIDs();
 
-       $sMoreURL = CONST_Website_BaseURL.'search.php?format='.urlencode($sOutputFormat).'&exclude_place_ids='.join(',',$oGeocode->getExcludedPlaceIDs());
+       $sMoreURL = CONST_Website_BaseURL.'search.php?format='.urlencode($sOutputFormat).'&exclude_place_ids='.join(',',$aExcludePlaceIDs);
        if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) $sMoreURL .= '&accept-language='.$_SERVER["HTTP_ACCEPT_LANGUAGE"];
        if ($bShowPolygons) $sMoreURL .= '&polygon=1';
        if ($oGeocode->getIncludeAddressDetails()) $sMoreURL .= '&addressdetails=1';