Commit 74ca8331 authored by Franco Fichtner's avatar Franco Fichtner

dyndns: fix previous widget race in actual page code again

parent 2c045731
...@@ -141,31 +141,37 @@ $main_buttons = array( ...@@ -141,31 +141,37 @@ $main_buttons = array(
<td> <td>
<?php <?php
$filename = "/conf/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache"; $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"; $fdata = '';
if (file_exists($filename) && !empty($dyndns['enable'])) { if (file_exists($filename) && !empty($dyndns['enable'])) {
$ipaddr = dyndnsCheckIP($dyndns['interface']); $ipaddr = dyndnsCheckIP($dyndns['interface']);
$cached_ip_s = explode(":", file_get_contents($filename)); $fdata = @file_get_contents($filename);
$cached_ip = $cached_ip_s[0]; }
if ($ipaddr <> $cached_ip) {
echo "<font color='red'>"; $filename_v6 = "/conf/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}_v6.cache";
} else { $fdata6 = '';
echo "<font color='green'>"; if (file_exists($filename_v6) && !empty($dyndns['enable'])) {
} $ipv6addr = get_interface_ipv6($dyndns['interface']);
echo htmlspecialchars($cached_ip); $fdata6 = @file_get_contents($filename_v6);
echo "</font>"; }
} elseif (file_exists($filename_v6) && !empty($dyndns['enable'])) {
$ipv6addr = get_interface_ipv6($dyndns['interface']); if (!empty($fdata)) {
$cached_ipv6_s = explode("|", file_get_contents($filename_v6)); $cached_ip_s = explode(':', $fdata);
$cached_ipv6 = $cached_ipv6_s[0]; $cached_ip = $cached_ip_s[0];
if ($ipv6addr <> $cached_ipv6) { echo sprintf(
echo "<font color='red'>"; '<font color="%s">%s</font>',
} else { $ipaddr != $cached_ip ? 'red' : 'green',
echo "<font color='green'>"; htmlspecialchars($cached_ip)
} );
echo htmlspecialchars($cached_ipv6); } elseif (!empty($fdata6)) {
echo "</font>"; $cached_ipv6_s = explode('|', $fdata6);
$cached_ipv6 = $cached_ipv6_s[0];
echo sprintf(
'<font color="%s">%s</font>',
$ipv6addr != $cached_ipv6 ? 'red' : 'green',
htmlspecialchars($cached_ipv6)
);
} else { } else {
echo gettext('N/A'); echo sprintf('<span class="text-muted">%s</span>', gettext('N/A'));
}?> }?>
</td> </td>
<td><?=$dyndns['descr'];?></td> <td><?=$dyndns['descr'];?></td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment