2         @define('CONST_ConnectionBucket_PageType', 'Reverse');
 
   4         require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
 
   5         require_once(CONST_BasePath.'/lib/init-website.php');
 
   6         require_once(CONST_BasePath.'/lib/log.php');
 
   7         require_once(CONST_BasePath.'/lib/PlaceLookup.php');
 
   8         require_once(CONST_BasePath.'/lib/output.php');
 
  11         ini_set('memory_limit', '200M');
 
  14         $sOutputFormat = getParamSet('format', array('xml', 'json'), 'xml');
 
  17         $aLangPrefOrder = getPreferredLanguages();
 
  19         $hLog = logStart($oDB, 'place', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
 
  21         $aSearchResults = array();
 
  22         $aCleanedQueryParts = array();
 
  24         $oPlaceLookup = new PlaceLookup($oDB);
 
  25         $oPlaceLookup->setLanguagePreference($aLangPrefOrder);
 
  26         $oPlaceLookup->setIncludeAddressDetails(getParamBool('addressdetails', true));
 
  27         $oPlaceLookup->setIncludeExtraTags(getParamBool('extratags', false));
 
  28         $oPlaceLookup->setIncludeNameDetails(getParamBool('namedetails', false));
 
  30         $aOsmIds = explode(',', getParamString('osm_ids', ''));
 
  32         if (count($aOsmIds) > CONST_Places_Max_ID_count)
 
  34                 userError('Bulk User: Only ' . CONST_Places_Max_ID_count . " ids are allowed in one request.");
 
  37         foreach ($aOsmIds AS $sItem)
 
  40                 if (empty($sItem)) continue;
 
  43                 $iId = (int) substr($sItem, 1);
 
  44                 if ( $iId > 0 && ($sType == 'N' || $sType == 'W' || $sType == 'R') )
 
  46                         $aCleanedQueryParts[] = $sType . $iId;
 
  47                         $oPlace = $oPlaceLookup->lookupOSMID($sType, $iId);
 
  49                                 // we want to use the search-* output templates, so we need to fill
 
  50                                 // $aSearchResults and slightly change the (reverse search) oPlace
 
  53                                 unset($oResult['aAddress']);
 
  54                                 if (isset($oPlace['aAddress'])) $oResult['address'] = $oPlace['aAddress'];
 
  55                                 unset($oResult['langaddress']);
 
  56                                 $oResult['name'] = $oPlace['langaddress'];
 
  57                                 $aSearchResults[] = $oResult;
 
  63         if (CONST_Debug) exit;
 
  65         $sXmlRootTag = 'lookupresults';
 
  66         $sQuery = join(',',$aCleanedQueryParts);
 
  67         // we initialize these to avoid warnings in our logfile
 
  70         $aExcludePlaceIDs = [];
 
  73         include(CONST_BasePath.'/lib/template/search-'.$sOutputFormat.'.php');