Commit 0a7e8655 authored by Manuel Faux's avatar Manuel Faux

Cleaner way to show banner for disabled services

parent 5d159b2c
...@@ -606,10 +606,7 @@ include("head.inc"); ...@@ -606,10 +606,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">
......
...@@ -87,10 +87,7 @@ include("head.inc"); ...@@ -87,10 +87,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">
......
...@@ -63,10 +63,7 @@ include("head.inc"); ...@@ -63,10 +63,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">
......
...@@ -114,9 +114,7 @@ include("head.inc"); ?> ...@@ -114,9 +114,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">
......
...@@ -69,6 +69,7 @@ $( document ).ready(function() { ...@@ -69,6 +69,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
......
...@@ -200,9 +200,7 @@ $( document ).ready(function() { ...@@ -200,9 +200,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;
......
...@@ -65,7 +65,7 @@ include("head.inc"); ...@@ -65,7 +65,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