Commit a10382ca authored by Franco Fichtner's avatar Franco Fichtner

dashboard: adjust data collection for previous

parent 63a0231e
...@@ -42,6 +42,10 @@ $a_dyndns = &$config['dyndnses']['dyndns']; ...@@ -42,6 +42,10 @@ $a_dyndns = &$config['dyndnses']['dyndns'];
if (!empty($_REQUEST['getdyndnsstatus'])) { if (!empty($_REQUEST['getdyndnsstatus'])) {
$first_entry = true; $first_entry = true;
foreach ($a_dyndns as $dyndns) { foreach ($a_dyndns as $dyndns) {
if (empty($dyndns['enable'])) {
continue;
}
if ($first_entry) { if ($first_entry) {
$first_entry = false; $first_entry = false;
} else { } else {
...@@ -50,10 +54,19 @@ if (!empty($_REQUEST['getdyndnsstatus'])) { ...@@ -50,10 +54,19 @@ if (!empty($_REQUEST['getdyndnsstatus'])) {
} }
$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)) {
$ipaddr = dyndnsCheckIP($dyndns['interface']); $ipaddr = dyndnsCheckIP($dyndns['interface']);
$fdata = @file_get_contents($filename); $fdata = @file_get_contents($filename);
}
$filename_v6 = "/conf/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}_v6.cache";
$fdata6 = '';
if (file_exists($filename_v6)) {
$ipv6addr = get_interface_ipv6($dyndns['interface']);
$fdata6 = @file_get_contents($filename_v6);
}
if (!empty($fdata)) { if (!empty($fdata)) {
$cached_ip_s = preg_split('/:/', $fdata); $cached_ip_s = preg_split('/:/', $fdata);
$cached_ip = $cached_ip_s[0]; $cached_ip = $cached_ip_s[0];
...@@ -62,11 +75,7 @@ if (!empty($_REQUEST['getdyndnsstatus'])) { ...@@ -62,11 +75,7 @@ if (!empty($_REQUEST['getdyndnsstatus'])) {
$ipaddr != $cached_ip ? 'red' : 'green', $ipaddr != $cached_ip ? 'red' : 'green',
htmlspecialchars($cached_ip) htmlspecialchars($cached_ip)
); );
} } elseif (!empty($fdata6)) {
} elseif (file_exists($filename_v6) && !empty($dyndns['enable'])) {
$ipv6addr = get_interface_ipv6($dyndns['interface']);
$fdata6 = @file_get_contents($filename_v6);
if (!empty($fdata6)) {
$cached_ipv6_s = explode('|', $fdata6); $cached_ipv6_s = explode('|', $fdata6);
$cached_ipv6 = $cached_ipv6_s[0]; $cached_ipv6 = $cached_ipv6_s[0];
echo sprintf( echo sprintf(
...@@ -74,7 +83,6 @@ if (!empty($_REQUEST['getdyndnsstatus'])) { ...@@ -74,7 +83,6 @@ if (!empty($_REQUEST['getdyndnsstatus'])) {
$ipv6addr != $cached_ipv6 ? 'red' : 'green', $ipv6addr != $cached_ipv6 ? 'red' : 'green',
htmlspecialchars($cached_ipv6) htmlspecialchars($cached_ipv6)
); );
}
} else { } else {
echo sprintf('<span class="text-muted">%s</span>', gettext('N/A')); echo sprintf('<span class="text-muted">%s</span>', gettext('N/A'));
} }
......
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