diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/inc/upgrade_config.inc | 2 | ||||
-rw-r--r-- | src/usr/local/www/edit.php | 55 | ||||
-rwxr-xr-x | src/usr/local/www/firewall_aliases_edit.php | 62 | ||||
-rw-r--r-- | src/usr/local/www/firewall_nat_1to1.php | 8 |
4 files changed, 97 insertions, 30 deletions
diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index dedab7c..d627f11 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -654,7 +654,7 @@ function upgrade_039_to_040() { $config['system']['user'][0]['priv'][2]['descr'] = gettext("Indicates whether this user is able to login for example via SSH."); $config['system']['user'][0]['priv'][3]['id'] = "copyfiles"; $config['system']['user'][0]['priv'][3]['name'] = "Is allowed to copy files"; - $config['system']['user'][0]['priv'][3]['descr'] = sprintf(gettext("Indicates whether this user is allowed to copy files onto the %s appliance via SCP/SFTP. If you are going to use this privilege, you must install scponly on the appliance (Hint: pkg_add -r scponly)."), $g['product_name']); + $config['system']['user'][0]['priv'][3]['descr'] = sprintf(gettext("Indicates whether this user is allowed to copy files onto the %s appliance via SCP/SFTP."), $g['product_name']); $config['system']['user'][0]['priv'][4]['id'] = "isroot"; $config['system']['user'][0]['priv'][4]['name'] = "Is root user"; $config['system']['user'][0]['priv'][4]['descr'] = gettext("This user is associated with the UNIX root user (you should associate this privilege only with one single user)."); diff --git a/src/usr/local/www/edit.php b/src/usr/local/www/edit.php index fe15105..45fa6c1 100644 --- a/src/usr/local/www/edit.php +++ b/src/usr/local/www/edit.php @@ -128,6 +128,9 @@ require("head.inc"); <input type="button" class="btn btn-default btn-sm" onclick="loadFile();" value="<?=gettext('Load')?>" /> <input type="button" class="btn btn-default btn-sm" id="fbOpen" value="<?=gettext('Browse')?>" /> <input type="button" class="btn btn-default btn-sm" onclick="saveFile();" value="<?=gettext('Save')?>" /> + <span class="pull-right"> + <button id="btngoto" class="btn btn-default btn-sm"><?=gettext("GoTo Line #")?></button> <input type="number" id="gotoline" width="6"></input> + </span> </form> <div id="fbBrowser" style="display:none; border:1px dashed gray; width:98%;"></div> @@ -148,6 +151,58 @@ require("head.inc"); <script type="text/javascript"> //<![CDATA[ + events.push(function(){ + + function showLine(tarea, lineNum) { + + lineNum--; // array starts at 0 + var lines = tarea.value.split("\n"); + + // calculate start/end + var startPos = 0, endPos = tarea.value.length; + for(var x = 0; x < lines.length; x++) { + if(x == lineNum) { + break; + } + startPos += (lines[x].length+1); + + } + + var endPos = lines[lineNum].length+startPos; + + // do selection + // Chrome / Firefox + + if(typeof(tarea.selectionStart) != "undefined") { + tarea.focus(); + tarea.selectionStart = startPos; + tarea.selectionEnd = endPos; + return true; + } + + // IE + if (document.selection && document.selection.createRange) { + tarea.focus(); + tarea.select(); + var range = document.selection.createRange(); + range.collapse(true); + range.moveEnd("character", endPos); + range.moveStart("character", startPos); + range.select(); + return true; + } + + return false; + } + + $("#btngoto").prop('type','button'); + + $('#btngoto').click(function() { + var tarea = document.getElementById("fileContent"); + showLine(tarea, $('#gotoline').val()); + }); + }); + function loadFile() { jQuery("#fileStatus").html(""); jQuery("#fileStatusBox").show(500); 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(); diff --git a/src/usr/local/www/firewall_nat_1to1.php b/src/usr/local/www/firewall_nat_1to1.php index 4be8a9e..f336433 100644 --- a/src/usr/local/www/firewall_nat_1to1.php +++ b/src/usr/local/www/firewall_nat_1to1.php @@ -75,7 +75,7 @@ if (!is_array($config['nat']['onetoone'])) { $a_1to1 = &$config['nat']['onetoone']; /* update rule order, POST[rule] is an array of ordered IDs */ -if ($_POST['order-store']) { +if (array_key_exists('order-store', $_POST)) { if (is_array($_POST['rule']) && !empty($_POST['rule'])) { $a_1to1_new = array(); @@ -144,7 +144,7 @@ if (isset($_POST['del_x'])) { } else { $a_1to1[$_GET['id']]['disabled'] = true; } - if (write_config("Firewall: NAT: Outbound, enable/disable NAT rule")) { + if (write_config(gettext("Firewall: NAT: 1 to 1, enable/disable NAT rule"))) { mark_subsystem_dirty('natconf'); } header("Location: firewall_nat_1to1.php"); @@ -269,11 +269,11 @@ display_top_tabs($tab_array); <i class="fa fa-plus icon-embed-btn"></i> <?=gettext('Add')?> </a> - <button name="del_x" type="submit" class="btn btn-danger btn-sm" value="<?=gettext("Delete selected rule"); ?>"> + <button name="del_x" type="submit" class="btn btn-danger btn-sm" title="<?=gettext('Delete selected mappings')?>"> <i class="fa fa-trash icon-embed-btn"></i> <?=gettext("Delete"); ?> </button> - <button type="submit" id="order-store" name="order-store" class="btn btn-primary btn-sm" value="Save changes" disabled> + <button type="submit" id="order-store" name="order-store" class="btn btn-primary btn-sm" disabled title="<?=gettext('Save rule order')?>"> <i class="fa fa-save icon-embed-btn"></i> <?=gettext("Save")?> </button> |