summaryrefslogtreecommitdiffstats
path: root/usr/local
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2015-05-13 14:13:17 -0300
committerRenato Botelho <garga@FreeBSD.org>2015-05-13 14:13:17 -0300
commit62a9a5d08d78f2dd9e654c2040fb9aa4cef71f72 (patch)
tree968fadece0b7cc24f92d4646ecbca6de9aa6ef9a /usr/local
parent101258ebaeb412c2715e4e4555d426ad9d3e3641 (diff)
parent1caf2209da7065fb8795da08cd20214999d33b11 (diff)
downloadpfsense-62a9a5d08d78f2dd9e654c2040fb9aa4cef71f72.zip
pfsense-62a9a5d08d78f2dd9e654c2040fb9aa4cef71f72.tar.gz
Merge pull request #1650 from phil-davis/interfaces-php
Diffstat (limited to 'usr/local')
-rw-r--r--usr/local/www/interfaces.php1130
1 files changed, 681 insertions, 449 deletions
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php
index 89cff44..f1423b1 100644
--- a/usr/local/www/interfaces.php
+++ b/usr/local/www/interfaces.php
@@ -61,8 +61,9 @@ $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/inter
$ifdescrs = get_configured_interface_with_descr(false, true);
$if = "wan";
-if ($_REQUEST['if'])
+if ($_REQUEST['if']) {
$if = $_REQUEST['if'];
+}
if (empty($ifdescrs[$if])) {
header("Location: interfaces.php");
@@ -74,21 +75,25 @@ define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
define("CRON_DAILY_PATTERN", "0 0 * * *");
define("CRON_HOURLY_PATTERN", "0 * * * *");
-if (!is_array($pconfig))
+if (!is_array($pconfig)) {
$pconfig = array();
+}
-if (!is_array($config['ppps']))
+if (!is_array($config['ppps'])) {
$config['ppps'] = array();
-if (!is_array($config['ppps']['ppp']))
+}
+if (!is_array($config['ppps']['ppp'])) {
$config['ppps']['ppp'] = array();
+}
$a_ppps = &$config['ppps']['ppp'];
function remove_bad_chars($string) {
return preg_replace('/[^a-z_0-9]/i','',$string);
}
-if (!is_array($config['gateways']['gateway_item']))
+if (!is_array($config['gateways']['gateway_item'])) {
$config['gateways']['gateway_item'] = array();
+}
$a_gateways = &$config['gateways']['gateway_item'];
$wancfg = &$config['interfaces'][$if];
@@ -96,15 +101,17 @@ $old_wancfg = $wancfg;
$old_wancfg['realif'] = get_real_interface($if);
$old_ppps = $a_ppps;
// Populate page descr if it does not exist.
-if ($if == "wan" && !$wancfg['descr'])
+if ($if == "wan" && !$wancfg['descr']) {
$wancfg['descr'] = "WAN";
-else if ($if == "lan" && !$wancfg['descr'])
+} else if ($if == "lan" && !$wancfg['descr']) {
$wancfg['descr'] = "LAN";
+}
/* NOTE: The code here is used to set the $pppid for the curious */
foreach ($a_ppps as $pppid => $ppp) {
- if ($wancfg['if'] == $ppp['if'])
+ if ($wancfg['if'] == $ppp['if']) {
break;
+ }
}
$type_disabled = (substr($wancfg['if'], 0, 3) == 'gre') ? 'disabled="disabled"' : '';
@@ -119,8 +126,7 @@ if ($wancfg['if'] == $a_ppps[$pppid]['if']) {
$pconfig['phone'] = $a_ppps[$pppid]['phone'];
$pconfig['apn'] = $a_ppps[$pppid]['apn'];
- }
- else if ($a_ppps[$pppid]['type'] == "pppoe") {
+ } else if ($a_ppps[$pppid]['type'] == "pppoe") {
$pconfig['pppoe_username'] = $a_ppps[$pppid]['username'];
$pconfig['pppoe_password'] = base64_decode($a_ppps[$pppid]['password']);
$pconfig['provider'] = $a_ppps[$pppid]['provider'];
@@ -134,8 +140,9 @@ if ($wancfg['if'] == $a_ppps[$pppid]['if']) {
if (isset($a_ppps[$pppid]['pppoe-reset-type'])) {
$pconfig['pppoe-reset-type'] = $a_ppps[$pppid]['pppoe-reset-type'];
$itemhash = getMPDCRONSettings($a_ppps[$pppid]['if']);
- if ($itemhash)
+ if ($itemhash) {
$cronitem = $itemhash['ITEM'];
+ }
if (isset($cronitem)) {
$resetTime = "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
} else {
@@ -147,8 +154,9 @@ if ($wancfg['if'] == $a_ppps[$pppid]['if']) {
$pconfig['pppoe_pr_custom'] = true;
$pconfig['pppoe_resetminute'] = $cronitem['minute'];
$pconfig['pppoe_resethour'] = $cronitem['hour'];
- if ($cronitem['mday'] <> "*" && $cronitem['month'] <> "*")
+ if ($cronitem['mday'] <> "*" && $cronitem['month'] <> "*") {
$pconfig['pppoe_resetdate'] = "{$cronitem['month']}/{$cronitem['mday']}/" . date("Y");
+ }
}
} else if ($a_ppps[$pppid]['pppoe-reset-type'] == "preset") {
$pconfig['pppoe_pr_preset'] = true;
@@ -167,9 +175,9 @@ if ($wancfg['if'] == $a_ppps[$pppid]['if']) {
break;
}
}
- }// End force pppoe reset at specific time
- }// End if type == pppoe
- else if ($a_ppps[$pppid]['type'] == "pptp" || $a_ppps[$pppid]['type'] == "l2tp"){
+ } // End force pppoe reset at specific time
+ // End if type == pppoe
+ } else if ($a_ppps[$pppid]['type'] == "pptp" || $a_ppps[$pppid]['type'] == "l2tp") {
$pconfig['pptp_username'] = $a_ppps[$pppid]['username'];
$pconfig['pptp_password'] = base64_decode($a_ppps[$pppid]['password']);
$pconfig['pptp_local'] = explode(",",$a_ppps[$pppid]['localip']);
@@ -245,14 +253,14 @@ $pconfig['descr'] = remove_bad_chars($wancfg['descr']);
$pconfig['enable'] = isset($wancfg['enable']);
if (is_array($config['aliases']['alias'])) {
- foreach($config['aliases']['alias'] as $alias) {
- if($alias['name'] == $wancfg['descr']) {
+ foreach ($config['aliases']['alias'] as $alias) {
+ if ($alias['name'] == $wancfg['descr']) {
$input_errors[] = sprintf(gettext("Sorry, an alias with the name %s already exists."),$wancfg['descr']);
}
}
}
-switch($wancfg['ipaddr']) {
+switch ($wancfg['ipaddr']) {
case "dhcp":
$pconfig['type'] = "dhcp";
break;
@@ -263,24 +271,26 @@ switch($wancfg['ipaddr']) {
$pconfig['type'] = $wancfg['ipaddr'];
break;
default:
- if(is_ipaddrv4($wancfg['ipaddr'])) {
+ if (is_ipaddrv4($wancfg['ipaddr'])) {
$pconfig['type'] = "staticv4";
$pconfig['ipaddr'] = $wancfg['ipaddr'];
$pconfig['subnet'] = $wancfg['subnet'];
$pconfig['gateway'] = $wancfg['gateway'];
- } else
+ } else {
$pconfig['type'] = "none";
+ }
break;
}
-switch($wancfg['ipaddrv6']) {
+switch ($wancfg['ipaddrv6']) {
case "slaac":
$pconfig['type6'] = "slaac";
break;
case "dhcp6":
$pconfig['dhcp6-duid'] = $wancfg['dhcp6-duid'];
- if(!isset($wancfg['dhcp6-ia-pd-len']))
+ if (!isset($wancfg['dhcp6-ia-pd-len'])) {
$wancfg['dhcp6-ia-pd-len'] = "none";
+ }
$pconfig['dhcp6-ia-pd-len'] = $wancfg['dhcp6-ia-pd-len'];
$pconfig['dhcp6-ia-pd-send-hint'] = isset($wancfg['dhcp6-ia-pd-send-hint']);
$pconfig['type6'] = "dhcp6";
@@ -293,28 +303,31 @@ switch($wancfg['ipaddrv6']) {
case "track6":
$pconfig['type6'] = "track6";
$pconfig['track6-interface'] = $wancfg['track6-interface'];
- if ($wancfg['track6-prefix-id'] == "")
+ if ($wancfg['track6-prefix-id'] == "") {
$pconfig['track6-prefix-id'] = 0;
- else
+ } else {
$pconfig['track6-prefix-id'] = $wancfg['track6-prefix-id'];
+ }
$pconfig['track6-prefix-id--hex'] = sprintf("%x", $pconfig['track6-prefix-id']);
break;
case "6rd":
$pconfig['prefix-6rd'] = $wancfg['prefix-6rd'];
- if($wancfg['prefix-6rd-v4plen'] == "")
+ if ($wancfg['prefix-6rd-v4plen'] == "") {
$wancfg['prefix-6rd-v4plen'] = "0";
+ }
$pconfig['prefix-6rd-v4plen'] = $wancfg['prefix-6rd-v4plen'];
$pconfig['type6'] = "6rd";
$pconfig['gateway-6rd'] = $wancfg['gateway-6rd'];
break;
default:
- if(is_ipaddrv6($wancfg['ipaddrv6'])) {
+ if (is_ipaddrv6($wancfg['ipaddrv6'])) {
$pconfig['type6'] = "staticv6";
$pconfig['ipaddrv6'] = $wancfg['ipaddrv6'];
$pconfig['subnetv6'] = $wancfg['subnetv6'];
$pconfig['gatewayv6'] = $wancfg['gatewayv6'];
- } else
+ } else {
$pconfig['type6'] = "none";
+ }
break;
}
@@ -332,15 +345,22 @@ if (isset($wancfg['wireless'])) {
interface_sync_wireless_clones($wancfg, false);
/* Get wireless modes */
$wlanif = get_real_interface($if);
- if (!does_interface_exist($wlanif))
+ if (!does_interface_exist($wlanif)) {
interface_wireless_clone($wlanif, $wancfg);
+ }
$wlanbaseif = interface_get_wireless_base($wancfg['if']);
preg_match("/^(.*?)([0-9]*)$/", $wlanbaseif, $wlanbaseif_split);
$wl_modes = get_wireless_modes($if);
$wl_chaninfo = get_wireless_channel_info($if);
$wl_sysctl_prefix = 'dev.' . $wlanbaseif_split[1] . '.' . $wlanbaseif_split[2];
- $wl_sysctl = get_sysctl(array("{$wl_sysctl_prefix}.diversity", "{$wl_sysctl_prefix}.txantenna", "{$wl_sysctl_prefix}.rxantenna",
- "{$wl_sysctl_prefix}.slottime", "{$wl_sysctl_prefix}.acktimeout", "{$wl_sysctl_prefix}.ctstimeout"));
+ $wl_sysctl = get_sysctl(
+ array(
+ "{$wl_sysctl_prefix}.diversity",
+ "{$wl_sysctl_prefix}.txantenna",
+ "{$wl_sysctl_prefix}.rxantenna",
+ "{$wl_sysctl_prefix}.slottime",
+ "{$wl_sysctl_prefix}.acktimeout",
+ "{$wl_sysctl_prefix}.ctstimeout"));
$wl_regdomain_xml_attr = array();
$wl_regdomain_xml = parse_xml_regdomain($wl_regdomain_xml_attr);
$wl_regdomains = &$wl_regdomain_xml['regulatory-domains']['rd'];
@@ -362,12 +382,13 @@ if (isset($wancfg['wireless'])) {
$pconfig['regcountry'] = $wancfg['wireless']['regcountry'];
$pconfig['reglocation'] = $wancfg['wireless']['reglocation'];
$pconfig['wme_enable'] = isset($wancfg['wireless']['wme']['enable']);
- if (isset($wancfg['wireless']['puren']['enable']))
+ if (isset($wancfg['wireless']['puren']['enable'])) {
$pconfig['puremode'] = '11n';
- else if (isset($wancfg['wireless']['pureg']['enable']))
+ } else if (isset($wancfg['wireless']['pureg']['enable'])) {
$pconfig['puremode'] = '11g';
- else
+ } else {
$pconfig['puremode'] = 'any';
+ }
$pconfig['apbridge_enable'] = isset($wancfg['wireless']['apbridge']['enable']);
$pconfig['authmode'] = $wancfg['wireless']['authmode'];
$pconfig['hidessid_enable'] = isset($wancfg['wireless']['hidessid']['enable']);
@@ -400,20 +421,22 @@ if (isset($wancfg['wireless'])) {
$i = 1;
foreach ($wancfg['wireless']['wep']['key'] as $wepkey) {
$pconfig['key' . $i] = $wepkey['value'];
- if (isset($wepkey['txkey']))
+ if (isset($wepkey['txkey'])) {
$pconfig['txkey'] = $i;
+ }
$i++;
}
- if (!isset($wepkey['txkey']))
+ if (!isset($wepkey['txkey'])) {
$pconfig['txkey'] = 1;
+ }
}
}
if ($_POST['apply']) {
unset($input_errors);
- if (!is_subsystem_dirty('interfaces'))
+ if (!is_subsystem_dirty('interfaces')) {
$input_errors[] = gettext("You have already applied your settings!");
- else {
+ } else {
unlink_if_exists("{$g['tmp_path']}/config.cache");
clear_subsystem_dirty('interfaces');
@@ -426,8 +449,9 @@ if ($_POST['apply']) {
} else {
interface_bring_down($ifapply, true, $ifcfgo);
if (isset($config['dhcpd'][$ifapply]['enable']) ||
- isset($config['dhcpdv6'][$ifapply]['enable']))
+ isset($config['dhcpdv6'][$ifapply]['enable'])) {
services_dhcpd_configure();
+ }
}
}
}
@@ -443,16 +467,18 @@ if ($_POST['apply']) {
enable_rrd_graphing();
- if (is_subsystem_dirty('staticroutes') && (system_routing_configure() == 0))
+ if (is_subsystem_dirty('staticroutes') && (system_routing_configure() == 0)) {
clear_subsystem_dirty('staticroutes');
+ }
}
@unlink("{$g['tmp_path']}/.interfaces.apply");
header("Location: interfaces.php?if={$if}");
exit;
} else if ($_POST && $_POST['enable'] != "yes") {
unset($wancfg['enable']);
- if (isset($wancfg['wireless']))
+ if (isset($wancfg['wireless'])) {
interface_sync_wireless_clones($wancfg, false);
+ }
write_config("Interface {$_POST['descr']}({$if}) is now disabled.");
mark_subsystem_dirty('interfaces');
if (file_exists("{$g['tmp_path']}/.interfaces.apply")) {
@@ -471,17 +497,18 @@ if ($_POST['apply']) {
unset($input_errors);
$pconfig = $_POST;
- if (is_numeric("0x" . $_POST['track6-prefix-id--hex']))
+ if (is_numeric("0x" . $_POST['track6-prefix-id--hex'])) {
$pconfig['track6-prefix-id'] = intval($_POST['track6-prefix-id--hex'], 16);
- else
+ } else {
$pconfig['track6-prefix-id'] = 0;
+ }
conf_mount_rw();
/* filter out spaces from descriptions */
$_POST['descr'] = remove_bad_chars($_POST['descr']);
/* okay first of all, cause we are just hiding the PPPoE HTML
- * fields releated to PPPoE resets, we are going to unset $_POST
+ * fields related to PPPoE resets, we are going to unset $_POST
* vars, if the reset feature should not be used. Otherwise the
* data validation procedure below, may trigger a false error
* message.
@@ -500,26 +527,29 @@ if ($_POST['apply']) {
break;
}
}
- if(is_numeric($_POST['descr'])) {
+ if (is_numeric($_POST['descr'])) {
$input_errors[] = gettext("The interface description cannot contain only numbers.");
}
/* input validation */
- if (isset($config['dhcpd']) && isset($config['dhcpd'][$if]['enable']) && (! preg_match("/^staticv4/", $_POST['type'])))
+ if (isset($config['dhcpd']) && isset($config['dhcpd'][$if]['enable']) && (! preg_match("/^staticv4/", $_POST['type']))) {
$input_errors[] = gettext("The DHCP Server is active on this interface and it can be used only with a static IP configuration. Please disable the DHCP Server service on this interface first, then change the interface configuration.");
- if (isset($config['dhcpdv6']) && isset($config['dhcpdv6'][$if]['enable']) && (! preg_match("/^staticv6/", $_POST['type6'])))
+ }
+ if (isset($config['dhcpdv6']) && isset($config['dhcpdv6'][$if]['enable']) && (! preg_match("/^staticv6/", $_POST['type6']))) {
$input_errors[] = gettext("The DHCP6 Server is active on this interface and it can be used only with a static IPv6 configuration. Please disable the DHCPv6 Server service on this interface first, then change the interface configuration.");
+ }
- switch(strtolower($_POST['type'])) {
+ switch (strtolower($_POST['type'])) {
case "staticv4":
$reqdfields = explode(" ", "ipaddr subnet gateway");
$reqdfieldsn = array(gettext("IPv4 address"),gettext("Subnet bit count"),gettext("Gateway"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
break;
case "none":
- if(is_array($config['virtualip']['vip'])) {
+ if (is_array($config['virtualip']['vip'])) {
foreach ($config['virtualip']['vip'] as $vip) {
- if (is_ipaddrv4($vip['subnet']) && $vip['interface'] == $if)
+ if (is_ipaddrv4($vip['subnet']) && $vip['interface'] == $if) {
$input_errors[] = gettext("This interface is referenced by IPv4 VIPs. Please delete those before setting the interface to 'none' configuration.");
+ }
}
}
break;
@@ -559,23 +589,25 @@ if ($_POST['apply']) {
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
break;
}
- switch(strtolower($_POST['type6'])) {
+ switch (strtolower($_POST['type6'])) {
case "staticv6":
$reqdfields = explode(" ", "ipaddrv6 subnetv6 gatewayv6");
$reqdfieldsn = array(gettext("IPv6 address"),gettext("Subnet bit count"),gettext("Gateway"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
break;
case "none":
- if(is_array($config['virtualip']['vip'])) {
+ if (is_array($config['virtualip']['vip'])) {
foreach ($config['virtualip']['vip'] as $vip) {
- if (is_ipaddrv6($vip['subnet']) && $vip['interface'] == $if)
+ if (is_ipaddrv6($vip['subnet']) && $vip['interface'] == $if) {
$input_errors[] = gettext("This interface is referenced by IPv6 VIPs. Please delete those before setting the interface to 'none' configuration.");
+ }
}
}
break;
case "dhcp6":
- if (in_array($wancfg['ipaddrv6'], array()))
+ if (in_array($wancfg['ipaddrv6'], array())) {
$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
+ }
if ($_POST['dhcp6-ia-pd-send-hint'] && strtolower($_POST['dhcp6-ia-pd-len']) == 'none') {
$input_errors[] = gettext('DHCPv6 Prefix Delegation size must be provided when Send IPv6 prefix hint flag is checked');
}
@@ -589,8 +621,9 @@ if ($_POST['apply']) {
}
}
}
- if (in_array($wancfg['ipaddrv6'], array()))
+ if (in_array($wancfg['ipaddrv6'], array())) {
$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
+ }
break;
case "6to4":
foreach ($ifdescrs as $ifent => $ifdescr) {
@@ -599,13 +632,15 @@ if ($_POST['apply']) {
break;
}
}
- if (in_array($wancfg['ipaddrv6'], array()))
+ if (in_array($wancfg['ipaddrv6'], array())) {
$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
+ }
break;
case "track6":
/* needs to check if $track6-prefix-id is used on another interface */
- if (in_array($wancfg['ipaddrv6'], array()))
+ if (in_array($wancfg['ipaddrv6'], array())) {
$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
+ }
if ($_POST['track6-prefix-id--hex'] != "" && !is_numeric("0x" . $_POST['track6-prefix-id--hex'])) {
$input_errors[] = gettext("You must enter a valid hexadecimal number for the IPv6 prefix ID.");
@@ -616,8 +651,9 @@ if ($_POST['apply']) {
" ({$_POST['track6-interface']}) - (0) - (" . sprintf('%x', $_POST['ipv6-num-prefix-ids-' . $_POST['track6-interface']]) . ")";
} else {
foreach ($ifdescrs as $ifent => $ifdescr) {
- if ($if == $ifent)
+ if ($if == $ifent) {
continue;
+ }
if ($config['interfaces'][$ifent]['ipaddrv6'] == 'track6' &&
$config['interfaces'][$ifent]['track6-interface'] == $_POST['track6-interface'] &&
$config['interfaces'][$ifent]['track6-prefix-id'] == $track6_prefix_id)
@@ -628,14 +664,13 @@ if ($_POST['apply']) {
break;
}
-
/* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
$staticroutes = get_staticroutes(true);
$_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
if ($_POST['ipaddr']) {
- if (!is_ipaddrv4($_POST['ipaddr']))
+ if (!is_ipaddrv4($_POST['ipaddr'])) {
$input_errors[] = gettext("A valid IPv4 address must be specified.");
- else {
+ } else {
$where_ipaddr_configured = where_is_ipaddr_configured($_POST['ipaddr'], $if, true, true, $_POST['subnet']);
if (count($where_ipaddr_configured)) {
$subnet_conflict_text = sprintf(gettext("IPv4 address %s is being used by or overlaps with:"), $_POST['ipaddr'] . "/" . $_POST['subnet']);
@@ -647,10 +682,11 @@ if ($_POST['apply']) {
/* Do not accept network or broadcast address, except if subnet is 31 or 32 */
if ($_POST['subnet'] < 31) {
- if ($_POST['ipaddr'] == gen_subnet($_POST['ipaddr'], $_POST['subnet']))
+ if ($_POST['ipaddr'] == gen_subnet($_POST['ipaddr'], $_POST['subnet'])) {
$input_errors[] = gettext("This IPv4 address is the network address and cannot be used");
- else if ($_POST['ipaddr'] == gen_subnet_max($_POST['ipaddr'], $_POST['subnet']))
+ } else if ($_POST['ipaddr'] == gen_subnet_max($_POST['ipaddr'], $_POST['subnet'])) {
$input_errors[] = gettext("This IPv4 address is the broadcast address and cannot be used");
+ }
}
foreach ($staticroutes as $route_subnet) {
@@ -664,9 +700,9 @@ if ($_POST['apply']) {
}
}
if ($_POST['ipaddrv6']) {
- if (!is_ipaddrv6($_POST['ipaddrv6']))
+ if (!is_ipaddrv6($_POST['ipaddrv6'])) {
$input_errors[] = gettext("A valid IPv6 address must be specified.");
- else {
+ } else {
$where_ipaddr_configured = where_is_ipaddr_configured($_POST['ipaddrv6'], $if, true, true, $_POST['subnetv6']);
if (count($where_ipaddr_configured)) {
$subnet_conflict_text = sprintf(gettext("IPv6 address %s is being used by or overlaps with:"), $_POST['ipaddrv6'] . "/" . $_POST['subnetv6']);
@@ -686,57 +722,73 @@ if ($_POST['apply']) {
}
}
}
- if (($_POST['subnet'] && !is_numeric($_POST['subnet'])))
+ if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
$input_errors[] = gettext("A valid subnet bit count must be specified.");
- if (($_POST['subnetv6'] && !is_numeric($_POST['subnetv6'])))
+ }
+ if (($_POST['subnetv6'] && !is_numeric($_POST['subnetv6']))) {
$input_errors[] = gettext("A valid subnet bit count must be specified.");
- if (($_POST['alias-address'] && !is_ipaddrv4($_POST['alias-address'])))
+ }
+ if (($_POST['alias-address'] && !is_ipaddrv4($_POST['alias-address']))) {
$input_errors[] = gettext("A valid alias IP address must be specified.");
- if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet'])))
+ }
+ if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet']))) {
$input_errors[] = gettext("A valid alias subnet bit count must be specified.");
- if ($_POST['dhcprejectfrom'] && !is_ipaddrv4($_POST['dhcprejectfrom']))
+ }
+ if ($_POST['dhcprejectfrom'] && !is_ipaddrv4($_POST['dhcprejectfrom'])) {
$input_errors[] = gettext("A valid alias IP address must be specified to reject DHCP Leases from.");
+ }
if (($_POST['gateway'] != "none") || ($_POST['gatewayv6'] != "none")) {
$match = false;
- foreach($a_gateways as $gateway) {
- if(in_array($_POST['gateway'], $gateway)) {
+ foreach ($a_gateways as $gateway) {
+ if (in_array($_POST['gateway'], $gateway)) {
$match = true;
}
}
- foreach($a_gateways as $gateway) {
- if(in_array($_POST['gatewayv6'], $gateway)) {
+ foreach ($a_gateways as $gateway) {
+ if (in_array($_POST['gatewayv6'], $gateway)) {
$match = true;
}
}
- if(!$match) {
+ if (!$match) {
$input_errors[] = gettext("A valid gateway must be specified.");
}
}
- if (($_POST['provider'] && !is_domain($_POST['provider'])))
+ if (($_POST['provider'] && !is_domain($_POST['provider']))) {
$input_errors[] = gettext("The service name contains invalid characters.");
- if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout']))
+ }
+ if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout'])) {
$input_errors[] = gettext("The idle timeout value must be an integer.");
+ }
if ($_POST['pppoe_resethour'] <> "" && !is_numericint($_POST['pppoe_resethour']) &&
- $_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23)
+ $_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23) {
$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
+ }
if ($_POST['pppoe_resetminute'] <> "" && !is_numericint($_POST['pppoe_resetminute']) &&
- $_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59)
+ $_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59) {
$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
- if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate'])))
+ }
+ if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))) {
$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
- if (($_POST['pptp_local'] && !is_ipaddrv4($_POST['pptp_local'])))
+ }
+ if (($_POST['pptp_local'] && !is_ipaddrv4($_POST['pptp_local']))) {
$input_errors[] = gettext("A valid PPTP local IP address must be specified.");
- if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet'])))
+ }
+ if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet']))) {
$input_errors[] = gettext("A valid PPTP subnet bit count must be specified.");
- if (($_POST['pptp_remote'] && !is_ipaddrv4($_POST['pptp_remote']) && !is_hostname($_POST['gateway'][$iface])))
+ }
+ if (($_POST['pptp_remote'] && !is_ipaddrv4($_POST['pptp_remote']) && !is_hostname($_POST['gateway'][$iface]))) {
$input_errors[] = gettext("A valid PPTP remote IP address must be specified.");
- if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout']))
+ }
+ if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) {
$input_errors[] = gettext("The idle timeout value must be an integer.");
- if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac'])))
+ }
+ if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) {
$input_errors[] = gettext("A valid MAC address must be specified.");
+ }
if ($_POST['mtu']) {
- if (!is_numericint($_POST['mtu']))
+ if (!is_numericint($_POST['mtu'])) {
$input_errors[] = "MTU must be an integer.";
+ }
if (substr($wancfg['if'], 0, 3) == 'gif') {
$min_mtu = 1280;
$max_mtu = 8192;
@@ -745,8 +797,9 @@ if ($_POST['apply']) {
$max_mtu = 9000;
}
- if ($_POST['mtu'] < $min_mtu || $_POST['mtu'] > $max_mtu)
+ if ($_POST['mtu'] < $min_mtu || $_POST['mtu'] > $max_mtu) {
$input_errors[] = sprintf(gettext("The MTU must be between %d and %d bytes."), $min_mtu, $max_mtu);
+ }
unset($min_mtu, $max_mtu);
@@ -756,29 +809,35 @@ if ($_POST['apply']) {
$parent_realhwif = $realhwif_array[0];
$parent_if = convert_real_interface_to_friendly_interface_name($parent_realhwif);
if (!empty($parent_if) && !empty($config['interfaces'][$parent_if]['mtu'])) {
- if ($_POST['mtu'] > intval($config['interfaces'][$parent_if]['mtu']))
+ if ($_POST['mtu'] > intval($config['interfaces'][$parent_if]['mtu'])) {
$input_errors[] = gettext("The MTU of a VLAN cannot be greater than that of its parent interface.");
+ }
}
} else {
foreach ($config['interfaces'] as $idx => $ifdata) {
- if (($idx == $if) || !preg_match('/_vlan[0-9]/', $ifdata['if']))
+ if (($idx == $if) || !preg_match('/_vlan[0-9]/', $ifdata['if'])) {
continue;
+ }
$realhwif_array = get_parent_interface($ifdata['if']);
// Need code to handle MLPPP if we ever use $realhwif for MLPPP handling
$parent_realhwif = $realhwif_array[0];
- if ($parent_realhwif != $wancfg['if'])
+ if ($parent_realhwif != $wancfg['if']) {
continue;
+ }
- if (isset($ifdata['mtu']) && $ifdata['mtu'] > $_POST['mtu'])
+ if (isset($ifdata['mtu']) && $ifdata['mtu'] > $_POST['mtu']) {
$input_errors[] = sprintf(gettext("Interface %s (VLAN) has MTU set to a larger value"), $ifdata['descr']);
+ }
}
}
}
- if ($_POST['mss'] <> '')
- if (!is_numericint($_POST['mss']) || ($_POST['mss'] < 576 || $_POST['mss'] > 65535))
+ if ($_POST['mss'] <> '') {
+ if (!is_numericint($_POST['mss']) || ($_POST['mss'] < 576 || $_POST['mss'] > 65535)) {
$input_errors[] = gettext("The MSS must be an integer between 576 and 65535 bytes.");
+ }
+ }
/* Wireless interface? */
if (isset($wancfg['wireless'])) {
$reqdfields = array("mode");
@@ -858,8 +917,9 @@ if ($_POST['apply']) {
for ($i = 1; $i <= 4; $i++) {
if ($_POST['key' . $i]) {
/* 64 bit */
- if (strlen($_POST['key' . $i]) == 5)
+ if (strlen($_POST['key' . $i]) == 5) {
continue;
+ }
if (strlen($_POST['key' . $i]) == 10) {
/* hex key */
if (stristr($_POST['key' . $i], "0x") == false) {
@@ -869,22 +929,25 @@ if ($_POST['apply']) {
}
if (strlen($_POST['key' . $i]) == 12) {
/* hex key */
- if(stristr($_POST['key' . $i], "0x") == false) {
- $_POST['key' . $i] = "0x" . $_POST['key' . $i];
+ if (stristr($_POST['key' . $i], "0x") == false) {
+ $_POST['key' . $i] = "0x" . $_POST['key' . $i];
}
continue;
}
/* 128 bit */
- if (strlen($_POST['key' . $i]) == 13)
+ if (strlen($_POST['key' . $i]) == 13) {
continue;
+ }
if (strlen($_POST['key' . $i]) == 26) {
/* hex key */
- if (stristr($_POST['key' . $i], "0x") == false)
+ if (stristr($_POST['key' . $i], "0x") == false) {
$_POST['key' . $i] = "0x" . $_POST['key' . $i];
+ }
continue;
}
- if(strlen($_POST['key' . $i]) == 28)
+ if (strlen($_POST['key' . $i]) == 28) {
continue;
+ }
$input_errors[] = gettext("Invalid WEP key. Enter a valid 40, 64, 104 or 128 bit WEP key.");
break;
}
@@ -892,8 +955,9 @@ if ($_POST['apply']) {
if ($_POST['passphrase']) {
$passlen = strlen($_POST['passphrase']);
- if ($passlen < 8 || $passlen > 63)
+ if ($passlen < 8 || $passlen > 63) {
$input_errors[] = gettext("The WPA passphrase must be between 8 and 63 characters long.");
+ }
}
if ($_POST['wpa_enable'] == "yes") {
if (empty($_POST['passphrase']) && stristr($_POST['wpa_key_mgmt'], "WPA-PSK")) {
@@ -911,15 +975,18 @@ if ($_POST['apply']) {
}
if ($wancfg['ipaddrv6'] == "dhcp6") {
$pid = find_dhcp6c_process($wancfg['if']);
- if($pid)
+ if ($pid) {
posix_kill($pid, SIGTERM);
+ }
}
}
$ppp = array();
- if ($wancfg['ipaddr'] != "ppp")
+ if ($wancfg['ipaddr'] != "ppp") {
unset($wancfg['ipaddr']);
- if ($wancfg['ipaddrv6'] != "ppp")
+ }
+ if ($wancfg['ipaddrv6'] != "ppp") {
unset($wancfg['ipaddrv6']);
+ }
unset($wancfg['subnet']);
unset($wancfg['gateway']);
unset($wancfg['subnetv6']);
@@ -996,8 +1063,9 @@ if ($_POST['apply']) {
unset($wancfg['provider']);
unset($wancfg['ondemand']);
unset($wancfg['timeout']);
- if (empty($wancfg['pppoe']['pppoe-reset-type']))
+ if (empty($wancfg['pppoe']['pppoe-reset-type'])) {
unset($wancfg['pppoe']['pppoe-reset-type']);
+ }
unset($wancfg['local']);
unset($wancfg['remote']);
@@ -1013,8 +1081,9 @@ if ($_POST['apply']) {
unset($a_ppps[$pppid]['subnet']);
unset($a_ppps[$pppid]['gateway']);
}
- if ($wancfg['ipaddr'] != 'pppoe')
+ if ($wancfg['ipaddr'] != 'pppoe') {
unset($a_ppps[$pppid]['pppoe-reset-type']);
+ }
if ($wancfg['type'] != $_POST['type']) {
unset($a_ppps[$pppid]['idletimeout']);
}
@@ -1024,7 +1093,7 @@ if ($_POST['apply']) {
$wancfg['enable'] = $_POST['enable'] == "yes" ? true : false;
/* let return_gateways_array() do the magic on dynamic interfaces for us */
- switch($_POST['type']) {
+ switch ($_POST['type']) {
case "staticv4":
$wancfg['ipaddr'] = $_POST['ipaddr'];
$wancfg['subnet'] = $_POST['subnet'];
@@ -1058,7 +1127,7 @@ if ($_POST['apply']) {
$wancfg['adv_dhcp_config_file_override_path'] = $_POST['adv_dhcp_config_file_override_path'];
$wancfg['dhcp_plus'] = $_POST['dhcp_plus'] == "yes" ? true : false;
- if($gateway_item) {
+ if ($gateway_item) {
$a_gateways[] = $gateway_item;
}
break;
@@ -1079,29 +1148,33 @@ if ($_POST['apply']) {
$a_ppps[$pppid]['ptpid'] = $_POST['ptpid'];
$a_ppps[$pppid]['type'] = $_POST['type'];
$a_ppps[$pppid]['if'] = $_POST['type'].$_POST['ptpid'];
- if (isset($_POST['ppp_port']))
+ if (isset($_POST['ppp_port'])) {
$a_ppps[$pppid]['ports'] = $_POST['ppp_port'];
- else
+ } else {
$a_ppps[$pppid]['ports'] = $wancfg['if'];
+ }
$a_ppps[$pppid]['username'] = $_POST['pppoe_username'];
$a_ppps[$pppid]['password'] = base64_encode($_POST['pppoe_password']);
- if (!empty($_POST['provider']))
+ if (!empty($_POST['provider'])) {
$a_ppps[$pppid]['provider'] = $_POST['provider'];
- else
+ } else {
$a_ppps[$pppid]['provider'] = true;
+ }
$a_ppps[$pppid]['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
- if (!empty($_POST['pppoe_idletimeout']))
+ if (!empty($_POST['pppoe_idletimeout'])) {
$a_ppps[$pppid]['idletimeout'] = $_POST['pppoe_idletimeout'];
- else
+ } else {
unset($a_ppps[$pppid]['idletimeout']);
+ }
- if (!empty($_POST['pppoe-reset-type']))
+ if (!empty($_POST['pppoe-reset-type'])) {
$a_ppps[$pppid]['pppoe-reset-type'] = $_POST['pppoe-reset-type'];
- else
+ } else {
unset($a_ppps[$pppid]['pppoe-reset-type']);
+ }
$wancfg['if'] = $_POST['type'].$_POST['ptpid'];
$wancfg['ipaddr'] = $_POST['type'];
- if($gateway_item) {
+ if ($gateway_item) {
$a_gateways[] = $gateway_item;
}
@@ -1111,30 +1184,32 @@ if ($_POST['apply']) {
$a_ppps[$pppid]['ptpid'] = $_POST['ptpid'];
$a_ppps[$pppid]['type'] = $_POST['type'];
$a_ppps[$pppid]['if'] = $_POST['type'].$_POST['ptpid'];
- if (isset($_POST['ppp_port']))
+ if (isset($_POST['ppp_port'])) {
$a_ppps[$pppid]['ports'] = $_POST['ppp_port'];
- else
+ } else {
$a_ppps[$pppid]['ports'] = $wancfg['if'];
+ }
$a_ppps[$pppid]['username'] = $_POST['pptp_username'];
$a_ppps[$pppid]['password'] = base64_encode($_POST['pptp_password']);
$a_ppps[$pppid]['localip'] = $_POST['pptp_local'];
$a_ppps[$pppid]['subnet'] = $_POST['pptp_subnet'];
$a_ppps[$pppid]['gateway'] = $_POST['pptp_remote'];
$a_ppps[$pppid]['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
- if (!empty($_POST['pptp_idletimeout']))
+ if (!empty($_POST['pptp_idletimeout'])) {
$a_ppps[$pppid]['idletimeout'] = $_POST['pptp_idletimeout'];
- else
+ } else {
unset($a_ppps[$pppid]['idletimeout']);
+ }
$wancfg['if'] = $_POST['type'].$_POST['ptpid'];
$wancfg['ipaddr'] = $_POST['type'];
- if($gateway_item) {
+ if ($gateway_item) {
$a_gateways[] = $gateway_item;
}
break;
case "none":
break;
}
- switch($_POST['type6']) {
+ switch ($_POST['type6']) {
case "staticv6":
$wancfg['ipaddrv6'] = $_POST['ipaddrv6'];
$wancfg['subnetv6'] = $_POST['subnetv6'];
@@ -1149,77 +1224,108 @@ if ($_POST['apply']) {
$wancfg['ipaddrv6'] = "dhcp6";
$wancfg['dhcp6-duid'] = $_POST['dhcp6-duid'];
$wancfg['dhcp6-ia-pd-len'] = $_POST['dhcp6-ia-pd-len'];
- if($_POST['dhcp6-ia-pd-send-hint'] == "yes")
+ if ($_POST['dhcp6-ia-pd-send-hint'] == "yes") {
$wancfg['dhcp6-ia-pd-send-hint'] = true;
- if($_POST['dhcp6prefixonly'] == "yes")
+ }
+ if ($_POST['dhcp6prefixonly'] == "yes") {
$wancfg['dhcp6prefixonly'] = true;
- if($_POST['dhcp6usev4iface'] == "yes")
+ }
+ if ($_POST['dhcp6usev4iface'] == "yes") {
$wancfg['dhcp6usev4iface'] = true;
+ }
- if (!empty($_POST['adv_dhcp6_interface_statement_send_options']))
+ if (!empty($_POST['adv_dhcp6_interface_statement_send_options'])) {
$wancfg['adv_dhcp6_interface_statement_send_options'] = $_POST['adv_dhcp6_interface_statement_send_options'];
- if (!empty($_POST['adv_dhcp6_interface_statement_request_options']))
+ }
+ if (!empty($_POST['adv_dhcp6_interface_statement_request_options'])) {
$wancfg['adv_dhcp6_interface_statement_request_options'] = $_POST['adv_dhcp6_interface_statement_request_options'];
- if (isset($_POST['adv_dhcp6_interface_statement_information_only_enable']))
+ }
+ if (isset($_POST['adv_dhcp6_interface_statement_information_only_enable'])) {
$wancfg['adv_dhcp6_interface_statement_information_only_enable'] = $_POST['adv_dhcp6_interface_statement_information_only_enable'];
- if (!empty($_POST['adv_dhcp6_interface_statement_script']))
+ }
+ if (!empty($_POST['adv_dhcp6_interface_statement_script'])) {
$wancfg['adv_dhcp6_interface_statement_script'] = $_POST['adv_dhcp6_interface_statement_script'];
+ }
- if (isset($_POST['adv_dhcp6_id_assoc_statement_address_enable']))
+ if (isset($_POST['adv_dhcp6_id_assoc_statement_address_enable'])) {
$wancfg['adv_dhcp6_id_assoc_statement_address_enable'] = $_POST['adv_dhcp6_id_assoc_statement_address_enable'];
- if (!empty($_POST['adv_dhcp6_id_assoc_statement_address']))
+ }
+ if (!empty($_POST['adv_dhcp6_id_assoc_statement_address'])) {
$wancfg['adv_dhcp6_id_assoc_statement_address'] = $_POST['adv_dhcp6_id_assoc_statement_address'];
- if (is_numericint($_POST['adv_dhcp6_id_assoc_statement_address_id']))
+ }
+ if (is_numericint($_POST['adv_dhcp6_id_assoc_statement_address_id'])) {
$wancfg['adv_dhcp6_id_assoc_statement_address_id'] = $_POST['adv_dhcp6_id_assoc_statement_address_id'];
- if (!empty($_POST['adv_dhcp6_id_assoc_statement_address_pltime']))
+ }
+ if (!empty($_POST['adv_dhcp6_id_assoc_statement_address_pltime'])) {
$wancfg['adv_dhcp6_id_assoc_statement_address_pltime'] = $_POST['adv_dhcp6_id_assoc_statement_address_pltime'];
- if (!empty($_POST['adv_dhcp6_id_assoc_statement_address_vltime']))
+ }
+ if (!empty($_POST['adv_dhcp6_id_assoc_statement_address_vltime'])) {
$wancfg['adv_dhcp6_id_assoc_statement_address_vltime'] = $_POST['adv_dhcp6_id_assoc_statement_address_vltime'];
+ }
- if (isset($_POST['adv_dhcp6_id_assoc_statement_prefix_enable']))
+ if (isset($_POST['adv_dhcp6_id_assoc_statement_prefix_enable'])) {
$wancfg['adv_dhcp6_id_assoc_statement_prefix_enable'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_enable'];
- if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix']))
+ }
+ if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix'])) {
$wancfg['adv_dhcp6_id_assoc_statement_prefix'] = $_POST['adv_dhcp6_id_assoc_statement_prefix'];
- if (is_numericint($_POST['adv_dhcp6_id_assoc_statement_prefix_id']))
+ }
+ if (is_numericint($_POST['adv_dhcp6_id_assoc_statement_prefix_id'])) {
$wancfg['adv_dhcp6_id_assoc_statement_prefix_id'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_id'];
- if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix_pltime']))
+ }
+ if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix_pltime'])) {
$wancfg['adv_dhcp6_id_assoc_statement_prefix_pltime'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_pltime'];
- if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix_vltime']))
+ }
+ if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix_vltime'])) {
$wancfg['adv_dhcp6_id_assoc_statement_prefix_vltime'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_vltime'];
+ }
- if (is_numericint($_POST['adv_dhcp6_prefix_interface_statement_sla_id']))
+ if (is_numericint($_POST['adv_dhcp6_prefix_interface_statement_sla_id'])) {
$wancfg['adv_dhcp6_prefix_interface_statement_sla_id'] = $_POST['adv_dhcp6_prefix_interface_statement_sla_id'];
- if (is_numericint($_POST['adv_dhcp6_prefix_interface_statement_sla_len']))
+ }
+ if (is_numericint($_POST['adv_dhcp6_prefix_interface_statement_sla_len'])) {
$wancfg['adv_dhcp6_prefix_interface_statement_sla_len'] = $_POST['adv_dhcp6_prefix_interface_statement_sla_len'];
+ }
- if (!empty($_POST['adv_dhcp6_authentication_statement_authname']))
+ if (!empty($_POST['adv_dhcp6_authentication_statement_authname'])) {
$wancfg['adv_dhcp6_authentication_statement_authname'] = $_POST['adv_dhcp6_authentication_statement_authname'];
- if (!empty($_POST['adv_dhcp6_authentication_statement_protocol']))
+ }
+ if (!empty($_POST['adv_dhcp6_authentication_statement_protocol'])) {
$wancfg['adv_dhcp6_authentication_statement_protocol'] = $_POST['adv_dhcp6_authentication_statement_protocol'];
- if (!empty($_POST['adv_dhcp6_authentication_statement_algorithm']))
+ }
+ if (!empty($_POST['adv_dhcp6_authentication_statement_algorithm'])) {
$wancfg['adv_dhcp6_authentication_statement_algorithm'] = $_POST['adv_dhcp6_authentication_statement_algorithm'];
- if (!empty($_POST['adv_dhcp6_authentication_statement_rdm']))
+ }
+ if (!empty($_POST['adv_dhcp6_authentication_statement_rdm'])) {
$wancfg['adv_dhcp6_authentication_statement_rdm'] = $_POST['adv_dhcp6_authentication_statement_rdm'];
+ }
- if (!empty($_POST['adv_dhcp6_key_info_statement_keyname']))
+ if (!empty($_POST['adv_dhcp6_key_info_statement_keyname'])) {
$wancfg['adv_dhcp6_key_info_statement_keyname'] = $_POST['adv_dhcp6_key_info_statement_keyname'];
- if (!empty($_POST['adv_dhcp6_key_info_statement_realm']))
+ }
+ if (!empty($_POST['adv_dhcp6_key_info_statement_realm'])) {
$wancfg['adv_dhcp6_key_info_statement_realm'] = $_POST['adv_dhcp6_key_info_statement_realm'];
- if (!empty($_POST['adv_dhcp6_key_info_statement_keyid']))
+ }
+ if (!empty($_POST['adv_dhcp6_key_info_statement_keyid'])) {
$wancfg['adv_dhcp6_key_info_statement_keyid'] = $_POST['adv_dhcp6_key_info_statement_keyid'];
- if (!empty($_POST['adv_dhcp6_key_info_statement_secret']))
+ }
+ if (!empty($_POST['adv_dhcp6_key_info_statement_secret'])) {
$wancfg['adv_dhcp6_key_info_statement_secret'] = $_POST['adv_dhcp6_key_info_statement_secret'];
- if (!empty($_POST['adv_dhcp6_key_info_statement_expire']))
+ }
+ if (!empty($_POST['adv_dhcp6_key_info_statement_expire'])) {
$wancfg['adv_dhcp6_key_info_statement_expire'] = $_POST['adv_dhcp6_key_info_statement_expire'];
+ }
- if (!empty($_POST['adv_dhcp6_config_advanced']))
+ if (!empty($_POST['adv_dhcp6_config_advanced'])) {
$wancfg['adv_dhcp6_config_advanced'] = $_POST['adv_dhcp6_config_advanced'];
- if (!empty($_POST['adv_dhcp6_config_file_override']))
+ }
+ if (!empty($_POST['adv_dhcp6_config_file_override'])) {
$wancfg['adv_dhcp6_config_file_override'] = $_POST['adv_dhcp6_config_file_override'];
- if (!empty($_POST['adv_dhcp6_config_file_override_path']))
+ }
+ if (!empty($_POST['adv_dhcp6_config_file_override_path'])) {
$wancfg['adv_dhcp6_config_file_override_path'] = $_POST['adv_dhcp6_config_file_override_path'];
+ }
- if($gateway_item) {
+ if ($gateway_item) {
$a_gateways[] = $gateway_item;
}
break;
@@ -1228,7 +1334,7 @@ if ($_POST['apply']) {
$wancfg['prefix-6rd'] = $_POST['prefix-6rd'];
$wancfg['prefix-6rd-v4plen'] = $_POST['prefix-6rd-v4plen'];
$wancfg['gateway-6rd'] = $_POST['gateway-6rd'];
- if($gateway_item) {
+ if ($gateway_item) {
$a_gateways[] = $gateway_item;
}
break;
@@ -1238,24 +1344,25 @@ if ($_POST['apply']) {
case "track6":
$wancfg['ipaddrv6'] = "track6";
$wancfg['track6-interface'] = $_POST['track6-interface'];
- if ($_POST['track6-prefix-id--hex'] === "")
+ if ($_POST['track6-prefix-id--hex'] === "") {
$wancfg['track6-prefix-id'] = 0;
- else if (is_numeric("0x" . $_POST['track6-prefix-id--hex']))
+ } else if (is_numeric("0x" . $_POST['track6-prefix-id--hex'])) {
$wancfg['track6-prefix-id'] = intval($_POST['track6-prefix-id--hex'], 16);
- else
+ } else {
$wancfg['track6-prefix-id'] = 0;
+ }
break;
case "none":
break;
}
handle_pppoe_reset($_POST);
- if($_POST['blockpriv'] == "yes") {
+ if ($_POST['blockpriv'] == "yes") {
$wancfg['blockpriv'] = true;
} else {
unset($wancfg['blockpriv']);
}
- if($_POST['blockbogons'] == "yes") {
+ if ($_POST['blockbogons'] == "yes") {
$wancfg['blockbogons'] = true;
} else {
unset($wancfg['blockbogons']);
@@ -1276,9 +1383,14 @@ if ($_POST['apply']) {
unset($wancfg['mediaopt']);
} else {
$mediaopts = explode(' ', $_POST['mediaopt']);
- if ($mediaopts[0] != ''){ $wancfg['media'] = $mediaopts[0]; }
- if ($mediaopts[1] != ''){ $wancfg['mediaopt'] = $mediaopts[1]; }
- else { unset($wancfg['mediaopt']); }
+ if ($mediaopts[0] != '') {
+ $wancfg['media'] = $mediaopts[0];
+ }
+ if ($mediaopts[1] != '') {
+ $wancfg['mediaopt'] = $mediaopts[1];
+ } else {
+ unset($wancfg['mediaopt']);
+ }
}
if (isset($wancfg['wireless'])) {
handle_wireless_post();
@@ -1305,12 +1417,13 @@ if ($_POST['apply']) {
exit;
}
-} // end if($_POST)
+} // end if ($_POST)
function handle_wireless_post() {
global $_POST, $config, $g, $wancfg, $if, $wl_countries_attr, $wlanbaseif;
- if (!is_array($wancfg['wireless']))
+ if (!is_array($wancfg['wireless'])) {
$wancfg['wireless'] = array();
+ }
$wancfg['wireless']['standard'] = $_POST['standard'];
$wancfg['wireless']['mode'] = $_POST['mode'];
$wancfg['wireless']['protmode'] = $_POST['protmode'];
@@ -1323,15 +1436,16 @@ function handle_wireless_post() {
$wancfg['wireless']['regcountry'] = $_POST['regcountry'];
$wancfg['wireless']['reglocation'] = $_POST['reglocation'];
if (!empty($wancfg['wireless']['regdomain']) && !empty($wancfg['wireless']['regcountry'])) {
- foreach($wl_countries_attr as $wl_country) {
+ foreach ($wl_countries_attr as $wl_country) {
if ($wancfg['wireless']['regcountry'] == $wl_country['ID']) {
$wancfg['wireless']['regdomain'] = $wl_country['rd'][0]['REF'];
break;
}
}
}
- if (!is_array($wancfg['wireless']['wpa']))
+ if (!is_array($wancfg['wireless']['wpa'])) {
$wancfg['wireless']['wpa'] = array();
+ }
$wancfg['wireless']['wpa']['macaddr_acl'] = $_POST['macaddr_acl'];
$wancfg['wireless']['wpa']['auth_algs'] = $_POST['auth_algs'];
$wancfg['wireless']['wpa']['wpa_mode'] = $_POST['wpa_mode'];
@@ -1349,99 +1463,126 @@ function handle_wireless_post() {
$wancfg['wireless']['auth_server_shared_secret2'] = $_POST['auth_server_shared_secret2'];
if ($_POST['persistcommonwireless'] == "yes") {
- if (!is_array($config['wireless']))
+ if (!is_array($config['wireless'])) {
$config['wireless'] = array();
- if (!is_array($config['wireless']['interfaces']))
+ }
+ if (!is_array($config['wireless']['interfaces'])) {
$config['wireless']['interfaces'] = array();
- if (!is_array($config['wireless']['interfaces'][$wlanbaseif]))
+ }
+ if (!is_array($config['wireless']['interfaces'][$wlanbaseif])) {
$config['wireless']['interfaces'][$wlanbaseif] = array();
- } else if (isset($config['wireless']['interfaces'][$wlanbaseif]))
+ }
+ } else if (isset($config['wireless']['interfaces'][$wlanbaseif])) {
unset($config['wireless']['interfaces'][$wlanbaseif]);
- if (isset($_POST['diversity']) && is_numeric($_POST['diversity']))
+ }
+ if (isset($_POST['diversity']) && is_numeric($_POST['diversity'])) {
$wancfg['wireless']['diversity'] = $_POST['diversity'];
- else if (isset($wancfg['wireless']['diversity']))
+ } else if (isset($wancfg['wireless']['diversity'])) {
unset($wancfg['wireless']['diversity']);
- if (isset($_POST['txantenna']) && is_numeric($_POST['txantenna']))
+ }
+ if (isset($_POST['txantenna']) && is_numeric($_POST['txantenna'])) {
$wancfg['wireless']['txantenna'] = $_POST['txantenna'];
- else if (isset($wancfg['wireless']['txantenna']))
+ } else if (isset($wancfg['wireless']['txantenna'])) {
unset($wancfg['wireless']['txantenna']);
- if (isset($_POST['rxantenna']) && is_numeric($_POST['rxantenna']))
+ }
+ if (isset($_POST['rxantenna']) && is_numeric($_POST['rxantenna'])) {
$wancfg['wireless']['rxantenna'] = $_POST['rxantenna'];
- else if (isset($wancfg['wireless']['rxantenna']))
+ } else if (isset($wancfg['wireless']['rxantenna'])) {
unset($wancfg['wireless']['rxantenna']);
- if ($_POST['hidessid_enable'] == "yes")
+ }
+ if ($_POST['hidessid_enable'] == "yes") {
$wancfg['wireless']['hidessid']['enable'] = true;
- else if (isset($wancfg['wireless']['hidessid']['enable']))
+ } else if (isset($wancfg['wireless']['hidessid']['enable'])) {
unset($wancfg['wireless']['hidessid']['enable']);
- if ($_POST['mac_acl_enable'] == "yes")
+ }
+ if ($_POST['mac_acl_enable'] == "yes") {
$wancfg['wireless']['wpa']['mac_acl_enable'] = true;
- else if (isset($wancfg['wireless']['wpa']['mac_acl_enable']))
+ } else if (isset($wancfg['wireless']['wpa']['mac_acl_enable'])) {
unset($wancfg['wireless']['wpa']['mac_acl_enable']);
- if ($_POST['rsn_preauth'] == "yes")
+ }
+ if ($_POST['rsn_preauth'] == "yes") {
$wancfg['wireless']['wpa']['rsn_preauth'] = true;
- else
+ } else {
unset($wancfg['wireless']['wpa']['rsn_preauth']);
- if ($_POST['ieee8021x'] == "yes")
+ }
+ if ($_POST['ieee8021x'] == "yes") {
$wancfg['wireless']['wpa']['ieee8021x']['enable'] = true;
- else if (isset($wancfg['wireless']['wpa']['ieee8021x']['enable']))
+ } else if (isset($wancfg['wireless']['wpa']['ieee8021x']['enable'])) {
unset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
- if ($_POST['wpa_strict_rekey'] == "yes")
+ }
+ if ($_POST['wpa_strict_rekey'] == "yes") {
$wancfg['wireless']['wpa']['wpa_strict_rekey'] = true;
- else if (isset($wancfg['wireless']['wpa']['wpa_strict_rekey']))
+ } else if (isset($wancfg['wireless']['wpa']['wpa_strict_rekey'])) {
unset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
- if ($_POST['debug_mode'] == "yes")
+ }
+ if ($_POST['debug_mode'] == "yes") {
$wancfg['wireless']['wpa']['debug_mode'] = true;
- else if (isset($wancfg['wireless']['wpa']['debug_mode']))
+ } else if (isset($wancfg['wireless']['wpa']['debug_mode'])) {
sunset($wancfg['wireless']['wpa']['debug_mode']);
- if ($_POST['wpa_enable'] == "yes")
+ }
+ if ($_POST['wpa_enable'] == "yes") {
$wancfg['wireless']['wpa']['enable'] = $_POST['wpa_enable'] = true;
- else if (isset($wancfg['wireless']['wpa']['enable']))
+ } else if (isset($wancfg['wireless']['wpa']['enable'])) {
unset($wancfg['wireless']['wpa']['enable']);
+ }
if ($_POST['wep_enable'] == "yes") {
- if (!is_array($wancfg['wireless']['wep']))
+ if (!is_array($wancfg['wireless']['wep'])) {
$wancfg['wireless']['wep'] = array();
+ }
$wancfg['wireless']['wep']['enable'] = $_POST['wep_enable'] = true;
- } else if (isset($wancfg['wireless']['wep']))
+ } else if (isset($wancfg['wireless']['wep'])) {
unset($wancfg['wireless']['wep']);
+ }
if ($_POST['wme_enable'] == "yes") {
- if (!is_array($wancfg['wireless']['wme']))
+ if (!is_array($wancfg['wireless']['wme'])) {
$wancfg['wireless']['wme'] = array();
+ }
$wancfg['wireless']['wme']['enable'] = $_POST['wme_enable'] = true;
- } else if (isset($wancfg['wireless']['wme']['enable']))
+ } else if (isset($wancfg['wireless']['wme']['enable'])) {
unset($wancfg['wireless']['wme']['enable']);
+ }
if ($_POST['puremode'] == "11g") {
- if (!is_array($wancfg['wireless']['pureg']))
+ if (!is_array($wancfg['wireless']['pureg'])) {
$wancfg['wireless']['pureg'] = array();
+ }
$wancfg['wireless']['pureg']['enable'] = true;
} else if ($_POST['puremode'] == "11n") {
- if (!is_array($wancfg['wireless']['puren']))
+ if (!is_array($wancfg['wireless']['puren'])) {
$wancfg['wireless']['puren'] = array();
+ }
$wancfg['wireless']['puren']['enable'] = true;
} else {
- if (isset($wancfg['wireless']['pureg']))
+ if (isset($wancfg['wireless']['pureg'])) {
unset($wancfg['wireless']['pureg']);
- if (isset($wancfg['wireless']['puren']))
+ }
+ if (isset($wancfg['wireless']['puren'])) {
unset($wancfg['wireless']['puren']);
+ }
}
if ($_POST['apbridge_enable'] == "yes") {
- if (!is_array($wancfg['wireless']['apbridge']))
+ if (!is_array($wancfg['wireless']['apbridge'])) {
$wancfg['wireless']['apbridge'] = array();
+ }
$wancfg['wireless']['apbridge']['enable'] = $_POST['apbridge_enable'] = true;
- } else if (isset($wancfg['wireless']['apbridge']['enable']))
+ } else if (isset($wancfg['wireless']['apbridge']['enable'])) {
unset($wancfg['wireless']['apbridge']['enable']);
+ }
if ($_POST['standard'] == "11g Turbo" || $_POST['standard'] == "11a Turbo") {
- if (!is_array($wancfg['wireless']['turbo']))
+ if (!is_array($wancfg['wireless']['turbo'])) {
$wancfg['wireless']['turbo'] = array();
+ }
$wancfg['wireless']['turbo']['enable'] = true;
- } else if (isset($wancfg['wireless']['turbo']['enable']))
+ } else if (isset($wancfg['wireless']['turbo']['enable'])) {
unset($wancfg['wireless']['turbo']['enable']);
+ }
$wancfg['wireless']['wep']['key'] = array();
for ($i = 1; $i <= 4; $i++) {
if ($_POST['key' . $i]) {
$newkey = array();
$newkey['value'] = $_POST['key' . $i];
- if ($_POST['txkey'] == $i)
+ if ($_POST['txkey'] == $i) {
$newkey['txkey'] = true;
+ }
$wancfg['wireless']['wep']['key'][] = $newkey;
}
}
@@ -1451,17 +1592,20 @@ function handle_wireless_post() {
function check_wireless_mode() {
global $_POST, $config, $g, $wlan_modes, $wancfg, $if, $wlanif, $wlanbaseif, $old_wireless_mode, $input_errors;
- if ($wancfg['wireless']['mode'] == $_POST['mode'])
+ if ($wancfg['wireless']['mode'] == $_POST['mode']) {
return;
+ }
- if (does_interface_exist(interface_get_wireless_clone($wlanbaseif)))
+ if (does_interface_exist(interface_get_wireless_clone($wlanbaseif))) {
$clone_count = 1;
- else
+ } else {
$clone_count = 0;
+ }
if (isset($config['wireless']['clone']) && is_array($config['wireless']['clone'])) {
foreach ($config['wireless']['clone'] as $clone) {
- if ($clone['if'] == $wlanbaseif)
+ if ($clone['if'] == $wlanbaseif) {
$clone_count++;
+ }
}
}
if ($clone_count > 1) {
@@ -1480,12 +1624,12 @@ function check_wireless_mode() {
$mediaopts_list = array();
$intrealname = $config['interfaces'][$if]['if'];
exec("/sbin/ifconfig -m $intrealname | grep \"media \"", $mediaopts);
-foreach ($mediaopts as $mediaopt){
+foreach ($mediaopts as $mediaopt) {
preg_match("/media (.*)/", $mediaopt, $matches);
- if (preg_match("/(.*) mediaopt (.*)/", $matches[1], $matches1)){
+ if (preg_match("/(.*) mediaopt (.*)/", $matches[1], $matches1)) {
// there is media + mediaopt like "media 1000baseT mediaopt full-duplex"
array_push($mediaopts_list, $matches1[1] . " " . $matches1[2]);
- }else{
+ } else {
// there is only media like "media 1000baseT"
array_push($mediaopts_list, $matches[1]);
}
@@ -1509,7 +1653,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<script type="text/javascript">
//<![CDATA[
function updateType(t) {
- switch(t) {
+ switch (t) {
case "none": {
jQuery('#staticv4, #dhcp, #pppoe, #pptp, #ppp').hide();
break;
@@ -1538,12 +1682,13 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
break;
}
}
- if (t != "l2tp" && t != "pptp")
+ if (t != "l2tp" && t != "pptp") {
jQuery('#'+t).show();
+ }
}
function updateTypeSix(t) {
if (!isNaN(t[0])) t = '_' + t;
- switch(t) {
+ switch (t) {
case "none": {
jQuery('#staticv6, #dhcp6, #_6rd, #_6to4, #track6, #slaac').hide();
break;
@@ -1574,23 +1719,24 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
break;
}
}
- if (t != "l2tp" && t != "pptp")
+ if (t != "l2tp" && t != "pptp") {
jQuery('#'+t).show();
+ }
}
function show_allcfg(obj) {
- if (obj.checked)
+ if (obj.checked) {
jQuery('#allcfg').show();
- else
+ } else {
jQuery('#allcfg').hide();
+ }
}
function show_reset_settings(reset_type) {
if (reset_type == 'preset') {
jQuery('#pppoepresetwrap').show();
jQuery('#pppoecustomwrap').hide();
- }
- else if (reset_type == 'custom') {
+ } else if (reset_type == 'custom') {
jQuery('#pppoecustomwrap').show();
jQuery('#pppoepresetwrap').hide();
} else {
@@ -1598,6 +1744,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
jQuery('#pppoepresetwrap').hide();
}
}
+
function show_mon_config() {
jQuery("#showmonbox").html('');
jQuery('#showmon').css('display','block');
@@ -1605,11 +1752,13 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
function openwindow(url) {
var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
- if (oWin==null || typeof(oWin)=="undefined")
+ if (oWin==null || typeof(oWin)=="undefined") {
return false;
- else
+ } else {
return true;
+ }
}
+
function country_list() {
jQuery('#country').children().remove();
jQuery('#provider_list').children().remove();
@@ -1661,7 +1810,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
var responseTextArr = response.split("\n");
responseTextArr.sort();
responseTextArr.each( function(value) {
- if(value != "") {
+ if (value != "") {
providerplan = value.split(":");
var option = new Element('option');
@@ -1684,7 +1833,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
var provider = xmldoc.getElementsByTagName('connection')[0];
jQuery('#ppp_username').val('');
jQuery('#ppp_password').val('');
- if(provider.getElementsByTagName('apn')[0].firstChild.data == "CDMA") {
+ if (provider.getElementsByTagName('apn')[0].firstChild.data == "CDMA") {
jQuery('#phone').val('#777');
jQuery('#apn').val('');
} else {
@@ -1701,11 +1850,13 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
function update_track6_prefix() {
var iface = jQuery("#track6-interface").val();
- if (iface == null)
+ if (iface == null) {
return;
+ }
var track6_prefix_ids = jQuery('#ipv6-num-prefix-ids-' + iface).val();
- if (track6_prefix_ids == null)
+ if (track6_prefix_ids == null) {
return;
+ }
track6_prefix_ids = parseInt(track6_prefix_ids).toString(16);
jQuery('#track6-prefix-id-range').html('(<b>hexadecimal</b> from 0 to ' + track6_prefix_ids + ')');
}
@@ -1733,7 +1884,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<td width="22%" valign="top" class="vncell"><?=gettext("Enable"); ?></td>
<td width="78%" class="vtable">
<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable'] == true) echo "checked=\"checked\""; ?> onclick="show_allcfg(this);" />
- <strong><?=gettext("Enable Interface"); ?></strong>
+ <strong><?=gettext("Enable Interface"); ?></strong>
</td>
</tr>
</table>
@@ -1749,12 +1900,13 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr>
<td valign="middle" class="vncell"><strong><?=gettext("IPv4 Configuration Type"); ?></strong></td>
<td class="vtable">
- <select name="type" onchange="updateType(this.value);" <?php echo $type_disabled; ?> class="formselect" id="type">
+ <select name="type" onchange="updateType(this.value);" <?php echo $type_disabled; ?> class="formselect" id="type">
<?php
foreach ($types4 as $key => $opt) {
echo "<option onclick=\"updateType('{$key}');\"";
- if ($key == $pconfig['type'])
+ if ($key == $pconfig['type']) {
echo " selected=\"selected\"";
+ }
echo " value=\"{$key}\" >" . htmlspecialchars($opt);
echo "</option>";
}
@@ -1765,12 +1917,13 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr>
<td valign="middle" class="vncell"><strong><?=gettext("IPv6 Configuration Type"); ?></strong></td>
<td class="vtable">
- <select name="type6" onchange="updateTypeSix(this.value);" <?php echo $type_disabled; ?> class="formselect" id="type6">
+ <select name="type6" onchange="updateTypeSix(this.value);" <?php echo $type_disabled; ?> class="formselect" id="type6">
<?php
foreach ($types6 as $key => $opt) {
echo "<option onclick=\"updateTypeSix('{$key}');\"";
- if ($key == $pconfig['type6'])
+ if ($key == $pconfig['type6']) {
echo " selected=\"selected\"";
+ }
echo " value=\"{$key}\" >" . htmlspecialchars($opt);
echo "</option>";
}
@@ -1786,7 +1939,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
$ip = getenv('REMOTE_ADDR');
$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
$mac = str_replace("\n","",$mac);
- if($mac):
+ if ($mac):
?>
<a onclick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#"><?=gettext("Insert my local MAC address"); ?></a>
<?php endif; ?>
@@ -1820,40 +1973,48 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
</td>
</tr>
<?php
- if (count($mediaopts_list) > 0){
- $mediaopt_from_config = $config['interfaces'][$if]['media'] . ' ' . $config['interfaces'][$if]['mediaopt'];
- echo "<tr>";
+ if (count($mediaopts_list) > 0) {
+ $mediaopt_from_config = $config['interfaces'][$if]['media'] . ' ' . $config['interfaces'][$if]['mediaopt'];
+ echo "<tr>";
echo '<td valign="top" class="vncell">' . gettext("Speed and duplex") . '</td>';
echo '<td class="vtable">';
echo '<div id="showadvmediabox"';
- if ($mediaopt_from_config != 'autoselect ' && $mediaopt_from_config != ' ') echo " style='display:none'>";
- else echo '>';
- echo '<input type="button" onclick="show_advanced_media()" value="' . gettext("Advanced") . '" /> - ' . gettext("Show advanced option");
+ if ($mediaopt_from_config != 'autoselect ' && $mediaopt_from_config != ' ') {
+ echo " style='display:none'>";
+ } else {
+ echo '>';
+ }
+ echo '<input type="button" onclick="show_advanced_media()" value="' . gettext("Advanced") . '" /> - ' . gettext("Show advanced option");
echo "</div>";
echo '<div id="showmediaadv" ';
- if ($mediaopt_from_config == 'autoselect ' || $mediaopt_from_config == ' ') echo "style='display:none'>";
- else echo '>';
- echo '<select name="mediaopt" class="formselect" id="mediaopt">';
- print "<option value=\"\">Default (no preference, typically autoselect)</option>";
- print "<option value=\"\">------- Media Supported by this interface -------</option>";
- foreach($mediaopts_list as $mediaopt){
- if ($mediaopt != rtrim($mediaopt_from_config)){
- print "<option value=\"$mediaopt\">" . gettext("$mediaopt") . "</option>";
- } else {
- print "<option value=\"$mediaopt\" selected=\"selected\">" . gettext("$mediaopt") . "</option>";
- }
+ if ($mediaopt_from_config == 'autoselect ' || $mediaopt_from_config == ' ') {
+ echo "style='display:none'>";
+ } else {
+ echo '>';
+ }
+ echo '<select name="mediaopt" class="formselect" id="mediaopt">';
+ print "<option value=\"\">Default (no preference, typically autoselect)</option>";
+ print "<option value=\"\">------- Media Supported by this interface -------</option>";
+ foreach ($mediaopts_list as $mediaopt) {
+ if ($mediaopt != rtrim($mediaopt_from_config)) {
+ print "<option value=\"$mediaopt\">" . gettext("$mediaopt") . "</option>";
+ } else {
+ print "<option value=\"$mediaopt\" selected=\"selected\">" . gettext("$mediaopt") . "</option>";
}
- echo '</select><br />';
- echo gettext("Here you can explicitly set speed and duplex mode for this interface. WARNING: You MUST leave this set to autoselect (automatically negotiate speed) unless the port this interface connects to has its speed and duplex forced.");
- echo '</div>';
+ }
+ echo '</select><br />';
+ echo gettext("Here you can explicitly set speed and duplex mode for this interface. WARNING: You MUST leave this set to autoselect (automatically negotiate speed) unless the port this interface connects to has its speed and duplex forced.");
+ echo '</div>';
echo '</td>';
- echo '</tr>';
+ echo '</tr>';
}
?>
<tr>
<td colspan="2" valign="top" height="16"></td>
</tr>
- <tr style="display:none;" id="none"><td style="display:none;"></td></tr>
+ <tr style="display:none;" id="none">
+ <td style="display:none;"></td>
+ </tr>
<tr style="display:none;" id="staticv4">
<td colspan="2" style="padding:0px;">
<a name="gatewaysection"></a>
@@ -1870,7 +2031,9 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<?php
for ($i = 32; $i > 0; $i--) {
echo "<option value=\"{$i}\" ";
- if ($i == $pconfig['subnet']) echo "selected=\"selected\"";
+ if ($i == $pconfig['subnet']) {
+ echo "selected=\"selected\"";
+ }
echo ">" . $i . "</option>";
}
?>
@@ -1882,19 +2045,19 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<td width="78%" class="vtable">
<select name="gateway" class="formselect" id="gateway">
<option value="none" selected="selected"><?=gettext("None"); ?></option>
- <?php
- if(count($a_gateways) > 0) {
- foreach ($a_gateways as $gateway) {
- if(($gateway['interface'] == $if) && (is_ipaddrv4($gateway['gateway']))) {
- ?>
- <option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gateway']) echo "selected=\"selected\""; ?>>
- <?=htmlspecialchars($gateway['name']) . " - " . htmlspecialchars($gateway['gateway']);?>
- </option>
- <?php
- }
+ <?php
+ if (count($a_gateways) > 0) {
+ foreach ($a_gateways as $gateway) {
+ if (($gateway['interface'] == $if) && (is_ipaddrv4($gateway['gateway']))) {
+ ?>
+ <option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gateway']) echo "selected=\"selected\""; ?>>
+ <?=htmlspecialchars($gateway['name']) . " - " . htmlspecialchars($gateway['gateway']);?>
+ </option>
+ <?php
}
}
- ?>
+ }
+ ?>
</select>
- or <strong><a onclick="show_add_gateway();" href="#gatewaysection"><?=gettext("add a new one."); ?></a></strong>
<br />
@@ -1912,14 +2075,19 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr>
<td>
<table class="addgatewaybox" cellpadding="1" cellspacing="1" summary="addgateway">
- <tr><td>&nbsp;</td></tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
<tr>
<td colspan="2"><center><b><font color="white"><?=gettext("Add new gateway:"); ?></font></b></center></td>
</tr>
- <tr><td>&nbsp;</td></tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
<?php
- if($if == "wan" || $if == "WAN")
+ if ($if == "wan" || $if == "WAN") {
$checked = " checked=\"checked\"";
+ }
?>
<tr>
<td width="45%" align="right"><font color="white"><?=gettext("Default gateway:"); ?></font></td><td><input type="checkbox" id="defaultgw" name="defaultgw"<?=$checked?> /></td>
@@ -1933,7 +2101,9 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr>
<td align="right"><font color="white"><?=gettext("Description:"); ?></font></td><td><input id="gatewaydescr" name="gatewaydescr" /></td>
</tr>
- <tr><td>&nbsp;</td></tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
<tr>
<td colspan="2">
<center>
@@ -1944,7 +2114,9 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
</center>
</td>
</tr>
- <tr><td>&nbsp;</td></tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
</table>
</td>
</tr>
@@ -1974,7 +2146,9 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<?php
for ($i = 128; $i > 0; $i--) {
echo "<option value=\"{$i}\" ";
- if ($i == $pconfig['subnetv6']) echo "selected=\"selected\"";
+ if ($i == $pconfig['subnetv6']) {
+ echo "selected=\"selected\"";
+ }
echo ">" . $i . "</option>";
}
?>
@@ -1986,19 +2160,19 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<td width="78%" class="vtable">
<select name="gatewayv6" class="formselect" id="gatewayv6">
<option value="none" selected="selected"><?=gettext("None"); ?></option>
- <?php
- if(count($a_gateways) > 0) {
- foreach ($a_gateways as $gateway) {
- if(($gateway['interface'] == $if) && (is_ipaddrv6($gateway['gateway']))) {
- ?>
- <option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gatewayv6']) echo "selected=\"selected\""; ?>>
- <?=htmlspecialchars($gateway['name']) . " - " . htmlspecialchars($gateway['gateway']);?>
- </option>
- <?php
- }
+ <?php
+ if (count($a_gateways) > 0) {
+ foreach ($a_gateways as $gateway) {
+ if (($gateway['interface'] == $if) && (is_ipaddrv6($gateway['gateway']))) {
+ ?>
+ <option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gatewayv6']) echo "selected=\"selected\""; ?>>
+ <?=htmlspecialchars($gateway['name']) . " - " . htmlspecialchars($gateway['gateway']);?>
+ </option>
+ <?php
}
}
- ?>
+ }
+ ?>
</select>
- or <strong><a onclick="show_add_gateway_v6();" href="#gatewayv6section"><?=gettext("add a new one."); ?></a></strong>
<br />
@@ -2016,14 +2190,19 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr>
<td>
<table class="addgatewaybox" cellpadding="1" cellspacing="1" summary="addgatewayv6">
- <tr><td>&nbsp;</td></tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
<tr>
<td colspan="2"><center><b><font color="white"><?=gettext("Add new v6 gateway:"); ?></font></b></center></td>
</tr>
- <tr><td>&nbsp;</td></tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
<?php
- if($if == "wan" || $if == "WAN")
+ if ($if == "wan" || $if == "WAN") {
$checked = " checked=\"checked\"";
+ }
?>
<tr>
<td width="45%" align="right"><font color="white"><?=gettext("Default v6 gateway:"); ?></font></td><td><input type="checkbox" id="defaultgwv6" name="defaultgwv6"<?=$checked?> /></td>
@@ -2037,7 +2216,9 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr>
<td align="right"><font color="white"><?=gettext("Description:"); ?></font></td><td><input id="gatewaydescrv6" name="gatewaydescrv6" /></td>
</tr>
- <tr><td>&nbsp;</td></tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
<tr>
<td colspan="2">
<center>
@@ -2048,7 +2229,9 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
</center>
</td>
</tr>
- <tr><td>&nbsp;</td></tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
</table>
</td>
</tr>
@@ -2102,7 +2285,9 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<?php
for ($i = 32; $i > 0; $i--) {
echo "<option value=\"{$i}\" ";
- if ($i == $pconfig['alias-subnet']) echo "selected=\"selected\"";
+ if ($i == $pconfig['alias-subnet']) {
+ echo "selected=\"selected\"";
+ }
echo ">" . $i . "</option>";
}
?>
@@ -2128,9 +2313,9 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
Retry: <input name="adv_dhcp_pt_retry" type="text" class="formfld unknown" id="adv_dhcp_pt_retry" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_retry']);?>" onchange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');" />
Select Timeout: <input name="adv_dhcp_pt_select_timeout" type="text" class="formfld unknown" id="adv_dhcp_pt_select_timeout" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_select_timeout']);?>" onchange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');" />
- &nbsp; &nbsp; &nbsp; &nbsp;
+ &nbsp; &nbsp; &nbsp; &nbsp;
Presets: &nbsp;
- <input name="adv_dhcp_pt_values" type="radio" value="DHCP" id="customdhcpptdhcpdefaults" onclick="customdhcpptsetvalues(this, iform);" />FreeBSD Default &nbsp;
+ <input name="adv_dhcp_pt_values" type="radio" value="DHCP" id="customdhcpptdhcpdefaults" onclick="customdhcpptsetvalues(this, iform);" />FreeBSD Default &nbsp;
<input name="adv_dhcp_pt_values" type="radio" value="Clear" id="customdhcpptclear" onclick="customdhcpptsetvalues(this, iform);" />Clear
<br />
@@ -2138,12 +2323,12 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
Backoff Cutoff: <input name="adv_dhcp_pt_backoff_cutoff" type="text" class="formfld unknown" id="adv_dhcp_pt_backoff_cutoff" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_backoff_cutoff']);?>" onchange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');" />
Initial Interval: <input name="adv_dhcp_pt_initial_interval" type="text" class="formfld unknown" id="adv_dhcp_pt_initial_interval" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_initial_interval']);?>" onchange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');" />
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
- <input name="adv_dhcp_pt_values" type="radio" value="pfSense" id="customdhcpptpfsensedefaults" onclick="customdhcpptsetvalues(this, iform);" />pfSense Default &nbsp;
- <input name="adv_dhcp_pt_values" type="radio" value="SavedCfg" checked="checked" id="customdhcpptsavedcfg" onclick="customdhcpptsetvalues(this, iform);" />Saved Cfg
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
+ <input name="adv_dhcp_pt_values" type="radio" value="pfSense" id="customdhcpptpfsensedefaults" onclick="customdhcpptsetvalues(this, iform);" />pfSense Default &nbsp;
+ <input name="adv_dhcp_pt_values" type="radio" value="SavedCfg" checked="checked" id="customdhcpptsavedcfg" onclick="customdhcpptsetvalues(this, iform);" />Saved Cfg
<br />
- <?=gettext("The values in these fields are DHCP protocol timings used when requesting a lease. <br /> " ); ?>
+ <?=gettext("The values in these fields are DHCP protocol timings used when requesting a lease. <br /> "); ?>
<script type="text/javascript">
//<![CDATA[
@@ -2220,7 +2405,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr style='display:none' id="show_adv_dhcp_config_file_override">
<td width="22%" valign="top" class="vncell"><?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&amp;sektion=5\">Configuration File</a> Override"); ?></td>
<td width="78%" class="vtable">
- <input name="adv_dhcp_config_file_override_path" type="text" class="formfld unknown" id="adv_dhcp_config_file_override_path" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp_config_file_override_path']);?>" />
+ <input name="adv_dhcp_config_file_override_path" type="text" class="formfld unknown" id="adv_dhcp_config_file_override_path" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp_config_file_override_path']);?>" />
<br />
<?=gettext("The value in this field is the full absolute path to a DHCP client configuration file. [/[dirname/[.../]]filename[.ext]] <br /> " .
"Value Substitutions in Config File: {interface}, {hostname}, {mac_addr_asciiCD}, {mac_addr_hexCD} <br />" .
@@ -2229,46 +2414,57 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
</td>
</tr>
- <tr>
- <td colspan="2" valign="top" height="16"></td>
- </tr>
+ <tr>
+ <td colspan="2" valign="top" height="16"></td>
+ </tr>
</table>
- <script type="text/javascript">
- //<![CDATA[
- function show_adv_dhcp_config(T) {
+ <script type="text/javascript">
+ //<![CDATA[
+ function show_adv_dhcp_config(T) {
- if (T.checked) T.value = "Selected";
- else T.value = "";
+ if (T.checked) {
+ T.value = "Selected";
+ } else {
+ T.value = "";
+ }
- if (document.iform.adv_dhcp_config_file_override.checked) show_hide_adv_dhcp('none', 'none', '');
- else if (document.iform.adv_dhcp_config_advanced.checked) show_hide_adv_dhcp('', '', 'none');
- else show_hide_adv_dhcp('', 'none', 'none');
+ if (document.iform.adv_dhcp_config_file_override.checked) {
+ show_hide_adv_dhcp('none', 'none', '');
+ } else if (document.iform.adv_dhcp_config_advanced.checked) {
+ show_hide_adv_dhcp('', '', 'none');
+ } else {
+ show_hide_adv_dhcp('', 'none', 'none');
}
+ }
- function show_hide_adv_dhcp(basic, advanced, override) {
+ function show_hide_adv_dhcp(basic, advanced, override) {
- document.getElementById("show_basic_dhcphostname").style.display = basic;
- document.getElementById("show_basic_dhcpalias-address").style.display = basic;
- document.getElementById("show_basic_dhcprejectlease").style.display = basic;
+ document.getElementById("show_basic_dhcphostname").style.display = basic;
+ document.getElementById("show_basic_dhcpalias-address").style.display = basic;
+ document.getElementById("show_basic_dhcprejectlease").style.display = basic;
- document.getElementById("show_adv_dhcp_protocol_timing").style.display = advanced;
- document.getElementById("show_adv_dhcp_lease_requirements_and_requests").style.display = advanced;
- document.getElementById("show_adv_dhcp_option_modifiers").style.display = advanced;
+ document.getElementById("show_adv_dhcp_protocol_timing").style.display = advanced;
+ document.getElementById("show_adv_dhcp_lease_requirements_and_requests").style.display = advanced;
+ document.getElementById("show_adv_dhcp_option_modifiers").style.display = advanced;
- document.getElementById("show_adv_dhcp_config_file_override").style.display = override;
- }
+ document.getElementById("show_adv_dhcp_config_file_override").style.display = override;
+ }
- <!-- Set the adv_dhcp_config_advanced checkbox from saved config -->
- if ("<?=htmlspecialchars($pconfig['adv_dhcp_config_advanced']);?>" == "Selected") document.iform.adv_dhcp_config_advanced.checked = true;
- show_adv_dhcp_config(document.iform.adv_dhcp_config_advanced);
+ <!-- Set the adv_dhcp_config_advanced checkbox from saved config -->
+ if ("<?=htmlspecialchars($pconfig['adv_dhcp_config_advanced']);?>" == "Selected") {
+ document.iform.adv_dhcp_config_advanced.checked = true;
+ }
+ show_adv_dhcp_config(document.iform.adv_dhcp_config_advanced);
- <!-- Set the adv_dhcp_config_file_override checkbox from saved config -->
- if ("<?=htmlspecialchars($pconfig['adv_dhcp_config_file_override']);?>" == "Selected") document.iform.adv_dhcp_config_file_override.checked = true;
- show_adv_dhcp_config(document.iform.adv_dhcp_config_file_override);
- //]]>
- </script>
+ <!-- Set the adv_dhcp_config_file_override checkbox from saved config -->
+ if ("<?=htmlspecialchars($pconfig['adv_dhcp_config_file_override']);?>" == "Selected") {
+ document.iform.adv_dhcp_config_file_override.checked = true;
+ }
+ show_adv_dhcp_config(document.iform.adv_dhcp_config_file_override);
+ //]]>
+ </script>
</td>
</tr>
@@ -2291,7 +2487,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<br />
<?=gettext("The value in this field is sent as the DHCPv6 client identifier " .
"when requesting a DHCPv6 lease."); ?><br />
- <?php if(is_readable("/var/db/dhcp6c_duid")) {
+ <?php if (is_readable("/var/db/dhcp6c_duid")) {
// $current_duid = file_get_contents("/var/db/dhcp6c_duid");
}
printf(gettext("The current DUID is: '%s'"),$current_duid);
@@ -2320,9 +2516,11 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<select name="dhcp6-ia-pd-len" class="formselect" id="dhcp6-ia-pd-len">
<?php
$sizes = array("none" => "None", 16 => "48", 12 => "52", 8 => "56", 4 => "60", 2 => "62", 1 => "63", 0 => "64");
- foreach($sizes as $bits => $length) {
+ foreach ($sizes as $bits => $length) {
echo "<option value=\"{$bits}\" ";
- if (is_numeric($pconfig['dhcp6-ia-pd-len']) && ($bits == $pconfig['dhcp6-ia-pd-len'])) echo "selected=\"selected\"";
+ if (is_numeric($pconfig['dhcp6-ia-pd-len']) && ($bits == $pconfig['dhcp6-ia-pd-len'])) {
+ echo "selected=\"selected\"";
+ }
echo ">" . $length . "</option>";
}
?>
@@ -2465,7 +2663,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&amp;sektion=5&amp;apropos=0&amp;manpath=FreeBSD+10.1-RELEASE+and+Ports\">Configuration File</a> Override"); ?>
</td>
<td width="78%" class="vtable">
- <input name="adv_dhcp6_config_file_override_path" type="text" class="formfld unknown" id="adv_dhcp6_config_file_override_path" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp6_config_file_override_path']);?>" />
+ <input name="adv_dhcp6_config_file_override_path" type="text" class="formfld unknown" id="adv_dhcp6_config_file_override_path" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp6_config_file_override_path']);?>" />
<br />
<?=gettext("The value in this field is the full absolute path to a DHCP client configuration file. [/[dirname/[.../]]filename[.ext]] <br /> " .
"Value Substitutions in Config File: {interface}, {hostname}, {mac_addr_asciiCD}, {mac_addr_hexCD} <br />" .
@@ -2474,73 +2672,90 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
</td>
</tr>
- <tr>
- <td colspan="2" valign="top" height="16"></td>
- </tr>
+ <tr>
+ <td colspan="2" valign="top" height="16"></td>
+ </tr>
</table>
- <script type="text/javascript">
- //<![CDATA[
- function show_adv_dhcp6_config(T) {
+ <script type="text/javascript">
+ //<![CDATA[
+ function show_adv_dhcp6_config(T) {
- if (T.checked) T.value = "Selected";
- else T.value = "";
+ if (T.checked) {
+ T.value = "Selected";
+ } else {
+ T.value = "";
+ }
- if (document.iform.adv_dhcp6_config_file_override.checked) show_hide_adv_dhcp6('none', 'none', '' );
- else if (document.iform.adv_dhcp6_config_advanced.checked) show_hide_adv_dhcp6('none', '', 'none');
- else show_hide_adv_dhcp6('', 'none', 'none');
+ if (document.iform.adv_dhcp6_config_file_override.checked) {
+ show_hide_adv_dhcp6('none', 'none', '');
+ } else if (document.iform.adv_dhcp6_config_advanced.checked) {
+ show_hide_adv_dhcp6('none', '', 'none');
+ } else {
+ show_hide_adv_dhcp6('', 'none', 'none');
}
+ }
- function show_hide_adv_dhcp6(basic, advanced, override) {
+ function show_hide_adv_dhcp6(basic, advanced, override) {
- document.getElementById("basicdhcp6_use_pppoeinterface").style.display = basic;
- document.getElementById("basicdhcp6_show_dhcp6_prefix_delegation_size").style.display = basic;
- document.getElementById("basicdhcp6_show_dhcp6_prefix_send_hint").style.display = basic;
- document.getElementById("basicdhcp6_show_dhcp6_prefix_only").style.display = basic;
+ document.getElementById("basicdhcp6_use_pppoeinterface").style.display = basic;
+ document.getElementById("basicdhcp6_show_dhcp6_prefix_delegation_size").style.display = basic;
+ document.getElementById("basicdhcp6_show_dhcp6_prefix_send_hint").style.display = basic;
+ document.getElementById("basicdhcp6_show_dhcp6_prefix_only").style.display = basic;
- document.getElementById("show_adv_dhcp6_interface_statement").style.display = advanced;
- document.getElementById("show_adv_dhcp6_id_assoc_statement").style.display = advanced;
+ document.getElementById("show_adv_dhcp6_interface_statement").style.display = advanced;
+ document.getElementById("show_adv_dhcp6_id_assoc_statement").style.display = advanced;
- document.getElementById("show_adv_dhcp6_id_assoc_statement_address").style.display = 'none';
- if (document.iform.adv_dhcp6_id_assoc_statement_address_enable.checked) {
- document.getElementById("show_adv_dhcp6_id_assoc_statement_address").style.display = advanced;
- }
+ document.getElementById("show_adv_dhcp6_id_assoc_statement_address").style.display = 'none';
+ if (document.iform.adv_dhcp6_id_assoc_statement_address_enable.checked) {
+ document.getElementById("show_adv_dhcp6_id_assoc_statement_address").style.display = advanced;
+ }
- document.getElementById("show_adv_dhcp6_id_assoc_statement_prefix").style.display = 'none';
- document.getElementById("show_adv_dhcp6_prefix_interface_statement").style.display = 'none';
- if (document.iform.adv_dhcp6_id_assoc_statement_prefix_enable.checked) {
- document.getElementById("show_adv_dhcp6_id_assoc_statement_prefix").style.display = advanced;
- document.getElementById("show_adv_dhcp6_prefix_interface_statement").style.display = advanced;
- }
+ document.getElementById("show_adv_dhcp6_id_assoc_statement_prefix").style.display = 'none';
+ document.getElementById("show_adv_dhcp6_prefix_interface_statement").style.display = 'none';
+ if (document.iform.adv_dhcp6_id_assoc_statement_prefix_enable.checked) {
+ document.getElementById("show_adv_dhcp6_id_assoc_statement_prefix").style.display = advanced;
+ document.getElementById("show_adv_dhcp6_prefix_interface_statement").style.display = advanced;
+ }
- document.getElementById("show_adv_dhcp6_authentication_statement").style.display = advanced;
- document.getElementById("show_adv_dhcp6_key_info_statement").style.display = advanced;
+ document.getElementById("show_adv_dhcp6_authentication_statement").style.display = advanced;
+ document.getElementById("show_adv_dhcp6_key_info_statement").style.display = advanced;
- document.getElementById("show_adv_dhcp6_config_file_override").style.display = override;
- }
+ document.getElementById("show_adv_dhcp6_config_file_override").style.display = override;
+ }
- <!-- Set the adv_dhcp6_config_advanced checkbox from saved config -->
- if ("<?=htmlspecialchars($pconfig['adv_dhcp6_config_advanced']);?>" == "Selected") document.iform.adv_dhcp6_config_advanced.checked = true;
- show_adv_dhcp6_config(document.iform.adv_dhcp6_config_advanced);
+ <!-- Set the adv_dhcp6_config_advanced checkbox from saved config -->
+ if ("<?=htmlspecialchars($pconfig['adv_dhcp6_config_advanced']);?>" == "Selected") {
+ document.iform.adv_dhcp6_config_advanced.checked = true;
+ }
+ show_adv_dhcp6_config(document.iform.adv_dhcp6_config_advanced);
- <!-- Set the adv_dhcp6_config_file_override checkbox from saved config -->
- if ("<?=htmlspecialchars($pconfig['adv_dhcp6_config_file_override']);?>" == "Selected") document.iform.adv_dhcp6_config_file_override.checked = true;
- show_adv_dhcp6_config(document.iform.adv_dhcp6_config_file_override);
+ <!-- Set the adv_dhcp6_config_file_override checkbox from saved config -->
+ if ("<?=htmlspecialchars($pconfig['adv_dhcp6_config_file_override']);?>" == "Selected") {
+ document.iform.adv_dhcp6_config_file_override.checked = true;
+ }
+ show_adv_dhcp6_config(document.iform.adv_dhcp6_config_file_override);
- <!-- Set the adv_dhcp6_interface_statement_information_only_enable checkbox from saved config -->
- if ("<?=htmlspecialchars($pconfig['adv_dhcp6_interface_statement_information_only_enable']);?>" == "Selected") document.iform.adv_dhcp6_interface_statement_information_only_enable.checked = true;
- show_adv_dhcp6_config(document.iform.adv_dhcp6_interface_statement_information_only_enable);
+ <!-- Set the adv_dhcp6_interface_statement_information_only_enable checkbox from saved config -->
+ if ("<?=htmlspecialchars($pconfig['adv_dhcp6_interface_statement_information_only_enable']);?>" == "Selected") {
+ document.iform.adv_dhcp6_interface_statement_information_only_enable.checked = true;
+ }
+ show_adv_dhcp6_config(document.iform.adv_dhcp6_interface_statement_information_only_enable);
- <!-- Set the adv_dhcp6_id_assoc_statement_address_enable checkbox from saved config -->
- if ("<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_address_enable']);?>" == "Selected") document.iform.adv_dhcp6_id_assoc_statement_address_enable.checked = true;
- show_adv_dhcp6_config(document.iform.adv_dhcp6_id_assoc_statement_address_enable);
+ <!-- Set the adv_dhcp6_id_assoc_statement_address_enable checkbox from saved config -->
+ if ("<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_address_enable']);?>" == "Selected") {
+ document.iform.adv_dhcp6_id_assoc_statement_address_enable.checked = true;
+ }
+ show_adv_dhcp6_config(document.iform.adv_dhcp6_id_assoc_statement_address_enable);
- <!-- Set the adv_dhcp6_id_assoc_statement_prefix_enable checkbox from saved config -->
- if ("<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_prefix_enable']);?>" == "Selected") document.iform.adv_dhcp6_id_assoc_statement_prefix_enable.checked = true;
- show_adv_dhcp6_config(document.iform.adv_dhcp6_id_assoc_statement_prefix_enable);
- //]]>
- </script>
+ <!-- Set the adv_dhcp6_id_assoc_statement_prefix_enable checkbox from saved config -->
+ if ("<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_prefix_enable']);?>" == "Selected") {
+ document.iform.adv_dhcp6_id_assoc_statement_prefix_enable.checked = true;
+ }
+ show_adv_dhcp6_config(document.iform.adv_dhcp6_id_assoc_statement_prefix_enable);
+ //]]>
+ </script>
</td>
</tr>
@@ -2573,7 +2788,9 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<?php
for ($i = 0; $i < 32; $i++) {
echo "<option value=\"{$i}\" ";
- if (is_numeric($pconfig['prefix-6rd-v4plen']) && ($i == $pconfig['prefix-6rd-v4plen'])) echo "selected=\"selected\"";
+ if (is_numeric($pconfig['prefix-6rd-v4plen']) && ($i == $pconfig['prefix-6rd-v4plen'])) {
+ echo "selected=\"selected\"";
+ }
echo ">" . $i . " bits</option>";
}
?>
@@ -2597,41 +2814,43 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Interface"); ?></td>
<td width="78%" class="vtable">
- <select name="track6-interface" id='track6-interface' class='formselect' onchange="update_track6_prefix();">
- <?php
- $interfaces = get_configured_interface_with_descr(false, true);
- $dynv6ifs = array();
- foreach ($interfaces as $iface => $ifacename) {
- switch($config['interfaces'][$iface]['ipaddrv6']) {
- case "6to4":
- case "6rd":
- case "dhcp6":
- $dynv6ifs[$iface] = array(
- 'name' => $ifacename,
- 'ipv6_num_prefix_ids' => pow(2, calculate_ipv6_delegation_length($iface)) - 1
- );
- break;
- default:
- continue;
+ <select name="track6-interface" id='track6-interface' class='formselect' onchange="update_track6_prefix();">
+ <?php
+ $interfaces = get_configured_interface_with_descr(false, true);
+ $dynv6ifs = array();
+ foreach ($interfaces as $iface => $ifacename) {
+ switch ($config['interfaces'][$iface]['ipaddrv6']) {
+ case "6to4":
+ case "6rd":
+ case "dhcp6":
+ $dynv6ifs[$iface] = array(
+ 'name' => $ifacename,
+ 'ipv6_num_prefix_ids' => pow(2, calculate_ipv6_delegation_length($iface)) - 1
+ );
+ break;
+ default:
+ continue;
+ }
}
- }
- $rowIndex = 0;
- foreach($dynv6ifs as $iface => $ifacedata) {
- $rowIndex++;
- echo "<option value=\"{$iface}\"";
- if ($iface == $pconfig['track6-interface'])
- echo " selected=\"selected\"";
- echo ">" . htmlspecialchars($ifacedata['name']) . "</option>";
- }
- if ($rowIndex == 0)
- echo "<option></option>";
- ?>
- </select> <br />
- <?php
- foreach($dynv6ifs as $iface => $ifacedata) {
- echo "<input type=\"hidden\" name=\"ipv6-num-prefix-ids-{$iface}\" id=\"ipv6-num-prefix-ids-{$iface}\" value=\"{$ifacedata['ipv6_num_prefix_ids']}\">\n";
- }
- ?>
+ $rowIndex = 0;
+ foreach ($dynv6ifs as $iface => $ifacedata) {
+ $rowIndex++;
+ echo "<option value=\"{$iface}\"";
+ if ($iface == $pconfig['track6-interface']) {
+ echo " selected=\"selected\"";
+ }
+ echo ">" . htmlspecialchars($ifacedata['name']) . "</option>";
+ }
+ if ($rowIndex == 0) {
+ echo "<option></option>";
+ }
+ ?>
+ </select> <br />
+ <?php
+ foreach ($dynv6ifs as $iface => $ifacedata) {
+ echo "<input type=\"hidden\" name=\"ipv6-num-prefix-ids-{$iface}\" id=\"ipv6-num-prefix-ids-{$iface}\" value=\"{$ifacedata['ipv6_num_prefix_ids']}\">\n";
+ }
+ ?>
<br />
<?=gettext("This selects the dynamic IPv6 WAN interface to track for configuration") ?><br />
</td>
@@ -2640,8 +2859,9 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Prefix ID"); ?></td>
<td width="78%" class="vtable">
<?php
- if ($pconfig['track6-prefix-id'] == "")
+ if ($pconfig['track6-prefix-id'] == "") {
$pconfig['track6-prefix-id'] = 0;
+ }
$track6_prefix_id_hex = sprintf("%x", $pconfig['track6-prefix-id']);
?>
<input name="track6-prefix-id--hex" type="text" class="formfld unknown" id="track6-prefix-id--hex" size="8" value="<?= $track6_prefix_id_hex ?>" />
@@ -2700,13 +2920,13 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Username"); ?></td>
<td width="78%" class="vtable">
- <input name="ppp_username" type="text" class="formfld user" id="ppp_username" size="20" value="<?=htmlspecialchars($pconfig['ppp_username']);?>" />
+ <input name="ppp_username" type="text" class="formfld user" id="ppp_username" size="20" value="<?=htmlspecialchars($pconfig['ppp_username']);?>" />
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Password"); ?></td>
<td width="78%" class="vtable">
- <input name="ppp_password" type="password" class="formfld pwd" id="ppp_password" size="20" value="<?=htmlspecialchars($pconfig['ppp_password']);?>" />
+ <input name="ppp_password" type="password" class="formfld pwd" id="ppp_password" size="20" value="<?=htmlspecialchars($pconfig['ppp_password']);?>" />
</td>
</tr>
<tr id="phone_num">
@@ -2731,31 +2951,34 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
$portlist = array_merge($portlist, $modems);
$rowIndex = 0;
foreach ($portlist as $port) {
- if(preg_match("/\.(lock|init)$/", $port))
+ if (preg_match("/\.(lock|init)$/", $port)) {
continue;
+ }
$rowIndex++;
echo "<option value=\"".trim($port)."\"";
- if ($pconfig['port'] == $port)
+ if ($pconfig['port'] == $port) {
echo " selected=\"selected\"";
+ }
echo ">{$port}</option>";
}
- if ($rowIndex == 0)
+ if ($rowIndex == 0) {
echo "<option></option>";
- ?>
+ }
+ ?>
</select>
</td>
</tr>
<tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("Advanced PPP"); ?></td>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Advanced PPP"); ?></td>
<?php if (isset($pconfig['pppid'])): ?>
<td width="78%" class="vtable">
- <a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk"><?=gettext("Click here"); ?> </a>
- <?=gettext("to edit PPP configuration."); ?>
+ <a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk"><?=gettext("Click here"); ?> </a>
+ <?=gettext("to edit PPP configuration."); ?>
</td>
<?php else: ?>
<td width="78%" class="vtable">
- <a href="/interfaces_ppps_edit.php" class="navlnk"><?=gettext("Click here"); ?> </a>
- <?=gettext("to create a PPP configuration."); ?>
+ <a href="/interfaces_ppps_edit.php" class="navlnk"><?=gettext("Click here"); ?> </a>
+ <?=gettext("to create a PPP configuration."); ?>
</td>
<?php endif; ?>
</tr>
@@ -2774,7 +2997,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Username"); ?></td>
<td width="78%" class="vtable">
- <input name="pppoe_username" type="text" class="formfld user" id="pppoe_username" size="20" value="<?=htmlspecialchars($pconfig['pppoe_username']);?>" />
+ <input name="pppoe_username" type="text" class="formfld user" id="pppoe_username" size="20" value="<?=htmlspecialchars($pconfig['pppoe_username']);?>" />
</td>
</tr>
<tr>
@@ -2858,13 +3081,13 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<td width="22%" valign="top" class="vncell"><?=gettext("Advanced and MLPPP"); ?></td>
<?php if (isset($pconfig['pppid'])): ?>
<td width="78%" class="vtable">
- <a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk"><?=gettext("Click here"); ?> </a>
- <?=gettext("for additional PPPoE configuration options. Save first if you made changes."); ?>
+ <a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk"><?=gettext("Click here"); ?> </a>
+ <?=gettext("for additional PPPoE configuration options. Save first if you made changes."); ?>
</td>
<?php else: ?>
<td width="78%" class="vtable">
- <a href="/interfaces_ppps_edit.php" class="navlnk"><?=gettext("Click here"); ?> </a>
- <?=gettext("for advanced PPPoE configuration options and MLPPP configuration."); ?>
+ <a href="/interfaces_ppps_edit.php" class="navlnk"><?=gettext("Click here"); ?> </a>
+ <?=gettext("for advanced PPPoE configuration options and MLPPP configuration."); ?>
</td>
<?php endif; ?>
</tr>
@@ -2900,7 +3123,8 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<select name="pptp_subnet" class="formselect" id="pptp_subnet">
<?php for ($i = 31; $i > 0; $i--): ?>
<option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet'][0]) echo "selected=\"selected\""; ?>>
- <?=$i;?></option>
+ <?=$i;?>
+ </option>
<?php endfor; ?>
</select>
</td>
@@ -2929,13 +3153,13 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<td width="22%" valign="top" class="vncell"><?=gettext("Advanced"); ?></td>
<?php if (isset($pconfig['pppid'])): ?>
<td width="78%" class="vtable">
- <a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk"><?=gettext("Click here");?></a>
- <?=gettext("for additional PPTP and L2TP configuration options. Save first if you made changes.");?>
+ <a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk"><?=gettext("Click here");?></a>
+ <?=gettext("for additional PPTP and L2TP configuration options. Save first if you made changes.");?>
</td>
<?php else: ?>
<td width="78%" class="vtable">
- <a href="/interfaces_ppps_edit.php" class="navlnk"><?=gettext("Click here");?></a>
- <?=gettext("for advanced PPTP and L2TP configuration options");?>.
+ <a href="/interfaces_ppps_edit.php" class="navlnk"><?=gettext("Click here");?></a>
+ <?=gettext("for advanced PPTP and L2TP configuration options");?>.
</td>
<?php endif; ?>
</tr>
@@ -2970,7 +3194,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
echo "selected=\"selected\" ";
}
echo "value=\"auto\">auto</option>\n";
- foreach($wl_modes as $wl_standard => $wl_channels) {
+ foreach ($wl_modes as $wl_standard => $wl_channels) {
$rowIndex++;
echo "<option ";
if ($pconfig['standard'] == "$wl_standard") {
@@ -2983,8 +3207,9 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
}
echo "value=\"$wl_standard\">802.$wl_standard</option>\n";
}
- if ($rowIndex == 0)
+ if ($rowIndex == 0) {
echo "<option></option>";
+ }
?>
</select>
</td>
@@ -3012,8 +3237,8 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<td class="vtable">
<select name="txpower" class="formselect" id="txpower">
<?
- for($x = 99; $x > 0; $x--) {
- if($pconfig["txpower"] == $x)
+ for ($x = 99; $x > 0; $x--) {
+ if ($pconfig["txpower"] == $x)
$SELECTED = " selected=\"selected\"";
else
$SELECTED = "";
@@ -3031,18 +3256,23 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<select name="channel" class="formselect" id="channel">
<option <?php if ($pconfig['channel'] == 0) echo "selected=\"selected\""; ?> value="0"><?=gettext("Auto"); ?></option>
<?php
- foreach($wl_modes as $wl_standard => $wl_channels) {
- if($wl_standard == "11g") { $wl_standard = "11b/g"; }
- else if($wl_standard == "11ng") { $wl_standard = "11b/g/n"; }
- else if($wl_standard == "11na") { $wl_standard = "11a/n"; }
- foreach($wl_channels as $wl_channel) {
+ foreach ($wl_modes as $wl_standard => $wl_channels) {
+ if ($wl_standard == "11g") {
+ $wl_standard = "11b/g";
+ } else if ($wl_standard == "11ng") {
+ $wl_standard = "11b/g/n";
+ } else if ($wl_standard == "11na") {
+ $wl_standard = "11a/n";
+ }
+ foreach ($wl_channels as $wl_channel) {
echo "<option ";
if ($pconfig['channel'] == "$wl_channel") {
echo "selected=\"selected\" ";
}
echo "value=\"$wl_channel\">$wl_standard - $wl_channel";
- if(isset($wl_chaninfo[$wl_channel]))
+ if (isset($wl_chaninfo[$wl_channel])) {
echo " ({$wl_chaninfo[$wl_channel][1]} @ {$wl_chaninfo[$wl_channel][2]} / {$wl_chaninfo[$wl_channel][3]})";
+ }
echo "</option>\n";
}
}
@@ -3119,7 +3349,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<select name="regdomain" class="formselect" id="regdomain">
<option <?php if (empty($pconfig['regdomain'])) echo "selected=\"selected\""; ?> value=""><?=gettext("Default"); ?></option>
<?php
- foreach($wl_regdomains as $wl_regdomain_key => $wl_regdomain) {
+ foreach ($wl_regdomains as $wl_regdomain_key => $wl_regdomain) {
echo "<option ";
if ($pconfig['regdomain'] == $wl_regdomains_attr[$wl_regdomain_key]['ID']) {
echo "selected=\"selected\" ";
@@ -3135,7 +3365,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<select name="regcountry" class="formselect" id="regcountry">
<option <?php if (empty($pconfig['regcountry'])) echo "selected=\"selected\""; ?> value=""><?=gettext("Default"); ?></option>
<?php
- foreach($wl_countries as $wl_country_key => $wl_country) {
+ foreach ($wl_countries as $wl_country_key => $wl_country) {
echo "<option ";
if ($pconfig['regcountry'] == $wl_countries_attr[$wl_country_key]['ID']) {
echo "selected=\"selected\" ";
@@ -3401,7 +3631,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
</td>
</tr>
<tr>
- <td valign="top" class="vncell"><?=gettext("Secondary 802.1X Authentication Server IP Address"); ?></td>
+ <td valign="top" class="vncell"><?=gettext("Secondary 802.1X Authentication Server IP Address"); ?></td>
<td class="vtable">
<input name="auth_server_addr2" id="auth_server_addr2" type="text" class="formfld unknown" size="66" value="<?=htmlspecialchars($pconfig['auth_server_addr2']);?>" />
<br /><?=gettext("Enter the IP address of the 802.1X Authentication Server. This is commonly a Radius server (FreeRadius, Internet Authentication Services, etc.)"); ?>
@@ -3541,8 +3771,9 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
gatewayip = jQuery('#gatewayip').val();
var defaultgw = '';
- if (jQuery('#defaultgw').is(':checked'))
+ if (jQuery('#defaultgw').is(':checked')) {
defaultgw = '&defaultgw=on';
+ }
var url = "system_gateways_edit.php";
var pars = 'isAjax=true&ipprotocol=inet' + defaultgw + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip);
jQuery.ajax(
@@ -3562,8 +3793,9 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
var descr = jQuery('#gatewaydescrv6').val();
gatewayip = jQuery('#gatewayipv6').val();
var defaultgw = '';
- if (jQuery('#defaultgwv6').is(':checked'))
+ if (jQuery('#defaultgwv6').is(':checked')) {
defaultgw = '&defaultgw=on';
+ }
var url_v6 = "system_gateways_edit.php";
var pars_v6 = 'isAjax=true&ipprotocol=inet6' + defaultgw + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip);
jQuery.ajax(
@@ -3610,7 +3842,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
hide_add_gateway_v6();
}
function save_callback(response) {
- if(response) {
+ if (response) {
document.getElementById("addgateway").style.display = 'none';
hide_add_gateway();
var gwtext = escape(name) + " - " + gatewayip;
@@ -3628,7 +3860,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
aodiv.style.display = "block";
}
function save_callback_v6(response_v6) {
- if(response_v6) {
+ if (response_v6) {
document.getElementById("addgatewayv6").style.display = 'none';
hide_add_gateway_v6();
var gwtext_v6 = escape(name) + " - " + gatewayip;
OpenPOWER on IntegriCloud