mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-09 11:34:07 +00:00
Fix PHP errors in structured HTML output
Correctly handle missing parameters.
This commit is contained in:
@@ -15,63 +15,55 @@
|
|||||||
<a id="switch-to-reverse" href="<?php echo CONST_Website_BaseURL; ?>reverse.php?format=html">reverse search</a>
|
<a id="switch-to-reverse" href="<?php echo CONST_Website_BaseURL; ?>reverse.php?format=html">reverse search</a>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if (empty($aMoreParams['q']) and empty($aMoreParams['street']) and empty($aMoreParams['city']) and empty($aMoreParams['county']) and empty($aMoreParams['state']) and empty($aMoreParams['country']) and empty($aMoreParams['postalcode'])) {
|
$bSimpleQuery = !empty($aMoreParams['q']);
|
||||||
echo '<div class="radio-inline"><input type="radio" name="query-selector" id="simple" value="simple" checked="checked">';
|
$bStructuredQuery = !$bSimpleQuery
|
||||||
echo '<label for="simple">simple</label></div>';
|
&& !(empty($aMoreParams['street'])
|
||||||
echo '<div class="radio-inline"><input type="radio" name="query-selector" id="structured" value="structured">';
|
&& empty($aMoreParams['city'])
|
||||||
echo '<label for="structured">structured</label></div>';
|
&& empty($aMoreParams['county'])
|
||||||
}
|
&& empty($aMoreParams['state'])
|
||||||
elseif (!empty($aMoreParams['q'])) {
|
&& empty($aMoreParams['country'])
|
||||||
echo '<div class="radio-inline"><input type="radio" name="query-selector" id="simple" value="simple" checked="checked">';
|
&& empty($aMoreParams['postalcode']));
|
||||||
echo '<label for="simple">simple</label></div>';
|
|
||||||
echo '<div class="radio-inline"><input type="radio" name="query-selector" id="structured" value="structured">';
|
|
||||||
echo '<label for="structured">structured</label></div>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo '<div class="radio-inline"><input type="radio" name="query-selector" id="simple" value="simple">';
|
|
||||||
echo '<label for="simple">simple</label></div>';
|
|
||||||
echo '<div class="radio-inline"><input type="radio" name="query-selector" id="structured" value="structured" checked="checked">';
|
|
||||||
echo '<label for="structured">structured</label></div>';
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
<div class="radio-inline">
|
||||||
|
<input type="radio" name="query-selector" id="simple" value="simple" <?php if ($bSimpleQuery) { echo 'checked="checked"'; } ?> >
|
||||||
|
<label for="simple">simple</label>
|
||||||
|
</div>
|
||||||
|
<div class="radio-inline">
|
||||||
|
<input type="radio" name="query-selector" id="structured" value="structured" <?php if ($bStructuredQuery) { echo 'checked="checked"'; } ?> >
|
||||||
|
<label for="structured">structured</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<form role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>search.php">
|
<form role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>search.php">
|
||||||
<div class="form-group-simple"
|
<div class="form-group-simple"
|
||||||
<?php
|
<?php
|
||||||
if (empty($aMoreParams['q']) and empty($aMoreParams['street']) and empty($aMoreParams['city']) and empty($aMoreParams['county']) and empty($aMoreParams['state']) and empty($aMoreParams['country']) and empty($aMoreParams['postalcode'])) {
|
if (!$bSimpleQuery) {
|
||||||
echo "style='display:block;'";
|
echo 'style="display:none;"';
|
||||||
}
|
|
||||||
elseif (empty($aMoreParams['q'])) {
|
|
||||||
echo "style='display:none;'";
|
|
||||||
}
|
}
|
||||||
?>>
|
?>>
|
||||||
<input id="q" name="q" type="text" class="form-control input-sm" placeholder="Search" value="<?php echo htmlspecialchars($aMoreParams['q']); ?>" >
|
<input id="q" name="q" type="text" class="form-control input-sm" placeholder="Search" value="<?php echo htmlspecialchars($aMoreParams['q'] ?? ''); ?>" >
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group-structured"
|
<div class="form-group-structured"
|
||||||
<?php
|
<?php
|
||||||
if (empty($aMoreParams['street']) and empty($aMoreParams['city']) and empty($aMoreParams['county']) and empty($aMoreParams['state']) and empty($aMoreParams['country']) and empty($aMoreParams['postalcode'])) {
|
if (!$bStructuredQuery) {
|
||||||
echo "style='display:none;'";
|
echo "style='display:none;'";
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
echo "style='display:block;'";
|
|
||||||
}
|
|
||||||
?>>
|
?>>
|
||||||
<div class="form-inline">
|
<div class="form-inline">
|
||||||
<input id="street" name="street" type="text" class="form-control input-sm" placeholder="House number/Street" value="<?php echo htmlspecialchars($aMoreParams['street']); ?>" >
|
<input id="street" name="street" type="text" class="form-control input-sm" placeholder="House number/Street" value="<?php echo htmlspecialchars($aMoreParams['street'] ?? ''); ?>" >
|
||||||
<input id="city" name="city" type="text" class="form-control input-sm" placeholder="City" value="<?php echo htmlspecialchars($aMoreParams['city']); ?>" >
|
<input id="city" name="city" type="text" class="form-control input-sm" placeholder="City" value="<?php echo htmlspecialchars($aMoreParams['city'] ?? ''); ?>" >
|
||||||
<input id="county" name="county" type="text" class="form-control input-sm" placeholder="County" value="<?php echo htmlspecialchars($aMoreParams['county']); ?>" >
|
<input id="county" name="county" type="text" class="form-control input-sm" placeholder="County" value="<?php echo htmlspecialchars($aMoreParams['county'] ?? ''); ?>" >
|
||||||
<input id="state" name="state" type="text" class="form-control input-sm" placeholder="State" value="<?php echo htmlspecialchars($aMoreParams['state']); ?>" >
|
<input id="state" name="state" type="text" class="form-control input-sm" placeholder="State" value="<?php echo htmlspecialchars($aMoreParams['state'] ?? ''); ?>" >
|
||||||
<input id="country" name="country" type="text" class="form-control input-sm" placeholder="Country" value="<?php echo htmlspecialchars($aMoreParams['country']); ?>" >
|
<input id="country" name="country" type="text" class="form-control input-sm" placeholder="Country" value="<?php echo htmlspecialchars($aMoreParams['country'] ?? ''); ?>" >
|
||||||
<input id="postalcode" name="postalcode" type="text" class="form-control input-sm" placeholder="Postal Code" value="<?php echo htmlspecialchars($aMoreParams['postalcode']); ?>" >
|
<input id="postalcode" name="postalcode" type="text" class="form-control input-sm" placeholder="Postal Code" value="<?php echo htmlspecialchars($aMoreParams['postalcode'] ?? ''); ?>" >
|
||||||
</div></div>
|
</div></div>
|
||||||
<div class="form-group search-button-group">
|
<div class="form-group search-button-group">
|
||||||
<button type="submit" class="btn btn-primary btn-sm">Search</button>
|
<button type="submit" class="btn btn-primary btn-sm">Search</button>
|
||||||
<?php if (CONST_Search_AreaPolygons) { ?>
|
<?php if (CONST_Search_AreaPolygons) { ?>
|
||||||
<input type="hidden" value="1" name="polygon_geojson" />
|
<input type="hidden" value="1" name="polygon_geojson" />
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<input type="hidden" name="viewbox" value="<?php if (isset($aMoreParams['viewbox'])) echo ($aMoreParams['viewbox']); ?>" />
|
<input type="hidden" name="viewbox" value="<?php echo htmlspecialchars($aMoreParams['viewbox'] ?? ''); ?>" />
|
||||||
<div class="checkbox-inline">
|
<div class="checkbox-inline">
|
||||||
<input type="checkbox" id="use_viewbox" <?php if (isset($aMoreParams['viewbox'])) echo "checked='checked'"; ?>>
|
<input type="checkbox" id="use_viewbox" <?php if (!empty($aMoreParams['viewbox'])) echo "checked='checked'"; ?>>
|
||||||
<label for="use_viewbox">apply viewbox</label>
|
<label for="use_viewbox">apply viewbox</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user