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,31 +54,35 @@ if (!empty($_REQUEST['getdyndnsstatus'])) { ...@@ -50,31 +54,35 @@ 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);
if (!empty($fdata)) { }
$cached_ip_s = preg_split('/:/', $fdata);
$cached_ip = $cached_ip_s[0]; $filename_v6 = "/conf/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}_v6.cache";
echo sprintf( $fdata6 = '';
'<font color="%s">%s</font>', if (file_exists($filename_v6)) {
$ipaddr != $cached_ip ? 'red' : 'green',
htmlspecialchars($cached_ip)
);
}
} elseif (file_exists($filename_v6) && !empty($dyndns['enable'])) {
$ipv6addr = get_interface_ipv6($dyndns['interface']); $ipv6addr = get_interface_ipv6($dyndns['interface']);
$fdata6 = @file_get_contents($filename_v6); $fdata6 = @file_get_contents($filename_v6);
if (!empty($fdata6)) { }
$cached_ipv6_s = explode('|', $fdata6);
$cached_ipv6 = $cached_ipv6_s[0]; if (!empty($fdata)) {
echo sprintf( $cached_ip_s = preg_split('/:/', $fdata);
'<font color="%s">%s</font>', $cached_ip = $cached_ip_s[0];
$ipv6addr != $cached_ipv6 ? 'red' : 'green', echo sprintf(
htmlspecialchars($cached_ipv6) '<font color="%s">%s</font>',
); $ipaddr != $cached_ip ? 'red' : 'green',
} htmlspecialchars($cached_ip)
);
} elseif (!empty($fdata6)) {
$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 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