X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/db3ced17bbfff00411f506d8c84419c875959d5e..690f9ec06fd7a08b41de027427d8a1d3d0e3ff2e:/lib-php/admin/export.php?ds=sidebyside diff --git a/lib-php/admin/export.php b/lib-php/admin/export.php index b038cf2a..887b4beb 100644 --- a/lib-php/admin/export.php +++ b/lib-php/admin/export.php @@ -1,4 +1,12 @@ connect(); if (isset($aCMDResult['output-type'])) { - if (!isset($aRankmap[$aCMDResult['output-type']])) fail('unknown output-type: '.$aCMDResult['output-type']); + if (!isset($aRankmap[$aCMDResult['output-type']])) { + fail('unknown output-type: '.$aCMDResult['output-type']); + } $iOutputRank = $aRankmap[$aCMDResult['output-type']]; } else { $iOutputRank = $aRankmap['street']; @@ -58,14 +68,18 @@ // Preferred language $oParams = new Nominatim\ParameterParser(); - if (!isset($aCMDResult['language'])) $aCMDResult['language'] = 'xx'; + if (!isset($aCMDResult['language'])) { + $aCMDResult['language'] = 'xx'; + } $aLangPrefOrder = $oParams->getPreferredLanguages($aCMDResult['language']); $sLanguagePrefArraySQL = $oDB->getArraySQL($oDB->getDBQuotedList($aLangPrefOrder)); // output formatting: build up a lookup table that maps address ranks to columns $aColumnMapping = array(); $iNumCol = 0; - if (!isset($aCMDResult['output-format'])) $aCMDResult['output-format'] = 'street;suburb;city;county;state;country'; + if (!isset($aCMDResult['output-format'])) { + $aCMDResult['output-format'] = 'street;suburb;city;county;state;country'; + } foreach (preg_split('/\s*;\s*/', $aCMDResult['output-format']) as $sColumn) { $bHasData = false; foreach (preg_split('/\s*,\s*/', $sColumn) as $sRank) { @@ -80,7 +94,9 @@ } } } - if ($bHasData) $iNumCol++; + if ($bHasData) { + $iNumCol++; + } } // build the query for objects @@ -122,7 +138,9 @@ if ($sOsmType) { $sSQL = 'select place_id from placex where osm_type = :osm_type and osm_id = :osm_id'; $sParentId = $oDB->getOne($sSQL, array('osm_type' => $sOsmType, 'osm_id' => $sOsmId)); - if (!$sParentId) fail('Could not find place '.$sOsmType.' '.$sOsmId); + if (!$sParentId) { + fail('Could not find place '.$sOsmType.' '.$sOsmId); + } } if ($sParentId) { $sPlacexSQL .= ' and place_id in (select place_id from place_addressline where address_place_id = '.$sParentId.' and isaddress)'; @@ -136,7 +154,6 @@ $oResults = $oDB->getQueryStatement($sPlacexSQL); $fOutstream = fopen('php://output', 'w'); while ($aRow = $oResults->fetch()) { - //var_dump($aRow); $iPlaceID = $aRow['place_id']; $sSQL = "select rank_address,get_name_by_language(name,$sLanguagePrefArraySQL) as localname from get_addressdata(:place_id, -1)"; $sSQL .= ' WHERE isaddress';