mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 10:04:41 +00:00
dhcp: show lease count; closes #2924
This commit is contained in:
parent
571dbd5552
commit
66eb47d982
@ -348,6 +348,7 @@ function pprint_port($port) {
|
||||
|
||||
function gentitle($breadcrumbs, $navlevelsep = ': ')
|
||||
{
|
||||
global $gentitle_suffix;
|
||||
$output = $breadcrumbs;
|
||||
|
||||
if (isset($breadcrumbs[0]['name'])) {
|
||||
@ -357,7 +358,7 @@ function gentitle($breadcrumbs, $navlevelsep = ': ')
|
||||
}
|
||||
}
|
||||
|
||||
return join($navlevelsep, $output);
|
||||
return join($navlevelsep, $output) . "$gentitle_suffix";
|
||||
}
|
||||
|
||||
function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendport)
|
||||
|
||||
@ -1,32 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2014-2016 Deciso B.V.
|
||||
Copyright (C) 2004-2009 Scott Ullrich <sullrich@gmail.com>
|
||||
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
* Copyright (C) 2014-2016 Deciso B.V.
|
||||
* Copyright (C) 2004-2009 Scott Ullrich <sullrich@gmail.com>
|
||||
* Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require_once("guiconfig.inc");
|
||||
require_once("config.inc");
|
||||
@ -236,6 +236,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
}
|
||||
|
||||
$order = ( $_GET['order'] ) ? $_GET['order'] : 'ip';
|
||||
|
||||
usort($leases,
|
||||
function ($a, $b) use ($order) {
|
||||
$cmp = strnatcasecmp($a[$order], $b[$order]);
|
||||
@ -245,7 +246,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
return $cmp;
|
||||
}
|
||||
);
|
||||
|
||||
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if (!empty($_POST['deleteip']) && is_ipaddr($_POST['deleteip'])) {
|
||||
// delete dhcp lease
|
||||
@ -283,12 +283,22 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$service_hook = 'dhcpd';
|
||||
|
||||
include("head.inc");?>
|
||||
include("head.inc");
|
||||
|
||||
$leases_count = 0;
|
||||
|
||||
foreach ($leases as $data) {
|
||||
if (!($data['act'] == 'active' || $data['act'] == 'static' || $_GET['all'] == 1)) {
|
||||
continue;
|
||||
}
|
||||
$leases_count++;
|
||||
}
|
||||
|
||||
$gentitle_suffix = " ($leases_count)";
|
||||
|
||||
?>
|
||||
<body>
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
@ -470,5 +480,6 @@ include("head.inc");?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php
|
||||
|
||||
<?php include("foot.inc"); ?>
|
||||
include("foot.inc");
|
||||
|
||||
@ -1,33 +1,33 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2014-2016 Deciso B.V.
|
||||
Copyright (C) 2004-2009 Scott Ullrich <sullrich@gmail.com>
|
||||
Copyright (C) 2011 Seth Mos <seth.mos@dds.nl>
|
||||
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
|
||||
All rights reserved.
|
||||
* Copyright (C) 2014-2016 Deciso B.V.
|
||||
* Copyright (C) 2004-2009 Scott Ullrich <sullrich@gmail.com>
|
||||
* Copyright (C) 2011 Seth Mos <seth.mos@dds.nl>
|
||||
* Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
|
||||
* All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require_once("guiconfig.inc");
|
||||
require_once("interfaces.inc");
|
||||
@ -372,6 +372,17 @@ $service_hook = 'dhcpd6';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
$leases_count = 0;
|
||||
|
||||
foreach ($leases as $data) {
|
||||
if (!($data['act'] == 'active' || $data['act'] == 'static' || $_GET['all'] == 1)) {
|
||||
continue;
|
||||
}
|
||||
$leases_count++;
|
||||
}
|
||||
|
||||
$gentitle_suffix = " ($leases_count)";
|
||||
|
||||
?>
|
||||
<body>
|
||||
<script>
|
||||
@ -444,6 +455,9 @@ endif;?>
|
||||
<?php
|
||||
$mac_man = json_decode(configd_run("interface list macdb json"), true);
|
||||
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 (isset($dhcpifconf['staticmap'])) {
|
||||
@ -559,5 +573,6 @@ endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php
|
||||
|
||||
<?php include("foot.inc"); ?>
|
||||
include("foot.inc");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user