factor out parameter parsing into its own class

Allows to use the parsing functions in website/search.php and
utils/query.php as well.
This commit is contained in:
Sarah Hoffmann
2016-07-31 21:04:33 +02:00
parent feb458f8dd
commit 5464dec057
13 changed files with 426 additions and 393 deletions

View File

@@ -8,16 +8,18 @@
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
$oDB =& getDB();
$oParams = new ParameterParser();
$sOutputFormat = getParamSet('format', array('html', 'json'), 'html');
$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"));