<?php
+/**
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * This file is part of Nominatim. (https://nominatim.org)
+ *
+ * Copyright (C) 2022 by the Nominatim developer community.
+ * For a full list of authors see the git log.
+ */
header('content-type: text/xml; charset=UTF-8');
echo '<';
echo ">\n";
if (empty($aPlace)) {
- if (isset($sError))
+ if (isset($sError)) {
echo "<error>$sError</error>";
- else echo '<error>Unable to geocode</error>';
+ } else {
+ echo '<error>Unable to geocode</error>';
+ }
} else {
echo '<result';
- if ($aPlace['place_id']) echo ' place_id="'.$aPlace['place_id'].'"';
+ if ($aPlace['place_id']) {
+ echo ' place_id="'.$aPlace['place_id'].'"';
+ }
$sOSMType = formatOSMType($aPlace['osm_type']);
- if ($sOSMType) echo ' osm_type="'.$sOSMType.'"'.' osm_id="'.$aPlace['osm_id'].'"';
- if ($aPlace['ref']) echo ' ref="'.htmlspecialchars($aPlace['ref']).'"';
- if (isset($aPlace['lat'])) echo ' lat="'.htmlspecialchars($aPlace['lat']).'"';
- if (isset($aPlace['lon'])) echo ' lon="'.htmlspecialchars($aPlace['lon']).'"';
+ if ($sOSMType) {
+ echo ' osm_type="'.$sOSMType.'"'.' osm_id="'.$aPlace['osm_id'].'"';
+ }
+ if ($aPlace['ref']) {
+ echo ' ref="'.htmlspecialchars($aPlace['ref']).'"';
+ }
+ if (isset($aPlace['lat'])) {
+ echo ' lat="'.htmlspecialchars($aPlace['lat']).'"';
+ }
+ if (isset($aPlace['lon'])) {
+ echo ' lon="'.htmlspecialchars($aPlace['lon']).'"';
+ }
if (isset($aPlace['aBoundingBox'])) {
echo ' boundingbox="';
echo join(',', $aPlace['aBoundingBox']);