From e6f34d22cf841af5ee8cfeba9f71a9729dc113d9 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Tue, 1 Sep 2015 01:08:25 +0545 Subject: bootstrap usr\local\www\f minor changes --- src/usr/local/www/firewall_aliases.php | 26 +- src/usr/local/www/firewall_aliases_edit.php | 180 +++++----- src/usr/local/www/firewall_aliases_import.php | 2 +- src/usr/local/www/firewall_nat.php | 6 +- src/usr/local/www/firewall_nat_1to1_edit.php | 38 +- src/usr/local/www/firewall_nat_edit.php | 64 ++-- src/usr/local/www/firewall_nat_npt_edit.php | 14 +- src/usr/local/www/firewall_nat_out.php | 60 ++-- src/usr/local/www/firewall_nat_out_edit.php | 32 +- src/usr/local/www/firewall_rules.php | 34 +- src/usr/local/www/firewall_rules_edit.php | 76 ++-- src/usr/local/www/firewall_schedule.php | 18 +- src/usr/local/www/firewall_schedule_edit.php | 422 +++++++++++------------ src/usr/local/www/firewall_shaper.php | 10 +- src/usr/local/www/firewall_shaper_layer7.php | 56 +-- src/usr/local/www/firewall_shaper_queues.php | 2 +- src/usr/local/www/firewall_shaper_vinterface.php | 56 +-- src/usr/local/www/firewall_shaper_wizards.php | 2 +- src/usr/local/www/firewall_virtual_ip.php | 12 +- 19 files changed, 555 insertions(+), 555 deletions(-) (limited to 'src/usr/local') diff --git a/src/usr/local/www/firewall_aliases.php b/src/usr/local/www/firewall_aliases.php index c7be7d9..aeed7f1 100644 --- a/src/usr/local/www/firewall_aliases.php +++ b/src/usr/local/www/firewall_aliases.php @@ -127,7 +127,7 @@ if ($_GET['act'] == "del") { // Alias in an alias find_alias_reference(array('aliases', 'alias'), array('address'), $alias_name, $is_alias_referenced, $referenced_by); // Load Balancer - find_alias_reference(array('load_balancer', 'lbpool'), array('port'), $alias_name, $is_alias_referenced, $referenced_by); + find_alias_reference(array('load_balancer', 'lbpool'), array('port'), $alias_name, $is_alias_referenced, $referenced_by); find_alias_reference(array('load_balancer', 'virtual_server'), array('port'), $alias_name, $is_alias_referenced, $referenced_by); // Static routes find_alias_reference(array('staticroutes', 'route'), array('network'), $alias_name, $is_alias_referenced, $referenced_by); @@ -194,10 +194,10 @@ if (is_subsystem_dirty('aliases')) print_info_box_np(gettext("The alias list has been changed.") . "
" . gettext("You must apply the changes in order for them to take effect.")); $tab_array = array(); -$tab_array[] = array(gettext("IP"),($tab=="ip" ? true : ($tab=="host" ? true : ($tab == "network" ? true : false))), "/firewall_aliases.php?tab=ip"); -$tab_array[] = array(gettext("Ports"), ($tab=="port"? true : false), "/firewall_aliases.php?tab=port"); -$tab_array[] = array(gettext("URLs"), ($tab=="url"? true : false), "/firewall_aliases.php?tab=url"); -$tab_array[] = array(gettext("All"), ($tab=="all"? true : false), "/firewall_aliases.php?tab=all"); +$tab_array[] = array(gettext("IP"), ($tab == "ip" ? true : ($tab == "host" ? true : ($tab == "network" ? true : false))), "/firewall_aliases.php?tab=ip"); +$tab_array[] = array(gettext("Ports"), ($tab == "port"? true : false), "/firewall_aliases.php?tab=port"); +$tab_array[] = array(gettext("URLs"), ($tab == "url"? true : false), "/firewall_aliases.php?tab=url"); +$tab_array[] = array(gettext("All"), ($tab == "all"? true : false), "/firewall_aliases.php?tab=all"); display_top_tabs($tab_array); ?> @@ -213,24 +213,24 @@ display_top_tabs($tab_array); $alias): + foreach ($a_aliases as $i => $alias): unset ($show_alias); - switch ($tab){ + switch ($tab) { case "all": $show_alias= true; break; case "ip": case "host": case "network": - if (preg_match("/(host|network)/",$alias["type"])) + if (preg_match("/(host|network)/", $alias["type"])) $show_alias= true; break; case "url": - if (preg_match("/(url)/i",$alias["type"])) + if (preg_match("/(url)/i", $alias["type"])) $show_alias= true; break; case "port": - if($alias["type"] == "port") + if ($alias["type"] == "port") $show_alias= true; break; } @@ -245,10 +245,10 @@ display_top_tabs($tab_array); if ($alias["url"]) { echo $alias["url"] . "
"; } else { - if(is_array($alias["aliasurl"])) { + if (is_array($alias["aliasurl"])) { $aliasurls = implode(", ", array_slice($alias["aliasurl"], 0, 10)); echo $aliasurls; - if(count($aliasurls) > 10) { + if (count($aliasurls) > 10) { echo "…
"; } echo "
\n"; @@ -256,7 +256,7 @@ display_top_tabs($tab_array); $tmpaddr = explode(" ", $alias['address']); $addresses = implode(", ", array_slice($tmpaddr, 0, 10)); echo $addresses; - if(count($tmpaddr) > 10) { + if (count($tmpaddr) > 10) { echo '…'; } } diff --git a/src/usr/local/www/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php index 84d9d96..de47a5d 100755 --- a/src/usr/local/www/firewall_aliases_edit.php +++ b/src/usr/local/www/firewall_aliases_edit.php @@ -110,8 +110,8 @@ if ($_POST) { $adrs = count($_POST['address']); -for($idx=0; $idx<$adrs; $idx++) { - if($_POST['address'][$idx] == "") +for ($idx = 0; $idx < $adrs; $idx++) { + if ($_POST['address'][$idx] == "") unset($_POST['address'][$idx]); } @@ -260,9 +260,9 @@ if ($_POST) { download_file($post_address, $temp_filename . "/aliases", $verify_ssl); /* if the item is tar gzipped then extract */ - if(stristr($post_address, ".tgz")) + if (stristr($post_address, ".tgz")) process_alias_tgz($temp_filename); - else if(stristr($post_address, ".zip")) + else if (stristr($post_address, ".zip")) process_alias_unzip($temp_filename); if (!isset($alias['aliasurl'])) { @@ -312,47 +312,75 @@ if ($_POST) { // Users can paste strings like "10.1.2.0/24 10.3.0.0/16 9.10.11.0/24" into an address box. // They can also put an IP range. // This loop expands out that stuff so it can easily be validated. - foreach ($_POST['address'] as $idx => $post_address) { - if ($post_address != "") { + foreach ($_POST['address'] as $idx => $post_address) { + if ($post_address != "") { - if ((strpos($post_address, "||") === false) && (substr($post_address, 0, 1) != "|") && (substr($post_address, -1, 1) != "|")) { - $detail_text = $post_address; - } else { - /* Remove leading and trailing vertical bars and replace multiple vertical bars with single, */ - /* and put in the output array so the text is at least redisplayed for the user. */ - $detail_text = preg_replace('/\|\|+/', '|', trim($post_address, "|")); - if (!$desc_fmt_err_found) { - $input_errors[] = $vertical_bar_err_text; - $desc_fmt_err_found = true; - } - } + if ((strpos($post_address, "||") === false) && (substr($post_address, 0, 1) != "|") && (substr($post_address, -1, 1) != "|")) { + $detail_text = $post_address; } else { - $detail_text = sprintf(gettext("Entry added %s"), date('r')); + /* Remove leading and trailing vertical bars and replace multiple vertical bars with single, */ + /* and put in the output array so the text is at least redisplayed for the user. */ + $detail_text = preg_replace('/\|\|+/', '|', trim($post_address, "|")); + if (!$desc_fmt_err_found) { + $input_errors[] = $vertical_bar_err_text; + $desc_fmt_err_found = true; + } } - - $address_items = explode(" ", trim($post_address)); - foreach ($address_items as $address_item) { - $iprange_type = is_iprange($address_item); - - if ($iprange_type == 4) { - list($startip, $endip) = explode('-', $address_item); - if ($_POST['type'] == "network") { - // For network type aliases, expand an IPv4 range into an array of subnets. - $rangesubnets = ip_range_to_subnet_array($startip, $endip); - foreach ($rangesubnets as $rangesubnet) { - if ($alias_address_count > $max_alias_addresses) { - break; - } - list($address_part, $subnet_part) = explode("/", $rangesubnet); - $input_addresses[] = $address_part; - $input_address_subnet[] = $subnet_part; + } else { + $detail_text = sprintf(gettext("Entry added %s"), date('r')); + } + + $address_items = explode(" ", trim($post_address)); + foreach ($address_items as $address_item) { + $iprange_type = is_iprange($address_item); + + if ($iprange_type == 4) { + list($startip, $endip) = explode('-', $address_item); + if ($_POST['type'] == "network") { + // For network type aliases, expand an IPv4 range into an array of subnets. + $rangesubnets = ip_range_to_subnet_array($startip, $endip); + foreach ($rangesubnets as $rangesubnet) { + if ($alias_address_count > $max_alias_addresses) { + break; + } + list($address_part, $subnet_part) = explode("/", $rangesubnet); + $input_addresses[] = $address_part; + $input_address_subnet[] = $subnet_part; + $final_address_details[] = $detail_text; + $alias_address_count++; + } + } else { + // For host type aliases, expand an IPv4 range into a list of individual IPv4 addresses. + $rangeaddresses = ip_range_to_address_array($startip, $endip, $max_alias_addresses - $alias_address_count); + if (is_array($rangeaddresses)) { + foreach ($rangeaddresses as $rangeaddress) { + $input_addresses[] = $rangeaddress; + $input_address_subnet[] = ""; $final_address_details[] = $detail_text; $alias_address_count++; } } else { - // For host type aliases, expand an IPv4 range into a list of individual IPv4 addresses. - $rangeaddresses = ip_range_to_address_array($startip, $endip, $max_alias_addresses - $alias_address_count); - if (is_array($rangeaddresses)) { + $input_errors[] = sprintf(gettext('Range is too large to expand into individual host IP addresses (%s)'), $address_item); + $input_errors[] = sprintf(gettext('The maximum number of entries in an alias is %s'), $max_alias_addresses); + // Put the user-entered data in the output anyway, so it will be re-displayed for correction. + $input_addresses[] = $address_item; + $input_address_subnet[] = ""; + $final_address_details[] = $detail_text; + } + } + } else if ($iprange_type == 6) { + $input_errors[] = sprintf(gettext('IPv6 address ranges are not supported (%s)'), $address_item); + // Put the user-entered data in the output anyway, so it will be re-displayed for correction. + $input_addresses[] = $address_item; + $input_address_subnet[] = ""; + $final_address_details[] = $detail_text; + } else { + $subnet_type = is_subnet($address_item); + if (($_POST['type'] == "host") && $subnet_type) { + if ($subnet_type == 4) { + // For host type aliases, if the user enters an IPv4 subnet, expand it into a list of individual IPv4 addresses. + if (subnet_size($address_item) <= ($max_alias_addresses - $alias_address_count)) { + $rangeaddresses = subnetv4_expand($address_item); foreach ($rangeaddresses as $rangeaddress) { $input_addresses[] = $rangeaddress; $input_address_subnet[] = ""; @@ -360,75 +388,47 @@ if ($_POST) { $alias_address_count++; } } else { - $input_errors[] = sprintf(gettext('Range is too large to expand into individual host IP addresses (%s)'), $address_item); + $input_errors[] = sprintf(gettext('Subnet is too large to expand into individual host IP addresses (%s)'), $address_item); $input_errors[] = sprintf(gettext('The maximum number of entries in an alias is %s'), $max_alias_addresses); // Put the user-entered data in the output anyway, so it will be re-displayed for correction. $input_addresses[] = $address_item; $input_address_subnet[] = ""; $final_address_details[] = $detail_text; } + } else { + $input_errors[] = sprintf(gettext('IPv6 subnets are not supported in host aliases (%s)'), $address_item); + // Put the user-entered data in the output anyway, so it will be re-displayed for correction. + $input_addresses[] = $address_item; + $input_address_subnet[] = ""; + $final_address_details[] = $detail_text; } - } else if ($iprange_type == 6) { - $input_errors[] = sprintf(gettext('IPv6 address ranges are not supported (%s)'), $address_item); - // Put the user-entered data in the output anyway, so it will be re-displayed for correction. - $input_addresses[] = $address_item; - $input_address_subnet[] = ""; - $final_address_details[] = $detail_text; } else { - $subnet_type = is_subnet($address_item); - if (($_POST['type'] == "host") && $subnet_type) { - if ($subnet_type == 4) { - // For host type aliases, if the user enters an IPv4 subnet, expand it into a list of individual IPv4 addresses. - if (subnet_size($address_item) <= ($max_alias_addresses - $alias_address_count)) { - $rangeaddresses = subnetv4_expand($address_item); - foreach ($rangeaddresses as $rangeaddress) { - $input_addresses[] = $rangeaddress; - $input_address_subnet[] = ""; - $final_address_details[] = $detail_text; - $alias_address_count++; - } - } else { - $input_errors[] = sprintf(gettext('Subnet is too large to expand into individual host IP addresses (%s)'), $address_item); - $input_errors[] = sprintf(gettext('The maximum number of entries in an alias is %s'), $max_alias_addresses); - // Put the user-entered data in the output anyway, so it will be re-displayed for correction. - $input_addresses[] = $address_item; - $input_address_subnet[] = ""; - $final_address_details[] = $detail_text; - } + list($address_part, $subnet_part) = explode("/", $address_item); + if (!empty($subnet_part)) { + if (is_subnet($address_item)) { + $input_addresses[] = $address_part; + $input_address_subnet[] = $subnet_part; } else { - $input_errors[] = sprintf(gettext('IPv6 subnets are not supported in host aliases (%s)'), $address_item); - // Put the user-entered data in the output anyway, so it will be re-displayed for correction. + // The user typed something like "1.2.3.444/24" or "1.2.3.0/36" or similar rubbish. + // Feed it through without splitting it apart, then it will be caught by the validation loop below. $input_addresses[] = $address_item; $input_address_subnet[] = ""; - $final_address_details[] = $detail_text; } } else { - list($address_part, $subnet_part) = explode("/", $address_item); - if (!empty($subnet_part)) { - if (is_subnet($address_item)) { - $input_addresses[] = $address_part; - $input_address_subnet[] = $subnet_part; - } else { - // The user typed something like "1.2.3.444/24" or "1.2.3.0/36" or similar rubbish. - // Feed it through without splitting it apart, then it will be caught by the validation loop below. - $input_addresses[] = $address_item; - $input_address_subnet[] = ""; - } - } else { - $input_addresses[] = $address_part; - $input_address_subnet[] = $_POST["address_subnet"][$idx]; - } - - $final_address_details[] = $detail_text; - $alias_address_count++; + $input_addresses[] = $address_part; + $input_address_subnet[] = $_POST["address_subnet"][$idx]; } + + $final_address_details[] = $detail_text; + $alias_address_count++; } - if ($alias_address_count > $max_alias_addresses) { - $input_errors[] = sprintf(gettext('The maximum number of entries in an alias has been exceeded (%s)'), $max_alias_addresses); - break; - } + } + if ($alias_address_count > $max_alias_addresses) { + $input_errors[] = sprintf(gettext('The maximum number of entries in an alias has been exceeded (%s)'), $max_alias_addresses); + break; } } + } // Validate the input data expanded above. foreach ($input_addresses as $idx => $input_address) { diff --git a/src/usr/local/www/firewall_aliases_import.php b/src/usr/local/www/firewall_aliases_import.php index 0199426..cb54c29 100755 --- a/src/usr/local/www/firewall_aliases_import.php +++ b/src/usr/local/www/firewall_aliases_import.php @@ -93,7 +93,7 @@ if (!is_array($config['aliases']['alias'])) { } $a_aliases = &$config['aliases']['alias']; -if($_POST['aliasimport'] != "") { +if ($_POST['aliasimport'] != "") { $reqdfields = explode(" ", "name aliasimport"); $reqdfieldsn = array(gettext("Name"), gettext("Aliases")); diff --git a/src/usr/local/www/firewall_nat.php b/src/usr/local/www/firewall_nat.php index 651428d..82b5774 100644 --- a/src/usr/local/www/firewall_nat.php +++ b/src/usr/local/www/firewall_nat.php @@ -267,14 +267,14 @@ foreach ($a_nat as $natent): ); /* if user does not have access to edit an interface skip on to the next record */ - if(!have_natpfruleint_access($natent['interface'])) + if (!have_natpfruleint_access($natent['interface'])) continue; ?> "> 0) { +if (count($a_nat) > 0) { ?>
diff --git a/src/usr/local/www/firewall_nat_1to1_edit.php b/src/usr/local/www/firewall_nat_1to1_edit.php index ba92003..4970ba9 100644 --- a/src/usr/local/www/firewall_nat_1to1_edit.php +++ b/src/usr/local/www/firewall_nat_1to1_edit.php @@ -142,8 +142,8 @@ if ($_POST) { $temp = str_replace(">", "", $value); $newpost = htmlentities($temp); - if($newpost != $temp) - $input_errors[] = sprintf(gettext("Invalid characters detected (%s). Please remove invalid characters and save again."),$temp); + if ($newpost != $temp) + $input_errors[] = sprintf(gettext("Invalid characters detected (%s). Please remove invalid characters and save again."), $temp); } /* input validation */ @@ -282,17 +282,17 @@ function build_srctype_list() { $sel = is_specialnet($pconfig['src']); - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $list['pptp'] = 'PPTP clients'; - if(have_ruleint_access("pppoe")) + if (have_ruleint_access("pppoe")) $list['pppoe'] = 'PPPoE clients'; - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $list['l2tp'] = 'L2TP clients'; foreach ($ifdisp as $ifent => $ifdesc) { - if(have_ruleint_access($ifent)) { + if (have_ruleint_access($ifent)) { $list[$ifent] = $ifdesc . ' net'; $list[$ifent . 'ip'] = $ifdesc . ' address'; } @@ -306,8 +306,8 @@ function srctype_selected() { $sel = is_specialnet($pconfig['src']); - if(!$sel) { - if(($pconfig['srcmask'] == 32) || (!isset($pconfig['srcmask']))) + if (!$sel) { + if (($pconfig['srcmask'] == 32) || (!isset($pconfig['srcmask']))) return('single'); return('network'); @@ -322,17 +322,17 @@ function build_dsttype_list() { $sel = is_specialnet($pconfig['dst']); $list = array('any' => 'Any', 'single' => 'Single host or alias', 'network' => 'Network', '(self)' => 'This Firewall (self)'); - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $list['pptp'] = 'PPTP clients'; - if(have_ruleint_access("pppoe")) + if (have_ruleint_access("pppoe")) $list['pppoe'] = 'PPPoE clients'; - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $list['l2tp'] = 'L2TP clients'; foreach ($ifdisp as $if => $ifdesc) { - if(have_ruleint_access($if)) { + if (have_ruleint_access($if)) { $list[$if] = $ifdesc; $list[$if . 'ip'] = $ifdesc . ' address'; } @@ -367,11 +367,11 @@ function dsttype_selected() { $sel = is_specialnet($pconfig['dst']); - if(empty($pconfig['dst'] || $pconfig['dst'] == "any")) + if (empty($pconfig['dst'] || $pconfig['dst'] == "any")) return('any'); - if(!$sel) { - if($pconfig['dstmask'] == 32) + if (!$sel) { + if ($pconfig['dstmask'] == 32) return('single'); return('network'); @@ -402,15 +402,15 @@ $section->addInput(new Form_Checkbox( $iflist = get_configured_interface_with_descr(false, true); foreach ($iflist as $if => $ifdesc) - if(have_ruleint_access($if)) + if (have_ruleint_access($if)) $interfaces[$if] = $ifdesc; if ($config['l2tp']['mode'] == "server") - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $interfaces['l2tp'] = "L2TP VPN"; if ($config['pptpd']['mode'] == "server") - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $interfaces['pptp'] = "PPTP VPN"; if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) @@ -418,7 +418,7 @@ if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) /* add ipsec interfaces */ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable'])) - if(have_ruleint_access("enc0")) + if (have_ruleint_access("enc0")) $interfaces["enc0"] = "IPsec"; /* add openvpn/tun interfaces */ diff --git a/src/usr/local/www/firewall_nat_edit.php b/src/usr/local/www/firewall_nat_edit.php index 2b15c80..57f64a4 100644 --- a/src/usr/local/www/firewall_nat_edit.php +++ b/src/usr/local/www/firewall_nat_edit.php @@ -157,7 +157,7 @@ unset($input_errors); foreach ($_POST as $key => $value) { $temp = $value; $newpost = htmlentities($temp); - if($newpost != $temp) + if ($newpost != $temp) $input_errors[] = sprintf(gettext("Invalid characters detected %s. Please remove invalid characters and save again."), $temp); } @@ -534,17 +534,17 @@ function build_srctype_list() { $sel = is_specialnet($pconfig['src']); - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $list['pptp'] = 'PPTP clients'; - if(have_ruleint_access("pppoe")) + if (have_ruleint_access("pppoe")) $list['pppoe'] = 'PPPoE clients'; - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $list['l2tp'] = 'L2TP clients'; foreach ($ifdisp as $ifent => $ifdesc) { - if(have_ruleint_access($ifent)) { + if (have_ruleint_access($ifent)) { $list[$ifent] = $ifdesc . ' net'; $list[$ifent . 'ip'] = $ifdesc . ' address'; } @@ -559,17 +559,17 @@ function build_dsttype_list() { $sel = is_specialnet($pconfig['dst']); $list = array('any' => 'Any', 'single' => 'Single host or alias', 'network' => 'Network', '(self)' => 'This Firewall (self)'); - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $list['pptp'] = 'PPTP clients'; - if(have_ruleint_access("pppoe")) + if (have_ruleint_access("pppoe")) $list['pppoe'] = 'PPPoE clients'; - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $list['l2tp'] = 'L2TP clients'; foreach ($ifdisp as $if => $ifdesc) { - if(have_ruleint_access($if)) { + if (have_ruleint_access($if)) { $list[$if] = $ifdesc; $list[$if . 'ip'] = $ifdesc . ' address'; } @@ -604,8 +604,8 @@ function dsttype_selected() { $sel = is_specialnet($pconfig['dst']); - if(!$sel) { - if($pconfig['dstmask'] == 32) + if (!$sel) { + if ($pconfig['dstmask'] == 32) return('single'); return('network'); @@ -619,8 +619,8 @@ function srctype_selected() { $sel = is_specialnet($pconfig['src']); - if(!$sel) { - if($pconfig['srcmask'] == 32) + if (!$sel) { + if ($pconfig['srcmask'] == 32) return('single'); return('network'); @@ -662,15 +662,15 @@ $section->addInput(new Form_Checkbox( $iflist = get_configured_interface_with_descr(false, true); foreach ($iflist as $if => $ifdesc) - if(have_ruleint_access($if)) + if (have_ruleint_access($if)) $interfaces[$if] = $ifdesc; if ($config['l2tp']['mode'] == "server") - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $interfaces['l2tp'] = "L2TP VPN"; if ($config['pptpd']['mode'] == "server") - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $interfaces['pptp'] = "PPTP VPN"; if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) @@ -678,11 +678,11 @@ if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) /* add ipsec interfaces */ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable'])) - if(have_ruleint_access("enc0")) + if (have_ruleint_access("enc0")) $interfaces["enc0"] = "IPsec"; /* add openvpn/tun interfaces */ -if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) +if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) $interfaces["openvpn"] = "OpenVPN"; $section->addInput(new Form_Select( @@ -894,7 +894,7 @@ if (isset($id) && $a_nat[$id] && (!isset($_GET['dup']) || !is_numericint($_GET[' if (isset($filter_rule['associated-rule-id'])) { $rulelist[$filter_rule['associated-rule-id']] = 'Rule ' . $filter_rule['descr']; - if ($filter_rule['associated-rule-id']==$pconfig['associated-rule-id']) { + if ($filter_rule['associated-rule-id'] == $pconfig['associated-rule-id']) { $hlpstr = '' . gettext("View the filter rule") . '
'; } } @@ -902,7 +902,7 @@ if (isset($id) && $a_nat[$id] && (!isset($_GET['dup']) || !is_numericint($_GET[' } if (isset($pconfig['associated-rule-id'])) - $rulelist['new'] = 'Create new associated filter rule'; + $rulelist['new'] = 'Create new associated filter rule'; $section->addInput(new Form_Select( 'associated-rule-id', @@ -932,14 +932,14 @@ $has_updated_time = (isset($a_nat[$id]['updated']) && is_array($a_nat[$id]['upda if ($has_created_time || $has_updated_time) { $section = new Form_Section('Rule Information'); - if($has_created_time) { + if ($has_created_time) { $section->addInput(new Form_StaticText( 'Created', date(gettext("n/j/y H:i:s"), $a_nat[$id]['created']['time']) . gettext("by") . $a_nat[$id]['created']['username'] )); } - if($has_updated_time) { + if ($has_updated_time) { $section->addInput(new Form_StaticText( 'Updated', date(gettext("n/j/y H:i:s"), $a_nat[$id]['updated']['time']) . gettext("by") . $a_nat[$id]['updated']['username'] @@ -979,7 +979,7 @@ events.push(function(){ // ---------- "Library" functions --------------------------------------------------------------------------------- // Hides the
in which the specified input element lives so that the input, its label and help text are hidden function hideInput(id, hide) { - if(hide) + if (hide) $('#' + id).parent().parent('div').addClass('hidden'); else $('#' + id).parent().parent('div').removeClass('hidden'); @@ -992,7 +992,7 @@ events.push(function(){ // Hides all elements of the specified class. This will usually be a section function hideClass(s_class, hide) { - if(hide) + if (hide) $('.' + s_class).hide(); else $('.' + s_class).show(); @@ -1046,7 +1046,7 @@ events.push(function(){ disableInput('srcbeginport', false); disableInput('srcendport', false); disableInput('localbeginport_cust', false); - if( dstenabled ) { + if ( dstenabled ) { disableInput('dstbeginport', false); disableInput('dstendport', false); } @@ -1054,7 +1054,7 @@ events.push(function(){ } function nordr_change() { - if( $('#nordr').prop('checked') ) { + if ( $('#nordr').prop('checked') ) { hideInput('localip', true); hideClass('lclportrange', true); hideInput('associated-rule-id', true); @@ -1071,8 +1071,8 @@ events.push(function(){ // if External port range is an alias, then disallow // entry of Local port // - for(i=0; i $ifdesc) { - if(have_ruleint_access($if)) + if (have_ruleint_access($if)) $interfaces[$if] = $ifdesc; } if ($config['l2tp']['mode'] == "server") - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $interfaces['l2tp'] = "L2TP VPN"; if ($config['pptpd']['mode'] == "server") - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $interfaces['pptp'] = "PPTP VPN"; if ($config['pppoe']['mode'] == "server") - if(have_ruleint_access("pppoe")) + if (have_ruleint_access("pppoe")) $interfaces['pppoe'] = "PPPoE Server"; /* add ipsec interfaces */ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['mobileclients']['enable'])) { - if(have_ruleint_access("enc0")) + if (have_ruleint_access("enc0")) $interfaces["enc0"] = "IPsec"; } /* add openvpn/tun interfaces */ - if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) + if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) $interfaces["openvpn"] = "OpenVPN"; return($interfaces); } -$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("NPt"),gettext("Edit")); +$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("NPt"), gettext("Edit")); include("head.inc"); if ($input_errors) diff --git a/src/usr/local/www/firewall_nat_out.php b/src/usr/local/www/firewall_nat_out.php index 8f3d458..0412348 100644 --- a/src/usr/local/www/firewall_nat_out.php +++ b/src/usr/local/www/firewall_nat_out.php @@ -152,10 +152,10 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") { $found = false; foreach ($a_out as $rule) { if ($rule['interface'] == $natent['interface'] && - $rule['source']['network'] == $natent['source']['network'] && - $rule['dstport'] == $natent['dstport'] && - $rule['target'] == $natent['target'] && - $rule['descr'] == $natent['descr']) { + $rule['source']['network'] == $natent['source']['network'] && + $rule['dstport'] == $natent['dstport'] && + $rule['target'] == $natent['target'] && + $rule['descr'] == $natent['descr']) { $found = true; break; } @@ -269,16 +269,16 @@ if (isset($_POST['del_x'])) { } } -function rule_popup($src,$srcport,$dst,$dstport){ - global $config,$g; +function rule_popup($src, $srcport, $dst, $dstport) { + global $config, $g; $aliases_array = array(); if ($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias'])) { $descriptions = array (); - foreach ($config['aliases']['alias'] as $alias_id=>$alias_name){ + foreach ($config['aliases']['alias'] as $alias_id => $alias_name) { $loading_image="\'loader\' " .gettext("loading...").""; - switch ($alias_name['type']){ + switch ($alias_name['type']) { case "port": $width="250"; break; @@ -303,7 +303,7 @@ function rule_popup($src,$srcport,$dst,$dstport){ $descriptions['srcport_end'] = $span_end; } - if ($alias_name['name'] == $dst ) { + if ($alias_name['name'] == $dst) { $descriptions['dst'] = $span_begin; $descriptions['dst_end'] = $span_end; } @@ -318,7 +318,7 @@ function rule_popup($src,$srcport,$dst,$dstport){ } } -$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("Outbound")); +$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("Outbound")); include("head.inc"); if ($savemsg) @@ -411,11 +411,11 @@ print($form); $alias = rule_columns_with_alias( - $natent['source']['address'], - pprint_port($natent['source']['port']), - $natent['destination']['address'], - pprint_port($natent['destination']['port']) - ); + $natent['source']['address'], + pprint_port($natent['source']['port']), + $natent['destination']['address'], + pprint_port($natent['destination']['port']) + ); ?> @@ -464,9 +464,9 @@ print($form); @@ -487,9 +487,9 @@ print($form); @@ -560,7 +560,7 @@ print($form); @@ -687,7 +687,7 @@ if ($mode == "automatic" || $mode == "hybrid"): ' . + print_info_box(gettext('If automatic outbound NAT is selected, a mapping is automatically generated for each interface\'s subnet (except WAN-type connections) and the rules ' . + 'on the "Mappings" section of this page are ignored.' . '
' . 'If manual outbound NAT is selected, outbound NAT rules will not be automatically generated and only the mappings you specify on this page ' . 'will be used.' . '
' . 'If hybrid outbound NAT is selected, mappings you specify on this page will be used, followed by the automatically generated ones.' . '
' . diff --git a/src/usr/local/www/firewall_nat_out_edit.php b/src/usr/local/www/firewall_nat_out_edit.php index 4d85609..6ecf2ac 100644 --- a/src/usr/local/www/firewall_nat_out_edit.php +++ b/src/usr/local/www/firewall_nat_out_edit.php @@ -465,15 +465,15 @@ $section->addInput(new Form_Checkbox( $iflist = get_configured_interface_with_descr(false, true); foreach ($iflist as $if => $ifdesc) - if(have_ruleint_access($if)) + if (have_ruleint_access($if)) $interfaces[$if] = $ifdesc; if ($config['l2tp']['mode'] == "server") - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $interfaces['l2tp'] = "L2TP VPN"; if ($config['pptpd']['mode'] == "server") - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $interfaces['pptp'] = "PPTP VPN"; if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) @@ -481,11 +481,11 @@ if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) /* add ipsec interfaces */ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable'])) - if(have_ruleint_access("enc0")) + if (have_ruleint_access("enc0")) $interfaces["enc0"] = "IPsec"; /* add openvpn/tun interfaces */ -if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) +if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) $interfaces["openvpn"] = "OpenVPN"; $section->addInput(new Form_Select( @@ -669,14 +669,14 @@ $has_updated_time = (isset($a_out[$id]['updated']) && is_array($a_out[$id]['upda if ($has_created_time || $has_updated_time) { $section = new Form_Section('Rule Information'); - if($has_created_time) { + if ($has_created_time) { $section->addInput(new Form_StaticText( 'Created', date(gettext("n/j/y H:i:s"), $a_out[$id]['created']['time']) . gettext("by") . $a_out[$id]['created']['username'] )); } - if($has_updated_time) { + if ($has_updated_time) { $section->addInput(new Form_StaticText( 'Updated', date(gettext("n/j/y H:i:s"), $a_out[$id]['updated']['time']) . gettext("by") . $a_out[$id]['updated']['username'] @@ -697,7 +697,7 @@ events.push(function(){ // Hides the
in which the specified input element lives so that the input, its label and help text are hidden function hideInput(id, hide) { - if(hide) + if (hide) $('#' + id).parent().parent('div').addClass('hidden'); else $('#' + id).parent().parent('div').removeClass('hidden'); @@ -706,7 +706,7 @@ events.push(function(){ // Hides the
in which the specified group input element lives so that the input, // its label and help text are hidden function hideGroupInput(id, hide) { - if(hide) + if (hide) $('#' + id).parent('div').addClass('hidden'); else $('#' + id).parent('div').removeClass('hidden'); @@ -714,7 +714,7 @@ events.push(function(){ // Hides the
in which the specified checkbox lives so that the checkbox, its label and help text are hidden function hideCheckbox(id, hide) { - if(hide) + if (hide) $('#' + id).parent().parent().parent('div').addClass('hidden'); else $('#' + id).parent().parent().parent('div').removeClass('hidden'); @@ -727,7 +727,7 @@ events.push(function(){ // Hides all elements of the specified class. This will usually be a section function hideClass(s_class, hide) { - if(hide) + if (hide) $('.' + s_class).hide(); else $('.' + s_class).show(); @@ -735,14 +735,14 @@ events.push(function(){ // Hides all elements of the specified class assigned to a group. This will usually be a group function hideGroupClass(s_class, hide) { - if(hide) + if (hide) $('.' + s_class).parent().parent().parent().hide(); else $('.' + s_class).parent().parent().parent().show(); } function staticportchange() { - if($('#staticnatport').prop('checked')) { + if ($('#staticnatport').prop('checked')) { $('#natport').val(""); disableInput('natport' , true); } else { @@ -751,7 +751,7 @@ events.push(function(){ } function sourcesel_change() { - if($('#source_type').find(":selected").val() == "network") { + if ($('#source_type').find(":selected").val() == "network") { disableInput('source', false); disableInput('source_subnet', false); } @@ -764,7 +764,7 @@ events.push(function(){ } function typesel_change() { - if($('#destination_type').find(":selected").val() == "network") { + if ($('#destination_type').find(":selected").val() == "network") { disableInput('destination', false); disableInput('destination_subnet', false); } @@ -781,7 +781,7 @@ events.push(function(){ } function proto_change() { - if( ($('#protocol').find(":selected").index() > 0) && ($('#protocol').find(":selected").index() <= 3) ) { + if (($('#protocol').find(":selected").index() > 0) && ($('#protocol').find(":selected").index() <= 3)) { hideGroupInput('sourceport', false); hideGroupInput('dstport', false); hideClass('natportgrp', false); diff --git a/src/usr/local/www/firewall_rules.php b/src/usr/local/www/firewall_rules.php index cf5497b..f3b4b00 100644 --- a/src/usr/local/www/firewall_rules.php +++ b/src/usr/local/www/firewall_rules.php @@ -173,7 +173,7 @@ if ($_POST) { clear_subsystem_dirty('filter'); - $savemsg = sprintf(gettext("The settings have been applied. The firewall rules are now reloading in the background.
You can also %s monitor %s the reload progress"),"
",""); + $savemsg = sprintf(gettext("The settings have been applied. The firewall rules are now reloading in the background.
You can also %s monitor %s the reload progress"), "", ""); } } @@ -268,8 +268,8 @@ display_top_tabs($tab_array); 1, or WAN with an if count of 1. if (!isset($config['system']['webgui']['noantilockout']) && - (((count($config['interfaces']) > 1) && ($if == 'lan')) - || ((count($config['interfaces']) == 1) && ($if == 'wan')))): + (((count($config['interfaces']) > 1) && ($if == 'lan')) || + ((count($config['interfaces']) == 1) && ($if == 'wan')))): $alports = implode('
', filter_get_antilockout_ports(true)); ?> @@ -374,19 +374,19 @@ display_top_tabs($tab_array); $sched_caption_escaped = ""; $sched_content = ""; $schedstatus = false; - $dayArray = array (gettext('Mon'),gettext('Tues'),gettext('Wed'),gettext('Thur'),gettext('Fri'),gettext('Sat'),gettext('Sun')); - $monthArray = array (gettext('January'),gettext('February'),gettext('March'),gettext('April'),gettext('May'),gettext('June'),gettext('July'),gettext('August'),gettext('September'),gettext('October'),gettext('November'),gettext('December')); + $dayArray = array (gettext('Mon'), gettext('Tues'), gettext('Wed'), gettext('Thur'), gettext('Fri'), gettext('Sat'), gettext('Sun')); + $monthArray = array (gettext('January'), gettext('February'), gettext('March'), gettext('April'), gettext('May'), gettext('June'), gettext('July'), gettext('August'), gettext('September'), gettext('October'), gettext('November'), gettext('December')); if ($config['schedules']['schedule'] != "" && is_array($config['schedules']['schedule'])) { foreach ($a_schedules as $schedule) { - if ($schedule['name'] == $filterent['sched'] ){ + if ($schedule['name'] == $filterent['sched']) { $schedstatus = filter_get_time_based_rule_status($schedule); - foreach($schedule['timerange'] as $timerange) { + foreach ($schedule['timerange'] as $timerange) { $tempFriendlyTime = ""; $tempID = ""; $firstprint = false; - if ($timerange){ + if ($timerange) { $dayFriendly = ""; $tempFriendlyTime = ""; @@ -397,13 +397,13 @@ display_top_tabs($tab_array); $starttime = substr ($temptimerange, 0, $temptimeseparator); $stoptime = substr ($temptimerange, $temptimeseparator+1); - if ($timerange['month']){ + if ($timerange['month']) { $tempmontharray = explode(",", $timerange['month']); - $tempdayarray = explode(",",$timerange['day']); + $tempdayarray = explode(",", $timerange['day']); $arraycounter = 0; $firstDayFound = false; $firstPrint = false; - foreach ($tempmontharray as $monthtmp){ + foreach ($tempmontharray as $monthtmp) { $month = $tempmontharray[$arraycounter]; $day = $tempdayarray[$arraycounter]; @@ -417,7 +417,7 @@ display_top_tabs($tab_array); $currentDay = $day; $nextDay = $tempdayarray[$arraycounter+1]; $currentDay++; - if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){ + if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])) { if ($firstPrint) $dayFriendly .= ", "; $currentDay--; @@ -440,8 +440,8 @@ display_top_tabs($tab_array); $firstDay = ""; $nextDay = ""; $counter = 0; - foreach ($tempFriendlyDayArray as $day){ - if ($day != ""){ + foreach ($tempFriendlyDayArray as $day) { + if ($day != "") { if (!$firstDayFound) { $firstDay = $tempFriendlyDayArray[$counter]; @@ -451,7 +451,7 @@ display_top_tabs($tab_array); //get next day $nextDay = $tempFriendlyDayArray[$counter+1]; $currentDay++; - if ($currentDay != $nextDay){ + if ($currentDay != $nextDay) { if ($firstprint) $dayFriendly .= ", "; $currentDay--; @@ -504,7 +504,7 @@ display_top_tabs($tab_array); '; echo $filterent['icmptype']; echo ''; diff --git a/src/usr/local/www/firewall_rules_edit.php b/src/usr/local/www/firewall_rules_edit.php index 8b77041..1162dea 100644 --- a/src/usr/local/www/firewall_rules_edit.php +++ b/src/usr/local/www/firewall_rules_edit.php @@ -86,16 +86,16 @@ function is_aoadv_used($rule_config) { // Note that the user could set "tag" or "tagged" to the string "0", which is valid but empty(). // And if the user enters "0" in other fields, we want to present an error message, and keep the Advanced Options section open. if ((isset($rule_config['allowopts'])) || - (isset($rule_config['disablereplyto'])) || - ($rule_config['tag'] != "") || - ($rule_config['tagged'] != "") || - ($rule_config['max'] != "") || - ($rule_config['max-src-nodes'] != "") || - ($rule_config['max-src-conn'] != "") || - ($rule_config['max-src-states'] != "") || - ($rule_config['max-src-conn-rate'] != "") || - ($rule_config['max-src-conn-rates'] != "") || - ($rule_config['statetimeout'] != "")) { + (isset($rule_config['disablereplyto'])) || + ($rule_config['tag'] != "") || + ($rule_config['tagged'] != "") || + ($rule_config['max'] != "") || + ($rule_config['max-src-nodes'] != "") || + ($rule_config['max-src-conn'] != "") || + ($rule_config['max-src-states'] != "") || + ($rule_config['max-src-conn-rate'] != "") || + ($rule_config['max-src-conn-rates'] != "") || + ($rule_config['statetimeout'] != "")) { return true; } return false; @@ -450,12 +450,12 @@ if ($_POST) { } if (isset($a_filter[$id]['associated-rule-id']) === false && - (!(is_specialnet($_POST['srctype']) || ($_POST['srctype'] == "single")))) { + (!(is_specialnet($_POST['srctype']) || ($_POST['srctype'] == "single")))) { $reqdfields[] = "srcmask"; $reqdfieldsn[] = "Source bit count"; } if (isset($a_filter[$id]['associated-rule-id']) === false && - (!(is_specialnet($_POST['dsttype']) || ($_POST['dsttype'] == "single")))) { + (!(is_specialnet($_POST['dsttype']) || ($_POST['dsttype'] == "single")))) { $reqdfields[] = "dstmask"; $reqdfieldsn[] = gettext("Destination bit count"); } @@ -493,7 +493,7 @@ if ($_POST) { $input_errors[] = 'The same port alias must be used in Source port range from: and to: fields'; } if ((is_alias($_POST['srcbeginport_cust']) && (!is_alias($_POST['srcendport_cust']) && $_POST['srcendport_cust'] != '')) || - ((!is_alias($_POST['srcbeginport_cust']) && $_POST['srcbeginport_cust'] != '') && is_alias($_POST['srcendport_cust']))) { + ((!is_alias($_POST['srcbeginport_cust']) && $_POST['srcbeginport_cust'] != '') && is_alias($_POST['srcendport_cust']))) { $input_errors[] = 'You cannot specify numbers and port aliases at the same time in Source port range from: and to: field'; } } @@ -507,7 +507,7 @@ if ($_POST) { $input_errors[] = 'The same port alias must be used in Destination port range from: and to: fields'; } if ((is_alias($_POST['dstbeginport_cust']) && (!is_alias($_POST['dstendport_cust']) && $_POST['dstendport_cust'] != '')) || - ((!is_alias($_POST['dstbeginport_cust']) && $_POST['dstbeginport_cust'] != '') && is_alias($_POST['dstendport_cust']))) { + ((!is_alias($_POST['dstbeginport_cust']) && $_POST['dstbeginport_cust'] != '') && is_alias($_POST['dstendport_cust']))) { $input_errors[] = 'You cannot specify numbers and port aliases at the same time in Destination port range from: and to: field'; } } @@ -702,7 +702,7 @@ if ($_POST) { } if ((($_POST['max-src-conn-rate'] <> "" and $_POST['max-src-conn-rates'] == "")) || - (($_POST['max-src-conn-rate'] == "" and $_POST['max-src-conn-rates'] <> ""))) { + (($_POST['max-src-conn-rate'] == "" and $_POST['max-src-conn-rates'] <> ""))) { $input_errors[] = gettext("Both maximum new connections per host and the interval (per second(s)) must be specified"); } @@ -1085,9 +1085,9 @@ $edit_disabled = isset($pconfig['associated-rule-id']); if ($edit_disabled) { $extra = ''; - foreach( $config['nat']['rule'] as $index => $nat_rule ) + foreach ($config['nat']['rule'] as $index => $nat_rule) { - if ($nat_rule['associated-rule-id'] === $pconfig['associated-rule-id'] ) + if ($nat_rule['associated-rule-id'] === $pconfig['associated-rule-id']) $extra = '
'. gettext('View the NAT rule') .''; } @@ -1143,7 +1143,7 @@ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enabl $interfaces["enc0"] = "IPsec"; /* add openvpn/tun interfaces */ -if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) +if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) $interfaces["openvpn"] = "OpenVPN"; $section->addInput($input = new Form_Select( @@ -1211,7 +1211,7 @@ $section->addInput(new Form_Select( 'carp' => 'CARP', 'pfsync' => 'PFSYNC', ) -))->setHelp('Choose which IP protocol this rule should match. In most cases, you should specify TCP here.'); +))->setHelp('Choose which IP protocol this rule should match. In most cases, you should specify TCP here.'); $section->addInput(new Form_Select( 'icmptype', @@ -1245,8 +1245,8 @@ foreach (['src' => 'Source', 'dst' => 'Destination'] as $type => $name) { if (is_specialnet($pconfig[$type])) $ruleType = 'network'; elseif ((is_ipaddrv6($pconfig[$type]) && $pconfig[$type.'mask'] == 128) || - (is_ipaddrv4($pconfig[$type]) && $pconfig[$type.'mask'] == 32) || - (is_alias($pconfig[$type]))) + (is_ipaddrv4($pconfig[$type]) && $pconfig[$type.'mask'] == 32) || + (is_alias($pconfig[$type]))) $ruleType = 'single'; $ruleValues = array( @@ -1287,7 +1287,7 @@ foreach (['src' => 'Source', 'dst' => 'Destination'] as $type => $name) { $section->add($group); - if($type == 'src') { + if ($type == 'src') { $section->addInput(new Form_Button( 'btnsrcadv', 'Show advanced' @@ -1336,14 +1336,14 @@ foreach (['src' => 'Source', 'dst' => 'Destination'] as $type => $name) { if ($type == 'src') $group->setHelp('Specify the source port or port range for this rule. This is '. 'usually random and almost never equal to the destination port range (and '. - 'should usually be any. You can leave the "To" field '. + 'should usually be any). You can leave the "To" field '. 'empty if you only want to filter a single port.'); else $group->setHelp('Specify the destination port or port range for this rule. ' . 'You can leave the "To" field empty if you only want to filter a '. 'single port.'); - $group->addClass( ($type == 'src') ? 'srcprtr':'dstprtr'); + $group->addClass(($type == 'src') ? 'srcprtr':'dstprtr'); $section->add($group); $form->add($section); } @@ -1669,7 +1669,7 @@ events.push(function(){ // Hides the
in which the specified input element lives so that the input, its label and help text are hidden function hideInput(id, hide) { - if(hide) + if (hide) $('#' + id).parent().parent('div').addClass('hidden'); else $('#' + id).parent().parent('div').removeClass('hidden'); @@ -1678,7 +1678,7 @@ events.push(function(){ // Hides the
in which the specified group input element lives so that the input, // its label and help text are hidden function hideGroupInput(id, hide) { - if(hide) + if (hide) $('#' + id).parent('div').addClass('hidden'); else $('#' + id).parent('div').removeClass('hidden'); @@ -1686,7 +1686,7 @@ events.push(function(){ // Hides the
in which the specified checkbox lives so that the checkbox, its label and help text are hidden function hideCheckbox(id, hide) { - if(hide) + if (hide) $('#' + id).parent().parent().parent('div').addClass('hidden'); else $('#' + id).parent().parent().parent('div').removeClass('hidden'); @@ -1699,7 +1699,7 @@ events.push(function(){ // Hides all elements of the specified class. This will usually be a section function hideClass(s_class, hide) { - if(hide) + if (hide) $('.' + s_class).hide(); else $('.' + s_class).show(); @@ -1707,7 +1707,7 @@ events.push(function(){ // Hides all elements of the specified class assigned to a group. This will usually be a group function hideGroupClass(s_class, hide) { - if(hide) + if (hide) $('.' + s_class).parent().parent().parent().hide(); else $('.' + s_class).parent().parent().parent().show(); @@ -1760,7 +1760,7 @@ events.push(function(){ disableInput('dstbeginport', true); disableInput('dstendport', true); } else { - if( editenabled ) { + if (editenabled) { disableInput('srcbeginport', false); disableInput('srcendport', false); disableInput('dstbeginport', false); @@ -1776,7 +1776,7 @@ events.push(function(){ } function typesel_change() { - if( editenabled ) { + if (editenabled) { switch ($('#srctype').find(":selected").index()) { case 1: // single disableInput('src', false); @@ -1840,11 +1840,11 @@ events.push(function(){ ext_change(); - if($('#proto').find(":selected").index() == 3 || $('#proto').find(":selected").index() == 4) { - if($('#ipprotocol').find(":selected").index() == 0) { // IPv4 + if ($('#proto').find(":selected").index() == 3 || $('#proto').find(":selected").index() == 4) { + if ($('#ipprotocol').find(":selected").index() == 0) { // IPv4 hideInput('icmptype', false); hideInput('icmp6type', true); - } else if($('#ipprotocol').find(":selected").index() == 1) { // IPv6 + } else if ($('#ipprotocol').find(":selected").index() == 1) { // IPv6 hideInput('icmptype', true); hideInput('icmp6type', false); } else { // IPv4 + IPv6 @@ -1856,7 +1856,7 @@ events.push(function(){ hideInput('icmp6type', true); } - if($('#proto').find(":selected").index() >= 0 && $('#proto').find(":selected").index() <= 2) { + if ($('#proto').find(":selected").index() >= 0 && $('#proto').find(":selected").index() <= 2) { hideClass('dstprtr', false); hideClass('srcprtr', false); } else { @@ -1932,12 +1932,12 @@ events.push(function(){ $('#toggle-advanced').click(function() { optionsvisible = 1; hideClass('advanced-options', false); - if($('#tcpflags_any').prop('checked')) + if ($('#tcpflags_any').prop('checked')) $('.table-flags').addClass('hidden'); }); $('#tcpflags_any').click(function () { - if(this.checked) + if (this.checked) $('.table-flags').addClass('hidden'); else $('.table-flags').removeClass('hidden'); @@ -1951,7 +1951,7 @@ events.push(function(){ function setOptText(target, val) { var dispstr = ''; - if(val == 'keep state') + if (val == 'keep state') dispstr += 'Keep: works with all IP protocols'; else if (val == 'sloppy state') dispstr += 'Sloppy: works with all IP protocols'; diff --git a/src/usr/local/www/firewall_schedule.php b/src/usr/local/www/firewall_schedule.php index f3e2062..d52884f 100644 --- a/src/usr/local/www/firewall_schedule.php +++ b/src/usr/local/www/firewall_schedule.php @@ -101,7 +101,7 @@ if ($_GET['act'] == "del") { } if ($is_schedule_referenced == true) { - $savemsg = sprintf(gettext("Cannot delete Schedule. Currently in use by %s"), $referenced_by); + $savemsg = sprintf(gettext("Cannot delete Schedule. Currently in use by %s"), $referenced_by); } else { unset($a_schedules[$_GET['id']]); write_config(); @@ -146,7 +146,7 @@ foreach ($a_schedules as $schedule): "; @@ -208,8 +208,8 @@ foreach ($a_schedules as $schedule): $nextDay = ""; $counter = 0; - foreach ($tempFriendlyDayArray as $day){ - if ($day != ""){ + foreach ($tempFriendlyDayArray as $day) { + if ($day != "") { if (!$firstDayFound) { $firstDay = $tempFriendlyDayArray[$counter]; @@ -221,7 +221,7 @@ foreach ($a_schedules as $schedule): $nextDay = $tempFriendlyDayArray[$counter+1]; $currentDay++; - if ($currentDay != $nextDay){ + if ($currentDay != $nextDay) { if ($firstprint) $dayFriendly .= "
"; @@ -269,7 +269,7 @@ endforeach;
- 0) ? gettext(CLOCK . ' Indicates that the scedule is currently active.'):''?> + 0) ? gettext(CLOCK . ' Indicates that the schedule is currently active.'):''?>