Update admin.php

Fix for geolocates that succeed but don't return a country code.
This commit is contained in:
Brian Huisman 2023-05-03 11:32:24 -04:00
parent da235cdc95
commit 8caf5440d3

View file

@ -2271,7 +2271,7 @@ document.write(mustache.render(
<th colspan="6"> <th colspan="6">
<div class="row"> <div class="row">
<div class="col-md-6 d-flex mb-2 mb-md-0"> <div class="col-md-6 d-flex mb-2 mb-md-0">
<h3 class="mb-0 pe-2">Filters:</h3> <h3 class="d-flex flex-column justify-content-center mb-0 pe-2">Filters:</h3>
<label class="input-group pe-1"> <label class="input-group pe-1">
<input type="text" name="os_index_filter_text" value="<?php <input type="text" name="os_index_filter_text" value="<?php
echo htmlspecialchars($_SESSION['index_filter_text']); echo htmlspecialchars($_SESSION['index_filter_text']);
@ -3009,14 +3009,18 @@ document.write(mustache.render(
} ?> } ?>
<td class="text-end d-none d-md-table-cell" data-value="<?php echo $query['ipaddr']; ?>"> <td class="text-end d-none d-md-table-cell" data-value="<?php echo $query['ipaddr']; ?>">
<a href="https://bgp.he.net/ip/<?php echo $query['ipaddr']; ?>" target="_blank"><?php echo $query['ipaddr']; ?></a><?php <a href="https://bgp.he.net/ip/<?php echo $query['ipaddr']; ?>" target="_blank"><?php echo $query['ipaddr']; ?></a><?php
if (!empty($query['geo'])) { if (!empty($query['geo']->raw['country']['iso_code'])) {
if (file_exists(__DIR__.'/img/flags/'.strtolower($query['geo']->raw['country']['iso_code']).'.png')) { ?> if (file_exists(__DIR__.'/img/flags/'.strtolower($query['geo']->raw['country']['iso_code']).'.png')) {
<img src="<?php echo $flag = 'img/flags/'.strtolower($query['geo']->raw['country']['iso_code']).'.png';
'img/flags/'.strtolower($query['geo']->raw['country']['iso_code']).'.png'; $title = $query['geo']->raw['country']['names']['en'];
?>" alt="<?php echo htmlspecialchars($query['geo']->raw['country']['names']['en']); ?>" $classname = 'svg-icon-flag';
title="<?php echo htmlspecialchars($query['geo']->raw['country']['names']['en']); ?>" } else { // Missing flag
class="align-middle svg-icon-flag mb-1"><?php $flag = 'img/help.svg';
} $title = $query['geo']->raw['country']['names']['en'];
$classname = 'svg-icon';
} ?>
<img src="<?php echo $flag; ?>" class="align-middle <?php echo $classname; ?> mb-1"
alt="<?php echo htmlspecialchars($title); ?>" title="<?php echo htmlspecialchars($title); ?>"><?php
} }
?></td> ?></td>
</tr><?php </tr><?php