diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/usr/local/www/firewall_aliases_edit.php | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/src/usr/local/www/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php index a83b5d9..128335d 100755 --- a/src/usr/local/www/firewall_aliases_edit.php +++ b/src/usr/local/www/firewall_aliases_edit.php @@ -106,6 +106,16 @@ if ($debug) { unlink_if_exists("{$g['tmp_path']}/alias_rename_log.txt"); } +$singular_types = array( + 'host' => gettext("host"), + 'network' => gettext("network"), + 'port' => gettext("port"), + 'url' => gettext("URL (IP)"), + 'url_ports' => gettext("URL (Port)"), + 'urltable' => gettext("URL Table (IP)"), + 'urltable_ports' => gettext("URL Table (Port)"), +); + function alias_same_type($name, $type) { global $config; @@ -172,7 +182,7 @@ if ($_POST) { $input_errors[] = gettext("Reserved word used for alias name."); } else { if (is_validaliasname($_POST['name']) == false) { - $input_errors[] = gettext("The alias name must be less than 32 characters long, may not consist of only numbers, may not consist of only underscores, and may only contain the following characters:") . ' a-z, A-Z, 0-9, _'; + $input_errors[] = sprintf(gettext("The alias name must be less than 32 characters long, may not consist of only numbers, may not consist of only underscores, and may only contain the following characters: %s"), 'a-z, A-Z, 0-9, _'); } } /* check for name conflicts */ @@ -186,7 +196,7 @@ if ($_POST) { /* Check for reserved keyword names */ foreach ($reserved_keywords as $rk) { if ($rk == $_POST['name']) { - $input_errors[] = sprintf(gettext("Cannot use a reserved keyword as alias name %s"), $rk); + $input_errors[] = sprintf(gettext("Cannot use a reserved keyword as an alias name: %s"), $rk); } } @@ -428,18 +438,18 @@ if ($_POST) { } } else if ($_POST['type'] == "port") { if (!is_port($input_address) && !is_portrange($input_address)) { - $input_errors[] = $input_address . " " . gettext("is not a valid port or alias."); + $input_errors[] = sprintf(gettext("%s is not a valid port or alias."), $input_address); } } else if ($_POST['type'] == "host" || $_POST['type'] == "network") { if (is_subnet($input_address) || (!is_ipaddr($input_address) && !is_hostname($input_address))) { - $input_errors[] = sprintf(gettext('%1$s is not a valid %2$s address, FQDN or alias.'), $input_address, $_POST['type']); + $input_errors[] = sprintf(gettext('%1$s is not a valid %2$s address, FQDN or alias.'), $input_address, $singular_types[$_POST['type']]); } } $tmpaddress = $input_address; if ($_POST['type'] != "host" && is_ipaddr($input_address) && $input_address_subnet[$idx] <> "") { if (!is_subnet($input_address . "/" . $input_address_subnet[$idx])) { - $input_errors[] = sprintf(gettext('%s/%s is not a valid subnet.'), $input_address, $input_address_subnet[$idx]); + $input_errors[] = sprintf(gettext('%1$s/%2$s is not a valid subnet.'), $input_address, $input_address_subnet[$idx]); } else { $tmpaddress .= "/" . $input_address_subnet[$idx]; } @@ -557,7 +567,7 @@ $section_str = array( 'url_ports' => gettext("URL (Ports)"), 'urltable' => gettext("URL Table (IPs)"), 'urltable_ports' => gettext("URL Table (Ports)") - ); +); $btn_str = array( 'network' => gettext("Add Network"), @@ -567,7 +577,7 @@ $btn_str = array( 'url_ports' => gettext("Add URL"), 'urltable' => gettext("Add URL Table"), 'urltable_ports' => gettext("Add URL Table") - ); +); $label_str = array( 'network' => gettext("Network or FQDN"), @@ -577,18 +587,20 @@ $label_str = array( 'url_ports' => gettext("URL (Ports)"), 'urltable' => gettext("URL Table (IPs)"), 'urltable_ports' => gettext("URL Table (Ports)") - ); +); + +$special_cidr_usage_text = gettext("The value after the \"/\" is the update frequency in days."); $help = array( - 'network' => "Networks are specified in CIDR format. Select the CIDR mask that pertains to each entry. /32 specifies a single IPv4 host, /128 specifies a single IPv6 host, /24 specifies 255.255.255.0, /64 specifies a normal IPv6 network, etc. Hostnames (FQDNs) may also be specified, using a /32 mask for IPv4 or /128 for IPv6. You may also enter an IP range such as 192.168.1.1-192.168.1.254 and a list of CIDR networks will be derived to fill the range.", - 'host' => "Enter as many hosts as you would like. Hosts must be specified by their IP address or fully qualified domain name (FQDN). FQDN hostnames are periodically re-resolved and updated. If multiple IPs are returned by a DNS query, all are used. You may also enter an IP range such as 192.168.1.1-192.168.1.10 or a small subnet such as 192.168.1.16/28 and a list of individual IP addresses will be generated.", - 'port' => "Enter as many ports as you wish. Port ranges can be expressed by separating with a colon.", - 'url' => "Enter as many URLs as you wish. After saving we will download the URL and import the items into the alias. Use only with small sets of IP addresses (less than 3000).", - 'url_ports' => "Enter as many URLs as you wish. After saving we will download the URL and import the items into the alias. Use only with small sets of Ports (less than 3000).", - 'urltable' => "Enter a single URL containing a large number of IPs and/or Subnets. After saving we will download the URL and create a table file containing these addresses. This will work with large numbers of addresses (30,000+) or small numbers." . "<br /><b>The value after the \"/\" is the " . - "update frequency in days.</b>", - 'urltable_ports' => "Enter a single URL containing a list of Port numbers and/or Port ranges. After saving we will download the URL." . "<br /><b>The value after the \"/\" is the " . - "update frequency in days.</b>" + 'network' => gettext("Networks are specified in CIDR format. Select the CIDR mask that pertains to each entry. /32 specifies a single IPv4 host, /128 specifies a single IPv6 host, /24 specifies 255.255.255.0, /64 specifies a normal IPv6 network, etc. Hostnames (FQDNs) may also be specified, using a /32 mask for IPv4 or /128 for IPv6. You may also enter an IP range such as 192.168.1.1-192.168.1.254 and a list of CIDR networks will be derived to fill the range."), + 'host' => gettext("Enter as many hosts as you would like. Hosts must be specified by their IP address or fully qualified domain name (FQDN). FQDN hostnames are periodically re-resolved and updated. If multiple IPs are returned by a DNS query, all are used. You may also enter an IP range such as 192.168.1.1-192.168.1.10 or a small subnet such as 192.168.1.16/28 and a list of individual IP addresses will be generated."), + 'port' => gettext("Enter as many ports as you wish. Port ranges can be expressed by separating with a colon."), + 'url' => gettext("Enter as many URLs as you wish. After saving we will download the URL and import the items into the alias. Use only with small sets of IP addresses (less than 3000)."), + 'url_ports' => gettext("Enter as many URLs as you wish. After saving we will download the URL and import the items into the alias. Use only with small sets of Ports (less than 3000)."), + 'urltable' => gettext("Enter a single URL containing a large number of IPs and/or Subnets. After saving we will download the URL and create a table file containing these addresses. This will work with large numbers of addresses (30,000+) or small numbers.") . + "<br /><b>" . $special_cidr_usage_text . "</b>", + 'urltable_ports' => gettext("Enter a single URL containing a list of Port numbers and/or Port ranges. After saving we will download the URL.") . + "<br /><b>" . $special_cidr_usage_text . "</b>", ); // Tab type specific patterns. @@ -605,13 +617,13 @@ $pattern_str = array( ); $types = array( - 'host' => 'Host(s)', - 'network' => 'Network(s)', - 'port' => 'Port(s)', - 'url' => 'URL (IPs)', - 'url_ports' => 'URL (Ports)', - 'urltable' => 'URL Table (IPs)', - 'urltable_ports' => 'URL Table (Ports)', + 'host' => gettext("Host(s)"), + 'network' => gettext("Network(s)"), + 'port' => gettext("Port(s)"), + 'url' => gettext("URL (IPs)"), + 'url_ports' => gettext("URL (Ports)"), + 'urltable' => gettext("URL Table (IPs)"), + 'urltable_ports' => gettext("URL Table (Ports)"), ); if (empty($tab)) { @@ -785,7 +797,7 @@ events.push(function() { // Hide and disable rows other than the first hideRowsAfter(1, (tab == 'urltable') || (tab == 'urltable_ports')); - // The add button and delete buttons must not show on URL Table IP or URL table ports + // The add button and delete buttons must not show on URL Table IP or URL table ports if ((tab == 'urltable') || (tab == 'urltable_ports')) { hideClass('addbtn', true); $('[id^=deleterow]').hide(); |