From 6e3488e958f8f1e548962a7f07cca8f45f106a46 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 16 Dec 2015 23:16:58 +0545 Subject: Code style services dhcp dnsmasq dyndns --- src/usr/local/www/services_dhcp.php | 78 ++++++++++++---------- src/usr/local/www/services_dhcp_edit.php | 12 ++-- src/usr/local/www/services_dhcp_relay.php | 23 ++++--- src/usr/local/www/services_dhcpv6.php | 71 +++++++++++--------- src/usr/local/www/services_dhcpv6_edit.php | 5 +- src/usr/local/www/services_dhcpv6_relay.php | 29 ++++---- src/usr/local/www/services_dnsmasq.php | 32 +++++---- .../www/services_dnsmasq_domainoverride_edit.php | 59 ++++++++-------- src/usr/local/www/services_dnsmasq_edit.php | 29 ++++---- src/usr/local/www/services_dyndns.php | 16 +++-- src/usr/local/www/services_dyndns_edit.php | 19 ++++-- 11 files changed, 206 insertions(+), 167 deletions(-) (limited to 'src/usr/local') diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php index e42ab28..2b20681 100644 --- a/src/usr/local/www/services_dhcp.php +++ b/src/usr/local/www/services_dhcp.php @@ -95,7 +95,7 @@ if (!$if || !isset($iflist[$if])) { foreach ($iflist as $ifent => $ifname) { $oc = $config['interfaces'][$ifent]; if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddrv4($oc['ipaddr']))) || - (!is_array($config['dhcpd'][$ifent]) && (!is_ipaddrv4($oc['ipaddr'])))) { + (!is_array($config['dhcpd'][$ifent]) && (!is_ipaddrv4($oc['ipaddr'])))) { continue; } @@ -307,7 +307,7 @@ if (isset($_POST['submit'])) { $input_errors[] = gettext("A valid primary domain name server IP address must be specified for the dynamic domain name."); } if (($_POST['ddnsdomainkey'] && !$_POST['ddnsdomainkeyname']) || - ($_POST['ddnsdomainkeyname'] && !$_POST['ddnsdomainkey'])) { + ($_POST['ddnsdomainkeyname'] && !$_POST['ddnsdomainkey'])) { $input_errors[] = gettext("You must specify both a valid domain key and key name."); } if ($_POST['domainsearchlist']) { @@ -404,7 +404,7 @@ if (isset($_POST['submit'])) { $subnet_end = ip2ulong(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn)))); if ((ip2ulong($_POST['range_from']) < $subnet_start) || (ip2ulong($_POST['range_from']) > $subnet_end) || - (ip2ulong($_POST['range_to']) < $subnet_start) || (ip2ulong($_POST['range_to']) > $subnet_end)) { + (ip2ulong($_POST['range_to']) < $subnet_start) || (ip2ulong($_POST['range_to']) > $subnet_end)) { $input_errors[] = gettext("The specified range lies outside of the current subnet."); } @@ -427,7 +427,7 @@ if (isset($_POST['submit'])) { } if (is_inrange_v4($_POST['range_from'], $p['range']['from'], $p['range']['to']) || - is_inrange_v4($_POST['range_to'], $p['range']['from'], $p['range']['to'])) { + is_inrange_v4($_POST['range_to'], $p['range']['from'], $p['range']['to'])) { $input_errors[] = gettext("The specified range must not be within the range configured on a DHCP pool for this interface."); break; } @@ -446,7 +446,7 @@ if (isset($_POST['submit'])) { continue; } if ((ip2ulong($map['ipaddr']) > $dynsubnet_start) && - (ip2ulong($map['ipaddr']) < $dynsubnet_end)) { + (ip2ulong($map['ipaddr']) < $dynsubnet_end)) { $input_errors[] = sprintf(gettext("The DHCP range cannot overlap any static DHCP mappings.")); break; } @@ -701,11 +701,13 @@ $shortcut_section = "dhcp"; include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'success'); +} if (isset($config['dhcrelay']['enable'])) { print_info_box(gettext("DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.")); @@ -713,8 +715,9 @@ if (isset($config['dhcrelay']['enable'])) { exit; } -if (is_subsystem_dirty('staticmaps')) +if (is_subsystem_dirty('staticmaps')) { print_info_box_np(gettext("The static mapping configuration has been changed") . ".
" . gettext("You must apply the changes in order for them to take effect.")); +} /* active tabs */ $tab_array = array(); @@ -724,7 +727,7 @@ $i = 0; foreach ($iflist as $ifent => $ifname) { $oc = $config['interfaces'][$ifent]; if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddrv4($oc['ipaddr']))) || - (!is_array($config['dhcpd'][$ifent]) && (!is_ipaddrv4($oc['ipaddr'])))) { + (!is_array($config['dhcpd'][$ifent]) && (!is_ipaddrv4($oc['ipaddr'])))) { continue; } @@ -886,7 +889,7 @@ $section->addInput(new Form_IpAddress( $pconfig['wins2'] ))->setPattern('[.a-zA-Z0-9_]+')->setAttribute('placeholder', 'WINS Server 2'); -for($idx=1; $idx<=4; $idx++) { +for ($idx=1; $idx<=4; $idx++) { $section->addInput(new Form_IpAddress( 'dns' . $idx, ($idx == 1) ? 'DNS servers':null, @@ -1183,7 +1186,7 @@ $section->addInput(new Form_StaticText( 'For a list of available options please visit this ') . '' . gettext("URL") . '' )); -if(!$pconfig['numberoptions']) { +if (!$pconfig['numberoptions']) { $pconfig['numberoptions']['item'] = array(array('number' => '', 'type' => 'text', 'value' => '')); } @@ -1346,7 +1349,7 @@ if (!is_numeric($pool) && !($act == "newpool")) {