Fix #6195: Allow to change NAT Outbound mode

make_config_revision_entry() second parameter expects a username to
override current logged in user in special cases.  It's used when a tool
(e.g. wizard) is used to configure some functionality.

As it was already noted in easyrule.inc, this parameter cannot have
international characters since the tag where it's stored in config.xml
doesn't use CDATA.

Remove gettext() calls and add a comment on each place
make_config_revision_entry() is called with username parameter
This commit is contained in:
Renato Botelho do Couto 2019-09-11 10:31:55 -03:00
parent d81f270454
commit bdaa5235d4
6 changed files with 114 additions and 19 deletions

View File

@ -35,6 +35,10 @@ $config["filter"]["rule"][] = array(
"source" => array("any" => ""),
"destination" => array("any" => ""),
"descr" => "Allow all ipv4+ipv6 via pfSsh.php",
/*
* Do not translate this, it's considered a username which cannot
* contain international characters
*/
"created" => make_config_revision_entry(null, "pfSsh.php added allow all wan rule")
);

View File

@ -482,7 +482,12 @@ if ($_POST['save']) {
if ($_POST['filter-rule-association'] == 'add-associated') {
$filterent['associated-rule-id'] = $natent['associated-rule-id'] = get_unique_id();
$filterent['tracker'] = (int)microtime(true);
$filterent['created'] = make_config_revision_entry(null, gettext("NAT Port Forward"));
/*
* Do not translate this, it's considered a
* username which cannot contain international
* characters
*/
$filterent['created'] = make_config_revision_entry(null, "NAT Port Forward");
$config['filter']['rule'][] = $filterent;
}

View File

@ -108,7 +108,12 @@ if ($_POST['save']) {
$natent['descr'] .= sprintf(gettext(' - %1$s to %2$s'),
$tonathost['descr'],
convert_real_interface_to_friendly_descr($natent['interface']));
$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
/*
* Do not translate this, it's considered a
* username which cannot contain international
* characters
*/
$natent['created'] = make_config_revision_entry(null, "Manual Outbound NAT Switch");
/* Try to detect already auto created rules and avoid duplicating them */
$found = false;

View File

@ -673,7 +673,11 @@ function step12_submitphpaction() {
$rule['type'] = "pass";
$rule['enabled'] = "on";
$rule['tracker'] = $tracker++;
$rule['created'] = make_config_revision_entry(null, gettext("OpenVPN Wizard"));
/*
* Do not translate this, it's considered a username which
* cannot contain international characters
*/
$rule['created'] = make_config_revision_entry(null, "OpenVPN Wizard");
$config['filter']['rule'][] = $rule;
}
@ -690,7 +694,11 @@ function step12_submitphpaction() {
$rule['type'] = "pass";
$rule['enabled'] = "on";
$rule['tracker'] = $tracker++;
$rule['created'] = make_config_revision_entry(null, gettext("OpenVPN Wizard"));
/*
* Do not translate this, it's considered a username which
* cannot contain international characters
*/
$rule['created'] = make_config_revision_entry(null, "OpenVPN Wizard");
$config['filter']['rule'][] = $rule;
}

View File

@ -1493,7 +1493,11 @@ function apply_all_chosen_items() {
$rule['floating'] = "yes";
$rule['wizard'] = "yes";
$rule['enabled'] = "on";
$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
/*
* Do not translate this, it's considered a username
* which cannot contain international characters
*/
$rule['created'] = make_config_revision_entry(null, "Traffic Shaper Wizard");
$rule['tracker'] = $tracker++;
$config['filter']['rule'][] = $rule;
}
@ -1514,7 +1518,11 @@ function apply_all_chosen_items() {
$rule['floating'] = "yes";
$rule['wizard'] = "yes";
$rule['enabled'] = "on";
$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
/*
* Do not translate this, it's considered a username
* which cannot contain international characters
*/
$rule['created'] = make_config_revision_entry(null, "Traffic Shaper Wizard");
$rule['tracker'] = $tracker++;
$config['filter']['rule'][] = $rule;
@ -1529,7 +1537,11 @@ function apply_all_chosen_items() {
$rule['floating'] = "yes";
$rule['wizard'] = "yes";
$rule['enabled'] = "on";
$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
/*
* Do not translate this, it's considered a username
* which cannot contain international characters
*/
$rule['created'] = make_config_revision_entry(null, "Traffic Shaper Wizard");
$rule['tracker'] = $tracker++;
$config['filter']['rule'][] = $rule;
@ -1547,7 +1559,11 @@ function apply_all_chosen_items() {
$rule['floating'] = "yes";
$rule['wizard'] = "yes";
$rule['enabled'] = "on";
$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
/*
* Do not translate this, it's considered a username
* which cannot contain international characters
*/
$rule['created'] = make_config_revision_entry(null, "Traffic Shaper Wizard");
$rule['tracker'] = $tracker++;
$config['filter']['rule'][] = $rule;
@ -1567,7 +1583,12 @@ function apply_all_chosen_items() {
$rule['destination']['port'] = $voip[2]."-".$voip[3];
if ($voip[1] != '')
$rule['protocol'] = $voip[1];
$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
/*
* Do not translate this, it's considered a
* username which cannot contain international
* characters
*/
$rule['created'] = make_config_revision_entry(null, "Traffic Shaper Wizard");
$rule['tracker'] = $tracker++;
$config['filter']['rule'][] = $rule;
}
@ -1592,7 +1613,12 @@ function apply_all_chosen_items() {
$rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3];
if ($p2pclient[1] != '')
$rule['protocol'] = $p2pclient[1];
$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
/*
* Do not translate this, it's considered a
* username which cannot contain international
* characters
*/
$rule['created'] = make_config_revision_entry(null, "Traffic Shaper Wizard");
$rule['tracker'] = $tracker++;
$config['filter']['rule'][] = $rule;
}
@ -1672,7 +1698,12 @@ function apply_all_chosen_items() {
}
if ($otherclient[1] != '')
$rule['protocol'] = $otherclient[1];
$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
/*
* Do not translate this, it's
* considered a username which cannot
* contain international characters
*/
$rule['created'] = make_config_revision_entry(null, "Traffic Shaper Wizard");
$rule['tracker'] = $tracker++;
$config['filter']['rule'][] = $rule;
}

View File

@ -1579,7 +1579,11 @@ function apply_all_chosen_items() {
$rule['floating'] = "yes";
$rule['wizard'] = "yes";
$rule['enabled'] = "on";
$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
/*
* Do not translate this, it's considered a username
* which cannot contain international characters
*/
$rule['created'] = make_config_revision_entry(null, "Traffic Shaper Wizard");
$rule['tracker'] = $tracker++;
$config['filter']['rule'][] = $rule;
@ -1601,7 +1605,12 @@ function apply_all_chosen_items() {
$rule['floating'] = "yes";
$rule['wizard'] = "yes";
$rule['enabled'] = "on";
$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
/*
* Do not translate this, it's
* considered a username which cannot
* contain international characters
*/
$rule['created'] = make_config_revision_entry(null, "Traffic Shaper Wizard");
$rule['tracker'] = $tracker++;
$config['filter']['rule'][] = $rule;
@ -1616,7 +1625,12 @@ function apply_all_chosen_items() {
$rule['floating'] = "yes";
$rule['wizard'] = "yes";
$rule['enabled'] = "on";
$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
/*
* Do not translate this, it's
* considered a username which cannot
* contain international characters
*/
$rule['created'] = make_config_revision_entry(null, "Traffic Shaper Wizard");
$rule['tracker'] = $tracker++;
$config['filter']['rule'][] = $rule;
@ -1634,7 +1648,12 @@ function apply_all_chosen_items() {
$rule['floating'] = "yes";
$rule['wizard'] = "yes";
$rule['enabled'] = "on";
$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
/*
* Do not translate this, it's
* considered a username which cannot
* contain international characters
*/
$rule['created'] = make_config_revision_entry(null, "Traffic Shaper Wizard");
$rule['tracker'] = $tracker++;
$config['filter']['rule'][] = $rule;
@ -1654,7 +1673,13 @@ function apply_all_chosen_items() {
$rule['destination']['port'] = $voip[2]."-".$voip[3];
if ($voip[1] != '')
$rule['protocol'] = $voip[1];
$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
/*
* Do not translate this, it's
* considered a username which
* cannot contain international
* characters
*/
$rule['created'] = make_config_revision_entry(null, "Traffic Shaper Wizard");
$rule['tracker'] = $tracker++;
$config['filter']['rule'][] = $rule;
}
@ -1679,7 +1704,13 @@ function apply_all_chosen_items() {
$rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3];
if ($p2pclient[1] != '')
$rule['protocol'] = $p2pclient[1];
$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
/*
* Do not translate this, it's
* considered a username which
* cannot contain international
* characters
*/
$rule['created'] = make_config_revision_entry(null, "Traffic Shaper Wizard");
$rule['tracker'] = $tracker++;
$config['filter']['rule'][] = $rule;
}
@ -1707,7 +1738,13 @@ function apply_all_chosen_items() {
$rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3];
if ($Gameclient[1] != '')
$rule['protocol'] = $Gameclient[1];
$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
/*
* Do not translate this, it's
* considered a username which
* cannot contain international
* characters
*/
$rule['created'] = make_config_revision_entry(null, "Traffic Shaper Wizard");
$rule['tracker'] = $tracker++;
$config['filter']['rule'][] = $rule;
}
@ -1761,7 +1798,12 @@ function apply_all_chosen_items() {
}
if ($otherclient[1] != '')
$rule['protocol'] = $otherclient[1];
$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
/*
* Do not translate this, it's
* considered a username which cannot
* contain international characters
*/
$rule['created'] = make_config_revision_entry(null, "Traffic Shaper Wizard");
$rule['tracker'] = $tracker++;
$config['filter']['rule'][] = $rule;
}