Commit 2fe0b9e4 authored by Manuel Faux's avatar Manuel Faux Committed by Franco Fichtner

Cleaner way to show banner for disabled services

(cherry picked from commit 0a7e8655)
parent b3928376
...@@ -603,10 +603,7 @@ include("head.inc"); ...@@ -603,10 +603,7 @@ include("head.inc");
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<?php if (isset($config['system']['disablefilter'])): ?> <?php print_service_disabled_banner('firewall'); ?>
<?php print_warning_box(gettext("The firewall has globally been disabled. Configured rules are currently not enforced."));?>
<?php endif; ?>
<?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); ?>
<section class="col-xs-12"> <section class="col-xs-12">
......
...@@ -85,10 +85,7 @@ include("head.inc"); ...@@ -85,10 +85,7 @@ include("head.inc");
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<?php if (isset($config['system']['disablefilter'])): ?> <?php print_service_disabled_banner('firewall'); ?>
<?php print_warning_box(gettext("The firewall has globally been disabled. Configured rules are currently not enforced."));?>
<?php endif; ?>
<?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); ?>
<section class="col-xs-12"> <section class="col-xs-12">
......
...@@ -61,10 +61,7 @@ include("head.inc"); ...@@ -61,10 +61,7 @@ include("head.inc");
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<?php if (isset($config['system']['disablefilter'])): ?> <?php print_service_disabled_banner('firewall'); ?>
<?php print_warning_box(gettext("The firewall has globally been disabled. Configured rules are currently not enforced."));?>
<?php endif; ?>
<?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); ?>
<section class="col-xs-12"> <section class="col-xs-12">
......
...@@ -111,9 +111,7 @@ include("head.inc"); ?> ...@@ -111,9 +111,7 @@ include("head.inc"); ?>
<section class="page-content-main"> <section class="page-content-main">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<?php if (isset($config['system']['disablefilter'])): ?> <?php print_service_disabled_banner('firewall'); ?>
<?php print_warning_box(gettext("The firewall has globally been disabled. Configured rules are currently not enforced."));?>
<?php endif; ?>
<?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); ?>
<section class="col-xs-12"> <section class="col-xs-12">
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
......
...@@ -70,6 +70,7 @@ $( document ).ready(function() { ...@@ -70,6 +70,7 @@ $( document ).ready(function() {
<section class="page-content-main"> <section class="page-content-main">
<div class="container-fluid col-xs-12"> <div class="container-fluid col-xs-12">
<div class="row"> <div class="row">
<?php print_service_disabled_banner('firewall'); ?>
<section class="col-xs-12"> <section class="col-xs-12">
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs"> <ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
<?php <?php
......
...@@ -199,9 +199,7 @@ $( document ).ready(function() { ...@@ -199,9 +199,7 @@ $( document ).ready(function() {
<section class="page-content-main"> <section class="page-content-main">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<?php if (isset($config['system']['disablefilter'])): ?> <?php print_service_disabled_banner('firewall'); ?>
<?php print_warning_box(gettext("The firewall has globally been disabled. Configured rules are currently not enforced."));?>
<?php endif; ?>
<?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 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."));?> <?php 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."));?>
......
...@@ -237,8 +237,7 @@ function print_info_box($msg) ...@@ -237,8 +237,7 @@ function print_info_box($msg)
EOFnp; EOFnp;
} }
function print_warning_box($msg) function print_warning_box($msg) {
{
echo <<<EOFnp echo <<<EOFnp
<div class="col-xs-12"> <div class="col-xs-12">
<div class="alert alert-warning alert-dismissible" role="alert"> <div class="alert alert-warning alert-dismissible" role="alert">
...@@ -248,6 +247,29 @@ function print_warning_box($msg) ...@@ -248,6 +247,29 @@ function print_warning_box($msg)
EOFnp; EOFnp;
} }
function is_service_enabled($service) {
global $config;
switch ($service) {
case 'firewall':
case 'filter':
return !isset($config['system']['disablefilter']);
default:
return false;
}
}
function print_service_disabled_banner($service) {
if (!is_service_enabled($service)) {
switch ($service) {
case 'firewall':
case 'filter':
print_warning_box(gettext("The firewall has globally been disabled. Configured rules are currently not enforced."));
break;
}
}
}
function get_std_save_message() { function get_std_save_message() {
global $d_sysrebootreqd_path; global $d_sysrebootreqd_path;
$filter_related = false; $filter_related = false;
......
...@@ -62,7 +62,7 @@ include("head.inc"); ...@@ -62,7 +62,7 @@ include("head.inc");
<section class="page-content-main"> <section class="page-content-main">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<?php print_service_disabled_banner('firewall'); ?>
<?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); ?>
<section class="col-xs-12"> <section class="col-xs-12">
......
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