Commit 7f75ddb8 authored by Franco Fichtner's avatar Franco Fichtner

www: eradiacate print_info_box_np() for #444

parent ec7936c1
...@@ -108,19 +108,19 @@ ...@@ -108,19 +108,19 @@
<stepsubmitphpaction> <stepsubmitphpaction>
<![CDATA[ <![CDATA[
if(empty($_POST['hostname']) || !is_hostname($_POST['hostname'])) { if(empty($_POST['hostname']) || !is_hostname($_POST['hostname'])) {
print_info_box_np("Hostname is invalid. Please press back in your browser window and correct."); print_info_box("Hostname is invalid. Please press back in your browser window and correct.");
die; die;
} }
if(empty($_POST['domain']) || !is_domain($_POST['domain'])) { if(empty($_POST['domain']) || !is_domain($_POST['domain'])) {
print_info_box_np("Domain is invalid. Please press back in your browser window and correct."); print_info_box("Domain is invalid. Please press back in your browser window and correct.");
die; die;
} }
if(!empty($_POST['primarydnsserver']) && !is_ipaddr($_POST['primarydnsserver'])) { if(!empty($_POST['primarydnsserver']) && !is_ipaddr($_POST['primarydnsserver'])) {
print_info_box_np("Primary DNS server is invalid. Please press back in your browser window and correct."); print_info_box("Primary DNS server is invalid. Please press back in your browser window and correct.");
die; die;
} }
if(!empty($_POST['secondarydnsserver']) && !is_ipaddr($_POST['secondarydnsserver'])) { if(!empty($_POST['secondarydnsserver']) && !is_ipaddr($_POST['secondarydnsserver'])) {
print_info_box_np("Second DNS server is invalid. Please press back in your browser window and correct."); print_info_box("Second DNS server is invalid. Please press back in your browser window and correct.");
die; die;
} }
]]> ]]>
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
<![CDATA[ <![CDATA[
foreach (explode(' ', $_POST['timeserverhostname']) as $ts) { foreach (explode(' ', $_POST['timeserverhostname']) as $ts) {
if (!is_domain($ts)) { if (!is_domain($ts)) {
print_info_box_np(gettext("NTP Time Server names may only contain the characters a-z, 0-9, '-' and '.'. Entries may be separated by spaces. Please press back in your browser window and correct.")); print_info_box(gettext("NTP Time Server names may only contain the characters a-z, 0-9, '-' and '.'. Entries may be separated by spaces. Please press back in your browser window and correct."));
die; die;
} }
} }
...@@ -400,35 +400,35 @@ ...@@ -400,35 +400,35 @@
<stepsubmitphpaction> <stepsubmitphpaction>
<![CDATA[ <![CDATA[
if(!empty($_POST['mtu']) && ($_POST['mtu'] < 576)) { if(!empty($_POST['mtu']) && ($_POST['mtu'] < 576)) {
print_info_box_np("MTU Must be at least 576 (Per RFC 791). Please press back in your browser window and correct."); print_info_box("MTU Must be at least 576 (Per RFC 791). Please press back in your browser window and correct.");
die; die;
} }
if(!empty($_POST['macaddress']) && !is_macaddr($_POST['macaddress'])) { if(!empty($_POST['macaddress']) && !is_macaddr($_POST['macaddress'])) {
print_info_box_np("Invalid MAC Address. Please press back in your browser window and correct."); print_info_box("Invalid MAC Address. Please press back in your browser window and correct.");
die; die;
} }
if(!empty($_POST['ipaddress']) && ($_POST['selectedtype'] == "Static")) { if(!empty($_POST['ipaddress']) && ($_POST['selectedtype'] == "Static")) {
if (!is_ipaddr($_POST['ipaddress'])) { if (!is_ipaddr($_POST['ipaddress'])) {
print_info_box_np("Invalid WAN IP Address. Please press back in your browser window and correct."); print_info_box("Invalid WAN IP Address. Please press back in your browser window and correct.");
die; die;
} }
if ($_POST['subnetmask'] < 31 && if ($_POST['subnetmask'] < 31 &&
($_POST['ipaddress'] == gen_subnet($_POST['ipaddress'], $_POST['subnetmask']) || ($_POST['ipaddress'] == gen_subnet($_POST['ipaddress'], $_POST['subnetmask']) ||
$_POST['ipaddress'] == gen_subnet_max($_POST['ipaddress'], $_POST['subnetmask']))) { $_POST['ipaddress'] == gen_subnet_max($_POST['ipaddress'], $_POST['subnetmask']))) {
print_info_box_np("Invalid WAN IP Address. Please press back in your browser window and correct."); print_info_box("Invalid WAN IP Address. Please press back in your browser window and correct.");
die; die;
} }
} }
if(!empty($_POST['dhcphostname']) && !is_hostname($_POST['dhcphostname'])) { if(!empty($_POST['dhcphostname']) && !is_hostname($_POST['dhcphostname'])) {
print_info_box_np("Invalid DHCP Hostname. Please press back in your browser window and correct."); print_info_box("Invalid DHCP Hostname. Please press back in your browser window and correct.");
die; die;
} }
if(!empty($_POST['pptplocalipaddress']) && !is_ipaddr($_POST['pptplocalipaddress'])) { if(!empty($_POST['pptplocalipaddress']) && !is_ipaddr($_POST['pptplocalipaddress'])) {
print_info_box_np("Invalid PPTP Local IP Address. Please press back in your browser window and correct."); print_info_box("Invalid PPTP Local IP Address. Please press back in your browser window and correct.");
die; die;
} }
if(!empty($_POST['pptpremoteipaddress']) && !is_ipaddr($_POST['pptpremoteipaddress'])) { if(!empty($_POST['pptpremoteipaddress']) && !is_ipaddr($_POST['pptpremoteipaddress'])) {
print_info_box_np("Invalid PPTP Remopte IP Address. Please press back in your browser window and correct."); print_info_box("Invalid PPTP Remopte IP Address. Please press back in your browser window and correct.");
die; die;
} }
$type = $_POST['selectedtype']; $type = $_POST['selectedtype'];
...@@ -511,14 +511,14 @@ ...@@ -511,14 +511,14 @@
<![CDATA[ <![CDATA[
if (!empty(trim($_POST['lanipaddress']))) { if (!empty(trim($_POST['lanipaddress']))) {
if (!is_ipaddr($_POST['lanipaddress'])) { if (!is_ipaddr($_POST['lanipaddress'])) {
print_info_box_np("Invalid LAN IP Address. Please press back in your browser window and correct."); print_info_box("Invalid LAN IP Address. Please press back in your browser window and correct.");
die; die;
} }
if ($_POST['subnetmask'] < 31 && if ($_POST['subnetmask'] < 31 &&
($_POST['lanipaddress'] == gen_subnet($_POST['lanipaddress'], $_POST['subnetmask']) || ($_POST['lanipaddress'] == gen_subnet($_POST['lanipaddress'], $_POST['subnetmask']) ||
$_POST['lanipaddress'] == gen_subnet_max($_POST['lanipaddress'], $_POST['subnetmask']))) { $_POST['lanipaddress'] == gen_subnet_max($_POST['lanipaddress'], $_POST['subnetmask']))) {
print_info_box_np("Invalid LAN IP Address. Please press back in your browser window and correct."); print_info_box("Invalid LAN IP Address. Please press back in your browser window and correct.");
die; die;
} }
...@@ -563,7 +563,7 @@ ...@@ -563,7 +563,7 @@
local_user_set($admin_user); local_user_set($admin_user);
write_config(); write_config();
} else { } else {
print_info_box_np("Passwords do not match! Please press back in your browser window and correct."); print_info_box("Passwords do not match! Please press back in your browser window and correct.");
die; die;
} }
} }
......
...@@ -217,60 +217,20 @@ function print_info_box_apply($msg) ...@@ -217,60 +217,20 @@ function print_info_box_apply($msg)
EOFnp; EOFnp;
} }
function print_info_box_np($msg, $name="apply",$value="", $showapply=false) { function print_info_box($msg)
if(empty($value)) {
$value = gettext("Apply changes");
}
if(stristr($msg, gettext("apply")) != false || stristr($msg, gettext("save")) != false || stristr($msg, gettext("create")) != false || $showapply) {
$savebutton = "<form action=\"".$_SERVER['REQUEST_URI']."\" method=\"post\">";
$savebutton .= "<input name=\"{$name}\" type=\"submit\" class=\"btn btn-default\" id=\"${name}\" value=\"{$value}\" />";
if(!empty($_POST['if']))
$savebutton .= "<input type=\"hidden\" name=\"if\" value=\"" . htmlspecialchars($_POST['if']) . "\" />";
$savebutton.="</form>";
} else {
$savebutton = '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>';
}
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_apply_undo($msg, $undo)
{ {
$value = gettext('Apply changes'); $savebutton = '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>';
$name= 'apply';
$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}\" />";
$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">
<div class="alert alert-warning" summary="red box table"> <div class="alert alert-info alert-dismissible" role="alert">
<p>{$msg}<br /><br /></p> {$savebutton}
<div class="btn-group"> <p>{$msg}</p>
{$savebutton} </div>
{$undobutton} </div>
</div>
</div>
</form></div>
EOFnp; EOFnp;
} }
function print_info_box($msg)
{
print_info_box_np($msg);
}
function get_std_save_message() { function get_std_save_message() {
global $d_sysrebootreqd_path; global $d_sysrebootreqd_path;
$filter_related = false; $filter_related = false;
......
...@@ -94,7 +94,7 @@ $main_buttons = array( ...@@ -94,7 +94,7 @@ $main_buttons = array(
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?> <?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('loadbalancer')): ?><br/> <?php if (is_subsystem_dirty('loadbalancer')): ?><br/>
<?php print_info_box_np(gettext("The load balancer 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 load balancer 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">
......
...@@ -106,7 +106,7 @@ $main_buttons = array( ...@@ -106,7 +106,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('loadbalancer')): ?><br/> <?php if (is_subsystem_dirty('loadbalancer')): ?><br/>
<?php print_info_box_np(sprintf(gettext("The load balancer configuration has been changed%sYou must apply the changes in order for them to take effect."), "<br />"));?><br /> <?php print_info_box_apply(sprintf(gettext("The load balancer configuration has been changed%sYou must apply the changes in order for them to take effect."), "<br />"));?><br />
<?php endif; ?> <?php endif; ?>
<section class="col-xs-12"> <section class="col-xs-12">
......
...@@ -109,7 +109,7 @@ include("head.inc"); ...@@ -109,7 +109,7 @@ include("head.inc");
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?> <?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('loadbalancer')): ?><p> <?php if (is_subsystem_dirty('loadbalancer')): ?><p>
<?php print_info_box_np(gettext("The load balancer configuration has been changed.<br />You must apply the changes in order for them to take effect."));?><br /> <?php print_info_box_apply(gettext("The load balancer configuration has been changed.<br />You must apply the changes in order for them to take effect."));?><br />
<?php endif; ?> <?php endif; ?>
......
...@@ -104,7 +104,7 @@ include("head.inc"); ...@@ -104,7 +104,7 @@ include("head.inc");
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?> <?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('loadbalancer')): ?><p> <?php if (is_subsystem_dirty('loadbalancer')): ?><p>
<?php print_info_box_np(gettext("The load balancer 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 load balancer 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">
......
...@@ -100,7 +100,7 @@ include("head.inc"); ...@@ -100,7 +100,7 @@ include("head.inc");
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?> <?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('loadbalancer')): ?><br/> <?php if (is_subsystem_dirty('loadbalancer')): ?><br/>
<?php print_info_box_np(gettext("The load balancer 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 load balancer 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">
......
...@@ -143,7 +143,7 @@ $main_buttons = array( ...@@ -143,7 +143,7 @@ $main_buttons = array(
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?> <?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('loadbalancer')): ?><br/> <?php if (is_subsystem_dirty('loadbalancer')): ?><br/>
<?php print_info_box_np(gettext("The virtual server 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 virtual server 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">
......
...@@ -669,7 +669,7 @@ include("head.inc"); ...@@ -669,7 +669,7 @@ include("head.inc");
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?> <?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('staticmaps')): ?><br/> <?php if (is_subsystem_dirty('staticmaps')): ?><br/>
<?php print_info_box_np(gettext("The static mapping 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 static mapping 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">
......
...@@ -448,7 +448,7 @@ include("head.inc"); ...@@ -448,7 +448,7 @@ include("head.inc");
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?> <?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('staticmaps')): ?><p> <?php if (is_subsystem_dirty('staticmaps')): ?><p>
<?php print_info_box_np(gettext("The static mapping 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 static mapping 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">
......
...@@ -176,7 +176,7 @@ function show_advanced_dns() { ...@@ -176,7 +176,7 @@ function show_advanced_dns() {
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?> <?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('hosts')): ?><br/> <?php if (is_subsystem_dirty('hosts')): ?><br/>
<?php print_info_box_np(gettext("The DNS forwarder 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 DNS forwarder 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">
......
...@@ -83,7 +83,7 @@ $main_buttons = array( ...@@ -83,7 +83,7 @@ $main_buttons = array(
<div class="row"> <div class="row">
<?php if (isset($savemsg)) print_info_box($savemsg); ?> <?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('igmpproxy')): ?><br/> <?php if (is_subsystem_dirty('igmpproxy')): ?><br/>
<?php print_info_box_np(gettext("The IGMP entry list has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?> <?php print_info_box_apply(gettext("The IGMP entry list has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?>
<?php endif; ?> <?php endif; ?>
<section class="col-xs-12"> <section class="col-xs-12">
......
...@@ -193,7 +193,7 @@ function show_advanced_dns() { ...@@ -193,7 +193,7 @@ function show_advanced_dns() {
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?> <?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('unbound')): ?><br/> <?php if (is_subsystem_dirty('unbound')): ?><br/>
<?php print_info_box_np(gettext("The configuration for the DNS Resolver, 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 configuration for the DNS Resolver, has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
<?php endif; ?> <?php endif; ?>
<form action="services_unbound.php" method="post" name="iform" id="iform" onsubmit="presubmit()"> <form action="services_unbound.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
......
...@@ -196,7 +196,7 @@ include("head.inc"); ...@@ -196,7 +196,7 @@ include("head.inc");
print_info_box($savemsg); print_info_box($savemsg);
if (is_subsystem_dirty("unbound")) if (is_subsystem_dirty("unbound"))
print_info_box_np(gettext("The settings for the DNS Resolver have changed. You must apply the configuration to take affect.")); print_info_box_apply(gettext("The settings for the DNS Resolver have changed. You must apply the configuration to take affect."));
?> ?>
......
...@@ -132,7 +132,7 @@ include_once("head.inc"); ...@@ -132,7 +132,7 @@ include_once("head.inc");
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?> <?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('unbound')): ?><br/> <?php if (is_subsystem_dirty('unbound')): ?><br/>
<?php print_info_box_np(gettext("The configuration of the DNS Resolver, 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 configuration of the DNS Resolver, has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
<?php endif; ?> <?php endif; ?>
......
...@@ -111,7 +111,7 @@ if ($_POST) { ...@@ -111,7 +111,7 @@ if ($_POST) {
<div class="row"> <div class="row">
<?php if (is_subsystem_dirty('loadbalancer')): ?><br/> <?php if (is_subsystem_dirty('loadbalancer')): ?><br/>
<?php print_info_box_np(sprintf(gettext("The load balancer configuration has been changed%sYou must apply the changes in order for them to take effect."), "<br />"));?> <?php print_info_box_apply(sprintf(gettext("The load balancer configuration has been changed%sYou must apply the changes in order for them to take effect."), "<br />"));?>
<? endif; ?> <? endif; ?>
<section class="col-xs-12"> <section class="col-xs-12">
......
...@@ -57,7 +57,7 @@ include("head.inc"); ...@@ -57,7 +57,7 @@ include("head.inc");
<div class="row"> <div class="row">
<?php if (is_subsystem_dirty('loadbalancer')): ?><br/> <?php if (is_subsystem_dirty('loadbalancer')): ?><br/>
<?php print_info_box_np(sprintf(gettext("The load balancer configuration has been changed%sYou must apply the changes in order for them to take effect."), "<br />"));?> <?php print_info_box_apply(sprintf(gettext("The load balancer configuration has been changed%sYou must apply the changes in order for them to take effect."), "<br />"));?>
<? endif; ?> <? endif; ?>
<section class="col-xs-12"> <section class="col-xs-12">
......
...@@ -138,7 +138,7 @@ include("head.inc"); ...@@ -138,7 +138,7 @@ include("head.inc");
print_info_box($savemsg); print_info_box($savemsg);
} }
if (is_subsystem_dirty('sysctl') && ($act != "edit" )) { if (is_subsystem_dirty('sysctl') && ($act != "edit" )) {
print_info_box_np(gettext("The firewall tunables have changed. You must apply the configuration to take affect.")); print_info_box_apply(gettext("The firewall tunables have changed. You must apply the configuration to take affect."));
} }
?> ?>
</form> </form>
......
...@@ -148,7 +148,7 @@ $main_buttons = array( ...@@ -148,7 +148,7 @@ $main_buttons = array(
} ?> } ?>
<?php if (is_subsystem_dirty('staticroutes')) : <?php if (is_subsystem_dirty('staticroutes')) :
?><br/> ?><br/>
<?php print_info_box_np(sprintf(gettext("The gateway configuration has been changed.%sYou must apply the changes in order for them to take effect."), "<br />"));?><br /><br /> <?php print_info_box_apply(sprintf(gettext("The gateway configuration has been changed.%sYou must apply the changes in order for them to take effect."), "<br />"));?><br /><br />
<?php <?php
endif; ?> endif; ?>
......
...@@ -215,7 +215,7 @@ $main_buttons = array( ...@@ -215,7 +215,7 @@ $main_buttons = array(
print_info_box($savemsg); print_info_box($savemsg);
} }
if (is_subsystem_dirty('staticroutes')) { if (is_subsystem_dirty('staticroutes')) {
print_info_box_np(gettext("The gateway configuration has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect.")); print_info_box_apply(gettext("The gateway configuration has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect."));
} }
?> ?>
......
...@@ -113,7 +113,7 @@ if ($_POST) { ...@@ -113,7 +113,7 @@ if ($_POST) {
/* if ajax is calling, give them an update message */ /* if ajax is calling, give them an update message */
if (isAjax()) { if (isAjax()) {
print_info_box_np($savemsg); print_info_box($savemsg);
} }
include("head.inc"); include("head.inc");
......
...@@ -220,7 +220,7 @@ $main_buttons = array( ...@@ -220,7 +220,7 @@ $main_buttons = array(
} ?> } ?>
<?php if (is_subsystem_dirty('staticroutes')) : <?php if (is_subsystem_dirty('staticroutes')) :
?><p> ?><p>
<?php print_info_box_np(sprintf(gettext("The static route configuration has been changed.%sYou must apply the changes in order for them to take effect."), "<br />"));?><br /></p> <?php print_info_box_apply(sprintf(gettext("The static route configuration has been changed.%sYou must apply the changes in order for them to take effect."), "<br />"));?><br /></p>
<?php <?php
endif; ?> endif; ?>
......
...@@ -105,7 +105,7 @@ if ($_POST) { ...@@ -105,7 +105,7 @@ if ($_POST) {
/* if ajax is calling, give them an update message */ /* if ajax is calling, give them an update message */
if (isAjax()) { if (isAjax()) {
print_info_box_np($savemsg); print_info_box($savemsg);
} }
include("head.inc"); include("head.inc");
......
...@@ -267,7 +267,7 @@ function show_phase2(id, buttonid) { ...@@ -267,7 +267,7 @@ function show_phase2(id, buttonid) {
print_info_box($savemsg); print_info_box($savemsg);
} }
if ($pconfig['enable'] && is_subsystem_dirty('ipsec')) { if ($pconfig['enable'] && is_subsystem_dirty('ipsec')) {
print_info_box_np(gettext("The IPsec tunnel configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect.")); print_info_box_apply(gettext("The IPsec tunnel configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));
} }
?> ?>
<section class="col-xs-12"> <section class="col-xs-12">
......
...@@ -115,7 +115,7 @@ if (isset($savemsg)) { ...@@ -115,7 +115,7 @@ if (isset($savemsg)) {
print_info_box($savemsg); print_info_box($savemsg);
} }
if (is_subsystem_dirty('ipsec')) { if (is_subsystem_dirty('ipsec')) {
print_info_box_np(gettext("The IPsec tunnel configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect.")); print_info_box_apply(gettext("The IPsec tunnel configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));
} }
?> ?>
......
...@@ -325,7 +325,7 @@ if (isset($savemsg)) { ...@@ -325,7 +325,7 @@ if (isset($savemsg)) {
print_info_box($savemsg); print_info_box($savemsg);
} }
if (isset($config['ipsec']['enable']) && is_subsystem_dirty('ipsec')) { if (isset($config['ipsec']['enable']) && is_subsystem_dirty('ipsec')) {
print_info_box_np(gettext("The IPsec tunnel configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect.")); print_info_box_apply(gettext("The IPsec tunnel configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));
} }
$ph1found = false; $ph1found = false;
foreach ($config['ipsec']['phase1'] as $ph1ent) { foreach ($config['ipsec']['phase1'] as $ph1ent) {
...@@ -333,8 +333,28 @@ foreach ($config['ipsec']['phase1'] as $ph1ent) { ...@@ -333,8 +333,28 @@ foreach ($config['ipsec']['phase1'] as $ph1ent) {
$ph1found = true; $ph1found = true;
} }
} }
function print_legacy_box($msg, $name, $value)
{
$savebutton = "<form action=\"".$_SERVER['REQUEST_URI']."\" method=\"post\">";
$savebutton .= "<input name=\"{$name}\" type=\"submit\" class=\"btn btn-default\" id=\"${name}\" value=\"{$value}\" />";
if (!empty($_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;
}
if (!empty($pconfig['enable']) && !$ph1found) { if (!empty($pconfig['enable']) && !$ph1found) {
print_info_box_np(gettext("Support for IPsec Mobile clients is enabled but a Phase1 definition was not found") . ".<br />" . gettext("Please click Create to define one."), gettext("create"), gettext("Create Phase1")); print_legacy_box(gettext("Support for IPsec Mobile clients is enabled but a Phase1 definition was not found") . ".<br />" . gettext("Please click Create to define one."), gettext("create"), gettext("Create Phase1"));
} }
if (isset($input_errors) && count($input_errors) > 0) { if (isset($input_errors) && count($input_errors) > 0) {
print_input_errors($input_errors); print_input_errors($input_errors);
......
...@@ -178,7 +178,7 @@ if ($_POST) { ...@@ -178,7 +178,7 @@ if ($_POST) {
/* if ajax is calling, give them an update message */ /* if ajax is calling, give them an update message */
if (isAjax()) { if (isAjax()) {
print_info_box_np($savemsg); print_info_box($savemsg);
} }
} }
} }
......
...@@ -88,7 +88,7 @@ $main_buttons = array( ...@@ -88,7 +88,7 @@ $main_buttons = array(
} ?> } ?>
<?php if (is_subsystem_dirty('l2tpusers')) : <?php if (is_subsystem_dirty('l2tpusers')) :
?><br/> ?><br/>
<?php print_info_box_np(gettext("The l2tp user list has been modified") . ".<br />" . gettext("You must apply the changes in order for them to take effect") . ".<br /><b>" . gettext("Warning: this will terminate all current l2tp sessions!") . "</b>");?> <?php print_info_box_apply(gettext("The l2tp user list has been modified") . ".<br />" . gettext("You must apply the changes in order for them to take effect") . ".<br /><b>" . gettext("Warning: this will terminate all current l2tp sessions!") . "</b>");?>
<?php <?php
endif; ?> endif; ?>
......
...@@ -705,7 +705,7 @@ function tuntap_change() { ...@@ -705,7 +705,7 @@ function tuntap_change() {
print_input_errors($input_errors); print_input_errors($input_errors);
} }
if (isset($savemsg)) { if (isset($savemsg)) {
print_info_box_np($savemsg); print_info_box($savemsg);
} }
?> ?>
......
...@@ -97,15 +97,10 @@ $main_buttons = array( ...@@ -97,15 +97,10 @@ $main_buttons = array(
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<?php if (isset($savemsg)) { <?php if (isset($savemsg)) { print_info_box($savemsg); } ?>
print_info_box($savemsg); <?php if (is_subsystem_dirty('vpnpppoe')) : ?><br/>
} ?> <?php print_info_box_apply(gettext("The PPPoE entry list has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?>
<?php if (is_subsystem_dirty('vpnpppoe')) : <?php endif; ?>
?><br/>
<?php print_info_box_np(gettext("The PPPoE entry list has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?>
<?php
endif; ?>
<section class="col-xs-12"> <section class="col-xs-12">
......
...@@ -84,7 +84,7 @@ $main_buttons = array( ...@@ -84,7 +84,7 @@ $main_buttons = array(
} ?> } ?>
<?php if (is_subsystem_dirty('pptpusers')) : <?php if (is_subsystem_dirty('pptpusers')) :
?><br/> ?><br/>
<?php print_info_box_np(gettext("The PPTP user list has been modified").".<br />".gettext("You must apply the changes in order for them to take effect").".<br /></b><b>".gettext("Warning: this will terminate all current PPTP sessions")."!");?><br /> <?php print_info_box_apply(gettext("The PPTP user list has been modified").".<br />".gettext("You must apply the changes in order for them to take effect").".<br /></b><b>".gettext("Warning: this will terminate all current PPTP sessions")."!");?><br />
<?php <?php
endif; ?> endif; ?>
......
...@@ -123,7 +123,7 @@ $listtags = array_flip(array( ...@@ -123,7 +123,7 @@ $listtags = array_flip(array(
$pkg = parse_xml_config_raw("/usr/local/wizard/{$xml}.xml", 'opnsensewizard', false); $pkg = parse_xml_config_raw("/usr/local/wizard/{$xml}.xml", 'opnsensewizard', false);
if (!is_array($pkg)) { if (!is_array($pkg)) {
print_info_box_np(sprintf(gettext("ERROR: Could not parse %s wizard file."), $xml)); print_info_box(sprintf(gettext("ERROR: Could not parse %s wizard file."), $xml));
die; die;
} }
......
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