diff options
Diffstat (limited to 'src/usr/local')
-rw-r--r-- | src/usr/local/www/services_dhcp.php | 78 | ||||
-rw-r--r-- | src/usr/local/www/services_dhcp_edit.php | 12 | ||||
-rw-r--r-- | src/usr/local/www/services_dhcp_relay.php | 23 | ||||
-rw-r--r-- | src/usr/local/www/services_dhcpv6.php | 71 | ||||
-rw-r--r-- | src/usr/local/www/services_dhcpv6_edit.php | 5 | ||||
-rw-r--r-- | src/usr/local/www/services_dhcpv6_relay.php | 29 | ||||
-rw-r--r-- | src/usr/local/www/services_dnsmasq.php | 32 | ||||
-rw-r--r-- | src/usr/local/www/services_dnsmasq_domainoverride_edit.php | 59 | ||||
-rw-r--r-- | src/usr/local/www/services_dnsmasq_edit.php | 29 | ||||
-rw-r--r-- | src/usr/local/www/services_dyndns.php | 16 | ||||
-rw-r--r-- | src/usr/local/www/services_dyndns_edit.php | 19 |
11 files changed, 206 insertions, 167 deletions
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") . ".<br />" . 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 ') . '<a href="http://www.iana.org/assignments/bootp-dhcp-parameters/" target="_blank">' . gettext("URL") . '</a></div>' )); -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")) { <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { // Show advanced DNS options ====================================================================================== var showadvdns = false; @@ -1354,12 +1357,13 @@ events.push(function(){ function show_advdns() { <?php if (!$pconfig['ddnsupdate'] && empty($pconfig['ddnsdomain']) && empty($pconfig['ddnsdomainprimary']) && - empty($pconfig['ddnsdomainkeyname']) && empty($pconfig['ddnsdomainkey'])) + empty($pconfig['ddnsdomainkeyname']) && empty($pconfig['ddnsdomainkey'])) { $hide = false; - else + } else { $hide = true; + } ?> - var hide = <?php if($hide) {echo 'true';} else {echo 'false';} ?>; + var hide = <?php if ($hide) {echo 'true';} else {echo 'false';} ?>; hideCheckbox('ddnsupdate', !showadvdns && !hide); hideInput('ddnsdomain', !showadvdns && !hide); @@ -1381,12 +1385,13 @@ events.push(function(){ function show_advmac() { <?php - if (empty($pconfig['mac_allow']) && empty($pconfig['mac_deny'])) + if (empty($pconfig['mac_allow']) && empty($pconfig['mac_deny'])) { $hide = false; - else + } else { $hide = true; + } ?> - var hide = <?php if($hide) {echo 'true';} else {echo 'false';} ?>; + var hide = <?php if ($hide) {echo 'true';} else {echo 'false';} ?>; hideInput('mac_allow', !showadvmac && !hide); hideInput('mac_deny', !showadvmac && !hide); @@ -1406,12 +1411,13 @@ events.push(function(){ function show_advntp() { <?php - if (empty($pconfig['ntp1']) && empty($pconfig['ntp2'])) + if (empty($pconfig['ntp1']) && empty($pconfig['ntp2'])) { $hide = false; - else + } else { $hide = true; + } ?> - var hide = <?php if($hide) {echo 'true';} else {echo 'false';} ?>; + var hide = <?php if ($hide) {echo 'true';} else {echo 'false';} ?>; hideInput('ntp1', !showadvntp && !hide); hideInput('ntp2', !showadvntp && !hide); @@ -1431,12 +1437,13 @@ events.push(function(){ function show_advtftp() { <?php - if (empty($pconfig['tftp'])) + if (empty($pconfig['tftp'])) { $hide = false; - else + } else { $hide = true; + } ?> - var hide = <?php if($hide) {echo 'true';} else {echo 'false';} ?>; + var hide = <?php if ($hide) {echo 'true';} else {echo 'false';} ?>; hideInput('tftp', !showadvtftp && !hide); hideInput('btnadvtftp', hide); @@ -1455,12 +1462,13 @@ events.push(function(){ function show_advldap() { <?php - if (empty($pconfig['ldap'])) + if (empty($pconfig['ldap'])) { $hide = false; - else + } else { $hide = true; + } ?> - var hide = <?php if($hide) {echo 'true';} else {echo 'false';} ?>; + var hide = <?php if ($hide) {echo 'true';} else {echo 'false';} ?>; hideInput('ldap', !showadvldap && !hide); hideInput('btnadvldap', hide); @@ -1480,12 +1488,13 @@ events.push(function(){ function show_advboot() { <?php if (!$pconfig['netboot'] && empty($pconfig['nextserver']) && empty($pconfig['filename']) && empty($pconfig['filename32']) && - empty($pconfig['filename64']) && empty($pconfig['rootpath'])) + empty($pconfig['filename64']) && empty($pconfig['rootpath'])) { $hide = false; - else + } else { $hide = true; + } ?> - var hide = <?php if($hide) {echo 'true';} else {echo 'false';} ?>; + var hide = <?php if ($hide) {echo 'true';} else {echo 'false';} ?>; hideCheckbox('netboot', !showadvboot && !hide); hideInput('nextserver', !showadvboot && !hide); @@ -1509,13 +1518,14 @@ events.push(function(){ function show_advopts() { <?php - if ( empty($pconfig['numberoptions']) || - (empty($pconfig['numberoptions']['item'][0]['number']) && (empty($pconfig['numberoptions']['item'][0]['value'])))) + if (empty($pconfig['numberoptions']) || + (empty($pconfig['numberoptions']['item'][0]['number']) && (empty($pconfig['numberoptions']['item'][0]['value'])))) { $hide = false; - else + } else { $hide = true; + } ?> - var hide = <?php if($hide) {echo 'true';} else {echo 'false';} ?>; + var hide = <?php if ($hide) {echo 'true';} else {echo 'false';} ?>; hideClass('adnlopts', !showadvopts && !hide); hideInput('btnadvopts', hide); diff --git a/src/usr/local/www/services_dhcp_edit.php b/src/usr/local/www/services_dhcp_edit.php index 041fd3d..3a6b753 100644 --- a/src/usr/local/www/services_dhcp_edit.php +++ b/src/usr/local/www/services_dhcp_edit.php @@ -84,8 +84,9 @@ require("guiconfig.inc"); $if = $_GET['if']; -if ($_POST['if']) +if ($_POST['if']) { $if = $_POST['if']; +} if (!$if) { header("Location: services_dhcp.php"); @@ -398,7 +399,7 @@ if ($_POST) { // Get our MAC address $ip = $_SERVER['REMOTE_ADDR']; $mymac = `/usr/sbin/arp -an | grep '('{$ip}')' | cut -d" " -f4`; -$mymac = str_replace("\n","",$mymac); +$mymac = str_replace("\n", "", $mymac); $closehead = false; $pgtitle = array(gettext("Services"), gettext("DHCP"), gettext("Edit static mapping")); @@ -406,8 +407,9 @@ $shortcut_section = "dhcp"; include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form(); @@ -455,7 +457,7 @@ $section->addInput(new Form_Input( $pconfig['hostname'] ))->setHelp('Name of the host, without domain part.'); -if($netboot_enabled) { +if ($netboot_enabled) { $section->addInput(new Form_Input( 'filename', 'Netboot filename', @@ -682,7 +684,7 @@ print($form); <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { function hideDDNS(hide) { hideCheckbox('ddnsupdate', hide); diff --git a/src/usr/local/www/services_dhcp_relay.php b/src/usr/local/www/services_dhcp_relay.php index 6a9dcaa..4da2fab 100644 --- a/src/usr/local/www/services_dhcp_relay.php +++ b/src/usr/local/www/services_dhcp_relay.php @@ -114,13 +114,15 @@ if ($_POST) { $svrlist = ''; if ($_POST['server']) { - foreach($_POST['server'] as $checksrv => $srv) { - if (!is_ipaddr($srv[0])) + foreach ($_POST['server'] as $checksrv => $srv) { + if (!is_ipaddr($srv[0])) { $input_errors[] = gettext("A valid Destination Server IP address must be specified."); + } - if(!empty($srv[0])) { // Filter out any empties - if(!empty($svrlist)) + if (!empty($srv[0])) { // Filter out any empties + if (!empty($svrlist)) { $svrlist .= ','; + } $svrlist .= $srv[0]; } @@ -157,11 +159,13 @@ if ($dhcpd_enabled) { exit; } -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'success'); +} $form = new Form; @@ -194,8 +198,7 @@ $section->addInput(new Form_Checkbox( ); //Small function to prevent duplicate code -function createDestinationServerInputGroup($value = null) -{ +function createDestinationServerInputGroup($value = null) { $group = new Form_Group('Destination server'); $group->add(new Form_IpAddress( @@ -210,9 +213,9 @@ function createDestinationServerInputGroup($value = null) return $group; } -if (!isset($pconfig['server']) || count($pconfig['server']) < 1) +if (!isset($pconfig['server']) || count($pconfig['server']) < 1) { $section->add(createDestinationServerInputGroup()); -else { +} else { foreach (explode(',', $pconfig['server']) as $server) { $section->add(createDestinationServerInputGroup($server)); } diff --git a/src/usr/local/www/services_dhcpv6.php b/src/usr/local/www/services_dhcpv6.php index ae65010..afd1624 100644 --- a/src/usr/local/www/services_dhcpv6.php +++ b/src/usr/local/www/services_dhcpv6.php @@ -101,7 +101,7 @@ if (!$if || !isset($iflist[$if])) { $oc = $config['interfaces'][$ifent]; if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) || - (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) { + (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) { continue; } $if = $ifent; @@ -160,7 +160,7 @@ $dhcrelaycfg = $config['dhcrelay6']; if (is_array($dhcrelaycfg)) { foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) { if (isset($dhcrelayifconf['enable']) && isset($iflist[$dhcrelayif]) && - (!link_interface_to_bridge($dhcrelayif))) { + (!link_interface_to_bridge($dhcrelayif))) { $dhcrelay_enabled = true; } } @@ -210,9 +210,9 @@ if ($_POST) { $input_errors[] = gettext("A valid IPv6 address must be specified for the gateway."); } if (($_POST['dns1'] && !is_ipaddrv6($_POST['dns1'])) || - ($_POST['dns2'] && !is_ipaddrv6($_POST['dns2'])) || - ($_POST['dns3'] && !is_ipaddrv6($_POST['dns3'])) || - ($_POST['dns4'] && !is_ipaddrv6($_POST['dns4']))) { + ($_POST['dns2'] && !is_ipaddrv6($_POST['dns2'])) || + ($_POST['dns3'] && !is_ipaddrv6($_POST['dns3'])) || + ($_POST['dns4'] && !is_ipaddrv6($_POST['dns4']))) { $input_errors[] = gettext("A valid IPv6 address must be specified for each of the DNS servers."); } @@ -229,7 +229,7 @@ if ($_POST) { $input_errors[] = gettext("A valid primary domain name server IPv4 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']) { @@ -281,7 +281,7 @@ if ($_POST) { if (is_ipaddrv6($ifcfgip)) { if ((!is_inrange_v6($_POST['range_from'], $subnet_start, $subnet_end)) || - (!is_inrange_v6($_POST['range_to'], $subnet_start, $subnet_end))) { + (!is_inrange_v6($_POST['range_to'], $subnet_start, $subnet_end))) { $input_errors[] = gettext("The specified range lies outside of the current subnet."); } } @@ -308,7 +308,7 @@ if ($_POST) { continue; } if ((inet_pton($map['ipaddrv6']) > $dynsubnet_start) && - (inet_pton($map['ipaddrv6']) < $dynsubnet_end)) { + (inet_pton($map['ipaddrv6']) < $dynsubnet_end)) { $input_errors[] = sprintf(gettext("The DHCP range cannot overlap any static DHCP mappings.")); break; } @@ -437,18 +437,19 @@ if ($_GET['act'] == "del") { } // Delete a row in the options table -if($_GET['act'] == "delopt") { +if ($_GET['act'] == "delopt") { $idx = $_GET['id']; - if($pconfig['numberoptions'] && is_array($pconfig['numberoptions']['item'][$idx])) { + if ($pconfig['numberoptions'] && is_array($pconfig['numberoptions']['item'][$idx])) { unset($pconfig['numberoptions']['item'][$idx]); } } // Add an option row -if($_GET['act'] == "addopt") { - if(!is_array($pconfig['numberoptions']['item'])) +if ($_GET['act'] == "addopt") { + if (!is_array($pconfig['numberoptions']['item'])) { $pconfig['numberoptions']['item'] = array(); + } array_push($pconfig['numberoptions']['item'], array('number' => null, 'value' => null)); } @@ -459,11 +460,13 @@ $shortcut_section = "dhcp6"; include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'success'); +} if ($dhcrelay_enabled) { print_info_box(gettext("DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface."), 'danger'); @@ -471,8 +474,9 @@ if ($dhcrelay_enabled) { exit; } -if (is_subsystem_dirty('staticmaps')) +if (is_subsystem_dirty('staticmaps')) { print_info_box_np(gettext('The static mapping configuration has been changed') . '.<br />' . gettext('You must apply the changes in order for them to take effect.')); +} /* active tabs */ $tab_array = array(); @@ -483,14 +487,16 @@ foreach ($iflist as $ifent => $ifname) { $oc = $config['interfaces'][$ifent]; - if((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) || - (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) + if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) || + (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) { continue; + } - if ($ifent == $if) + if ($ifent == $if) { $active = true; - else + } else { $active = false; + } $tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}"); $tabscounter++; @@ -499,15 +505,16 @@ foreach ($iflist as $ifent => $ifname) { /* tack on PPPoE or PPtP servers here */ /* pppoe server */ if (is_array($config['pppoes']['pppoe'])) { - foreach($config['pppoes']['pppoe'] as $pppoe) { + foreach ($config['pppoes']['pppoe'] as $pppoe) { if ($pppoe['mode'] == "server") { $ifent = "poes". $pppoe['pppoeid']; $ifname = strtoupper($ifent); - if ($ifent == $if) + if ($ifent == $if) { $active = true; - else + } else { $active = false; + } $tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}"); $tabscounter++; @@ -526,7 +533,7 @@ display_top_tabs($tab_array); $tab_array = array(); $tab_array[] = array(gettext("DHCPv6 Server"), true, "services_dhcpv6.php?if={$if}"); $tab_array[] = array(gettext("Router Advertisements"), false, "services_router_advertisements.php?if={$if}"); -display_top_tabs($tab_array, false, 'nav nav-tabs' ); +display_top_tabs($tab_array, false, 'nav nav-tabs'); $form = new Form(new Form_Button( 'Submit', @@ -542,7 +549,7 @@ $section->addInput(new Form_Checkbox( $pconfig['enable'] ))->toggles('.form-group:not(:first-child)'); -if(is_ipaddrv6($ifcfgip)) { +if (is_ipaddrv6($ifcfgip)) { $section->addInput(new Form_StaticText( 'Subnet', @@ -560,7 +567,7 @@ if(is_ipaddrv6($ifcfgip)) { )); } -if($is_olsr_enabled) { +if ($is_olsr_enabled) { $section->addInput(new Form_Select( 'netmask', 'Subnet Mask', @@ -635,7 +642,7 @@ $section->addInput(new Form_Select( $group = new Form_Group('DNS Servers'); -for($i=1;$i<=4; $i++) { +for ($i=1;$i<=4; $i++) { $group->add(new Form_input( 'dns' . $i, null, @@ -645,7 +652,7 @@ for($i=1;$i<=4; $i++) { )); } -$group->setHelp('Leave blank to use the system default DNS servers,this interface\'s IP if DNS forwarder is enabled, or the servers configured on the "General" page.'); +$group->setHelp('Leave blank to use the system default DNS servers, this interface\'s IP if DNS forwarder is enabled, or the servers configured on the "General" page.'); $section->add($group); $section->addInput(new Form_Input( @@ -828,11 +835,11 @@ $form->add($section); $title = 'Show Additional BOOTP/DHCP Options'; -if($pconfig['numberoptions']) { +if ($pconfig['numberoptions']) { $counter = 0; $last = count($pconfig['numberoptions']['item']) - 1; - foreach($pconfig['numberoptions']['item'] as $item) { + foreach ($pconfig['numberoptions']['item'] as $item) { $group = new Form_Group(null); $group->add(new Form_Input( @@ -904,10 +911,10 @@ print_info_box(gettext('The DNS servers entered in ') . '<a href="system.php">' </thead> <tbody> <?php -if(is_array($a_maps)): +if (is_array($a_maps)): $i = 0; foreach ($a_maps as $mapent): - if($mapent['duid'] != "" or $mapent['ipaddrv6'] != ""): + if ($mapent['duid'] != "" or $mapent['ipaddrv6'] != ""): ?> <tr> <td> @@ -947,7 +954,7 @@ endif; <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { function hideDDNS(hide) { hideCheckBox('ddnsupdate', hide); diff --git a/src/usr/local/www/services_dhcpv6_edit.php b/src/usr/local/www/services_dhcpv6_edit.php index 67a3f51..c66ea60 100644 --- a/src/usr/local/www/services_dhcpv6_edit.php +++ b/src/usr/local/www/services_dhcpv6_edit.php @@ -76,7 +76,7 @@ function staticmaps_sort($ifgui) { require_once('globals.inc'); -if(!$g['services_dhcp_server_enable']) { +if (!$g['services_dhcp_server_enable']) { header("Location: /"); exit; } @@ -219,8 +219,9 @@ $shortcut_section = "dhcp6"; include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form(); diff --git a/src/usr/local/www/services_dhcpv6_relay.php b/src/usr/local/www/services_dhcpv6_relay.php index 56f1f15..84a55ba 100644 --- a/src/usr/local/www/services_dhcpv6_relay.php +++ b/src/usr/local/www/services_dhcpv6_relay.php @@ -63,8 +63,7 @@ ##|-PRIV require("guiconfig.inc"); -function filterDestinationServers(array $destinationServers) -{ +function filterDestinationServers(array $destinationServers) { return array_unique( array_filter($destinationServers) ); @@ -113,8 +112,9 @@ if ($_POST) { unset($input_errors); - if ($_POST['server']) + if ($_POST['server']) { $_POST['server'] = filterDestinationServers($_POST['server']); + } $pconfig = $_POST; @@ -127,8 +127,9 @@ if ($_POST) { if ($_POST['server']) { foreach ($_POST['server'] as $srv) { - if (!is_ipaddrv6($srv)) + if (!is_ipaddrv6($srv)) { $input_errors[] = gettext("A valid Destination Server IPv6 address must be specified."); + } } } } @@ -152,18 +153,19 @@ $pgtitle = array(gettext("Services"), gettext("DHCPv6 Relay")); $shortcut_section = "dhcp6"; include("head.inc"); -if ($dhcpd_enabled) -{ +if ($dhcpd_enabled) { echo '<div class="alert alert-danger">DHCPv6 Server is currently enabled. Cannot enable the DHCPv6 Relay service while the DHCPv6 Server is enabled on any interface.</div>'; include("foot.inc"); exit; } -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg); +} $form = new Form; @@ -196,8 +198,7 @@ $section->addInput(new Form_Checkbox( [$g['product_name']] ); -function createDestinationServerInputGroup($value = null) -{ +function createDestinationServerInputGroup($value = null) { $group = new Form_Group('Destination server'); $group->enableDuplication(); @@ -212,11 +213,13 @@ function createDestinationServerInputGroup($value = null) return $group; } -if (!isset($pconfig['server']) || count($pconfig['server']) < 1) +if (!isset($pconfig['server']) || count($pconfig['server']) < 1) { $section->add(createDestinationServerInputGroup()); -else - foreach ($pconfig['server'] as $idx => $server) +} else { + foreach ($pconfig['server'] as $idx => $server) { $section->add(createDestinationServerInputGroup($server)); + } +} $form->add($section); print $form; diff --git a/src/usr/local/www/services_dnsmasq.php b/src/usr/local/www/services_dnsmasq.php index 65bc0cb..89c2da3 100644 --- a/src/usr/local/www/services_dnsmasq.php +++ b/src/usr/local/www/services_dnsmasq.php @@ -117,7 +117,7 @@ if ($_POST) { } else { $pconfig = $_POST; unset($input_errors); - + $config['dnsmasq']['enable'] = ($_POST['enable']) ? true : false; $config['dnsmasq']['regdhcp'] = ($_POST['regdhcp']) ? true : false; $config['dnsmasq']['regdhcpstatic'] = ($_POST['regdhcpstatic']) ? true : false; @@ -127,13 +127,13 @@ if ($_POST) { $config['dnsmasq']['no_private_reverse'] = ($_POST['no_private_reverse']) ? true : false; $config['dnsmasq']['custom_options'] = str_replace("\r\n", "\n", $_POST['custom_options']); $config['dnsmasq']['strictbind'] = ($_POST['strictbind']) ? true : false; - + if (isset($_POST['enable']) && isset($config['unbound']['enable'])) { if ($_POST['port'] == $config['unbound']['port']) { $input_errors[] = "The DNS Resolver is enabled using this port. Choose a non-conflicting port, or disable DNS Resolver."; } } - + if ($_POST['port']) { if (is_port($_POST['port'])) { $config['dnsmasq']['port'] = $_POST['port']; @@ -143,13 +143,13 @@ if ($_POST) { } else if (isset($config['dnsmasq']['port'])) { unset($config['dnsmasq']['port']); } - + if (is_array($_POST['interface'])) { $config['dnsmasq']['interface'] = implode(",", $_POST['interface']); } elseif (isset($config['dnsmasq']['interface'])) { unset($config['dnsmasq']['interface']); } - + if ($config['dnsmasq']['custom_options']) { $args = ''; foreach (preg_split('/\s+/', $config['dnsmasq']['custom_options']) as $c) { @@ -160,7 +160,7 @@ if ($_POST) { $input_errors[] = gettext("Invalid custom options"); } } - + if (!$input_errors) { write_config(); mark_subsystem_dirty('hosts'); @@ -177,8 +177,7 @@ if ($_GET['act'] == "del") { header("Location: services_dnsmasq.php"); exit; } - } - elseif ($_GET['type'] == 'doverride') { + } elseif ($_GET['type'] == 'doverride') { if ($a_domainOverrides[$_GET['id']]) { unset($a_domainOverrides[$_GET['id']]); write_config(); @@ -194,14 +193,16 @@ function build_if_list() { $iflist = array('options' => array(), 'selected' => array()); $iflist['options'][""] = "All"; - if (empty($pconfig['interface']) || empty($pconfig['interface'][0])) + if (empty($pconfig['interface']) || empty($pconfig['interface'][0])) { array_push($iflist['selected'], ""); + } foreach ($interface_addresses as $laddr => $ldescr) { $iflist['options'][$laddr] = htmlspecialchars($ldescr); - if ($pconfig['interface'] && in_array($laddr, $pconfig['interface'])) + if ($pconfig['interface'] && in_array($laddr, $pconfig['interface'])) { array_push($iflist['selected'], $laddr); + } } unset($interface_addresses); @@ -214,14 +215,17 @@ $pgtitle = array(gettext("Services"), gettext("DNS Forwarder")); $shortcut_section = "forwarder"; include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'success'); +} -if (is_subsystem_dirty('hosts')) +if (is_subsystem_dirty('hosts')) { print_info_box_np(gettext("The DNS forwarder configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect.")); +} $form = new Form(); @@ -479,7 +483,7 @@ endforeach; <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { // On clicking the "Apply" button, submit the main form, not the little form the button lives in // $('[name=apply]').prop('type', 'button'); diff --git a/src/usr/local/www/services_dnsmasq_domainoverride_edit.php b/src/usr/local/www/services_dnsmasq_domainoverride_edit.php index 4eb3e49..b230a4b 100644 --- a/src/usr/local/www/services_dnsmasq_domainoverride_edit.php +++ b/src/usr/local/www/services_dnsmasq_domainoverride_edit.php @@ -92,46 +92,46 @@ if (isset($id) && $a_domainOverrides[$id]) { } if ($_POST) { - unset($input_errors); - $pconfig = $_POST; + unset($input_errors); + $pconfig = $_POST; - /* input validation */ - $reqdfields = explode(" ", "domain ip"); - $reqdfieldsn = array(gettext("Domain"),gettext("IP address")); + /* input validation */ + $reqdfields = explode(" ", "domain ip"); + $reqdfieldsn = array(gettext("Domain"), gettext("IP address")); - do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); + do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); - function String_Begins_With($needle, $haystack) { - return (substr($haystack, 0, strlen($needle))==$needle); - } + function String_Begins_With($needle, $haystack) { + return (substr($haystack, 0, strlen($needle)) == $needle); + } - if (String_Begins_With(_msdcs, $_POST['domain'])) { - $subdomainstr = substr($_POST['domain'], 7); + if (String_Begins_With(_msdcs, $_POST['domain'])) { + $subdomainstr = substr($_POST['domain'], 7); - if ($subdomainstr && !is_domain($subdomainstr)) { - $input_errors[] = gettext("A valid domain must be specified after _msdcs."); - } - } - elseif ($_POST['domain'] && !is_domain($_POST['domain'])) { - $input_errors[] = gettext("A valid domain must be specified."); - } + if ($subdomainstr && !is_domain($subdomainstr)) { + $input_errors[] = gettext("A valid domain must be specified after _msdcs."); + } + } elseif ($_POST['domain'] && !is_domain($_POST['domain'])) { + $input_errors[] = gettext("A valid domain must be specified."); + } - if ($_POST['ip'] && !is_ipaddr($_POST['ip']) && ($_POST['ip'] != '#') && ($_POST['ip'] != '!')) { - $input_errors[] = gettext("A valid IP address must be specified, or # for an exclusion or ! to not forward at all."); - } + if ($_POST['ip'] && !is_ipaddr($_POST['ip']) && ($_POST['ip'] != '#') && ($_POST['ip'] != '!')) { + $input_errors[] = gettext("A valid IP address must be specified, or # for an exclusion or ! to not forward at all."); + } - if ($_POST['dnssrcip'] && !in_array($_POST['dnssrcip'], get_configured_ip_addresses())) { - $input_errors[] = gettext("An interface IP address must be specified for the DNS query source."); - } + if ($_POST['dnssrcip'] && !in_array($_POST['dnssrcip'], get_configured_ip_addresses())) { + $input_errors[] = gettext("An interface IP address must be specified for the DNS query source."); + } - if (!$input_errors) { + if (!$input_errors) { $doment = array(); $doment['domain'] = $_POST['domain']; - if (empty($_POST['dnssrcip'])) + if (empty($_POST['dnssrcip'])) { $doment['ip'] = $_POST['ip']; - else - $doment['ip'] = $_POST['ip'] . "@" . $_POST['dnssrcip']; + } else { + $doment['ip'] = $_POST['ip'] . "@" . $_POST['dnssrcip']; + } $doment['descr'] = $_POST['descr']; @@ -154,8 +154,9 @@ $pgtitle = array(gettext("Services"), gettext("DNS Forwarder"), gettext("Edit Do $shortcut_section = "forwarder"; include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form(); diff --git a/src/usr/local/www/services_dnsmasq_edit.php b/src/usr/local/www/services_dnsmasq_edit.php index 0cc0ee5..8bc1ac4 100644 --- a/src/usr/local/www/services_dnsmasq_edit.php +++ b/src/usr/local/www/services_dnsmasq_edit.php @@ -80,8 +80,9 @@ function hosts_sort() { require("guiconfig.inc"); -if (!is_array($config['dnsmasq']['hosts'])) +if (!is_array($config['dnsmasq']['hosts'])) { $config['dnsmasq']['hosts'] = array(); +} $a_hosts = &$config['dnsmasq']['hosts']; @@ -137,12 +138,10 @@ if ($_POST) { if (!substr_compare('aliashost', $key, 0, 9)) { $entry = substr($key, 9); $field = 'host'; - } - elseif (!substr_compare('aliasdomain', $key, 0, 11)) { + } elseif (!substr_compare('aliasdomain', $key, 0, 11)) { $entry = substr($key, 11); $field = 'domain'; - } - elseif (!substr_compare('aliasdescription', $key, 0, 16)) { + } elseif (!substr_compare('aliasdescription', $key, 0, 16)) { $entry = substr($key, 16); $field = 'description'; } @@ -213,28 +212,30 @@ if ($_POST) { } // Delete a row in the options table -if($_GET['act'] == "delopt") { +if ($_GET['act'] == "delopt") { $idx = $_GET['id']; - if($pconfig['aliases'] && is_array($pconfig['aliases']['item'][$idx])) { + if ($pconfig['aliases'] && is_array($pconfig['aliases']['item'][$idx])) { unset($pconfig['aliases']['item'][$idx]); } } // Add an option row -if($_GET['act'] == "addopt") { - if(!is_array($pconfig['aliases']['item'])) +if ($_GET['act'] == "addopt") { + if (!is_array($pconfig['aliases']['item'])) { $pconfig['aliases']['item'] = array(); + } array_push($pconfig['aliases']['item'], array('host' => null, 'domain' => null, 'description' => null)); } -$pgtitle = array(gettext("Services"),gettext("DNS Forwarder"),gettext("Edit Host Override")); +$pgtitle = array(gettext("Services"), gettext("DNS Forwarder"), gettext("Edit Host Override")); $shortcut_section = "forwarder"; include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form(); @@ -283,15 +284,15 @@ $form->add($section); $section = new Form_Section('Additional names for this host'); -if(!$pconfig['aliases']['item']) { +if (!$pconfig['aliases']['item']) { $pconfig['aliases']['item'] = array('host' => ""); } -if( $pconfig['aliases']['item']) { +if ($pconfig['aliases']['item']) { $counter = 0; $last = count($pconfig['aliases']['item']) - 1; - foreach($pconfig['aliases']['item'] as $item) { + foreach ($pconfig['aliases']['item'] as $item) { $group = new Form_Group(null); $group->addClass('repeatable'); diff --git a/src/usr/local/www/services_dyndns.php b/src/usr/local/www/services_dyndns.php index 39ba9b9..0b42b8e 100644 --- a/src/usr/local/www/services_dyndns.php +++ b/src/usr/local/www/services_dyndns.php @@ -78,8 +78,7 @@ if ($_GET['act'] == "del") { header("Location: services_dyndns.php"); exit; -} -else if ($_GET['act'] == "toggle") { +} else if ($_GET['act'] == "toggle") { if ($a_dyndns[$_GET['id']]) { if (isset($a_dyndns[$_GET['id']]['enable'])) { unset($a_dyndns[$_GET['id']]['enable']); @@ -96,8 +95,9 @@ else if ($_GET['act'] == "toggle") { $pgtitle = array(gettext("Services"), gettext("Dynamic DNS"), gettext("Dynamic DNS Clients")); include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $tab_array = array(); $tab_array[] = array(gettext("Dynamic DNS"), true, "services_dyndns.php"); @@ -171,10 +171,11 @@ foreach ($a_dyndns as $dyndns): $cached_ip_s = explode(":", file_get_contents($filename)); $cached_ip = $cached_ip_s[0]; - if ($ipaddr != $cached_ip) + if ($ipaddr != $cached_ip) { print('<span class="text-danger">'); - else + } else { print('<span class="text-success">'); + } print(htmlspecialchars($cached_ip)); print('</span>'); @@ -183,10 +184,11 @@ foreach ($a_dyndns as $dyndns): $cached_ipv6_s = explode("|", file_get_contents($filename_v6)); $cached_ipv6 = $cached_ipv6_s[0]; - if ($ipv6addr != $cached_ipv6) + if ($ipv6addr != $cached_ipv6) { print('<span class="text-danger">'); - else + } else { print('<span class="text-success">'); + } print(htmlspecialchars($cached_ipv6)); print('</span>'); diff --git a/src/usr/local/www/services_dyndns_edit.php b/src/usr/local/www/services_dyndns_edit.php index 707dfc3..57cdbc7 100644 --- a/src/usr/local/www/services_dyndns_edit.php +++ b/src/usr/local/www/services_dyndns_edit.php @@ -217,8 +217,9 @@ function build_type_list() { $vals = explode(" ", DYNDNS_PROVIDER_VALUES); $typelist = array(); - for ($j = 0; $j < count($vals); $j++) + for ($j = 0; $j < count($vals); $j++) { $typelist[$vals[$j]] = htmlspecialchars($types[$j]); + } return($typelist); } @@ -228,15 +229,17 @@ function build_if_list() { $iflist = get_configured_interface_with_descr(); - foreach ($iflist as $if => $ifdesc) + foreach ($iflist as $if => $ifdesc) { $list[$if] = $ifdesc; + } unset($iflist); $grouplist = return_gateway_groups_array(); - foreach ($grouplist as $name => $group) + foreach ($grouplist as $name => $group) { $list[$name] = 'GW Group ' . $name; + } unset($grouplist); @@ -246,11 +249,13 @@ function build_if_list() { $pgtitle = array(gettext("Services"), gettext("Dynamic DNS"), gettext("Dynamic DNS Client"), gettext("Edit")); include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'success'); +} $form = new Form; @@ -418,7 +423,7 @@ print($form); events.push(function() { function setVisible(service) { - switch(service) { + switch (service) { case "custom" : case "custom-v6" : hideInput('resultmatch', false); @@ -463,7 +468,7 @@ events.push(function() { // When the 'Service type" selector is changed, we show/hide certain elements $('#type').on('change', function() { - setVisible( this.value ); + setVisible(this.value); }); // ---------- On initial page load ------------------------------------------------------------ |