From f925a01807dacf07d6909d6d9728719f79559047 Mon Sep 17 00:00:00 2001 From: D9ping Date: Tue, 25 Sep 2018 21:49:54 +0200 Subject: [PATCH] Properly selected ininite lease if ininite is selected. Made time units translatable. Signed-off-by: D9ping --- includes/dhcp.php | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/includes/dhcp.php b/includes/dhcp.php index c6cc91d9..5c7752a1 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -112,25 +112,30 @@ function DisplayDHCPConfig() { $RangeStart = $arrRange[0]; $RangeEnd = $arrRange[1]; $RangeMask = $arrRange[2]; - preg_match( '/([0-9]*)([a-z])/i', $arrRange[3], $arrRangeLeaseTime ); + $leaseTime = $arrRange[3]; $hselected = ''; $mselected = ''; $dselected = ''; - - switch( $arrRangeLeaseTime[2] ) { - case 'h': - $hselected = ' selected="selected"'; - break; - case 'm': - $mselected = ' selected="selected"'; - break; - case 'd': - $dselected = ' selected="selected"'; - break; + $infiniteselected = ''; + preg_match( '/([0-9]*)([a-z])/i', $leaseTime, $arrRangeLeaseTime ); + if ($leaseTime === 'infinite') { + $infiniteselected = ' selected="selected"'; + } else { + switch( $arrRangeLeaseTime[2] ) { + case 'h': + $hselected = ' selected="selected"'; + break; + case 'm': + $mselected = ' selected="selected"'; + break; + case 'd': + $dselected = ' selected="selected"'; + break; + } } - ?> +?>
@@ -161,7 +166,7 @@ function DisplayDHCPConfig() { foreach( $interfaces as $inet ) { $select = ''; if( $inet === $conf['interface'] ) { - $select = ' selected="selected"'; // FIXED use xhtml valid attribute + $select = ' selected="selected"'; } echo '