From c18f3b330abbe3055ccc246d96e554220fbdc20e Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 3 Jan 2018 06:27:32 +0000 Subject: [PATCH] */*: style updates (cherry picked from commit 92d9dfa3630ad5c358d36ecce51130115f1fc22e) --- .../snmp/src/etc/inc/plugins.inc.d/bsnmpd.inc | 9 +- .../OPNsense/HAProxy/Migrations/M2_0_0.php | 121 +++++++++--------- .../scripts/OPNsense/HAProxy/exportCerts.php | 6 +- .../MDNSRepeater/Api/ServiceController.php | 5 +- .../MDNSRepeater/Api/SettingsController.php | 4 +- .../src/etc/inc/plugins.inc.d/if_pppoe.inc | 2 +- .../src/etc/inc/plugins.inc.d/if_pptp.inc | 12 +- .../Quagga/Api/OspfsettingsController.php | 1 - .../src/etc/inc/plugins.inc.d/relayd.inc | 22 ++-- .../src/etc/inc/plugins.inc.d/miniupnpd.inc | 20 +-- .../Zerotier/Api/NetworkController.php | 9 +- .../Zerotier/Api/SettingsController.php | 5 +- .../OPNsense/Zerotier/OverviewController.php | 2 +- .../OPNsense/AcmeClient/certhelper.php | 11 +- .../OPNsense/Tinc/Api/SettingsController.php | 10 +- .../scripts/OPNsense/Monit/post-install.php | 13 +- 16 files changed, 126 insertions(+), 126 deletions(-) diff --git a/net-mgmt/snmp/src/etc/inc/plugins.inc.d/bsnmpd.inc b/net-mgmt/snmp/src/etc/inc/plugins.inc.d/bsnmpd.inc index a448ce834..123062a8c 100644 --- a/net-mgmt/snmp/src/etc/inc/plugins.inc.d/bsnmpd.inc +++ b/net-mgmt/snmp/src/etc/inc/plugins.inc.d/bsnmpd.inc @@ -85,7 +85,7 @@ read := "{$config['snmpd']['rocommunity']}" EOD; - if (isset($config['snmpd']['trapenable']) && preg_match('/^\S+$/', $config['snmpd']['trapserver'])){ + if (isset($config['snmpd']['trapenable']) && preg_match('/^\S+$/', $config['snmpd']['trapserver'])) { $snmpdconf .= <<expression = 'hdr_beg'; $acl->hdr_beg = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'host_ends_with': $acl->expression = 'hdr_end'; $acl->hdr_end = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'host_matches': $acl->expression = 'hdr'; $acl->hdr = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'host_regex': $acl->expression = 'hdr_reg'; $acl->hdr_reg = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'host_contains': $acl->expression = 'hdr_sub'; $acl->hdr_sub = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'path_starts_with': $acl->expression = 'path_beg'; $acl->path_beg = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'path_ends_with': $acl->expression = 'path_end'; $acl->path_end = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'path_matches': $acl->expression = 'path'; $acl->path = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'path_regex': $acl->expression = 'path_reg'; $acl->path_reg = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'path_contains': $acl->expression = 'path_dir'; $acl->path_dir = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'url_parameter': $acl->expression = 'url_param'; $acl->url_param_value = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'ssl_c_verify_code': $acl->ssl_c_verify_code = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'ssl_c_ca_commonname': $acl->ssl_c_ca_commonname = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'source_ip': $acl->expression = 'src'; $acl->src = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'backendservercount': $acl->expression = 'nbsrv'; $acl->nbsrv = (string)$acl->value; $acl->nbsrv_backend = (string)$acl->queryBackend; - $acl->value = NULL; - $acl->queryBackend = NULL; + $acl->value = null; + $acl->queryBackend = null; break; case 'ssl_sni_matches': $acl->expression = 'ssl_sni'; $acl->ssl_sni = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'ssl_sni_contains': $acl->expression = 'ssl_sni_sub'; $acl->ssl_sni_sub = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'ssl_sni_starts_with': $acl->expression = 'ssl_sni_beg'; $acl->ssl_sni_beg = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'ssl_sni_ends_with': $acl->expression = 'ssl_sni_end'; $acl->ssl_sni_end = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'ssl_sni_regex': $acl->expression = 'ssl_sni_reg'; $acl->ssl_sni_reg = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; case 'custom_acl': $acl->custom_acl = (string)$acl->value; - $acl->value = NULL; + $acl->value = null; break; } } @@ -149,107 +149,107 @@ class M2_0_0 extends BaseModelMigration switch ((string)$action->type) { case 'use_backend': $action->use_backend = (string)$action->useBackend; - $action->useBackend = NULL; + $action->useBackend = null; break; case 'use_server': $action->use_server = (string)$action->useServer; - $action->useServer = NULL; + $action->useServer = null; break; case 'http-request_auth': $action->http_request_auth = (string)$action->actionValue; - $action->actionValue = NULL; + $action->actionValue = null; break; case 'http-request_redirect': $action->http_request_redirect = (string)$action->actionValue; - $action->actionValue = NULL; + $action->actionValue = null; break; case 'http-request_lua': $action->http_request_lua = (string)$action->actionValue; - $action->actionValue = NULL; + $action->actionValue = null; break; case 'http-request_use-service': $action->http_request_use_service = (string)$action->actionValue; - $action->actionValue = NULL; + $action->actionValue = null; break; case 'http-request_add-header': $action->http_request_add_header_name = (string)$action->actionName; $action->http_request_add_header_content = (string)$action->actionValue; - $action->actionName = NULL; - $action->actionValue = NULL; + $action->actionName = null; + $action->actionValue = null; break; case 'http-request_set-header': $action->http_request_set_header_name = (string)$action->actionName; $action->http_request_set_header_content = (string)$action->actionValue; - $action->actionName = NULL; - $action->actionValue = NULL; + $action->actionName = null; + $action->actionValue = null; break; case 'http-request_del-header': $action->http_request_del_header_name = (string)$action->actionName; - $action->actionName = NULL; + $action->actionName = null; break; case 'http-request_replace-header': $action->http_request_replace_header_name = (string)$action->actionName; $action->http_request_replace_header_regex = (string)$action->actionFind . ' ' . (string)$action->actionValue; - $action->actionName = NULL; - $action->actionFind = NULL; - $action->actionValue = NULL; + $action->actionName = null; + $action->actionFind = null; + $action->actionValue = null; break; case 'http-request_replace-value': $action->http_request_replace_value_name = (string)$action->actionName; $action->http_request_replace_value_regex = (string)$action->actionFind . ' ' . (string)$action->actionValue; - $action->actionName = NULL; - $action->actionFind = NULL; - $action->actionValue = NULL; + $action->actionName = null; + $action->actionFind = null; + $action->actionValue = null; break; case 'http-response_lua': $action->http_response_lua = (string)$action->actionValue; - $action->actionValue = NULL; + $action->actionValue = null; break; case 'http-response_add-header': $action->http_response_add_header_name = (string)$action->actionName; $action->http_response_add_header_content = (string)$action->actionValue; - $action->actionName = NULL; - $action->actionValue = NULL; + $action->actionName = null; + $action->actionValue = null; break; case 'http-response_set-header': $action->http_response_set_header_name = (string)$action->actionName; $action->http_response_set_header_content = (string)$action->actionValue; - $action->actionName = NULL; - $action->actionValue = NULL; + $action->actionName = null; + $action->actionValue = null; break; case 'http-response_del-header': $action->http_response_del_header_name = (string)$action->actionName; - $action->actionName = NULL; + $action->actionName = null; break; case 'http-response_replace-header': $action->http_response_replace_header_name = (string)$action->actionName; $action->http_response_replace_header_regex = (string)$action->actionFind . ' ' . (string)$action->actionValue; - $action->actionName = NULL; - $action->actionFind = NULL; - $action->actionValue = NULL; + $action->actionName = null; + $action->actionFind = null; + $action->actionValue = null; break; case 'http-response_replace-value': $action->http_response_replace_value_name = (string)$action->actionName; $action->http_response_replace_value_regex = (string)$action->actionFind . ' ' . (string)$action->actionValue; - $action->actionName = NULL; - $action->actionFind = NULL; - $action->actionValue = NULL; + $action->actionName = null; + $action->actionFind = null; + $action->actionValue = null; break; case 'tcp-request_content_lua': $action->tcp_request_content_lua = (string)$action->actionValue; - $action->actionValue = NULL; + $action->actionValue = null; break; case 'tcp-request_content_use-service': $action->tcp_request_content_use_service = (string)$action->actionValue; - $action->actionValue = NULL; + $action->actionValue = null; break; case 'tcp-response_content_lua': $action->tcp_response_content_lua = (string)$action->actionValue; - $action->actionValue = NULL; + $action->actionValue = null; break; case 'custom': $action->custom = (string)$action->actionValue; - $action->actionValue = NULL; + $action->actionValue = null; break; } } @@ -259,26 +259,25 @@ class M2_0_0 extends BaseModelMigration switch ((string)$hc->type) { case 'agent': $hc->agent_port = (string)$hc->agentPort; - $hc->agentPort = NULL; + $hc->agentPort = null; break; case 'mysql': $hc->mysql_user = (string)$hc->dbUser; - $hc->dbUser = NULL; + $hc->dbUser = null; break; case 'pgsql': $hc->pgsql_user = (string)$hc->dbUser; - $hc->dbUser = NULL; + $hc->dbUser = null; break; case 'smtp': $hc->smtp_domain = (string)$hc->smtpDomain; - $hc->smtpDomain = NULL; + $hc->smtpDomain = null; break; case 'esmtp': $hc->esmtp_domain = (string)$hc->smtpDomain; - $hc->smtpDomain = NULL; + $hc->smtpDomain = null; break; } } - } } diff --git a/net/haproxy/src/opnsense/scripts/OPNsense/HAProxy/exportCerts.php b/net/haproxy/src/opnsense/scripts/OPNsense/HAProxy/exportCerts.php index 4ac6f7f62..ca577f177 100755 --- a/net/haproxy/src/opnsense/scripts/OPNsense/HAProxy/exportCerts.php +++ b/net/haproxy/src/opnsense/scripts/OPNsense/HAProxy/exportCerts.php @@ -97,9 +97,11 @@ foreach ($configNodes as $key => $value) { } // generate crt-list file // (this makes only sense for frontends) - if ( $key == 'frontends' ) { + if ($key == 'frontends') { // ignore if crt-list is empty - if (empty($crtlist)) { continue; } + if (empty($crtlist)) { + continue; + } // check if a default certificate is configured if (isset($child->ssl_default_certificate) and (string)$child->ssl_default_certificate != "") { $default_cert = (string)$child->ssl_default_certificate; diff --git a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/Api/ServiceController.php b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/Api/ServiceController.php index 3fd038224..145ae9b7a 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/Api/ServiceController.php +++ b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/Api/ServiceController.php @@ -40,7 +40,7 @@ class ServiceController extends ApiControllerBase $result = array('result' => 'failed'); $res = $backend->configdRun('mdnsrepeater status'); if (stripos($res, 'is running')) { - $result['result'] = 'running'; + $result['result'] = 'running'; } elseif (stripos($res, 'not running')) { $general = new MDNSRepeater(); if ((string)$general->enabled == '1') { @@ -48,8 +48,7 @@ class ServiceController extends ApiControllerBase } else { $result['result'] = 'disabled'; } - } - else { + } else { $result['message'] = $res; } return $result; diff --git a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/Api/SettingsController.php b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/Api/SettingsController.php index 945bafa57..5b1780ea0 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/Api/SettingsController.php +++ b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/Api/SettingsController.php @@ -34,6 +34,6 @@ use \OPNsense\Base\ApiMutableModelControllerBase; class SettingsController extends ApiMutableModelControllerBase { - static protected $internalModelClass = '\OPNsense\MDNSRepeater\MDNSRepeater'; - static protected $internalModelName = 'mdnsrepeater'; + static protected $internalModelClass = '\OPNsense\MDNSRepeater\MDNSRepeater'; + static protected $internalModelName = 'mdnsrepeater'; } diff --git a/net/pppoe/src/etc/inc/plugins.inc.d/if_pppoe.inc b/net/pppoe/src/etc/inc/plugins.inc.d/if_pppoe.inc index c508c08b9..58fe791f0 100644 --- a/net/pppoe/src/etc/inc/plugins.inc.d/if_pppoe.inc +++ b/net/pppoe/src/etc/inc/plugins.inc.d/if_pppoe.inc @@ -308,7 +308,7 @@ function if_pppoe_interfaces() if (isset($config['pppoes']['pppoe'])) { $pppoeifs = array('networks' => array()); - foreach($config['pppoes']['pppoe'] as $pppoe) { + foreach ($config['pppoes']['pppoe'] as $pppoe) { if ($pppoe['mode'] == "server") { $mask = !empty($pppoe['pppoe_subnet']) ? $pppoe['pppoe_subnet'] : 32; $pppoeifs['networks'][] = array("network" => gen_subnet($pppoe['remoteip'], $mask), "mask" => $mask); diff --git a/net/pptp/src/etc/inc/plugins.inc.d/if_pptp.inc b/net/pptp/src/etc/inc/plugins.inc.d/if_pptp.inc index 62d829959..b0efbaf2a 100644 --- a/net/pptp/src/etc/inc/plugins.inc.d/if_pptp.inc +++ b/net/pptp/src/etc/inc/plugins.inc.d/if_pptp.inc @@ -283,11 +283,15 @@ function if_pptp_interfaces() $oic['descr'] = 'pptp'; $mask = !empty($config['pptpd']['pptp_subnet']) ? $config['pptpd']['pptp_subnet'] : 32; if (isset($config['pptpd']['n_pptp_units']) && is_numeric($config['pptpd']['n_pptp_units'])) { - $pptp_subnets = ip_range_to_subnet_array($config['pptpd']['remoteip'], - long2ip32(ip2long($config['pptpd']['remoteip'])+($config['pptpd']['n_pptp_units']-1))); + $pptp_subnets = ip_range_to_subnet_array( + $config['pptpd']['remoteip'], + long2ip32(ip2long($config['pptpd']['remoteip'])+($config['pptpd']['n_pptp_units']-1)) + ); } else { - $pptp_subnets = ip_range_to_subnet_array($config['pptpd']['remoteip'], - long2ip32(ip2long($config['pptpd']['remoteip']))); + $pptp_subnets = ip_range_to_subnet_array( + $config['pptpd']['remoteip'], + long2ip32(ip2long($config['pptpd']['remoteip'])) + ); } foreach ($pptp_subnets as $pptp_subnet) { $snparts = explode("/", $pptp_subnet); diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/OspfsettingsController.php b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/OspfsettingsController.php index f8e315f7c..6c55bed5c 100644 --- a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/OspfsettingsController.php +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/OspfsettingsController.php @@ -404,5 +404,4 @@ class OspfsettingsController extends ApiMutableModelControllerBase { return $this->toggle_handler($uuid, 'prefixlists', 'prefixlist'); } - } diff --git a/net/relayd/src/etc/inc/plugins.inc.d/relayd.inc b/net/relayd/src/etc/inc/plugins.inc.d/relayd.inc index 89d6eff9f..6329a7a46 100644 --- a/net/relayd/src/etc/inc/plugins.inc.d/relayd.inc +++ b/net/relayd/src/etc/inc/plugins.inc.d/relayd.inc @@ -158,9 +158,9 @@ function relayd_configure_do($kill_first = false) break; case 'send': $check_a[$type['name']] = "check {$type['type']} "; - $check_a[$type['name']] .= !empty($type['options']['send']) ? "\"{$type['options']['send']}\"" : "\"\"" ; + $check_a[$type['name']] .= !empty($type['options']['send']) ? "\"{$type['options']['send']}\"" : "\"\""; $check_a[$type['name']] .= " expect "; - $check_a[$type['name']] .= !empty($type['options']['expect']) ? "\"{$type['options']['expect']}\"" : "\"\"" ; + $check_a[$type['name']] .= !empty($type['options']['expect']) ? "\"{$type['options']['expect']}\"" : "\"\""; break; default: break; @@ -197,12 +197,12 @@ function relayd_configure_do($kill_first = false) $conf .= "table <{$pool_a[$i]['name']}> {\n"; foreach ($pool_a[$i]['servers'] as $server) { if (is_subnetv4($server)) { - foreach (relayd_subnetv4_expand($server) as $ip) { - $conf .= "\t{$ip}{$retrytext}\n"; - } - } else { - $conf .= "\t{$server}{$retrytext}\n"; - } + foreach (relayd_subnetv4_expand($server) as $ip) { + $conf .= "\t{$ip}{$retrytext}\n"; + } + } else { + $conf .= "\t{$server}{$retrytext}\n"; + } } $conf .= "}\n"; /* Index by name for easier fetching when we loop through the virtual servers */ @@ -292,7 +292,7 @@ function relayd_configure_do($kill_first = false) } $conf .= "}\n"; - } else { + } else { // redirect mode $conf .= "redirect \"{$name}\" {\n"; $conf .= " listen on {$ip} port {$src_port}\n"; @@ -429,8 +429,8 @@ function relayd_get_lb_summary() { $relayctl = array(); exec('/usr/local/sbin/relayctl show summary 2>&1', $relayctl); - $relay_hosts=Array(); - foreach( (array) $relayctl as $line) { + $relay_hosts=array(); + foreach ((array) $relayctl as $line) { $t = explode("\t", $line); if (isset($t[1])) { switch (trim($t[1])) { diff --git a/net/upnp/src/etc/inc/plugins.inc.d/miniupnpd.inc b/net/upnp/src/etc/inc/plugins.inc.d/miniupnpd.inc index e7cddffd5..766b8db6f 100644 --- a/net/upnp/src/etc/inc/plugins.inc.d/miniupnpd.inc +++ b/net/upnp/src/etc/inc/plugins.inc.d/miniupnpd.inc @@ -93,7 +93,7 @@ function miniupnpd_uuid() /* md5 hash of wan mac */ $uuid = md5(get_interface_mac(get_real_interface("wan"))); /* put uuid in correct format 8-4-4-4-12 */ - return substr($uuid,0,8).'-'.substr($uuid,9,4).'-'.substr($uuid,13,4).'-'.substr($uuid,17,4).'-'.substr($uuid,21,12); + return substr($uuid, 0, 8).'-'.substr($uuid, 9, 4).'-'.substr($uuid, 13, 4).'-'.substr($uuid, 17, 4).'-'.substr($uuid, 21, 12); } function miniupnpd_configure_do($verbose = false) @@ -128,7 +128,7 @@ function miniupnpd_configure_do($verbose = false) /* since config is written before this file invoked we don't need to read post data */ if (!empty($upnp_config['iface_array'])) { - foreach(explode(',', $upnp_config['iface_array']) as $iface) { + foreach (explode(',', $upnp_config['iface_array']) as $iface) { /* Setting the same internal and external interface is not allowed. */ if ($iface == $upnp_config['ext_iface']) { continue; @@ -140,13 +140,13 @@ function miniupnpd_configure_do($verbose = false) $bits = find_interface_subnet($if); /* check that the interface has an ip address before adding parameters */ if (is_ipaddr($addr)) { - $config_text .= "listening_ip={$if}\n"; - if (!$ifaces_active) { - $webgui_ip = $addr; - $ifaces_active = $iface; - } else { - $ifaces_active .= ", {$iface}"; - } + $config_text .= "listening_ip={$if}\n"; + if (!$ifaces_active) { + $webgui_ip = $addr; + $ifaces_active = $iface; + } else { + $ifaces_active .= ", {$iface}"; + } } else { log_error("miniupnpd: Interface {$iface} has no ip address, ignoring"); } @@ -191,7 +191,7 @@ function miniupnpd_configure_do($verbose = false) /* set uuid and serial */ $config_text .= "uuid=".miniupnpd_uuid()."\n"; - $config_text .= "serial=".strtoupper(substr(miniupnpd_uuid(),0,8))."\n"; + $config_text .= "serial=".strtoupper(substr(miniupnpd_uuid(), 0, 8))."\n"; /* set model number */ $config_text .= "model_number=".file_get_contents("/usr/local/opnsense/version/opnsense")."\n"; diff --git a/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/Api/NetworkController.php b/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/Api/NetworkController.php index bc8de1402..036c20dd8 100644 --- a/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/Api/NetworkController.php +++ b/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/Api/NetworkController.php @@ -90,10 +90,10 @@ class NetworkController extends ApiMutableModelControllerBase { $result = array("result" => "failed"); if ($this->request->isPost() && $this->request->hasPost("network")) { - if($uuid != null) { + if ($uuid != null) { $mdlZerotier = $this->getModel(); $network = $mdlZerotier->getNodeByReference('networks.network.' . $uuid); - if($network != null) { + if ($network != null) { $network->setNodes($this->request->getPost("network")); $validationMessages = $mdlZerotier->performValidation(); foreach ($validationMessages as $field => $msg) { @@ -202,12 +202,11 @@ class NetworkController extends ApiMutableModelControllerBase { $zerotierNetworks = trim((new Backend())->configdRun("zerotier listnetworks")); $zerotierNetworks = explode("200 listnetworks", $zerotierNetworks); - foreach($zerotierNetworks as $zerotierNetwork) { - if(strpos($zerotierNetwork, $networkId) !== false) { + foreach ($zerotierNetworks as $zerotierNetwork) { + if (strpos($zerotierNetwork, $networkId) !== false) { return $zerotierNetwork; } } return gettext("Unable to obtain Zerotier information for network") . " " . $networkId . "! " . gettext("Is the network enabled?"); } - } diff --git a/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/Api/SettingsController.php b/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/Api/SettingsController.php index 8b0b3ebe6..1d04a9095 100644 --- a/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/Api/SettingsController.php +++ b/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/Api/SettingsController.php @@ -48,7 +48,7 @@ class SettingsController extends ApiMutableModelControllerBase $result = array(); if ($this->request->isGet()) { $mdlZerotier = $this->getModel(); - if(empty($mdlZerotier->localconf->__toString())) { + if (empty($mdlZerotier->localconf->__toString())) { $mdlZerotier->localconf = '{}'; } $result = array("zerotier" => $mdlZerotier->getNodes()); @@ -59,7 +59,7 @@ class SettingsController extends ApiMutableModelControllerBase public function setAction() { $result = array("result" => "failed"); - if($this->request->isPost() && $this->request->hasPost("zerotier")) { + if ($this->request->isPost() && $this->request->hasPost("zerotier")) { $mdlZerotier = $this->getModel(); $mdlZerotier->setNodes($this->request->getPost("zerotier")); $mdlZerotier->serializeToConfig(); @@ -101,5 +101,4 @@ class SettingsController extends ApiMutableModelControllerBase $action = $enabled ? "start" : "stop"; return trim($backend->configdRun("zerotier $action")); } - } diff --git a/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/OverviewController.php b/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/OverviewController.php index e827a8c0d..ca4ecaf50 100644 --- a/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/OverviewController.php +++ b/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/OverviewController.php @@ -60,7 +60,7 @@ class OverviewController extends \OPNsense\Base\IndexController private function invokeConfigdRun($action) { - if(!zerotier_enabled()) { + if (!zerotier_enabled()) { return (object)[]; } $result = json_decode(trim((new Backend())->configdRun("zerotier $action")), true); diff --git a/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/certhelper.php b/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/certhelper.php index 226d552ce..4485350a1 100755 --- a/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/certhelper.php +++ b/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/certhelper.php @@ -1146,7 +1146,8 @@ function local_cert_get_cn($crt, $decode = true) } // taken from system_camanager.php -function local_ca_import(& $ca, $str, $key="", $serial=0) { +function local_ca_import(& $ca, $str, $key = "", $serial = 0) +{ global $config; $ca['crt'] = base64_encode($str); @@ -1160,9 +1161,9 @@ function local_ca_import(& $ca, $str, $key="", $serial=0) { $issuer = cert_get_issuer($str, false); // Find my issuer unless self-signed - if($issuer <> $subject) { + if ($issuer <> $subject) { $issuer_crt =& lookup_ca_by_subject($issuer); - if($issuer_crt) { + if ($issuer_crt) { $ca['caref'] = $issuer_crt['refid']; } } @@ -1171,7 +1172,7 @@ function local_ca_import(& $ca, $str, $key="", $serial=0) { if (is_array($config['ca'])) { foreach ($config['ca'] as & $oca) { $issuer = cert_get_issuer($oca['crt']); - if($ca['refid']<>$oca['refid'] && $issuer==$subject) { + if ($ca['refid']<>$oca['refid'] && $issuer==$subject) { $oca['caref'] = $ca['refid']; } } @@ -1179,7 +1180,7 @@ function local_ca_import(& $ca, $str, $key="", $serial=0) { if (is_array($config['cert'])) { foreach ($config['cert'] as & $cert) { $issuer = cert_get_issuer($cert['crt']); - if($issuer==$subject) { + if ($issuer==$subject) { $cert['caref'] = $ca['refid']; } } diff --git a/security/tinc/src/opnsense/mvc/app/controllers/OPNsense/Tinc/Api/SettingsController.php b/security/tinc/src/opnsense/mvc/app/controllers/OPNsense/Tinc/Api/SettingsController.php index 341d0c030..019cf0ea9 100644 --- a/security/tinc/src/opnsense/mvc/app/controllers/OPNsense/Tinc/Api/SettingsController.php +++ b/security/tinc/src/opnsense/mvc/app/controllers/OPNsense/Tinc/Api/SettingsController.php @@ -59,7 +59,7 @@ class SettingsController extends ApiMutableModelControllerBase return array("network" => $node->getNodes()); } } - return array() ; + return array(); } /** @@ -76,7 +76,7 @@ class SettingsController extends ApiMutableModelControllerBase $node = $this->getModel()->networks->network->Add(); } $node->setNodes($this->request->getPost("network")); - if (empty((string)$node->pubkey) || empty((string)$node->privkey)){ + if (empty((string)$node->pubkey) || empty((string)$node->privkey)) { // generate new keypair $backend = new Backend(); $keys = json_decode(trim($backend->configdRun("tinc gen-key")), true); @@ -117,7 +117,7 @@ class SettingsController extends ApiMutableModelControllerBase $result = $this->validateAndSave(); } } - return $result ; + return $result; } /** @@ -166,7 +166,7 @@ class SettingsController extends ApiMutableModelControllerBase return array("host" => $node->getNodes()); } } - return array() ; + return array(); } /** @@ -217,7 +217,7 @@ class SettingsController extends ApiMutableModelControllerBase $result = $this->validateAndSave(); } } - return $result ; + return $result; } /** diff --git a/sysutils/monit/src/opnsense/scripts/OPNsense/Monit/post-install.php b/sysutils/monit/src/opnsense/scripts/OPNsense/Monit/post-install.php index 25d7450fa..e898107fd 100755 --- a/sysutils/monit/src/opnsense/scripts/OPNsense/Monit/post-install.php +++ b/sysutils/monit/src/opnsense/scripts/OPNsense/Monit/post-install.php @@ -44,14 +44,13 @@ $generalNode = $mdlMonit->getNodeByReference('general'); // generate password for local Monit plugin user if (empty($cfgObj->general->httpdUsername) && empty($cfgObj->general->httpdPassword)) { - srand(); - $generalNode->setNodes(array( + srand(); + $generalNode->setNodes(array( "httpdUsername" => "root", "httpdPassword" => substr(str_shuffle(str_repeat('0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz', 32)), rand(0, 16), rand(17, 32)) - ) - ); - $mdlMonit->serializeToConfig(false, true); - $cfg->save(); + )); + $mdlMonit->serializeToConfig(false, true); + $cfg->save(); } $nodes = $mdlMonit->getNodes(); @@ -91,7 +90,7 @@ if (!empty($cfgObj->notifications->smtp->notifyemailaddress)) { $alertSettings['recipient'] = $cfgObj->notifications->smtp->notifyemailaddress; } if (!empty($cfgObj->notifications->smtp->fromaddress)) { - $alertSettings['format'] = 'from: ' . $cfgObj->notifications->smtp->fromaddress; + $alertSettings['format'] = 'from: ' . $cfgObj->notifications->smtp->fromaddress; } // define some tests