From fff9ee45c313d0f68767648798d493230f1c2926 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 15 Oct 2014 11:32:23 +0545 Subject: Whitespace in status_dhcp_leases.php --- usr/local/www/status_dhcp_leases.php | 78 ++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'usr') diff --git a/usr/local/www/status_dhcp_leases.php b/usr/local/www/status_dhcp_leases.php index ed1a8c3..1aeecd1 100644 --- a/usr/local/www/status_dhcp_leases.php +++ b/usr/local/www/status_dhcp_leases.php @@ -93,15 +93,15 @@ include("head.inc"); $rien) - $new[] = $array[$k]; - return $new; + foreach ($array as $sub) + $cmp[] = $sub[$field]; + $unique = array_unique(array_reverse($cmp,true)); + foreach ($unique as $k => $rien) + $new[] = $array[$k]; + return $new; } $awk = "/usr/bin/awk"; @@ -271,7 +271,7 @@ if(count($pools) > 0) { } foreach($config['interfaces'] as $ifname => $ifarr) { - if (is_array($config['dhcpd'][$ifname]) && + if (is_array($config['dhcpd'][$ifname]) && is_array($config['dhcpd'][$ifname]['staticmap'])) { foreach($config['dhcpd'][$ifname]['staticmap'] as $static) { $slease = array(); @@ -347,7 +347,7 @@ foreach ($leases as $data) { $fspans = ""; $fspane = " "; } - $lip = ip2ulong($data['ip']); + $lip = ip2ulong($data['ip']); if ($data['act'] == "static") { foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) { if(is_array($dhcpifconf['staticmap'])) { @@ -366,40 +366,40 @@ foreach ($leases as $data) { foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) { if (!is_array($dhcpifconf['range'])) continue; - if (($lip >= ip2ulong($dhcpifconf['range']['from'])) && ($lip <= ip2ulong($dhcpifconf['range']['to']))) { - $data['if'] = $dhcpif; - break; - } + if (($lip >= ip2ulong($dhcpifconf['range']['from'])) && ($lip <= ip2ulong($dhcpifconf['range']['to']))) { + $data['if'] = $dhcpif; + break; + } } - } + } echo "\n"; - echo "{$fspans}{$data['ip']}{$fspane}\n"; - $mac=$data['mac']; + echo "{$fspans}{$data['ip']}{$fspane}\n"; + $mac=$data['mac']; $mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]); - if ($data['online'] != "online") { + if ($data['online'] != "online") { if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined - echo "{$fspans}{$mac}
{$mac_man[$mac_hi]}{$fspane}\n"; - }else{ - echo "{$fspans}{$data['mac']}{$fspane}\n"; + echo "{$fspans}{$mac}
{$mac_man[$mac_hi]}{$fspane}\n"; + } else { + echo "{$fspans}{$data['mac']}{$fspane}\n"; } - }else{ + } else { if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined echo "{$fspans}{$mac}
{$mac_man[$mac_hi]}{$fspane}\n"; - }else{ - echo "{$fspans}{$data['mac']}{$fspane}\n"; + } else { + echo "{$fspans}{$data['mac']}{$fspane}\n"; } - } - echo "{$fspans}" . htmlentities($data['hostname']) . "{$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 " "; + } + echo "{$fspans}" . htmlentities($data['hostname']) . "{$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 " "; if ($data['type'] == "dynamic") { echo ""; echo "\"add\" \n"; @@ -407,7 +407,7 @@ foreach ($leases as $data) { echo "\"add\" \n"; } - echo ""; + echo ""; echo "\"add\" \n"; /* Only show the button for offline dynamic leases */ @@ -415,7 +415,7 @@ foreach ($leases as $data) { echo ""; echo "\"delete\" \n"; } - echo "\n"; + echo "\n"; } } -- cgit v1.1 From 73a9669840750f4a11fbb38e36485458f418e3b0 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 15 Oct 2014 12:26:29 +0545 Subject: Provide an edit button for static mapped entries As suggested in forum https://forum.pfsense.org/index.php?topic=82883.msg0#new Instead of a non-functioning red plus icon, show an edit icon for static mapped entries, and take the user to services_dhcp_edit page if it is clicked. IMHO this makes it much easier to correct things that are noticed when viewing the Status, DHCP Leases display. --- usr/local/www/status_dhcp_leases.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'usr') diff --git a/usr/local/www/status_dhcp_leases.php b/usr/local/www/status_dhcp_leases.php index 1aeecd1..debca57 100644 --- a/usr/local/www/status_dhcp_leases.php +++ b/usr/local/www/status_dhcp_leases.php @@ -155,7 +155,7 @@ foreach($leases_content as $lease) { /* walk the fields */ $f = 0; $fcount = count($data); - /* with less then 20 fields there is nothing useful */ + /* with less than 20 fields there is nothing useful */ if($fcount < 20) { $i++; continue; @@ -351,11 +351,13 @@ foreach ($leases as $data) { if ($data['act'] == "static") { foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) { if(is_array($dhcpifconf['staticmap'])) { + $staticmap_array_index = 0; foreach ($dhcpifconf['staticmap'] as $staticent) { if ($data['ip'] == $staticent['ipaddr']) { $data['if'] = $dhcpif; break; } + $staticmap_array_index++; } } /* exit as soon as we have an interface */ @@ -404,7 +406,8 @@ foreach ($leases as $data) { echo ""; echo "\"add\" \n"; } else { - echo "\"add\" \n"; + echo ""; + echo "\"add\" \n"; } echo ""; -- cgit v1.1