Revision 9447acda
Added by Viktor Gurov over 4 years ago
src/usr/local/www/services_rfc2136.php | ||
---|---|---|
79 | 79 |
<table class="table table-striped table-hover table-condensed table-rowdblclickedit"> |
80 | 80 |
<thead> |
81 | 81 |
<tr> |
82 |
<th><?=gettext("Status")?></th> |
|
82 | 83 |
<th><?=gettext("Interface")?></th> |
83 | 84 |
<th><?=gettext("Server")?></th> |
84 | 85 |
<th><?=gettext("Hostname")?></th> |
... | ... | |
96 | 97 |
|
97 | 98 |
$i = 0; |
98 | 99 |
foreach ($a_rfc2136 as $rfc2136): |
100 |
$filename = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache"; |
|
101 |
$filename_v6 = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}_v6.cache"; |
|
102 |
$if = get_failover_interface($rfc2136['interface']); |
|
103 |
|
|
104 |
if (file_exists($filename)) { |
|
105 |
if (isset($rfc2136['usepublicip'])) { |
|
106 |
$ipaddr = dyndnsCheckIP($if); |
|
107 |
} else { |
|
108 |
$ipaddr = get_interface_ip($if); |
|
109 |
} |
|
110 |
|
|
111 |
$cached_ip_s = explode("|", file_get_contents($filename)); |
|
112 |
$cached_ip = $cached_ip_s[0]; |
|
113 |
|
|
114 |
if ($ipaddr == $cached_ip) { |
|
115 |
$icon_class = "fa fa-check-circle"; |
|
116 |
$text_class = "text-success"; |
|
117 |
$icon_title = "Updated"; |
|
118 |
} else { |
|
119 |
$icon_class = "fa fa-times-circle"; |
|
120 |
$text_class = "text-danger"; |
|
121 |
$icon_title = "Failed"; |
|
122 |
} |
|
123 |
} elseif (file_exists($filename_v6)) { |
|
124 |
$ipv6addr = get_interface_ipv6($if); |
|
125 |
$cached_ipv6_s = explode("|", file_get_contents($filename_v6)); |
|
126 |
$cached_ipv6 = $cached_ip_s[0]; |
|
127 |
|
|
128 |
if ($ipv6addr == $cached_ipv6) { |
|
129 |
$icon_class = "fa fa-check-circle"; |
|
130 |
$text_class = "text-success"; |
|
131 |
$icon_title = "Updated"; |
|
132 |
} else { |
|
133 |
$icon_class = "fa fa-times-circle"; |
|
134 |
$text_class = "text-danger"; |
|
135 |
$icon_title = "Failed"; |
|
136 |
} |
|
137 |
} |
|
99 | 138 |
?> |
100 | 139 |
<tr<?=(isset($rfc2136['enable']) ? '' : ' class="disabled"')?>> |
101 | 140 |
<td> |
141 |
<i class="<?=$icon_class?> <?=$text_class?>" title="<?=$icon_title?>"></i> |
|
142 |
</td> |
|
143 |
<td> |
|
102 | 144 |
<?php |
103 | 145 |
foreach ($iflist as $if => $ifdesc) { |
104 | 146 |
if ($rfc2136['interface'] == $if) { |
... | ... | |
122 | 164 |
</td> |
123 | 165 |
<td> |
124 | 166 |
<?php |
125 |
$filename = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache"; |
|
126 |
$filename_v6 = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}_v6.cache"; |
|
127 |
$if = get_failover_interface($rfc2136['interface']); |
|
128 |
|
|
129 | 167 |
if (file_exists($filename)) { |
130 | 168 |
print('IPv4: '); |
131 |
if (isset($rfc2136['usepublicip'])) { |
|
132 |
$ipaddr = dyndnsCheckIP($if); |
|
133 |
} else { |
|
134 |
$ipaddr = get_interface_ip($if); |
|
135 |
} |
|
136 |
|
|
137 |
$cached_ip_s = explode("|", file_get_contents($filename)); |
|
138 |
$cached_ip = $cached_ip_s[0]; |
|
139 |
|
|
140 |
if ($ipaddr != $cached_ip) { |
|
141 |
print('<span class="text-danger">'); |
|
142 |
} else { |
|
143 |
print('<span class="text-success">'); |
|
144 |
} |
|
145 |
|
|
169 |
print("<span class='{$text_class}'>"); |
|
146 | 170 |
print(htmlspecialchars($cached_ip)); |
147 | 171 |
print('</span>'); |
172 |
} elseif (file_exists($filename_v6)) { |
|
173 |
print("<span class='{$text_class}'>"); |
|
174 |
print(htmlspecialchars($cached_ipv6)); |
|
175 |
print('</span>'); |
|
148 | 176 |
} else { |
149 | 177 |
print('IPv4: N/A'); |
150 | 178 |
} |
Also available in: Unified diff
DynDNS status icons. Implements #3229