mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 08:34:39 +00:00
services: remove indirect mapping and fix remaining services
This commit is contained in:
parent
d4ff81bbbc
commit
3d93e25ba0
@ -3,4 +3,7 @@
|
||||
$logfile = '/var/log/gateways.log';
|
||||
$logclog = true;
|
||||
|
||||
require_once 'services.inc';
|
||||
$shortcut_section = 'apinger';
|
||||
|
||||
require_once 'diag_logs_template.inc';
|
||||
|
||||
@ -4,6 +4,6 @@ $logfile = '/var/log/ntpd.log';
|
||||
$logclog = true;
|
||||
|
||||
require_once 'services.inc';
|
||||
$shortcut_section = 'ntp';
|
||||
$shortcut_section = 'ntpd';
|
||||
|
||||
require_once 'diag_logs_template.inc';
|
||||
|
||||
@ -29,39 +29,18 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
function find_service_by_shortcut($names)
|
||||
function find_service_by_name($names)
|
||||
{
|
||||
$shortcuts = array();
|
||||
|
||||
if (!is_array($names)) {
|
||||
$names = array($names);
|
||||
}
|
||||
|
||||
$shortcuts['dhcpd'] = 'dhcpd';
|
||||
$shortcuts['dhcrelay'] = 'dhcrelay';
|
||||
$shortcuts['dhcrelay6'] = 'dhcrelay6';
|
||||
$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['snmp'] = 'bsnmpd';
|
||||
$shortcuts['squid'] = 'squid';
|
||||
$shortcuts['upnp'] = 'miniupnpd';
|
||||
|
||||
$services = get_services();
|
||||
|
||||
foreach ($shortcuts as $shortcut => $realname) {
|
||||
foreach ($services as $service) {
|
||||
foreach ($names as $name) {
|
||||
if ($shortcut == $name) {
|
||||
foreach ($services as $service)
|
||||
if ($service['name'] == $realname) {
|
||||
return $service;
|
||||
}
|
||||
if ($service['name'] == $name) {
|
||||
return $service;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -232,7 +211,7 @@ if($need_alert_display == true) {
|
||||
$ssvc = find_service_by_openvpn_vpnid($vpnid);
|
||||
break;
|
||||
default:
|
||||
$ssvc = find_service_by_shortcut($shortcut_section);
|
||||
$ssvc = find_service_by_name($shortcut_section);
|
||||
break;
|
||||
}
|
||||
if (!empty($ssvc)) {
|
||||
|
||||
@ -146,7 +146,7 @@ if ($_POST) {
|
||||
}
|
||||
}
|
||||
|
||||
$shortcut_section = "relayd";
|
||||
$shortcut_section = 'relayd';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
|
||||
@ -157,7 +157,7 @@ if (empty($pconfig['interface'])) {
|
||||
$pconfig['interface'] = explode(",", $pconfig['interface']);
|
||||
}
|
||||
|
||||
$shortcut_section = 'ntp';
|
||||
$shortcut_section = 'ntpd';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ if ($_POST) {
|
||||
}
|
||||
|
||||
$pconfig = &$config['ntpd']['gps'];
|
||||
$shortcut_section = "ntp";
|
||||
$shortcut_section = 'ntpd';
|
||||
$closehead = false;
|
||||
|
||||
include("head.inc");
|
||||
|
||||
@ -87,9 +87,9 @@ if ($_POST) {
|
||||
$retval = system_ntp_configure();
|
||||
$savemsg = get_std_save_message();
|
||||
}
|
||||
$pconfig = &$config['ntpd']['pps'];
|
||||
|
||||
$shortcut_section = "ntp";
|
||||
$pconfig = &$config['ntpd']['pps'];
|
||||
$shortcut_section = 'ntpd';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
|
||||
@ -152,7 +152,7 @@ if ($_POST) {
|
||||
}
|
||||
}
|
||||
|
||||
$shortcut_section = "snmp";
|
||||
$shortcut_section = 'bsnmpd';
|
||||
$closehead = false;
|
||||
|
||||
include("head.inc");
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
ini_set('max_execution_time', '0');
|
||||
|
||||
$shortcut_section = "upnp";
|
||||
$shortcut_section = 'miniupnpd';
|
||||
|
||||
require_once("guiconfig.inc");
|
||||
require_once("services.inc");
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
*/
|
||||
|
||||
require_once("guiconfig.inc");
|
||||
require_once("services.inc");
|
||||
|
||||
// request report data
|
||||
if (!isset($config['gateways']['gateway_group']) || !is_array($config['gateways']['gateway_group'])) {
|
||||
@ -41,6 +42,8 @@ $a_gateways = return_gateways_array();
|
||||
legacy_html_escape_form_data($a_gateways);
|
||||
legacy_html_escape_form_data($a_gateway_groups);
|
||||
|
||||
$shortcut_section = 'apinger';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
?>
|
||||
|
||||
@ -35,6 +35,8 @@ $a_gateways = return_gateways_array();
|
||||
$gateways_status = return_gateways_status(true);
|
||||
legacy_html_escape_form_data($a_gateways);
|
||||
|
||||
$shortcut_section = 'apinger';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
?>
|
||||
|
||||
@ -145,7 +145,7 @@ if (isset($config['ntpd']['gps']['type']) && ($config['ntpd']['gps']['type'] ==
|
||||
}
|
||||
}
|
||||
|
||||
$shortcut_section = "ntp";
|
||||
$shortcut_section = 'ntpd';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ exec("/sbin/pfctl -aminiupnpd -sn", $rdr_entries, $pf_ret);
|
||||
$now = time();
|
||||
$year = date("Y");
|
||||
|
||||
$shortcut_section = "upnp";
|
||||
$shortcut_section = 'miniupnpd';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ require_once("guiconfig.inc");
|
||||
require_once("interfaces.inc");
|
||||
require_once("openvpn.inc");
|
||||
require_once("system.inc");
|
||||
require_once("services.inc");
|
||||
require_once("pfsense-utils.inc");
|
||||
require_once("rrd.inc");
|
||||
|
||||
@ -112,6 +113,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
legacy_html_escape_form_data($a_gateway_groups);
|
||||
|
||||
$shortcut_section = 'apinger';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
$main_buttons = array(
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
require_once("guiconfig.inc");
|
||||
require_once("vpn.inc");
|
||||
require_once("services.inc");
|
||||
require_once("interfaces.inc");
|
||||
|
||||
if (!is_array($config['gateways'])) {
|
||||
@ -143,6 +144,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
legacy_html_escape_form_data($a_gateways);
|
||||
legacy_html_escape_form_data($pconfig);
|
||||
|
||||
$shortcut_section = 'apinger';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
?>
|
||||
|
||||
@ -1,30 +1,30 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2014-2015 Deciso B.V.
|
||||
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
|
||||
All rights reserved.
|
||||
Copyright (C) 2014-2015 Deciso B.V.
|
||||
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require_once("guiconfig.inc");
|
||||
@ -205,6 +205,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
legacy_html_escape_form_data($a_gateways);
|
||||
|
||||
$shortcut_section = 'apinger';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
$main_buttons = array(
|
||||
|
||||
@ -477,6 +477,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
legacy_html_escape_form_data($a_gateways);
|
||||
legacy_html_escape_form_data($pconfig);
|
||||
|
||||
$shortcut_section = 'apinger';
|
||||
|
||||
include("head.inc");
|
||||
|
||||
?>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user