]> git.openstreetmap.org Git - nominatim.git/blobdiff - website/hierarchy.php
factor out parameter parsing into its own class
[nominatim.git] / website / hierarchy.php
index 28a56f00938bda7b2382000bf8bfaa9dec761690..60d77d6a9d6f69e3004ddf26eaf4dc4e6754f794 100755 (executable)
@@ -8,16 +8,18 @@
        require_once(CONST_BasePath.'/lib/output.php');
        ini_set('memory_limit', '200M');
 
-       $oDB =& getDB();
-
-       $sOutputFormat = getParamSet('format', array('html', 'json'), 'html');
+       $oParams = new ParameterParser();
 
-       $aLangPrefOrder = getPreferredLanguages();
+       $sOutputFormat = $oParams->getSet('format', array('html', 'json'), 'html');
+       $aLangPrefOrder = $oParams->getPreferredLanguages();
        $sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$aLangPrefOrder))."]";
 
-       $sPlaceId = getParamString('place_id');
-       $sOsmType = getParamSet('osmtype', array('N', 'W', 'R'));
-       $iOsmId = getParamInt('osmid', -1);
+       $sPlaceId = $oParams->getString('place_id');
+       $sOsmType = $oParams->getSet('osmtype', array('N', 'W', 'R'));
+       $iOsmId = $oParams->getInt('osmid', -1);
+
+       $oDB =& getDB();
+
        if ($sOsmType && $iOsmId > 0)
        {
                $sPlaceId = chksql($oDB->getOne("select place_id from placex where osm_type = '".$sOsmType."' and osm_id = ".$iOsmId." order by type = 'postcode' asc"));