Commit fd3e179f authored by Franco Fichtner's avatar Franco Fichtner

firewall: do not probe translations for other translated words; fixes #321

parent eddee1fd
...@@ -243,7 +243,7 @@ $main_buttons = array( ...@@ -243,7 +243,7 @@ $main_buttons = array(
<?php if (isset($savemsg)) print_info_box($savemsg); ?> <?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('natconf')): ?> <?php if (is_subsystem_dirty('natconf')): ?>
<?php print_info_box_np(gettext("The NAT configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br /> <?php print_info_box_apply(gettext("The NAT configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
<?php endif; ?> <?php endif; ?>
<section class="col-xs-12"> <section class="col-xs-12">
......
...@@ -388,12 +388,13 @@ include("head.inc"); ...@@ -388,12 +388,13 @@ include("head.inc");
<?php if (isset($savemsg)) print_info_box($savemsg); ?> <?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('filter')): ?><p> <?php if (is_subsystem_dirty('filter')): ?><p>
<?php <?php
if($_REQUEST['undodrag']) { if ($_REQUEST['undodrag']) {
foreach($_REQUEST['dragtable'] as $dt) foreach ($_REQUEST['dragtable'] as $dt) {
$dragtable .= "&dragtable[]={$dt}"; $dragtable .= "&dragtable[]={$dt}";
print_info_box_np_undo(gettext("The firewall rule configuration has been changed.<br />You must apply the changes in order for them to take effect."), "apply" , gettext("Apply changes") , "firewall_rules.php?if={$_REQUEST['if']}&dragdroporder=true&{$dragtable}"); }
print_info_box_apply_undo(gettext("The firewall rule configuration has been changed.<br />You must apply the changes in order for them to take effect."), "firewall_rules.php?if={$_REQUEST['if']}&dragdroporder=true&{$dragtable}");
} else { } else {
print_info_box_np(gettext("The firewall rule configuration has been changed.<br />You must apply the changes in order for them to take effect.")); print_info_box_apply(gettext("The firewall rule configuration has been changed.<br />You must apply the changes in order for them to take effect."));
} }
?> ?>
......
...@@ -179,6 +179,28 @@ function print_input_errors($input_errors) { ...@@ -179,6 +179,28 @@ function print_input_errors($input_errors) {
echo "</ul></div></div>"; echo "</ul></div></div>";
} }
function print_info_box_apply($msg)
{
$value = gettext('Apply changes');
$name= 'apply';
$savebutton = '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post">';
$savebutton .= '<input name="' . $name . '" type="submit" class="btn btn-default" id="' . $name . '" value="' . $value . '" />';
if ($_POST['if']) {
$savebutton .= '<input type="hidden" name="if" value="' . htmlspecialchars($_POST['if']) . '" />';
}
$savebutton .= '</form>';
echo <<<EOFnp
<div class="col-xs-12">
<div class="alert alert-info alert-dismissible" role="alert">
{$savebutton}
<p>{$msg}</p>
</div>
</div>
EOFnp;
}
function print_info_box_np($msg, $name="apply",$value="", $showapply=false) { function print_info_box_np($msg, $name="apply",$value="", $showapply=false) {
if(empty($value)) { if(empty($value)) {
$value = gettext("Apply changes"); $value = gettext("Apply changes");
...@@ -205,23 +227,17 @@ EOFnp; ...@@ -205,23 +227,17 @@ EOFnp;
} }
function print_info_box_np_undo($msg, $name="apply",$value="Apply changes", $undo) { function print_info_box_apply_undo($msg, $undo)
if(stristr($msg, "apply") != false || stristr($msg, "save") != false || stristr($msg, "create") != false) { {
$value = gettext('Apply changes');
$name= 'apply';
$savebutton .= "<input class=\"btn btn-default\" type=\"button\" value=\"". gettext("Undo") . "\" onclick=\"document.location='{$undo}'\" />"; $savebutton .= "<input class=\"btn btn-default\" type=\"button\" value=\"". gettext("Undo") . "\" onclick=\"document.location='{$undo}'\" />";
$savebutton .= "<input class=\"btn btn-default\" name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\" />"; $savebutton .= "<input class=\"btn btn-default\" name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\" />";
if(isset($_POST['if']))
$savebutton .= "<input type=\"hidden\" name=\"if\" value=\"" . htmlspecialchars($_POST['if']) . "\" />";
} else {
$savebutton = "<input class=\"btn btn-default\" value=\"" . gettext("Close") . "\" type=\"button\" onclick=\"$('#redboxtable').hide();\" />";
}
$url = $_SERVER['REQUEST_URI']; $url = $_SERVER['REQUEST_URI'];
echo <<<EOFnp echo <<<EOFnp
<div class="col-xs-12" id="redboxtable"><form action="{$url}" method="post"> <div class="col-xs-12" id="redboxtable"><form action="{$url}" method="post">
<div class="alert alert-warning" summary="red box table"> <div class="alert alert-warning" summary="red box table">
<p>{$msg}<br /><br /></p> <p>{$msg}<br /><br /></p>
...@@ -232,10 +248,10 @@ function print_info_box_np_undo($msg, $name="apply",$value="Apply changes", $und ...@@ -232,10 +248,10 @@ function print_info_box_np_undo($msg, $name="apply",$value="Apply changes", $und
</div> </div>
</form></div> </form></div>
EOFnp; EOFnp;
} }
function print_info_box($msg) { function print_info_box($msg)
{
print_info_box_np($msg); print_info_box_np($msg);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment