dyndns: fix widget with IPv6; closes #797

This commit is contained in:
Franco Fichtner 2016-02-26 21:35:30 +01:00
parent 5bc1fdfa5e
commit db2fdd0ea0

View File

@ -53,6 +53,7 @@ if ($_REQUEST['getdyndnsstatus']) {
}
$filename = "/conf/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache";
$filename_v6 = "/conf/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}_v6.cache";
if (file_exists($filename) && !empty($dyndns['enable'])) {
$ipaddr = dyndnsCheckIP($dyndns['interface']);
$cached_ip_s = preg_split('/:/', file_get_contents($filename));
@ -64,7 +65,17 @@ if ($_REQUEST['getdyndnsstatus']) {
}
echo htmlspecialchars($cached_ip);
echo "</font>";
/* XXX IPv6 missing */
} elseif (file_exists($filename_v6) && !empty($dyndns['enable'])) {
$ipv6addr = get_interface_ipv6($dyndns['interface']);
$cached_ipv6_s = explode("|", file_get_contents($filename_v6));
$cached_ipv6 = $cached_ipv6_s[0];
if ($ipv6addr <> $cached_ipv6) {
echo "<font color='red'>";
} else {
echo "<font color='green'>";
}
echo htmlspecialchars($cached_ipv6);
echo "</font>";
} else {
echo '<span class="text-muted">' . gettext('N/A') . '</span>';
}