From d4ff81bbbc6ae465298125c3b00c5bc9579e7d44 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 18 Jan 2016 08:49:24 +0100 Subject: [PATCH] services: bring back service widgets for dns --- src/www/diag_logs_resolver.php | 3 +++ src/www/fbegin.inc | 23 ++++++++++++------- src/www/services_dnsmasq.php | 1 + .../services_dnsmasq_domainoverride_edit.php | 2 ++ src/www/services_dnsmasq_edit.php | 2 ++ src/www/services_unbound.php | 1 + src/www/services_unbound_acls.php | 1 + src/www/services_unbound_advanced.php | 1 + .../services_unbound_domainoverride_edit.php | 2 ++ src/www/services_unbound_host_edit.php | 2 ++ src/www/services_unbound_overrides.php | 3 ++- 11 files changed, 32 insertions(+), 9 deletions(-) diff --git a/src/www/diag_logs_resolver.php b/src/www/diag_logs_resolver.php index 9bafb5469..4541d22d4 100644 --- a/src/www/diag_logs_resolver.php +++ b/src/www/diag_logs_resolver.php @@ -3,4 +3,7 @@ $logfile = '/var/log/resolver.log'; $logclog = true; +require_once 'services.inc'; +$shortcut_section = array('dnsmasq', 'unbound'); + require_once 'diag_logs_template.inc'; diff --git a/src/www/fbegin.inc b/src/www/fbegin.inc index 5abd5e702..8ef1f3ea8 100644 --- a/src/www/fbegin.inc +++ b/src/www/fbegin.inc @@ -29,21 +29,26 @@ POSSIBILITY OF SUCH DAMAGE. */ -function find_service_by_shortcut($name) +function find_service_by_shortcut($names) { $shortcuts = array(); - /* WIP unify mapping so "shortcuts" are no longer needed */ + if (!is_array($names)) { + $names = array($names); + } + $shortcuts['dhcpd'] = 'dhcpd'; $shortcuts['dhcrelay'] = 'dhcrelay'; $shortcuts['dhcrelay6'] = 'dhcrelay6'; - $shortcuts['forwarder'] = 'dnsmasq'; + $shortcuts['dnsmasq'] = 'dnsmasq'; + $shortcuts['unbound'] = 'unbound'; + + /* WIP unify mapping so "shortcuts" are no longer needed */ $shortcuts['gateways'] = 'apinger'; $shortcuts['ipsec'] = 'ipsec'; $shortcuts['ntp'] = 'ntpd'; $shortcuts['openvpn'] = 'openvpn'; $shortcuts['relayd'] = 'relayd'; - $shortcuts['resolver'] = 'unbound'; $shortcuts['snmp'] = 'bsnmpd'; $shortcuts['squid'] = 'squid'; $shortcuts['upnp'] = 'miniupnpd'; @@ -51,10 +56,12 @@ function find_service_by_shortcut($name) $services = get_services(); foreach ($shortcuts as $shortcut => $realname) { - if ($shortcut == $name) { - foreach ($services as $service) - if ($service['name'] == $realname) { - return $service; + foreach ($names as $name) { + if ($shortcut == $name) { + foreach ($services as $service) + if ($service['name'] == $realname) { + return $service; + } } } } diff --git a/src/www/services_dnsmasq.php b/src/www/services_dnsmasq.php index 3e6bb8a2b..c2629b765 100644 --- a/src/www/services_dnsmasq.php +++ b/src/www/services_dnsmasq.php @@ -139,6 +139,7 @@ if ($_GET['act'] == "del") { } } +$shortcut_section = 'dnsmasq'; $closehead = false; include("head.inc"); diff --git a/src/www/services_dnsmasq_domainoverride_edit.php b/src/www/services_dnsmasq_domainoverride_edit.php index 368477471..2c23a1657 100644 --- a/src/www/services_dnsmasq_domainoverride_edit.php +++ b/src/www/services_dnsmasq_domainoverride_edit.php @@ -111,6 +111,8 @@ if ($_POST) { } } +$shortcut_section = 'dnsmasq'; + include("head.inc"); ?> diff --git a/src/www/services_dnsmasq_edit.php b/src/www/services_dnsmasq_edit.php index 3ef978f89..9d17a219b 100644 --- a/src/www/services_dnsmasq_edit.php +++ b/src/www/services_dnsmasq_edit.php @@ -156,6 +156,8 @@ if ($_POST) { } } +$shortcut_section = 'dnsmasq'; + include("head.inc"); ?> diff --git a/src/www/services_unbound.php b/src/www/services_unbound.php index 9ffaab2ea..4fdd6edd9 100644 --- a/src/www/services_unbound.php +++ b/src/www/services_unbound.php @@ -133,6 +133,7 @@ if ($_POST) { } } +$shortcut_section = 'unbound'; $closehead = false; include_once("head.inc"); diff --git a/src/www/services_unbound_acls.php b/src/www/services_unbound_acls.php index 458b71fb7..a58dd4292 100644 --- a/src/www/services_unbound_acls.php +++ b/src/www/services_unbound_acls.php @@ -156,6 +156,7 @@ if ($_POST) { } } +$shortcut_section = 'unbound'; $closehead = false; include("head.inc"); diff --git a/src/www/services_unbound_advanced.php b/src/www/services_unbound_advanced.php index 1a5f6d3a6..6b86e4785 100644 --- a/src/www/services_unbound_advanced.php +++ b/src/www/services_unbound_advanced.php @@ -113,6 +113,7 @@ if ($_POST) { } } +$shortcut_section = 'unbound'; $closehead = false; include_once("head.inc"); diff --git a/src/www/services_unbound_domainoverride_edit.php b/src/www/services_unbound_domainoverride_edit.php index 2ea815168..423c7c615 100644 --- a/src/www/services_unbound_domainoverride_edit.php +++ b/src/www/services_unbound_domainoverride_edit.php @@ -101,6 +101,8 @@ if ($_POST) { } } +$shortcut_section = 'unbound'; + include("head.inc"); ?> diff --git a/src/www/services_unbound_host_edit.php b/src/www/services_unbound_host_edit.php index 98d497972..55359ebbf 100644 --- a/src/www/services_unbound_host_edit.php +++ b/src/www/services_unbound_host_edit.php @@ -191,6 +191,8 @@ if ($_POST) { } } +$shortcut_section = 'unbound'; + include("head.inc"); ?> diff --git a/src/www/services_unbound_overrides.php b/src/www/services_unbound_overrides.php index e785c044c..834442089 100644 --- a/src/www/services_unbound_overrides.php +++ b/src/www/services_unbound_overrides.php @@ -88,8 +88,9 @@ if ($_GET['act'] == "del") { } } +$shortcut_section = 'unbound'; $closehead = false; -$pgtitle = array(gettext('Services'), gettext('DNS Resolver'), gettext('Overrides')); + include_once("head.inc"); ?>