From d7a42b2c29f0aa32e1876f50c0ffd41a305c2f7b Mon Sep 17 00:00:00 2001 From: Frank Wall Date: Thu, 3 Dec 2015 22:59:43 +0100 Subject: [PATCH 1/3] fixes #376: add description for static DHCP leases --- src/www/status_dhcp_leases.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/www/status_dhcp_leases.php b/src/www/status_dhcp_leases.php index 2223cfdc7..ae4953449 100644 --- a/src/www/status_dhcp_leases.php +++ b/src/www/status_dhcp_leases.php @@ -283,6 +283,7 @@ foreach($config['interfaces'] as $ifname => $ifarr) { $slease['start'] = ""; $slease['end'] = ""; $slease['hostname'] = htmlentities($static['hostname']); + $slease['descr'] = htmlentities($static['descr']); $slease['act'] = "static"; $slease['online'] = in_array(strtolower($slease['mac']), $arpdata_mac) ? 'online' : 'offline'; $leases[] = $slease; @@ -339,6 +340,7 @@ if(count($pools) > 0) { + @@ -405,6 +407,11 @@ if(count($pools) > 0) { } } echo "{$fspans}" . htmlentities($data['hostname']) . "{$fspane}\n"; + if (isset($data['descr'])) { + echo "{$fspans}" . htmlentities($data['descr']) . "{$fspane}\n"; + } else { + echo "{$fspans} n/a {$fspane}\n"; + } if ($data['type'] != "static") { echo "{$fspans}" . adjust_gmt($data['start']) . "{$fspane}\n"; echo "{$fspans}" . adjust_gmt($data['end']) . "{$fspane}\n"; From f4ac743192179d6a7fb62c65b0e06d9b8f069dfd Mon Sep 17 00:00:00 2001 From: Frank Wall Date: Thu, 3 Dec 2015 23:03:56 +0100 Subject: [PATCH 2/3] style fixes --- src/www/status_dhcp_leases.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/www/status_dhcp_leases.php b/src/www/status_dhcp_leases.php index ae4953449..8178afaae 100644 --- a/src/www/status_dhcp_leases.php +++ b/src/www/status_dhcp_leases.php @@ -391,18 +391,18 @@ if(count($pools) > 0) { } echo "\n"; echo "{$fspans}{$data['ip']}{$fspane}\n"; - $mac=$data['mac']; + $mac = $data['mac']; $mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]); if ($data['online'] != "online") { - if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined + if (isset($mac_man[$mac_hi])) { // Manufacturer for this MAC is defined echo "{$fspans}{$mac}
{$mac_man[$mac_hi]}{$fspane}\n"; - }else{ + } else { echo "{$fspans}{$data['mac']}{$fspane}\n"; } - }else{ - if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined + } else { + if (isset($mac_man[$mac_hi])) { // Manufacturer for this MAC is defined echo "{$fspans}{$mac}
{$mac_man[$mac_hi]}{$fspane}\n"; - }else{ + } else { echo "{$fspans}{$data['mac']}{$fspane}\n"; } } @@ -412,13 +412,13 @@ if(count($pools) > 0) { } else { echo "{$fspans} n/a {$fspane}\n"; } - if ($data['type'] != "static") { - echo "{$fspans}" . adjust_gmt($data['start']) . "{$fspane}\n"; - echo "{$fspans}" . adjust_gmt($data['end']) . "{$fspane}\n"; - } else { - echo "{$fspans} n/a {$fspane}\n"; - echo "{$fspans} n/a {$fspane}\n"; - } + if ($data['type'] != "static") { + echo "{$fspans}" . adjust_gmt($data['start']) . "{$fspane}\n"; + echo "{$fspans}" . adjust_gmt($data['end']) . "{$fspane}\n"; + } else { + echo "{$fspans} n/a {$fspane}\n"; + echo "{$fspans} n/a {$fspane}\n"; + } echo "{$fspans}{$data['online']}{$fspane}\n"; echo "{$fspans}{$data['act']}{$fspane}\n"; echo " "; From 3c39175af0df94c4a75fe7ca9a40eb0428a348fe Mon Sep 17 00:00:00 2001 From: Frank Wall Date: Thu, 3 Dec 2015 23:20:39 +0100 Subject: [PATCH 3/3] add description for static DHCP v6 leases --- src/www/status_dhcpv6_leases.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/www/status_dhcpv6_leases.php b/src/www/status_dhcpv6_leases.php index d3e7a2b51..d45d108ef 100644 --- a/src/www/status_dhcpv6_leases.php +++ b/src/www/status_dhcpv6_leases.php @@ -352,6 +352,7 @@ foreach($config['interfaces'] as $ifname => $ifarr) { $slease['start'] = ""; $slease['end'] = ""; $slease['hostname'] = htmlentities($static['hostname']); + $slease['descr'] = htmlentities($static['descr']); $slease['act'] = "static"; if (in_array($slease['ip'], array_keys($ndpdata))) { $slease['online'] = 'online'; @@ -419,6 +420,7 @@ if(count($pools) > 0) { + @@ -460,8 +462,13 @@ if(count($pools) > 0) { if (!empty($data['hostname'])) { echo htmlentities($data['hostname']) . "
"; } + if (isset($data['descr'])) { + echo "{$fspans}" . htmlentities($data['descr']) . "{$fspane}\n"; + } else { + echo "{$fspans} n/a {$fspane}\n"; + } - $mac=trim($ndpdata[$data['ip']]['mac']); + $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);