summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/status_dhcpv6_leases.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/local/www/status_dhcpv6_leases.php')
-rw-r--r--src/usr/local/www/status_dhcpv6_leases.php378
1 files changed, 196 insertions, 182 deletions
diff --git a/src/usr/local/www/status_dhcpv6_leases.php b/src/usr/local/www/status_dhcpv6_leases.php
index 63f1946..925f2da 100644
--- a/src/usr/local/www/status_dhcpv6_leases.php
+++ b/src/usr/local/www/status_dhcpv6_leases.php
@@ -93,12 +93,6 @@ $mac_man = load_mac_manufacturer_table();
include("head.inc");
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<?php
-
function leasecmp($a, $b) {
return strcmp($a[$_GET['order']], $b[$_GET['order']]);
}
@@ -314,11 +308,11 @@ while ($i < $leases_count) {
$f = $f+2;
break;
case "client-hostname":
- if ($data[$f+1] <> "") {
- $entry['hostname'] = preg_replace('/"/', '', $data[$f+1]);
+ if($data[$f+1] != "") {
+ $entry['hostname'] = preg_replace('/"/','',$data[$f+1]);
} else {
$hostname = gethostbyaddr($entry['ip']);
- if ($hostname <> "") {
+ if($hostname != "") {
$entry['hostname'] = $hostname;
}
}
@@ -384,198 +378,218 @@ if ($_GET['order']) {
/* only print pool status when we have one */
if (count($pools) > 0) {
?>
-<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="dhcp leases">
- <tr>
- <td class="listhdrr"><?=gettext("Failover Group"); ?></a></td>
- <td class="listhdrr"><?=gettext("My State"); ?></a></td>
- <td class="listhdrr"><?=gettext("Since"); ?></a></td>
- <td class="listhdrr"><?=gettext("Peer State"); ?></a></td>
- <td class="listhdrr"><?=gettext("Since"); ?></a></td>
- </tr>
-<?php
- foreach ($pools as $data) {
- echo "<tr>\n";
- echo "<td class=\"listlr\">{$fspans}{$data['name']}{$fspane}</td>\n";
- echo "<td class=\"listr\">{$fspans}{$data['mystate']}{$fspane}</td>\n";
- echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['mydate']) . "{$fspane}</td>\n";
- echo "<td class=\"listr\">{$fspans}{$data['peerstate']}{$fspane}</td>\n";
- echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['peerdate']) . "{$fspane}</td>\n";
- echo "<td class=\"list\" valign=\"middle\" width=\"17\">&nbsp;</td>\n";
- echo "<td class=\"list\" valign=\"middle\" width=\"17\">&nbsp;</td>\n";
- echo "</tr>\n";
- }
-?>
-</table>
-
+<div class="panel panel-default">
+ <div class="panel-heading"><h2 class="panel-title"><?=gettext('Pool status')?></h2></div>
+ <div class="panel-body">
+ <table class="table">
+ <thead>
+ <tr>
+ <th><?=gettext("Failover Group")?></a></th>
+ <th><?=gettext("My State")?></a></th>
+ <th><?=gettext("Since")?></a></th>
+ <th><?=gettext("Peer State")?></a></th>
+ <th><?=gettext("Since")?></a></th>
+ </tr>
+ </thead>
+ <tbody>
+<? foreach ($pools as $data):?>
+ <tr>
+ <td><?=$data['name']?></td>
+ <td><?=$data['mystate']?></td>
+ <td><?=adjust_gmt($data['mydate'])?></td>
+ <td><?=$data['peerstate']?></td>
+ <td><?=adjust_gmt($data['peerdate'])?></td>
+ </tr>
+<? endforeach?>
+ </tbody>
+ </table>
+ </div>
+</div>
<?php
/* only print pool status when we have one */
}
-?>
-<br/>
-
-<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="dhcp leases">
- <tr>
- <td class="listhdrr"><a href="#"><?=gettext("IPv6 address"); ?></a></td>
- <td class="listhdrr"><a href="#"><?=gettext("IAID"); ?></a></td>
- <td class="listhdrr"><a href="#"><?=gettext("DUID"); ?></a></td>
- <td class="listhdrr"><a href="#"><?=gettext("Hostname/MAC"); ?></a></td>
- <td class="listhdrr"><a href="#"><?=gettext("Start"); ?></a></td>
- <td class="listhdrr"><a href="#"><?=gettext("End"); ?></a></td>
- <td class="listhdrr"><a href="#"><?=gettext("Online"); ?></a></td>
- <td class="listhdrr"><a href="#"><?=gettext("Lease Type"); ?></a></td>
- </tr>
+if (empty($leases))
+ print '<div class="alert alert-warning" role="alert">'. gettext("No leases file found. Is the DHCP server active?") .'</div>';
+
+?>
+<div class="panel panel-default">
+ <div class="panel-heading"><h2 class="panel-title"><?=gettext('Leases')?></h2></div>
+ <div class="panel-body">
+ <table class="table">
+ <thead>
+ <tr>
+ <th><!-- icon --></th>
+ <th><?=gettext("IPv6 address")?></th>
+ <th><?=gettext("IAID")?></th>
+ <th><?=gettext("DUID")?></th>
+ <th><?=gettext("MAC address")?></th>
+ <th><?=gettext("Hostname")?></th>
+ <th><?=gettext("Start")?></th>
+ <th><?=gettext("End")?></th>
+ <th><?=gettext("Online")?></th>
+ <th><?=gettext("Lease Type")?></th>
+ </tr>
+ </thead>
+ <tbody>
<?php
-foreach ($leases as $data) {
- if (($data['act'] == "active") || ($data['act'] == "static") || ($_GET['all'] == 1)) {
- if ($data['act'] != "active" && $data['act'] != "static") {
- $fspans = "<span class=\"gray\">";
- $fspane = "&nbsp;</span>";
- } else {
- $fspans = "";
- $fspane = "&nbsp;";
- }
+foreach ($leases as $data):
+ if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1)
+ continue;
- if ($data['act'] == "static") {
- foreach ($config['dhcpdv6'] as $dhcpif => $dhcpifconf) {
- if (is_array($dhcpifconf['staticmap'])) {
- foreach ($dhcpifconf['staticmap'] as $staticent) {
- if ($data['ip'] == $staticent['ipaddr']) {
- $data['if'] = $dhcpif;
- break;
- }
+ if ($data['act'] == 'active')
+ $icon = 'icon-ok-circle';
+ elseif ($data['act'] == 'expired')
+ $icon = 'icon-ban-circle';
+ else
+ $icon = 'icon-remove-circle';
+
+ if ($data['act'] == "static") {
+ foreach ($config['dhcpdv6'] as $dhcpif => $dhcpifconf) {
+ if(is_array($dhcpifconf['staticmap'])) {
+ foreach ($dhcpifconf['staticmap'] as $staticent) {
+ if ($data['ip'] == $staticent['ipaddr']) {
+ $data['if'] = $dhcpif;
+ break;
}
}
- /* exit as soon as we have an interface */
- if ($data['if'] != "") {
- break;
- }
- }
- } else {
- $data['if'] = convert_real_interface_to_friendly_interface_name(guess_interface_from_ip($data['ip']));
- }
- echo "<tr>\n";
- echo "<td class=\"listlr\">{$fspans}{$data['ip']}{$fspane}</td>\n";
- echo "<td class=\"listr\">{$fspans}{$data['iaid']}{$fspane}</td>\n";
- echo "<td class=\"listr\">{$fspans}{$data['duid']}{$fspane}</td>\n";
- echo "<td class=\"listr\">{$fspans}";
- if (!empty($data['hostname'])) {
- echo htmlentities($data['hostname']) . "<br />";
- }
-
- $mac=trim($ndpdata[$data['ip']]['mac']);
- if (!empty($mac)) {
- $mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
- print htmlentities($mac);
- if (isset($mac_man[$mac_hi])) {
- print "<br /><font size=\"-2\"><i>{$mac_man[$mac_hi]}</i></font>";
}
+ /* exit as soon as we have an interface */
+ if ($data['if'] != "")
+ break;
}
-
- echo "{$fspane}&nbsp;</td>\n";
- if ($data['type'] != "static") {
- echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['start']) . "{$fspane}</td>\n";
- echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['end']) . "{$fspane}</td>\n";
- } else {
- echo "<td class=\"listr\">{$fspans} n/a {$fspane}</td>\n";
- echo "<td class=\"listr\">{$fspans} n/a {$fspane}</td>\n";
- }
- echo "<td class=\"listr\">{$fspans}{$data['online']}{$fspane}</td>\n";
- echo "<td class=\"listr\">{$fspans}{$data['act']}{$fspane}</td>\n";
-
- if ($data['type'] == "dynamic") {
- echo "<td valign=\"middle\"><a href=\"services_dhcpv6_edit.php?if={$data['if']}&amp;duid={$data['duid']}&amp;hostname={$data['hostname']}\">";
- echo "<img src=\"/themes/{$g['theme']}/images/icons/icon_plus.gif\" width=\"17\" height=\"17\" border=\"0\" title=\"" . gettext("add a static mapping for this MAC address") ."\" alt=\"add\" /></a></td>\n";
- } else {
- echo "<td class=\"list\" valign=\"middle\">";
- echo "<img src=\"/themes/{$g['theme']}/images/icons/icon_plus_mo.gif\" width=\"17\" height=\"17\" border=\"0\" alt=\"add\" /></td>\n";
- }
-
- /* Only show the button for offline dynamic leases */
- if (($data['type'] == "dynamic") && ($data['online'] != "online")) {
- echo "<td class=\"list\" valign=\"middle\"><a href=\"status_dhcpv6_leases.php?deleteip={$data['ip']}&amp;all=" . htmlspecialchars($_GET['all']) . "\">";
- echo "<img src=\"/themes/{$g['theme']}/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\" title=\"" . gettext("delete this DHCP lease") . "\" alt=\"delete\" /></a></td>\n";
- }
- echo "</tr>\n";
+ } else {
+ $data['if'] = convert_real_interface_to_friendly_interface_name(guess_interface_from_ip($data['ip']));
}
-}
+
+ $mac = trim($ndpdata[$data['ip']]['mac']);
+ $mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
?>
-</table>
-<br/>
-<h3>Delegated Prefixes</h3>
-<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="prefixes">
- <tr>
- <td class="listhdrr"><a href="#"><?=gettext("IPv6 Prefix"); ?></a></td>
- <td class="listhdrr"><a href="#"><?=gettext("IAID"); ?></a></td>
- <td class="listhdrr"><a href="#"><?=gettext("DUID"); ?></a></td>
- <td class="listhdrr"><a href="#"><?=gettext("Start"); ?></a></td>
- <td class="listhdrr"><a href="#"><?=gettext("End"); ?></a></td>
- <td class="listhdrr"><a href="#"><?=gettext("State"); ?></a></td>
- </tr>
+ <tr>
+ <td><i class="icon <?=$icon?>"></i></td>
+ <td><?=$data['ip']?></td>
+ <td><?=$data['iaid']?></td>
+ <td><?=$data['duid']?></td>
+ <td>
+ <?=$mac?>
+
+ <? if(isset($mac_man[$mac_hi])):?>
+ (<?=$mac_man[$mac_hi]?>)
+ <?endif?>
+ </td>
+ <td><?=htmlentities($data['hostname'])?></td>
+<? if ($data['type'] != "static"):?>
+ <td><?=adjust_gmt($data['start'])?></td>
+ <td><?=adjust_gmt($data['end'])?></td>
+<? else: ?>
+ <td>n/a</td>
+ <td>n/a</td>
+<? endif; ?>
+ <td><?=$data['online']?></td>
+ <td><?=$data['act']?></td>
+ <td>
+<? if ($data['type'] == "dynamic"): ?>
+ <a class="btn btn-xs btn-primary" href="services_dhcpv6_edit.php?if=<?=$data['if']?>&amp;duid=<?=$data['duid']?>&amp;hostname=<?=htmlspecialchars($data['hostname'])?>">
+ <?=gettext("add static mapping")?>
+ </a>
+<? endif; ?>
+
+ <a class="btn btn-xs btn-success" href="services_wol_edit.php?if=<?=$data['if']?>&amp;mac=<?=$data['mac']?>&amp;descr=<?=htmlentities($data['hostname'])?>">
+ add WOL mapping
+ </a>
+
+<? if ($data['type'] == "dynamic" && $data['online'] != "online"):?>
+ <a class="btn btn-xs btn-danger" href="status_dhcpv6_leases.php?deleteip=<?=$data['ip']?>&amp;all=<?=intval($_GET['all'])?>">
+ delete lease
+ </a>
+<? endif?>
+ </td>
+<? endforeach; ?>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+</div>
+
+<div class="panel panel-default">
+ <div class="panel-heading"><h2 class="panel-title"><?=gettext('Delegated Prefixes')?></h2></div>
+ <div class="panel-body">
+ <table class="table">
+ <thead>
+ <tr>
+ <th><?=gettext("IPv6 Prefix")?></th>
+ <th><?=gettext("IAID")?></th>
+ <th><?=gettext("DUID")?></th>
+ <th><?=gettext("Start")?></th>
+ <th><?=gettext("End")?></th>
+ <th><?=gettext("State")?></th>
+ </tr>
+ </thead>
+ <tbody>
<?php
-foreach ($prefixes as $data) {
- if (($data['act'] == "active") || ($data['act'] == "static") || ($_GET['all'] == 1)) {
- if ($data['act'] != "active" && $data['act'] != "static") {
- $fspans = "<span class=\"gray\">";
- $fspane = "&nbsp;</span>";
- } else {
- $fspans = "";
- $fspane = "&nbsp;";
- }
+foreach ($prefixes as $data):
+ if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1)
+ continue;
- if ($data['act'] == "static") {
- foreach ($config['dhcpdv6'] as $dhcpif => $dhcpifconf) {
- if (is_array($dhcpifconf['staticmap'])) {
- foreach ($dhcpifconf['staticmap'] as $staticent) {
- if ($data['ip'] == $staticent['ipaddr']) {
- $data['if'] = $dhcpif;
- break;
- }
+ if ($data['act'] == 'active')
+ $icon = 'icon-ok-circle';
+ elseif ($data['act'] == 'expired')
+ $icon = 'icon-ban-circle';
+ else
+ $icon = 'icon-remove-circle';
+
+ if ($data['act'] == "static") {
+ foreach ($config['dhcpdv6'] as $dhcpif => $dhcpifconf) {
+ if(is_array($dhcpifconf['staticmap'])) {
+ foreach ($dhcpifconf['staticmap'] as $staticent) {
+ if ($data['ip'] == $staticent['ipaddr']) {
+ $data['if'] = $dhcpif;
+ break;
}
}
- /* exit as soon as we have an interface */
- if ($data['if'] != "") {
- break;
- }
}
- } else {
- $data['if'] = convert_real_interface_to_friendly_interface_name(guess_interface_from_ip($data['ip']));
- }
- echo "<tr>\n";
- if ($mappings[$data['iaid'] . $data['duid']]) {
- $dip = "<br />Routed To: {$mappings[$data['iaid'] . $data['duid']]}";
- }
- echo "<td class=\"listlr\">{$fspans}{$data['prefix']}{$dip}{$fspane}</td>\n";
- echo "<td class=\"listr\">{$fspans}{$data['iaid']}{$fspane}</td>\n";
- echo "<td class=\"listr\">{$fspans}{$data['duid']}{$fspane}</td>\n";
- if ($data['type'] != "static") {
- echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['start']) . "{$fspane}</td>\n";
- echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['end']) . "{$fspane}</td>\n";
- } else {
- echo "<td class=\"listr\">{$fspans} n/a {$fspane}</td>\n";
- echo "<td class=\"listr\">{$fspans} n/a {$fspane}</td>\n";
+ /* exit as soon as we have an interface */
+ if ($data['if'] != "")
+ break;
}
- echo "<td class=\"listr\">{$fspans}{$data['act']}{$fspane}</td>\n";
- echo "</tr>\n";
+ } else {
+ $data['if'] = convert_real_interface_to_friendly_interface_name(guess_interface_from_ip($data['ip']));
+ }
+
+ {
+ $dip = "";
}
-}
?>
-</table>
-<br/>
-<form action="status_dhcpv6_leases.php" method="get">
- <input type="hidden" name="order" value="<?=htmlspecialchars($_GET['order']);?>" />
+ <tr>
+ <td><i class="icon <?=$icon?>"></i></td>
+ <td>
+ <?=$data['prefix']?>
+<? if ($mappings[$data['iaid'] . $data['duid']]): ?>
+ <br />
+ <?=gettext('Routed To')?>: <?=$mappings[$data['iaid'] . $data['duid']]?>
+<? endif; ?>
+ </td>
+ <td><?=$data['iaid']?></td>
+ <td><?=$data['duid']?></td>
+<? if ($data['type'] != "static"):?>
+ <td><?=adjust_gmt($data['start'])?></td>
+ <td><?=adjust_gmt($data['end'])?></td>
+<? else: ?>
+ <td>n/a</td>
+ <td>n/a</td>
+<? endif; ?>
+ <td><?=$data['act']?></td>
+<? endforeach; ?>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+</div>
+
<?php if ($_GET['all']): ?>
- <input type="hidden" name="all" value="0" />
- <input type="submit" class="formbtn" value="<?=gettext("Show active and static leases only"); ?>" />
+ <a class="btn btn-default" href="status_dhcpv6_leases.php?all=0"><?=gettext("Show active and static leases only")?></a>
<?php else: ?>
- <input type="hidden" name="all" value="1" />
- <input type="submit" class="formbtn" value="<?=gettext("Show all configured leases"); ?>" />
-<?php endif; ?>
-</form>
-<?php if ($leases == 0): ?>
-<p><strong><?=gettext("No leases file found. Is the DHCP server active"); ?>?</strong></p>
-<?php endif; ?>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
+ <a class="btn btn-default" href="status_dhcpv6_leases.php?all=1"><?=gettext("Show all configured leases")?></a>
+<?php endif;
+
+include("foot.inc"); \ No newline at end of file
OpenPOWER on IntegriCloud