diff options
author | Phil Davis <phil.davis@inf.org> | 2015-09-01 01:08:25 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-09-01 01:08:25 +0545 |
commit | e6f34d22cf841af5ee8cfeba9f71a9729dc113d9 (patch) | |
tree | 5f8b896bd756d3e322ba90cfd1df36781f9322fd | |
parent | 683ba309d50913828decb5fe3f6ade059c1dfab2 (diff) | |
download | pfsense-e6f34d22cf841af5ee8cfeba9f71a9729dc113d9.zip pfsense-e6f34d22cf841af5ee8cfeba9f71a9729dc113d9.tar.gz |
bootstrap usr\local\www\f minor changes
19 files changed, 555 insertions, 555 deletions
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.") . "<br />" . 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); <tbody> <?php asort($a_aliases); - foreach ($a_aliases as $i=> $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"] . "<br />"; } 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 "…<br />"; } echo "<br />\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; ?> <tr id="fr<?=$nnats?>"> <td> <?php - if($natent['associated-rule-id'] == "pass"): + if ($natent['associated-rule-id'] == "pass"): ?> <i class="icon-play" title="<?=gettext("All traffic matching this NAT entry is passed")?>"></i> <?php @@ -428,7 +428,7 @@ events.push(function() { </script> <?php -if(count($a_nat) > 0) { +if (count($a_nat) > 0) { ?> <!-- Legend --> <div> 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 = '<a href="firewall_rules_edit.php?id=' . $filter_id . '">' . gettext("View the filter rule") . '</a><br />'; } } @@ -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 <div> 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<customarray.length; i++) { - if($('#dstbeginport_cust').val() == customarray[i]) { + for (i = 0; i < customarray.length; i++) { + if ($('#dstbeginport_cust').val() == customarray[i]) { $('#dstendport_cust').val(customarray[i]); $('#localbeginport_cust').val(customarray[i]); disableInput('dstendport_cust', true); @@ -1082,7 +1082,7 @@ events.push(function(){ disableInput('localbeginport', false); disableInput('localbeginport_cust', false); } - if($('#dstbeginport').val() == customarray[i]) { + if ($('#dstbeginport').val() == customarray[i]) { $('#dstendport_cust').val(customarray[i]); $('#localbeginport_cust').val(customarray[i]); disableInput('dstendport_cust', true); @@ -1092,7 +1092,7 @@ events.push(function(){ disableInput('localbeginport', false); disableInput('localbeginport_cust', false); } - if($('#dstendport_cust').val() == customarray[i]) { + if ($('#dstendport_cust').val() == customarray[i]) { $('#dstendport_cust').val(customarray[i]); $('#localbeginport_cust').val(customarray[i]); disableInput('dstendport_cust', true); @@ -1102,7 +1102,7 @@ events.push(function(){ disableInput('localbeginport', false); disableInput('localbeginport_cust', false); } - if($('#dstendport').val() == customarray[i]) { + if ($('#dstendport').val() == customarray[i]) { $('#dstendport_cust').val(customarray[i]); $('#localbeginport_cust').val(customarray[i]); disableInput('dstendport_cust', true); @@ -1159,7 +1159,7 @@ events.push(function(){ break; } - if(dstenabled) { + if (dstenabled) { switch ($('#dsttype').find(":selected").index()) { case 1: // single disableInput('dst', false); diff --git a/src/usr/local/www/firewall_nat_npt_edit.php b/src/usr/local/www/firewall_nat_npt_edit.php index 7e385e5..75585f4 100644 --- a/src/usr/local/www/firewall_nat_npt_edit.php +++ b/src/usr/local/www/firewall_nat_npt_edit.php @@ -180,36 +180,36 @@ function build_if_list() { global $ifdisp; foreach ($ifdisp 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 ($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="<a><img src=\'/themes/{$g['theme']}/images/misc/loader.gif\' alt=\'loader\' /> " .gettext("loading...")."</a>"; - 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']) + ); ?> <tr id="fr<?=$i?>"> <td> @@ -464,9 +464,9 @@ print($form); <td> <?php echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ; - if (!$natent['sourceport']) + if (!$natent['sourceport']) { echo "*"; - else { + } else { if (isset($alias['srcport'])): ?> @@ -487,9 +487,9 @@ print($form); <td> <?php - if (isset($natent['destination']['any'])) + if (isset($natent['destination']['any'])) { echo "*"; - else { + } else { if (isset($natent['destination']['not'])) echo "! "; @@ -515,9 +515,9 @@ print($form); <?php echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ; - if (!$natent['dstport']) + if (!$natent['dstport']) { echo "*"; - else { + } else { if (isset($alias['dstport'])): ?> <a href="/firewall_aliases_edit.php?id=<?=$alias['dstport']?>" data-toggle="popover" data-trigger="hover focus" title="Alias details" data-content="<?=alias_info_popup($alias['dstport'])?>" data-html="true"> @@ -560,7 +560,7 @@ print($form); <td> <?php - if(isset($natent['staticnatport'])) + if (isset($natent['staticnatport'])) echo gettext("YES"); else echo gettext("NO"); @@ -594,10 +594,10 @@ print($form); <?php if ($mode == "automatic" || $mode == "hybrid"): - if(empty($FilterIflist)) + if (empty($FilterIflist)) filter_generate_optcfg_array(); - if(empty($GatewaysList)) + if (empty($GatewaysList)) filter_generate_gateways(); $automatic_rules = filter_nat_rules_outbound_automatic(implode(" ", filter_nat_rules_automatic_tonathosts())); @@ -646,14 +646,14 @@ if ($mode == "automatic" || $mode == "hybrid"): </td> <td> <?php - if (isset($natent['destination']['any'])) + if (isset($natent['destination']['any'])) { echo "*"; - else { + } else { if (isset($natent['destination']['not'])) echo "! "; echo $natent['destination']['address']; - } + } ?> </td> <td> @@ -687,7 +687,7 @@ if ($mode == "automatic" || $mode == "hybrid"): </td> <td> <?php - if(isset($natent['staticnatport'])) + if (isset($natent['staticnatport'])) echo gettext("YES"); else echo gettext("NO"); @@ -709,8 +709,8 @@ endif; <div> <?php - print_info_box(gettext('If automatic outbound NAT selected, a mapping is automatically generated for each interface\'s subnet (except WAN-type connections) and the rules ' . - 'on "Mappings" section of this page are ignored.' . '<br />' . + 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.' . '<br />' . '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.' . '<br />' . 'If hybrid outbound NAT is selected, mappings you specify on this page will be used, followed by the automatically generated ones.' . '<br />' . 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 <div> 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 <div> 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 <div> 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.<br />You can also %s monitor %s the reload progress"),"<a href='status_filter_reload.php'>","</a>"); + $savemsg = sprintf(gettext("The settings have been applied. The firewall rules are now reloading in the background.<br />You can also %s monitor %s the reload progress"), "<a href='status_filter_reload.php'>", "</a>"); } } @@ -268,8 +268,8 @@ display_top_tabs($tab_array); <?php // Show the anti-lockout rule if it's enabled, and we are on LAN with an if count > 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('<br />', filter_get_antilockout_ports(true)); ?> <tr id="antilockout"> @@ -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); <td> <?php if (isset($filterent['ipprotocol'])) { - switch($filterent['ipprotocol']) { + switch ($filterent['ipprotocol']) { case "inet": echo "IPv4 "; break; @@ -524,7 +524,7 @@ display_top_tabs($tab_array); if (strtoupper($filterent['protocol']) == "ICMP" && !empty($filterent['icmptype'])) { echo ' <span style="cursor: help;" title="ICMP type: ' . - ( $filterent['ipprotocol'] == "inet6" ? $icmp6types[$filterent['icmptype']] : $icmptypes[$filterent['icmptype']] ) . + ($filterent['ipprotocol'] == "inet6" ? $icmp6types[$filterent['icmptype']] : $icmptypes[$filterent['icmptype']]) . '"><u>'; echo $filterent['icmptype']; echo '</u></span>'; 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 = '<br/><a href="firewall_nat_edit.php?id='. $index .'">'. gettext('View the NAT rule') .'</a>'; } @@ -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 <b>any.</b> You can leave the "To" field '. + 'should usually be <b>any</b>). 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 <div> 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 <div> 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 <div> 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 = '<font color="green">'; - if(val == 'keep state') + if (val == 'keep state') dispstr += 'Keep: works with all IP protocols</font>'; 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): <td> <?php $first = true; - foreach($schedule['timerange'] as $timerange) { + foreach ($schedule['timerange'] as $timerange) { $tempFriendlyTime = ""; $tempID = ""; $firstprint = false; @@ -164,11 +164,11 @@ foreach ($a_schedules as $schedule): 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]; @@ -182,7 +182,7 @@ foreach ($a_schedules as $schedule): $nextDay = $tempdayarray[$arraycounter+1]; $currentDay++; - if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){ + if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])) { if ($firstPrint) $dayFriendly .= "<br />"; @@ -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 .= "<br />"; @@ -269,7 +269,7 @@ endforeach; </div> </div> -<?=($i > 0) ? gettext(CLOCK . ' Indicates that the scedule is currently active.'):''?> +<?=($i > 0) ? gettext(CLOCK . ' Indicates that the schedule is currently active.'):''?> <nav class="action-buttons"> <a href="firewall_schedule_edit.php" class="btn btn-sm btn-success"><?=gettext("Add new schedule")?></a> diff --git a/src/usr/local/www/firewall_schedule_edit.php b/src/usr/local/www/firewall_schedule_edit.php index bec4029..1d66d54 100644 --- a/src/usr/local/www/firewall_schedule_edit.php +++ b/src/usr/local/www/firewall_schedule_edit.php @@ -70,13 +70,13 @@ function schedulecmp($a, $b) { return strcmp($a['name'], $b['name']); } -function schedule_sort(){ - global $g, $config; +function schedule_sort() { + global $g, $config; - if (!is_array($config['schedules']['schedule'])) - return; + if (!is_array($config['schedules']['schedule'])) + return; - usort($config['schedules']['schedule'], "schedulecmp"); + usort($config['schedules']['schedule'], "schedulecmp"); } require("guiconfig.inc"); @@ -84,12 +84,12 @@ require_once("functions.inc"); require_once("filter.inc"); require_once("shaper.inc"); -$pgtitle = array(gettext("Firewall"),gettext("Schedules"),gettext("Edit")); +$pgtitle = array(gettext("Firewall"), gettext("Schedules"), gettext("Edit")); $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_schedule.php'); -$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 (!is_array($config['schedules']['schedule'])) $config['schedules']['schedule'] = array(); @@ -112,13 +112,13 @@ if (isset($id) && $a_schedules[$id]) { if ($_POST) { - if(strtolower($_POST['name']) == "lan") + if (strtolower($_POST['name']) == "lan") $input_errors[] = gettext("Schedule may not be named LAN."); - if(strtolower($_POST['name']) == "wan") + if (strtolower($_POST['name']) == "wan") $input_errors[] = gettext("Schedule may not be named WAN."); - if(strtolower($_POST['name']) == "") + if (strtolower($_POST['name']) == "") $input_errors[] = gettext("Schedule name cannot be blank."); $x = is_validaliasname($_POST['name']); @@ -147,8 +147,8 @@ if ($_POST) { $timerangeFound = false; - for ($x=0; $x<99; $x++){ - if($_POST['schedule' . $x]) { + for ($x = 0; $x < 99; $x++) { + if ($_POST['schedule' . $x]) { if (!preg_match('/^[0-9]+:[0-9]+$/', $_POST['starttime' . $x])) { $input_errors[] = sprintf(gettext("Invalid start time - '%s'"), $_POST['starttime' . $x]); continue; @@ -181,7 +181,7 @@ if ($_POST) { $tempindarray = explode(",", $timestr); foreach ($tempindarray as $currentselection) { - if ($currentselection){ + if ($currentselection) { if ($firstprint) { $monthstr .= ","; @@ -216,10 +216,10 @@ if ($_POST) { else $schedule['schedlabel'] = uniqid(); - if (isset($id) && $a_schedules[$id]){ + if (isset($id) && $a_schedules[$id]) { $a_schedules[$id] = $schedule; } - else{ + else { $a_schedules[] = $schedule; } @@ -257,7 +257,7 @@ function build_date_table() { $monthcounter = date("n"); $yearcounter = date("Y"); - for ($k=0; $k<12; $k++){ + for ($k = 0; $k < 12; $k++) { $firstdayofmonth = date("w", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter))); if ($firstdayofmonth == 0) @@ -273,7 +273,7 @@ function build_date_table() { $mostr = '<div id="' . date("F_y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter))) ; $mostr .= '" style="position:relative; display:'; - if($firstmonth) + if ($firstmonth) $mostr .= "block"; else $mostr .= "none"; @@ -306,7 +306,7 @@ function build_date_table() { $mostr .= "<tr>"; } - if ($firstdayofmonth == $positioncounter){ + if ($firstdayofmonth == $positioncounter) { $mostr .= '<td class="text-center" style="cursor: pointer;" id="w' . $weekcounter . 'p' . $positioncounter . '" onclick="daytoggle(\'w' . $weekcounter . 'p' . $positioncounter . '-m' . $monthcounter . 'd' . $daycounter . '\');">' . $daycounter . "\r\n"; @@ -324,11 +324,11 @@ function build_date_table() { $mostr .= '<td class="text-center"></td>'; } - if ($positioncounter == 7 || $daycounter > $numberofdays){ + if ($positioncounter == 7 || $daycounter > $numberofdays) { $positioncounter = 1; $mostr .= "</tr>"; } - else{ + else { $positioncounter++; } @@ -362,7 +362,7 @@ function build_month_list() { $monthlimit = $monthcounter + 12; $yearcounter = date("Y"); - for ($k=0; $k<12; $k++){ + for ($k = 0; $k < 12; $k++) { $list[$monthcounter] = date("F_y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter))); if ($monthcounter == 12) { @@ -397,7 +397,7 @@ $input = new Form_Input( $input->setHelp((is_schedule_inuse($pconfig['name']) != true) ? 'The name of the alias may only consist of the characters a-z, A-Z and 0-9': 'This schedule is in use so the name may not be modified!'); -if(is_schedule_inuse($pconfig['name']) == true) +if (is_schedule_inuse($pconfig['name']) == true) $input->setReadonly(); $section->addInput($input); @@ -490,179 +490,179 @@ $form->add($section); $section = new Form_Section('Configured ranges'); $counter = 0; -if ($getSchedule){ +if ($getSchedule) { $maxrows = count($pconfig['timerange']) -1; - foreach($pconfig['timerange'] as $timerange) { + foreach ($pconfig['timerange'] as $timerange) { $tempFriendlyTime = ""; $tempID = ""; - if ($timerange){ - $dayFriendly = ""; - $tempFriendlyTime = ""; - $timedescr = $timerange['rangedescr']; - - //get hours - $temptimerange = $timerange['hour']; - $temptimeseparator = strrpos($temptimerange, "-"); - - $starttime = substr ($temptimerange, 0, $temptimeseparator); - $stoptime = substr ($temptimerange, $temptimeseparator+1); - $currentDay = ""; - $firstDay = ""; - $nextDay = ""; - $foundEnd = false; - $firstDayFound = false; - $firstPrint = false; - $firstprint2 = false; - - if ($timerange['month']){ - $tempmontharray = explode(",", $timerange['month']); - $tempdayarray = explode(",",$timerange['day']); - $arraycounter = 0; - foreach ($tempmontharray as $monthtmp){ - $month = $tempmontharray[$arraycounter]; - $day = $tempdayarray[$arraycounter]; - $daypos = date("w", mktime(0, 0, 0, date($month), date($day), date("Y"))); - //if sunday, set position to 7 to get correct week number. This is due to php limitations on ISO-8601. When we move to php5.1 we can change this. - if ($daypos == 0){ - $daypos = 7; - } - - $weeknumber = date("W", mktime(0, 0, 0, date($month), date($day), date("Y"))); - $weeknumber = ltrim($weeknumber, "0"); - - if ($firstPrint) - { - $tempID .= ","; - } - - $tempID .= "w" . $weeknumber . "p" . $daypos . "-m" . $month . "d" . $day; - $firstPrint = true; - - if (!$firstDayFound) - { - $firstDay = $day; - $firstmonth = $month; - $firstDayFound = true; - } - - $currentDay = $day; - $nextDay = $tempdayarray[$arraycounter+1]; - $currentDay++; - if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){ - if ($firstprint2) - $tempFriendlyTime .= ", "; - - $currentDay--; + if ($timerange) { + $dayFriendly = ""; + $tempFriendlyTime = ""; + $timedescr = $timerange['rangedescr']; + + //get hours + $temptimerange = $timerange['hour']; + $temptimeseparator = strrpos($temptimerange, "-"); + + $starttime = substr ($temptimerange, 0, $temptimeseparator); + $stoptime = substr ($temptimerange, $temptimeseparator+1); + $currentDay = ""; + $firstDay = ""; + $nextDay = ""; + $foundEnd = false; + $firstDayFound = false; + $firstPrint = false; + $firstprint2 = false; + + if ($timerange['month']) { + $tempmontharray = explode(",", $timerange['month']); + $tempdayarray = explode(",", $timerange['day']); + $arraycounter = 0; + foreach ($tempmontharray as $monthtmp) { + $month = $tempmontharray[$arraycounter]; + $day = $tempdayarray[$arraycounter]; + $daypos = date("w", mktime(0, 0, 0, date($month), date($day), date("Y"))); + //if sunday, set position to 7 to get correct week number. This is due to php limitations on ISO-8601. When we move to php5.1 we can change this. + if ($daypos == 0) { + $daypos = 7; + } - if ($currentDay != $firstDay) - $tempFriendlyTime .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ; - else - $tempFriendlyTime .= $monthArray[$month-1] . " " . $day; + $weeknumber = date("W", mktime(0, 0, 0, date($month), date($day), date("Y"))); + $weeknumber = ltrim($weeknumber, "0"); - $firstDayFound = false; - $firstprint2 = true; - } - $arraycounter++; - } + if ($firstPrint) + { + $tempID .= ","; + } - } - else - { - $dayFriendly = $timerange['position']; - $tempID = $dayFriendly; - } + $tempID .= "w" . $weeknumber . "p" . $daypos . "-m" . $month . "d" . $day; + $firstPrint = true; - $tempTime = $tempID . "||" . $starttime . "-" . $stoptime . "||" . $timedescr; - - //following code makes the days friendly appearing, IE instead of Mon, Tues, Wed it will show Mon - Wed - $foundEnd = false; - $firstDayFound = false; - $firstprint = false; - $tempFriendlyDayArray = explode(",", $dayFriendly); - $currentDay = ""; - $firstDay = ""; - $nextDay = ""; - $i = 0; - - if (!$timerange['month']){ - foreach ($tempFriendlyDayArray as $day){ - if ($day != ""){ if (!$firstDayFound) { - $firstDay = $tempFriendlyDayArray[$i]; + $firstDay = $day; + $firstmonth = $month; $firstDayFound = true; } - $currentDay =$tempFriendlyDayArray[$i]; - //get next day - $nextDay = $tempFriendlyDayArray[$i+1]; + $currentDay = $day; + $nextDay = $tempdayarray[$arraycounter+1]; $currentDay++; - - if ($currentDay != $nextDay){ - if ($firstprint) + if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])) { + if ($firstprint2) $tempFriendlyTime .= ", "; $currentDay--; if ($currentDay != $firstDay) - $tempFriendlyTime .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1]; + $tempFriendlyTime .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ; else - $tempFriendlyTime .= $dayArray[$firstDay-1]; + $tempFriendlyTime .= $monthArray[$month-1] . " " . $day; $firstDayFound = false; - $firstprint = true; + $firstprint2 = true; } - $i++; + $arraycounter++; } + } - } + else + { + $dayFriendly = $timerange['position']; + $tempID = $dayFriendly; + } + + $tempTime = $tempID . "||" . $starttime . "-" . $stoptime . "||" . $timedescr; - $group = new Form_Group(''); - $group->add(new Form_Input( - 'tempFriendlyTime', - null, - 'readonly', - $tempFriendlyTime - ))->setWidth(2)->setHelp($counter == $maxrows ? 'Day(s)':''); - - $group->add(new Form_Input( - 'starttime' . $counter, - null, - 'readonly', - $starttime - ))->setWidth(2)->setHelp($counter == $maxrows ? 'Start time':''); - - $group->add(new Form_Input( - 'stoptime' . $counter, - null, - 'readonly', - $stoptime - ))->setWidth(2)->setHelp($counter == $maxrows ? 'Stop time':''); - - $group->add(new Form_Input( - 'timedescr' . $counter, - null, - 'readonly', - $timedescr - ))->setWidth(2)->setHelp($counter == $maxrows ? 'Description':''); - - $group->add(new Form_Button( - 'Delete' . $counter, - 'Delete' - ))->removeClass('btn-primary')->addClass('btn-xs btn-warning'); - - $group->add(new Form_Input( - 'schedule' . $counter, - null, - 'hidden', - $tempID - )); - - $group->addClass('schedulegrp' . $counter); - - $counter++; - $section->add($group); + //following code makes the days friendly appearing, IE instead of Mon, Tues, Wed it will show Mon - Wed + $foundEnd = false; + $firstDayFound = false; + $firstprint = false; + $tempFriendlyDayArray = explode(",", $dayFriendly); + $currentDay = ""; + $firstDay = ""; + $nextDay = ""; + $i = 0; + + if (!$timerange['month']) { + foreach ($tempFriendlyDayArray as $day) { + if ($day != "") { + if (!$firstDayFound) + { + $firstDay = $tempFriendlyDayArray[$i]; + $firstDayFound = true; + } + + $currentDay =$tempFriendlyDayArray[$i]; + //get next day + $nextDay = $tempFriendlyDayArray[$i+1]; + $currentDay++; + + if ($currentDay != $nextDay) { + if ($firstprint) + $tempFriendlyTime .= ", "; + + $currentDay--; + + if ($currentDay != $firstDay) + $tempFriendlyTime .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1]; + else + $tempFriendlyTime .= $dayArray[$firstDay-1]; + + $firstDayFound = false; + $firstprint = true; + } + $i++; + } + } + } + + $group = new Form_Group(''); + $group->add(new Form_Input( + 'tempFriendlyTime', + null, + 'readonly', + $tempFriendlyTime + ))->setWidth(2)->setHelp($counter == $maxrows ? 'Day(s)':''); + + $group->add(new Form_Input( + 'starttime' . $counter, + null, + 'readonly', + $starttime + ))->setWidth(2)->setHelp($counter == $maxrows ? 'Start time':''); + + $group->add(new Form_Input( + 'stoptime' . $counter, + null, + 'readonly', + $stoptime + ))->setWidth(2)->setHelp($counter == $maxrows ? 'Stop time':''); + + $group->add(new Form_Input( + 'timedescr' . $counter, + null, + 'readonly', + $timedescr + ))->setWidth(2)->setHelp($counter == $maxrows ? 'Description':''); + + $group->add(new Form_Button( + 'Delete' . $counter, + 'Delete' + ))->removeClass('btn-primary')->addClass('btn-xs btn-warning'); + + $group->add(new Form_Input( + 'schedule' . $counter, + null, + 'hidden', + $tempID + )); + + $group->addClass('schedulegrp' . $counter); + + $counter++; + $section->add($group); } } } @@ -738,10 +738,10 @@ function repeatExistingDays(){ var dayarray = daysSelected.split(","); - for (i=0; i<=dayarray.length; i++){ + for (i=0; i<=dayarray.length; i++) { tempstr = dayarray[i]; tempstrdaypos = tempstr.search("p"); - week = tempstr.substring(1,tempstrdaypos); + week = tempstr.substring(1, tempstrdaypos); week = parseInt(week); dashpos = tempstr.search("-"); daypos = tempstr.substring(tempstrdaypos+1, dashpos); @@ -750,7 +750,7 @@ function repeatExistingDays(){ daydone = dayposdone.search(daypos); tempstr = 'w' + week + 'p' + daypos; daycell = eval('document.getElementById(tempstr)'); - if (daydone == "-1"){ + if (daydone == "-1") { if (rgb2hex(daycell.style.backgroundColor) == "#F08080") // lightcoral daytogglerepeating(week,daypos,true); else @@ -773,7 +773,7 @@ function daytogglerepeating(week,daypos,bExists){ //unselect it and remove original day from daysSelected string if (daycell != null) { - if (bExists){ + if (bExists) { daycell.style.backgroundColor = "#FFFFFF"; // white } else @@ -797,7 +797,7 @@ function daytoggle(id) { iddashpos = id.search("-"); var tempstrdaypos = id.search("p"); - var week = id.substring(1,tempstrdaypos); + var week = id.substring(1, tempstrdaypos); week = parseInt(week); @@ -808,17 +808,17 @@ function daytoggle(id) { } else { - idmod = id.substring(0,iddashpos); - var daypos = id.substring(tempstrdaypos+1,iddashpos); + idmod = id.substring(0, iddashpos); + var daypos = id.substring(tempstrdaypos+1, iddashpos); } daypos = parseInt(daypos); - while (!bFoundValid){ + while (!bFoundValid) { var daycell = document.getElementById(idmod); - if (daycell != null){ - if (rgb2hex(daycell.style.backgroundColor) == "#FF0000"){ // red + if (daycell != null) { + if (rgb2hex(daycell.style.backgroundColor) == "#FF0000") { // red daycell.style.backgroundColor = "#FFFFFF"; // white str = id + ","; daysSelected = daysSelected.replace(str, ""); @@ -852,22 +852,22 @@ function daytoggle(id) { } } -function update_month(){ +function update_month() { var indexNum = document.forms[0].monthsel.selectedIndex; var selected = document.forms[0].monthsel.options[indexNum].text; - for (i=0; i<=11; i++){ + for (i = 0; i <= 11; i++) { option = document.forms[0].monthsel.options[i].text; document.popupMonthLayer = eval('document.getElementById (option)'); - if(selected == option) + if (selected == option) document.popupMonthLayer.style.display="block"; else document.popupMonthLayer.style.display="none"; } } -function checkForRanges(){ +function checkForRanges() { if (daysSelected != "") { alert("You have not saved the specified time range. Please click 'Add Time' button to save the time range."); @@ -879,7 +879,7 @@ function checkForRanges(){ } } -function processEntries(){ +function processEntries() { var tempstr, starttimehour, starttimemin, stoptimehour, stoptimemin, errors = ""; var passedValidiation = true; @@ -898,13 +898,13 @@ function processEntries(){ } else if (starttimehour == stoptimehour) { - if (starttimemin > stoptimemin){ + if (starttimemin > stoptimemin) { errors = "Error: Start Minute cannot be greater than Stop Minute."; passedValidiation = false; } } - if (passedValidiation){ + if (passedValidiation) { addTimeRange(); } else { @@ -913,7 +913,7 @@ function processEntries(){ } } -function addTimeRange(){ +function addTimeRange() { var tempdayarray = daysSelected.split(","); var tempstr, tempFriendlyDay, starttimehour, starttimemin, stoptimehour, nrtempFriendlyTime, rtempFriendlyTime, nrtempID, rtempID = ""; var stoptimemin, timeRange, tempstrdaypos, week, daypos, day, month, dashpos, nrtempTime, rtempTime, monthstr, daystr = ""; @@ -931,7 +931,7 @@ function addTimeRange(){ //check for existing entries var findCurrentCounter; - for (u=0; u<99; u++){ + for (u = 0; u < 99; u++) { findCurrentCounter = document.getElementById("schedule" + u); if (!findCurrentCounter) { @@ -940,16 +940,16 @@ function addTimeRange(){ } } - if (daysSelected != ""){ + if (daysSelected != "") { //get days selected - for (i=0; i<tempdayarray.length; i++) + for (i = 0; i < tempdayarray.length; i++) { tempstr = tempdayarray[i]; if (tempstr != "") { tempstrdaypos = tempstr.search("p"); - week = tempstr.substring(1,tempstrdaypos); + week = tempstr.substring(1, tempstrdaypos); week = parseInt(week); dashpos = tempstr.search("-"); @@ -987,9 +987,9 @@ function addTimeRange(){ var tempFriendlyDayArray = daystr.split(","); var currentDay, firstDay, nextDay, currentMonth, nextMonth, firstDay, firstMonth = ""; - for (k=0; k<tempFriendlyMonthArray.length; k++){ + for (k = 0; k < tempFriendlyMonthArray.length; k++) { tempstr = tempFriendlyMonthArray[k]; - if (tempstr != ""){ + if (tempstr != "") { if (!firstDayFound) { firstDay = tempFriendlyDayArray[k]; @@ -1007,7 +1007,7 @@ function addTimeRange(){ //get next month currentDay++; - if ((currentDay != nextDay) || (tempFriendlyMonthArray[k] != tempFriendlyMonthArray[k+1])){ + if ((currentDay != nextDay) || (tempFriendlyMonthArray[k] != tempFriendlyMonthArray[k+1])) { if (firstprint) nrtempFriendlyTime += ", "; @@ -1032,9 +1032,9 @@ function addTimeRange(){ tempFriendlyDayArray.sort(); currentDay, firstDay, nextDay = ""; - for (k=0; k<tempFriendlyDayArray.length; k++){ + for (k = 0; k < tempFriendlyDayArray.length; k++) { tempstr = tempFriendlyDayArray[k]; - if (tempstr != ""){ + if (tempstr != "") { if (!firstDayFound) { firstDay = tempFriendlyDayArray[k]; @@ -1049,7 +1049,7 @@ function addTimeRange(){ nextDay = parseInt(nextDay); currentDay++; - if (currentDay != nextDay){ + if (currentDay != nextDay) { if (firstprint) rtempFriendlyTime += ", "; @@ -1074,10 +1074,10 @@ function addTimeRange(){ //clear tempID rtempID = ""; - for (t=0; t<tempsortArray.length; t++) + for (t = 0; t < tempsortArray.length; t++) { - if (tempsortArray[t] != ""){ - if (!isFirstdone){ + if (tempsortArray[t] != "") { + if (!isFirstdone) { rtempID += tempsortArray[t]; isFirstdone = true; } @@ -1100,7 +1100,7 @@ function addTimeRange(){ //get description for time range var tempdescr = document.getElementById("timerangedescr").value - if (nonrepeatingfound){ + if (nonrepeatingfound) { nrtempTime += nrtempID; //add time ranges nrtempTime += timeRange; @@ -1109,7 +1109,7 @@ function addTimeRange(){ insertElements(nrtempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, nrtempTime, nrtempID); } - if (repeatingfound){ + if (repeatingfound) { rtempTime += rtempID; //add time ranges rtempTime += timeRange; @@ -1126,32 +1126,32 @@ function addTimeRange(){ } } -function clearCalendar(){ +function clearCalendar() { var tempstr, daycell = ""; //clear days selected daysSelected = ""; //loop through all 52 weeks - for (j=1; j<=53; j++) + for (j = 1; j <= 53; j++) { //loop through all 7 days - for (k=1; k<8; k++){ + for (k = 1; k < 8; k++) { tempstr = 'w' + j + 'p' + k; daycell = eval('document.getElementById(tempstr)'); - if (daycell != null){ + if (daycell != null) { daycell.style.backgroundColor = "#FFFFFF"; // white } } } } -function clearTime(){ +function clearTime() { document.getElementById("starttimehour").value = "0"; document.getElementById("starttimemin").value = "00"; document.getElementById("stoptimehour").value = "23"; document.getElementById("stoptimemin").value = "59"; } -function clearDescr(){ +function clearDescr() { document.getElementById("timerangedescr").value = ""; } @@ -1161,8 +1161,8 @@ var counter = -1; function insertElements(tempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, tempTime, tempID) { var rowhtml; - if(counter < 0) { - counter = <?php if(!isset($counter)) echo '0'; else echo $counter ?>; + if (counter < 0) { + counter = <?php if (!isset($counter)) echo '0'; else echo $counter ?>; rows_displayed = counter; } diff --git a/src/usr/local/www/firewall_shaper.php b/src/usr/local/www/firewall_shaper.php index 5050f9a..e65094d 100644 --- a/src/usr/local/www/firewall_shaper.php +++ b/src/usr/local/www/firewall_shaper.php @@ -75,7 +75,7 @@ require_once("filter.inc"); require_once("shaper.inc"); require_once("rrd.inc"); -if($_GET['reset'] != "") { +if ($_GET['reset'] != "") { /* XXX: Huh, why are we killing php? */ mwexec("killall -9 pfctl php"); exit; @@ -382,7 +382,7 @@ if ($_POST) { mwexec("killall qstats"); } -if(!$_POST && !$_GET){ +if (!$_POST && !$_GET) { $dfltmsg = true; $dontshow = true; } @@ -465,13 +465,13 @@ if (count($altq_list_queues) > 0) { <td> <?php -if($dfltmsg) +if ($dfltmsg) print_info_box($default_shaper_msg); else { // Add global buttons if (!$dontshow || $newqueue) { if ($can_add || $addnewaltq) { - if($queue) + if ($queue) $url = 'firewall_shaper.php?interface='. $interface . '&queue=' . $queue->GetQname() . '&action=add'; else $url = 'firewall_shaper.php?interface='. $interface . '&action=add'; @@ -483,7 +483,7 @@ else { ))->removeClass('btn-default')->addClass('btn-success'); } - if($queue) + if ($queue) $url = 'firewall_shaper.php?interface='. $interface . '&queue=' . $queue->GetQname() . '&action=delete'; else $url = 'firewall_shaper.php?interface='. $interface . '&action=delete'; diff --git a/src/usr/local/www/firewall_shaper_layer7.php b/src/usr/local/www/firewall_shaper_layer7.php index db350bd..3ed34dd 100644 --- a/src/usr/local/www/firewall_shaper_layer7.php +++ b/src/usr/local/www/firewall_shaper_layer7.php @@ -98,7 +98,7 @@ read_layer7_config(); $sform = new Form(false); -if($_GET['reset'] != "") { +if ($_GET['reset'] != "") { // kill all ipfw-classifyd processes mwexec("killall -9 ipfw-classifyd"); exit; @@ -134,7 +134,7 @@ if ($_GET) { break; case "show": $show_proto_form = true; - if($container) { + if ($container) { $sform = $container->build_form(); } else { @@ -155,7 +155,7 @@ if ($_POST) { $show_proto_form = true; unset($input_errors); - if($_POST['Submit']) { + if ($_POST['Submit']) { if (isset($layer7_rules_list[$name])) { $l7r = $layer7_rules_list[$name]; @@ -225,7 +225,7 @@ if ($_POST) { clear_subsystem_dirty('shaper'); - if($container) { + if ($container) { $sform = $container->build_form(); } else { $show_proto_form = false; @@ -245,7 +245,7 @@ if ($_POST) { } } -if(!$_GET && !$_POST) { +if (!$_GET && !$_POST) { $show_proto_form = false; $dfltmsg = true; } @@ -325,12 +325,12 @@ function fillStructure() { var name; <?php foreach ($avail_structures as $key => $struct) { ?> name = "<?= $struct; ?>"; - if(name == "queue") { - if(js_behaviours_altq != "") { structure += "<option value=" + name + ">" + name + "<\/option>";} + if (name == "queue") { + if (js_behaviours_altq != "") { structure += "<option value=" + name + ">" + name + "<\/option>";} } else { - if(name == "limiter") { - if(js_behaviours_limiter != "") { structure += "<option value=" + name + ">" + name + "<\/option>";} + if (name == "limiter") { + if (js_behaviours_limiter != "") { structure += "<option value=" + name + ">" + name + "<\/option>";} } else structure += "<option value=" + name + ">" + name + "<\/option>"; //action } @@ -394,8 +394,8 @@ function addRow(table_id) { initial_count[table_id] = rows_count; } // determining real count of added fields - var tFielsNum = rows_count - initial_count[table_id]; - if (rows_limit!=0 && tFielsNum >= rows_limit) return false; + var tFielsNum = rows_count - initial_count[table_id]; + if (rows_limit != 0 && tFielsNum >= rows_limit) return false; var remove = '<a class="btn btn-default" onclick="removeRow(\''+table_id+'\',this.parentNode.parentNode)">Remove<\/a>'; @@ -441,13 +441,13 @@ function build_l7table() { $tbl .= '<thead><tr><th>Protocol</th><th>Structure</th><th>Behavior</th></tr></thead>'; $tbl .= '<tbody>'; - if($container) { - foreach($container->rsets as $l7rule) { + if ($container) { + foreach ($container->rsets as $l7rule) { $tbl .= '<tr><td>'; $tbl .= '<select name="protocol[]" class="form-control">'; - foreach($avail_protos as $proto): + foreach ($avail_protos as $proto): $tbl .= '<option value="' . $proto . '"'; if ($proto == $l7rule->GetRProtocol()) @@ -460,9 +460,9 @@ function build_l7table() { $tbl .= '</select></td><td>'; $tbl .= '<select name="structure[]" class="form-control" onchange="changeBehaviourValues(this.parentNode.parentNode);">'; - foreach($avail_structures as $struct) { - if($struct == "queue") { - if(!empty($avail_behaviours_altq)) { + foreach ($avail_structures as $struct) { + if ($struct == "queue") { + if (!empty($avail_behaviours_altq)) { $tbl .= '<option value="' . $struct . '"'; if ($struct == $l7rule->GetRStructure()) $tbl .= ' selected="selected"'; @@ -471,8 +471,8 @@ function build_l7table() { } } else { - if($struct == "limiter") { - if(!empty($avail_behaviours_limiter)) { + if ($struct == "limiter") { + if (!empty($avail_behaviours_limiter)) { $tbl .= '<option value="' . $struct . '"'; if ($struct == $l7rule->GetRStructure()) $tbl .= ' selected="selected"'; @@ -481,7 +481,7 @@ function build_l7table() { } } else { - if($struct == "action") { + if ($struct == "action") { $tbl .= '<option value="' . $struct . '"'; if ($struct == $l7rule->GetRStructure()) $tbl .= ' selected="selected"'; @@ -496,8 +496,8 @@ function build_l7table() { $tbl .= '<select name="behaviour[]" class="form-control">'; - if($l7rule->GetRStructure() == "action"): - foreach($avail_behaviours_action as $behaviour): + if ($l7rule->GetRStructure() == "action"): + foreach ($avail_behaviours_action as $behaviour): $tbl .= '<option value="' . $behaviour . '"'; if ($behaviour == $l7rule->GetRBehaviour()) $tbl .= ' selected="selected"'; @@ -510,8 +510,8 @@ function build_l7table() { endif; - if($l7rule->GetRStructure() == "queue"): - foreach($avail_behaviours_altq as $behaviour): + if ($l7rule->GetRStructure() == "queue"): + foreach ($avail_behaviours_altq as $behaviour): $tbl .= '<option value="' . $behaviour . '"'; if ($behaviour == $l7rule->GetRBehaviour()) @@ -525,8 +525,8 @@ function build_l7table() { endif; - if($l7rule->GetRStructure() == "limiter"): - foreach($avail_behaviours_limiter as $behaviour): + if ($l7rule->GetRStructure() == "limiter"): + foreach ($avail_behaviours_limiter as $behaviour): $tbl .= '<option value="' . $behaviour . '"'; if ($behaviour == $l7rule->GetRBehaviour()) $tbl .= ' selected="selected"'; @@ -574,7 +574,7 @@ $tab_array[] = array(gettext("Wizards"), false, "firewall_shaper_wizards.php"); display_top_tabs($tab_array); // Create a StaticText control and populate it with the rules table -if(!$dfltmsg) { +if (!$dfltmsg) { $section = new Form_Section('Add one (or more) rules'); $section->addInput(new Form_StaticText( @@ -599,7 +599,7 @@ if(!$dfltmsg) { </div> <div class="col-sm-10"> <?php -if($dfltmsg) +if ($dfltmsg) print_info_box($output_form = $dn_default_shaper_msg . $default_layer7shaper_msg); else print($sform); diff --git a/src/usr/local/www/firewall_shaper_queues.php b/src/usr/local/www/firewall_shaper_queues.php index 5d1bbb7..190ca28 100644 --- a/src/usr/local/www/firewall_shaper_queues.php +++ b/src/usr/local/www/firewall_shaper_queues.php @@ -73,7 +73,7 @@ require_once("filter.inc"); require_once("shaper.inc"); require_once("rrd.inc"); -if($_GET['reset'] != "") { +if ($_GET['reset'] != "") { mwexec("killall -9 pfctl"); exit; } diff --git a/src/usr/local/www/firewall_shaper_vinterface.php b/src/usr/local/www/firewall_shaper_vinterface.php index da5ae24..c0e2a99 100644 --- a/src/usr/local/www/firewall_shaper_vinterface.php +++ b/src/usr/local/www/firewall_shaper_vinterface.php @@ -73,7 +73,7 @@ require_once("functions.inc"); require_once("filter.inc"); require_once("shaper.inc"); -if($_GET['reset'] != "") { +if ($_GET['reset'] != "") { mwexec("/usr/bin/killall -9 pfctl"); exit; } @@ -293,40 +293,40 @@ if ($_POST) { } else $input_errors[] = gettext("Could not add new queue."); } else if ($_POST['apply']) { - write_config(); + write_config(); - $retval = 0; - $retval = filter_configure(); - $savemsg = get_std_save_message($retval); + $retval = 0; + $retval = filter_configure(); + $savemsg = get_std_save_message($retval); - if (stristr($retval, "error") != true) - $savemsg = get_std_save_message($retval); - else - $savemsg = $retval; + if (stristr($retval, "error") != true) + $savemsg = get_std_save_message($retval); + else + $savemsg = $retval; /* XXX: TODO Make dummynet pretty graphs */ // enable_rrd_graphing(); - clear_subsystem_dirty('shaper'); + clear_subsystem_dirty('shaper'); - if ($queue) { - $sform = $queue->build_form(); - $dontshow = false; - } - else { - $output_form .= $dn_default_shaper_message; - $dontshow = true; - } + if ($queue) { + $sform = $queue->build_form(); + $dontshow = false; + } + else { + $output_form .= $dn_default_shaper_message; + $dontshow = true; + } } else if ($queue) { - $queue->validate_input($_POST, $input_errors); - if (!$input_errors) { + $queue->validate_input($_POST, $input_errors); + if (!$input_errors) { $queue->update_dn_data($_POST); $queue->wconfig(); if (write_config()) mark_subsystem_dirty('shaper'); $dontshow = false; - } + } read_dummynet_config(); $sform = $queue->build_form(); } else { @@ -335,20 +335,20 @@ if ($_POST) { } } -if(!$_POST && !$_GET) { +if (!$_POST && !$_GET) { $dfltmsg = true; $dontshow = true; } if ($queue) { if ($queue->GetEnabled()) - $can_enable = true; + $can_enable = true; else - $can_enable = false; + $can_enable = false; if ($queue->CanHaveChildren()) { $can_add = true; } else - $can_add = false; + $can_add = false; } $tree = "<ul class=\"tree\" >"; @@ -418,13 +418,13 @@ display_top_tabs($tab_array); <td> <?php -if($dfltmsg) +if ($dfltmsg) print_info_box($dn_default_shaper_msg); else { // Add global buttons if (!$dontshow || $newqueue) { if ($can_add || $addnewaltq) { - if($queue) + if ($queue) $url = 'href="firewall_shaper_vinterface.php?pipe=' . $pipe . '&queue=' . $queue->GetQname() . '&action=add'; else $url = 'firewall_shaper.php?pipe='. $pipe . '&action=add'; @@ -436,7 +436,7 @@ else { ))->removeClass('btn-default')->addClass('btn-success'); } - if($queue) + if ($queue) $url = 'firewall_shaper_vinterface.php?pipe='. $pipe . '&queue=' . $queue->GetQname() . '&action=delete'; else $url = 'firewall_shaper_vinterface.php?pipe='. $pipe . '&action=delete'; diff --git a/src/usr/local/www/firewall_shaper_wizards.php b/src/usr/local/www/firewall_shaper_wizards.php index 18cc97e..7ea8e55 100644 --- a/src/usr/local/www/firewall_shaper_wizards.php +++ b/src/usr/local/www/firewall_shaper_wizards.php @@ -73,7 +73,7 @@ require_once("filter.inc"); require_once("shaper.inc"); require_once("util.inc"); -if($_GET['reset'] != "") { +if ($_GET['reset'] != "") { sigkillbyname('pfctl', SIGKILL); exit; } diff --git a/src/usr/local/www/firewall_virtual_ip.php b/src/usr/local/www/firewall_virtual_ip.php index e321603..ca80307 100644 --- a/src/usr/local/www/firewall_virtual_ip.php +++ b/src/usr/local/www/firewall_virtual_ip.php @@ -127,7 +127,7 @@ if ($_GET['act'] == "del") { /* make sure no inbound NAT mappings reference this entry */ if (is_array($config['nat']['rule'])) { foreach ($config['nat']['rule'] as $rule) { - if($rule['destination']['address'] != "") { + if ($rule['destination']['address'] != "") { if ($rule['destination']['address'] == $a_vip[$_GET['id']]['subnet']) { $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one NAT mapping."); break; @@ -272,7 +272,7 @@ $types = array('proxyarp' => 'Proxy ARP', 'ipalias' => 'IP Alias' ); -$pgtitle = array(gettext("Firewall"),gettext("Virtual IP Addresses")); +$pgtitle = array(gettext("Firewall"), gettext("Virtual IP Addresses")); include("head.inc"); if ($input_errors) @@ -314,20 +314,20 @@ $interfaces['lo0'] = "Localhost"; $i = 0; foreach ($a_vip as $vipent): - if( $vipent['subnet'] != "" or $vipent['range'] != "" or - $vipent['subnet_bits'] != "" or (isset($vipent['range']['from']) && $vipent['range']['from'] != "")): + if ($vipent['subnet'] != "" or $vipent['range'] != "" or + $vipent['subnet_bits'] != "" or (isset($vipent['range']['from']) && $vipent['range']['from'] != "")): ?> <tr> <td> <?php if (($vipent['type'] == "single") || ($vipent['type'] == "network")) - if($vipent['subnet_bits']) + if ($vipent['subnet_bits']) print("{$vipent['subnet']}/{$vipent['subnet_bits']}"); if ($vipent['type'] == "range") print("{$vipent['range']['from']}-{$vipent['range']['to']}"); - if($vipent['mode'] == "carp") + if ($vipent['mode'] == "carp") print(" (vhid: {$vipent['vhid']})"); ?> </td> |