Merge remote-tracking branch 'upstream/master' into move-mouse-position-info-on-map

This commit is contained in:
Marc Tobias Metten
2016-08-24 00:03:40 +02:00
27 changed files with 647 additions and 529 deletions

View File

@@ -3,9 +3,9 @@
require_once(CONST_BasePath.'/lib/init-website.php');
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
$sOutputFormat = 'html';
ini_set('memory_limit', '200M');
$oDB =& getDB();

View File

@@ -5,19 +5,20 @@
require_once(CONST_BasePath.'/lib/init-website.php');
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
$oParams = new ParameterParser();
$sOutputFormat = 'html';
$aLangPrefOrder = $oParams->getPreferredLanguages();
$sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$aLangPrefOrder))."]";
ini_set('memory_limit', '200M');
$sPlaceId = $oParams->getString('place_id');
$sOsmType = $oParams->getSet('osmtype', array('N', 'W', 'R'));
$iOsmId = $oParams->getInt('osmid', -1);
$oDB =& getDB();
$aLangPrefOrder = getPreferredLanguages();
$sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$aLangPrefOrder))."]";
$sPlaceId = getParamString('place_id');
$sOsmType = getParamSet('osmtype', array('N', 'W', 'R'));
$iOsmId = getParamInt('osmid', -1);
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"));
@@ -125,7 +126,7 @@
$aPlaceSearchNameKeywords = false;
$aPlaceSearchAddressKeywords = false;
if (getParamBool('keywords'))
if ($oParams->getBool('keywords'))
{
$sSQL = "select * from search_name where place_id = $iPlaceID";
$aPlaceSearchName = $oDB->getRow($sSQL);

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"));

View File

@@ -6,15 +6,17 @@
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
require_once(CONST_BasePath.'/lib/output.php');
$oDB =& getDB();
ini_set('memory_limit', '200M');
$oParams = new ParameterParser();
// Format for output
$sOutputFormat = getParamSet('format', array('xml', 'json'), 'xml');
$sOutputFormat = $oParams->getSet('format', array('xml', 'json'), 'xml');
// Preferred language
$aLangPrefOrder = getPreferredLanguages();
$aLangPrefOrder = $oParams->getPreferredLanguages();
$oDB =& getDB();
$hLog = logStart($oDB, 'place', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
@@ -23,11 +25,11 @@
$oPlaceLookup = new PlaceLookup($oDB);
$oPlaceLookup->setLanguagePreference($aLangPrefOrder);
$oPlaceLookup->setIncludeAddressDetails(getParamBool('addressdetails', true));
$oPlaceLookup->setIncludeExtraTags(getParamBool('extratags', false));
$oPlaceLookup->setIncludeNameDetails(getParamBool('namedetails', false));
$oPlaceLookup->setIncludeAddressDetails($oParams->getBool('addressdetails', true));
$oPlaceLookup->setIncludeExtraTags($oParams->getBool('extratags', false));
$oPlaceLookup->setIncludeNameDetails($oParams->getBool('namedetails', false));
$aOsmIds = explode(',', getParamString('osm_ids', ''));
$aOsmIds = explode(',', $oParams->getString('osm_ids', ''));
if (count($aOsmIds) > CONST_Places_Max_ID_count)
{

View File

@@ -5,12 +5,14 @@
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
$oDB =& getDB();
$oParams = new ParameterParser();
$sOutputFormat = 'html';
$iDays = getParamInt('days', 1);
$bReduced = getParamBool('reduced', false);
$sClass = getParamString('class', false);
$iDays = $oParams->getInt('days', 1);
$bReduced = $oParams->getBool('reduced', false);
$sClass = $oParams->getString('class', false);
$oDB =& getDB();
$iTotalBroken = (int) chksql($oDB->getOne('select count(*) from import_polygon_error'));

View File

@@ -7,11 +7,14 @@
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
$bAsGeoJSON = getParamBool('polygon_geojson');
$bAsKML = getParamBool('polygon_kml');
$bAsSVG = getParamBool('polygon_svg');
$bAsText = getParamBool('polygon_text');
$oParams = new ParameterParser();
$bAsGeoJSON = $oParams->getBool('polygon_geojson');
$bAsKML = $oParams->getBool('polygon_kml');
$bAsSVG = $oParams->getBool('polygon_svg');
$bAsText = $oParams->getBool('polygon_text');
if ((($bAsGeoJSON?1:0) + ($bAsKML?1:0) + ($bAsSVG?1:0)
+ ($bAsText?1:0)) > CONST_PolygonOutput_MaximumTypes)
{
@@ -23,36 +26,32 @@
{
userError("Polygon output is disabled");
}
exit;
}
// Polygon simplification threshold (optional)
$fThreshold = getParamFloat('polygon_threshold', 0.0);
$oDB =& getDB();
ini_set('memory_limit', '200M');
$fThreshold = $oParams->getFloat('polygon_threshold', 0.0);
// Format for output
$sOutputFormat = getParamSet('format', array('html', 'xml', 'json', 'jsonv2'), 'xml');
$sOutputFormat = $oParams->getSet('format', array('html', 'xml', 'json', 'jsonv2'), 'xml');
// Preferred language
$aLangPrefOrder = getPreferredLanguages();
$aLangPrefOrder = $oParams->getPreferredLanguages();
$oDB =& getDB();
$hLog = logStart($oDB, 'reverse', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
$oPlaceLookup = new PlaceLookup($oDB);
$oPlaceLookup->setLanguagePreference($aLangPrefOrder);
$oPlaceLookup->setIncludeAddressDetails(getParamBool('addressdetails', true));
$oPlaceLookup->setIncludeExtraTags(getParamBool('extratags', false));
$oPlaceLookup->setIncludeNameDetails(getParamBool('namedetails', false));
$oPlaceLookup->setIncludeAddressDetails($oParams->getBool('addressdetails', true));
$oPlaceLookup->setIncludeExtraTags($oParams->getBool('extratags', false));
$oPlaceLookup->setIncludeNameDetails($oParams->getBool('namedetails', false));
$sOsmType = getParamSet('osm_type', array('N', 'W', 'R'));
$iOsmId = getParamInt('osm_id', -1);
$fLat = getParamFloat('lat');
$fLon = getParamFloat('lon');
$sOsmType = $oParams->getSet('osm_type', array('N', 'W', 'R'));
$iOsmId = $oParams->getInt('osm_id', -1);
$fLat = $oParams->getFloat('lat');
$fLon = $oParams->getFloat('lon');
if ($sOsmType && $iOsmId > 0)
{
$aPlace = $oPlaceLookup->lookupOSMID($sOsmType, $iOsmId);
@@ -60,7 +59,7 @@
else if ($fLat !== false && $fLon !== false)
{
$oReverseGeocode = new ReverseGeocode($oDB);
$oReverseGeocode->setZoom(getParamInt('zoom', 18));
$oReverseGeocode->setZoom($oParams->getInt('zoom', 18));
$aLookup = $oReverseGeocode->lookup($fLat, $fLon);
if (CONST_Debug) var_dump($aLookup);

View File

@@ -6,14 +6,14 @@
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/Geocode.php');
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
$oDB =& getDB();
$oParams = new ParameterParser();
$oGeocode = new Geocode($oDB);
$aLangPrefOrder = getPreferredLanguages();
$aLangPrefOrder = $oParams->getPreferredLanguages();
$oGeocode->setLanguagePreference($aLangPrefOrder);
if (CONST_Search_ReversePlanForAll
@@ -26,21 +26,21 @@
}
// Format for output
$sOutputFormat = getParamSet('format', array('html', 'xml', 'json', 'jsonv2'), 'html');
$sOutputFormat = $oParams->getSet('format', array('html', 'xml', 'json', 'jsonv2'), 'html');
// Show / use polygons
if ($sOutputFormat == 'html')
{
$oGeocode->setIncludePolygonAsText(getParamBool('polygon'));
$oGeocode->setIncludePolygonAsText($oParams->getBool('polygon'));
$bAsText = false;
}
else
{
$bAsPoints = getParamBool('polygon');
$bAsGeoJSON = getParamBool('polygon_geojson');
$bAsKML = getParamBool('polygon_kml');
$bAsSVG = getParamBool('polygon_svg');
$bAsText = getParamBool('polygon_text');
$bAsPoints = $oParams->getBool('polygon');
$bAsGeoJSON = $oParams->getBool('polygon_geojson');
$bAsKML = $oParams->getBool('polygon_kml');
$bAsSVG = $oParams->getBool('polygon_svg');
$bAsText = $oParams->getBool('polygon_text');
if ( ( ($bAsGeoJSON?1:0)
+ ($bAsKML?1:0)
+ ($bAsSVG?1:0)
@@ -66,9 +66,9 @@
}
// Polygon simplification threshold (optional)
$oGeocode->setPolygonSimplificationThreshold(getParamFloat('polygon_threshold', 0.0));
$oGeocode->setPolygonSimplificationThreshold($oParams->getFloat('polygon_threshold', 0.0));
$oGeocode->loadParamArray($_GET);
$oGeocode->loadParamArray($oParams);
if (CONST_Search_BatchMode && isset($_GET['batch']))
{
@@ -77,8 +77,9 @@
foreach($aBatch as $aBatchParams)
{
$oBatchGeocode = clone $oGeocode;
$oBatchGeocode->loadParamArray($aBatchParams);
$oBatchGeocode->setQueryFromParams($aBatchParams);
$oBatchParams = new ParameterParser($aBatchParams);
$oBatchGeocode->loadParamArray($oBatchParams);
$oBatchGeocode->setQueryFromParams($oBatchParams);
$aSearchResults = $oBatchGeocode->lookup();
$aBatchResults[] = $aSearchResults;
}
@@ -86,7 +87,10 @@
exit;
}
if (!getParamString('q') && isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'][0] == '/')
$oGeocode->setQueryFromParams($oParams);
if (!$oGeocode->getQueryString()
&& isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'][0] == '/')
{
$sQuery = substr(rawurldecode($_SERVER['PATH_INFO']), 1);
@@ -96,10 +100,6 @@
$sQuery = join(', ',$aPhrases);
$oGeocode->setQuery($sQuery);
}
else
{
$oGeocode->setQueryFromParams($_GET);
}
$hLog = logStart($oDB, 'search', $oGeocode->getQueryString(), $aLangPrefOrder);