diff --git a/src/www/guiconfig.inc b/src/www/guiconfig.inc index 230b63826..39bd79a76 100644 --- a/src/www/guiconfig.inc +++ b/src/www/guiconfig.inc @@ -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) diff --git a/src/www/status_dhcp_leases.php b/src/www/status_dhcp_leases.php index aee5c4874..306f36a54 100644 --- a/src/www/status_dhcp_leases.php +++ b/src/www/status_dhcp_leases.php @@ -1,32 +1,32 @@ - Copyright (C) 2003-2004 Manuel Kasper - 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 + * Copyright (C) 2003-2004 Manuel Kasper + * 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)"; + +?>