Commit 3d93e25b authored by Franco Fichtner's avatar Franco Fichtner

services: remove indirect mapping and fix remaining services

parent d4ff81bb
......@@ -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,42 +29,21 @@
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) {
if ($service['name'] == $name) {
return $service;
}
}
}
}
return array();
}
......@@ -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");
?>
......
......@@ -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");
?>
......
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