From 752a9d88b42882c28c42de00bf3212855a9cd159 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 7 Oct 2019 22:01:00 +0200 Subject: [PATCH] net: PSR12 conversion --- .../ARPscanner/Api/ServiceController.php | 8 ++++---- .../ARPscanner/Api/SettingsController.php | 6 +++--- .../models/OPNsense/ARPscanner/ARPscanner.php | 2 +- .../Freeradius/Api/ClientController.php | 7 ++++--- .../Freeradius/Api/DhcpController.php | 1 + .../OPNsense/Freeradius/Api/EapController.php | 5 +++-- .../Freeradius/Api/GeneralController.php | 5 +++-- .../Freeradius/Api/LdapController.php | 1 + .../Freeradius/Api/LeaseController.php | 1 + .../Freeradius/Api/UserController.php | 7 ++++--- .../app/models/OPNsense/Freeradius/Client.php | 1 + .../app/models/OPNsense/Freeradius/Dhcp.php | 1 + .../app/models/OPNsense/Freeradius/Eap.php | 1 + .../models/OPNsense/Freeradius/General.php | 1 + .../app/models/OPNsense/Freeradius/Ldap.php | 1 + .../app/models/OPNsense/Freeradius/Lease.php | 1 + .../app/models/OPNsense/Freeradius/User.php | 1 + .../OPNsense/Quagga/Api/BgpController.php | 1 + .../Quagga/Api/DiagnosticsController.php | 1 + .../OPNsense/Quagga/Api/GeneralController.php | 5 +++-- .../OPNsense/Quagga/Api/RipController.php | 1 + .../OPNsense/Quagga/Api/ServiceController.php | 1 + .../OPNsense/Quagga/BgpController.php | 1 + .../OPNsense/Quagga/DiagnosticsController.php | 1 + .../OPNsense/Quagga/GeneralController.php | 1 + .../OPNsense/Quagga/IsisController.php | 1 + .../OPNsense/Quagga/Ospf6Controller.php | 1 + .../OPNsense/Quagga/OspfController.php | 1 + .../OPNsense/Quagga/RipController.php | 1 + .../mvc/app/models/OPNsense/Quagga/BGP.php | 1 + .../app/models/OPNsense/Quagga/General.php | 1 + .../mvc/app/models/OPNsense/Quagga/OSPF.php | 1 + .../mvc/app/models/OPNsense/Quagga/OSPF6.php | 1 + .../mvc/app/models/OPNsense/Quagga/RIP.php | 1 + .../HAProxy/Api/ServiceController.php | 1 + .../HAProxy/Api/SettingsController.php | 1 + .../HAProxy/Api/StatisticsController.php | 1 + .../OPNsense/HAProxy/StatisticsController.php | 1 + .../app/models/OPNsense/HAProxy/HAProxy.php | 1 + .../OPNsense/HAProxy/Migrations/M2_0_0.php | 1 + .../OPNsense/HAProxy/Migrations/M2_3_0.php | 1 + .../OPNsense/HAProxy/Migrations/M2_6_0.php | 1 + .../OPNsense/HAProxy/Migrations/M2_7_0.php | 1 + .../OPNsense/HAProxy/Migrations/M2_8_0.php | 1 + .../src/etc/inc/plugins.inc.d/if_l2tp.inc | 4 ++-- .../src/etc/inc/plugins.inc.d/if_pppoe.inc | 4 ++-- .../src/etc/inc/plugins.inc.d/if_pptp.inc | 12 +++++------ .../Relayd/Api/SettingsController.php | 18 +++++++++++------ .../OPNsense/Relayd/Api/StatusController.php | 20 +++++++++++++------ .../OPNsense/Relayd/Migrations/M1_0_0.php | 18 +++++++++++------ .../compound/OPNsense/Relayd/RelaydTest.php | 8 ++++---- .../OPNsense/Siproxd/Api/DomainController.php | 7 ++++--- .../Siproxd/Api/GeneralController.php | 4 ++-- .../OPNsense/Siproxd/Api/UserController.php | 7 ++++--- .../src/etc/inc/plugins.inc.d/miniupnpd.inc | 12 +++++------ .../Wireguard/Api/ClientController.php | 1 + .../Wireguard/Api/ServerController.php | 9 +++++---- .../OPNsense/Wol/Api/WolController.php | 2 +- .../OPNsense/Wol/IndexController.php | 1 + .../mvc/app/models/OPNsense/Wol/Wol.php | 1 + .../Zerotier/Api/NetworkController.php | 2 +- .../OPNsense/Zerotier/IndexController.php | 1 + .../OPNsense/Zerotier/OverviewController.php | 1 + .../app/models/OPNsense/Zerotier/Zerotier.php | 1 + 64 files changed, 142 insertions(+), 72 deletions(-) diff --git a/net/arp-scan/src/opnsense/mvc/app/controllers/OPNsense/ARPscanner/Api/ServiceController.php b/net/arp-scan/src/opnsense/mvc/app/controllers/OPNsense/ARPscanner/Api/ServiceController.php index 778fd06c86..4a7f399974 100644 --- a/net/arp-scan/src/opnsense/mvc/app/controllers/OPNsense/ARPscanner/Api/ServiceController.php +++ b/net/arp-scan/src/opnsense/mvc/app/controllers/OPNsense/ARPscanner/Api/ServiceController.php @@ -41,7 +41,7 @@ public function startAction() $networks = escapeshellarg($_POST['networks']); //~ return 'arpscanner start '.$ifname.' '.$networks; $backend = new Backend(); - $result = json_decode(trim($backend->configdRun('arpscanner start '.$ifname.' '.$networks)), true); + $result = json_decode(trim($backend->configdRun('arpscanner start ' . $ifname . ' ' . $networks)), true); return $result; } return array("message" => "unable to run config action"); @@ -53,7 +53,7 @@ public function statusAction() $ifname = escapeshellarg($_POST['interface']); //~ return 'arpscanner start '.$ifname.' '.$networks; $backend = new Backend(); - $result = json_decode(trim($backend->configdRun('arpscanner status '.$ifname)), true); + $result = json_decode(trim($backend->configdRun('arpscanner status ' . $ifname)), true); return $result; } return array("message" => "this action must be called using the POST method"); @@ -64,7 +64,7 @@ public function stopAction() if ($this->request->isPost()) { $ifname = escapeshellarg($_POST['interface']); $backend = new Backend(); - $bckresult = trim($backend->configdRun("arpscanner stop ".$ifname)); + $bckresult = trim($backend->configdRun("arpscanner stop " . $ifname)); if ($bckresult !== null) { // only return valid json type responses return $bckresult; @@ -79,7 +79,7 @@ public function checkAction() $ifname = escapeshellarg($_POST['interface']); // test: "configctl arpscanner check em0" $backend = new Backend(); - $bckresult = json_decode(trim($backend->configdRun("arpscanner check ".$ifname)), true); + $bckresult = json_decode(trim($backend->configdRun("arpscanner check " . $ifname)), true); if ($bckresult !== null) { // only return valid json type responses return $bckresult; diff --git a/net/arp-scan/src/opnsense/mvc/app/controllers/OPNsense/ARPscanner/Api/SettingsController.php b/net/arp-scan/src/opnsense/mvc/app/controllers/OPNsense/ARPscanner/Api/SettingsController.php index 059df5fc65..5b427a311a 100644 --- a/net/arp-scan/src/opnsense/mvc/app/controllers/OPNsense/ARPscanner/Api/SettingsController.php +++ b/net/arp-scan/src/opnsense/mvc/app/controllers/OPNsense/ARPscanner/Api/SettingsController.php @@ -59,7 +59,7 @@ public function getAction() foreach ($ifnames as &$arr) { $ifname = $arr[0]; $result['arpscanner']['general']['interface'][$ifname] = array(); - $result['arpscanner']['general']['interface'][$ifname]['value'] = join(", ", array($ifname, " (".$arr[2].")")); + $result['arpscanner']['general']['interface'][$ifname]['value'] = join(", ", array($ifname, " (" . $arr[2] . ")")); } } // $result['arpscanner']['general']['networks'] = '192.168.1.0/24,172.16.45.0/25'; @@ -73,7 +73,7 @@ public function getAction() */ public function setAction() { - $result = array("result"=>"failed"); + $result = array("result" => "failed"); if ($this->request->isPost()) { // load model and update with provided data $mdl = new ARPscanner(); @@ -85,7 +85,7 @@ public function setAction() if (!array_key_exists("validations", $result)) { $result["validations"] = array(); } - $result["validations"]["general.".$msg->getField()] = $msg->getMessage(); + $result["validations"]["general." . $msg->getField()] = $msg->getMessage(); } // serialize model to config and save diff --git a/net/arp-scan/src/opnsense/mvc/app/models/OPNsense/ARPscanner/ARPscanner.php b/net/arp-scan/src/opnsense/mvc/app/models/OPNsense/ARPscanner/ARPscanner.php index 9448a28d73..281e7954b3 100644 --- a/net/arp-scan/src/opnsense/mvc/app/models/OPNsense/ARPscanner/ARPscanner.php +++ b/net/arp-scan/src/opnsense/mvc/app/models/OPNsense/ARPscanner/ARPscanner.php @@ -36,7 +36,7 @@ class ARPscanner extends BaseModel { public function test() { - $command="/sbin/ifconfig -l -u"; + $command = "/sbin/ifconfig -l -u"; exec($command, $output); return $output; } diff --git a/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/ClientController.php b/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/ClientController.php index ee4c1ec2b9..fcbf540138 100644 --- a/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/ClientController.php +++ b/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/ClientController.php @@ -1,4 +1,5 @@ @@ -52,7 +53,7 @@ public function getAction() public function setAction() { - $result = array("result"=>"failed"); + $result = array("result" => "failed"); if ($this->request->isPost()) { // load model and update with provided data $mdlClient = new Client(); @@ -63,7 +64,7 @@ public function setAction() if (!array_key_exists("validations", $result)) { $result["validations"] = array(); } - $result["validations"]["client.".$msg->getField()] = $msg->getMessage(); + $result["validations"]["client." . $msg->getField()] = $msg->getMessage(); } // serialize model to config and save if ($valMsgs->count() == 0) { @@ -179,7 +180,7 @@ public function toggle_handler($uuid, $elements, $element) if ($this->request->isPost()) { $mdlSetting = $this->getModel(); if ($uuid != null) { - $node = $mdlSetting->getNodeByReference($elements . '.'. $element .'.' . $uuid); + $node = $mdlSetting->getNodeByReference($elements . '.' . $element . '.' . $uuid); if ($node != null) { if ($node->enabled->__toString() == "1") { $result['result'] = "Disabled"; diff --git a/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/DhcpController.php b/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/DhcpController.php index d8f9b2a3e3..3c985d9cdb 100644 --- a/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/DhcpController.php +++ b/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/DhcpController.php @@ -1,4 +1,5 @@ diff --git a/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/EapController.php b/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/EapController.php index a3438ed477..31bf54bb10 100644 --- a/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/EapController.php +++ b/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/EapController.php @@ -1,4 +1,5 @@ @@ -49,7 +50,7 @@ public function getAction() public function setAction() { - $result = array("result"=>"failed"); + $result = array("result" => "failed"); if ($this->request->isPost()) { // load model and update with provided data $mdlEAP = new EAP(); @@ -61,7 +62,7 @@ public function setAction() if (!array_key_exists("validations", $result)) { $result["validations"] = array(); } - $result["validations"]["eap.".$msg->getField()] = $msg->getMessage(); + $result["validations"]["eap." . $msg->getField()] = $msg->getMessage(); } // serialize model to config and save diff --git a/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/GeneralController.php b/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/GeneralController.php index 032b520c4d..e153e1b7fb 100644 --- a/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/GeneralController.php +++ b/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/GeneralController.php @@ -1,4 +1,5 @@ @@ -49,7 +50,7 @@ public function getAction() public function setAction() { - $result = array("result"=>"failed"); + $result = array("result" => "failed"); if ($this->request->isPost()) { // load model and update with provided data $mdlGeneral = new General(); @@ -61,7 +62,7 @@ public function setAction() if (!array_key_exists("validations", $result)) { $result["validations"] = array(); } - $result["validations"]["general.".$msg->getField()] = $msg->getMessage(); + $result["validations"]["general." . $msg->getField()] = $msg->getMessage(); } // serialize model to config and save diff --git a/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/LdapController.php b/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/LdapController.php index 73721c921a..d53e485c96 100644 --- a/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/LdapController.php +++ b/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/LdapController.php @@ -1,4 +1,5 @@ diff --git a/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/LeaseController.php b/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/LeaseController.php index dab7494c9a..58a71277c4 100644 --- a/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/LeaseController.php +++ b/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/LeaseController.php @@ -1,4 +1,5 @@ diff --git a/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/UserController.php b/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/UserController.php index 78d9185023..d6a26bc2c4 100644 --- a/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/UserController.php +++ b/net/freeradius/src/opnsense/mvc/app/controllers/OPNsense/Freeradius/Api/UserController.php @@ -1,4 +1,5 @@ @@ -53,7 +54,7 @@ public function getAction() public function setAction() { - $result = array("result"=>"failed"); + $result = array("result" => "failed"); if ($this->request->isPost()) { // load model and update with provided data $mdlUser = new User(); @@ -64,7 +65,7 @@ public function setAction() if (!array_key_exists("validations", $result)) { $result["validations"] = array(); } - $result["validations"]["user.".$msg->getField()] = $msg->getMessage(); + $result["validations"]["user." . $msg->getField()] = $msg->getMessage(); } // serialize model to config and save if ($valMsgs->count() == 0) { @@ -180,7 +181,7 @@ public function toggle_handler($uuid, $elements, $element) if ($this->request->isPost()) { $mdlSetting = $this->getModel(); if ($uuid != null) { - $node = $mdlSetting->getNodeByReference($elements . '.'. $element .'.' . $uuid); + $node = $mdlSetting->getNodeByReference($elements . '.' . $element . '.' . $uuid); if ($node != null) { if ($node->enabled->__toString() == "1") { $result['result'] = "Disabled"; diff --git a/net/freeradius/src/opnsense/mvc/app/models/OPNsense/Freeradius/Client.php b/net/freeradius/src/opnsense/mvc/app/models/OPNsense/Freeradius/Client.php index 5b8437f7d7..6c6cc08463 100644 --- a/net/freeradius/src/opnsense/mvc/app/models/OPNsense/Freeradius/Client.php +++ b/net/freeradius/src/opnsense/mvc/app/models/OPNsense/Freeradius/Client.php @@ -1,4 +1,5 @@ diff --git a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/GeneralController.php b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/GeneralController.php index b643a499b6..1f26d219de 100644 --- a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/GeneralController.php +++ b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/GeneralController.php @@ -1,4 +1,5 @@ "failed"); + $result = array("result" => "failed"); if ($this->request->isPost()) { // load model and update with provided data $mdlGeneral = new General(); @@ -60,7 +61,7 @@ public function setAction() if (!array_key_exists("validations", $result)) { $result["validations"] = array(); } - $result["validations"]["general.".$msg->getField()] = $msg->getMessage(); + $result["validations"]["general." . $msg->getField()] = $msg->getMessage(); } // serialize model to config and save diff --git a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/RipController.php b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/RipController.php index 5e786794dc..98a8b8b052 100644 --- a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/RipController.php +++ b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/RipController.php @@ -1,4 +1,5 @@ diff --git a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/DiagnosticsController.php b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/DiagnosticsController.php index 6ed9e21739..0c0ccd21b5 100644 --- a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/DiagnosticsController.php +++ b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/DiagnosticsController.php @@ -1,4 +1,5 @@ diff --git a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/GeneralController.php b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/GeneralController.php index db963b90ff..f0db9a6f28 100644 --- a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/GeneralController.php +++ b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/GeneralController.php @@ -1,4 +1,5 @@ diff --git a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/OspfController.php b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/OspfController.php index 4e884c5ec6..c240f4cf64 100644 --- a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/OspfController.php +++ b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/OspfController.php @@ -1,4 +1,5 @@ diff --git a/net/frr/src/opnsense/mvc/app/models/OPNsense/Quagga/RIP.php b/net/frr/src/opnsense/mvc/app/models/OPNsense/Quagga/RIP.php index 674f56d093..7a9838a28b 100644 --- a/net/frr/src/opnsense/mvc/app/models/OPNsense/Quagga/RIP.php +++ b/net/frr/src/opnsense/mvc/app/models/OPNsense/Quagga/RIP.php @@ -1,4 +1,5 @@ 1) ? $pptpdcfg['radius']['server']['port'] : 1812; $acctport = $authport + 1; - $mpdconf .=<< 1) ? $pptpdcfg['radius']['server2']['port'] : 1812; $acctport = $authport + 1; - $mpdconf .=<< 0) || - ($type != $virtualServerType && strlen($virtualServerType) > 5)) { + if ( + ($id != $virtualServerId + && $virtualServerId > 0) + || ($type != $virtualServerType + && strlen($virtualServerType) > 5) + ) { $rows[] = $virtualserver; $virtualserver = array(); } @@ -102,13 +106,17 @@ public function toggleAction($nodeType = null, $id = null, $action = null) $this->sessionClose(); } $result = array("result" => "failed", "function" => "toggle"); - if ($nodeType != null && + if ( + $nodeType != null && ($nodeType == 'redirect' || $nodeType == 'table' || - $nodeType == 'host')) { - if ($action != null && + $nodeType == 'host') + ) { + if ( + $action != null && ($action == 'enable' || - $action == 'disable')) { + $action == 'disable') + ) { if ($id != null && $id > 0) { $backend = new Backend(); $result["output"] = $backend->configdRun("relayd toggle $nodeType $action $id"); diff --git a/net/relayd/src/opnsense/mvc/app/models/OPNsense/Relayd/Migrations/M1_0_0.php b/net/relayd/src/opnsense/mvc/app/models/OPNsense/Relayd/Migrations/M1_0_0.php index ca0eac5d11..667c5bee91 100644 --- a/net/relayd/src/opnsense/mvc/app/models/OPNsense/Relayd/Migrations/M1_0_0.php +++ b/net/relayd/src/opnsense/mvc/app/models/OPNsense/Relayd/Migrations/M1_0_0.php @@ -66,8 +66,10 @@ public function run($model) switch ($monitorType->type) { case 'http': case 'https': - if (!empty($monitorType->options->path) && - !empty($monitorType->options->code)) { + if ( + !empty($monitorType->options->path) && + !empty($monitorType->options->code) + ) { $setting = array( 'name' => $name, 'path' => $monitorType->options->path, @@ -115,9 +117,11 @@ public function run($model) /* load_balancer lbpool */ if (!empty($cfgObj->load_balancer->lbpool) && count($cfgObj->load_balancer->lbpool)) { foreach ($cfgObj->load_balancer->lbpool as $lbpool) { - if (!empty($lbpool->name) && + if ( + !empty($lbpool->name) && !empty($lbpool->servers && - !empty($lbpool->monitor))) { + !empty($lbpool->monitor)) + ) { $name = $lbpool->name->__toString(); $tableSetting = array( 'enabled' => 1, @@ -191,10 +195,12 @@ public function run($model) /* load_balancer virtual_server */ if (!empty($cfgObj->load_balancer->virtual_server) && count($cfgObj->load_balancer->virtual_server)) { foreach ($cfgObj->load_balancer->virtual_server as $virtual_server) { - if (!empty($virtual_server->name) && + if ( + !empty($virtual_server->name) && !empty($virtual_server->ipaddr) && !empty($virtual_server->port) && - !empty($virtual_server->poolname)) { + !empty($virtual_server->poolname) + ) { $poolname = $virtual_server->poolname->__toString(); $vserverSetting = array( 'enabled' => 1, diff --git a/net/relayd/src/opnsense/mvc/tests/app/compound/OPNsense/Relayd/RelaydTest.php b/net/relayd/src/opnsense/mvc/tests/app/compound/OPNsense/Relayd/RelaydTest.php index 91bf054ac4..966fb2971c 100644 --- a/net/relayd/src/opnsense/mvc/tests/app/compound/OPNsense/Relayd/RelaydTest.php +++ b/net/relayd/src/opnsense/mvc/tests/app/compound/OPNsense/Relayd/RelaydTest.php @@ -42,7 +42,7 @@ class RelaydTest extends \PHPUnit\Framework\TestCase public static function setUpBeforeClass() { - self::$setRelayd = new \OPNsense\Relayd\Api\SettingsController; + self::$setRelayd = new \OPNsense\Relayd\Api\SettingsController(); } private function cleanupNodes($nodeType = null) @@ -386,7 +386,7 @@ public function testSetVirtualServer() */ public function testServiceController() { - $svcRelayd = new \OPNsense\Relayd\Api\ServiceController; + $svcRelayd = new \OPNsense\Relayd\Api\ServiceController(); $_SERVER['REQUEST_METHOD'] = 'POST'; // stop possibly running service @@ -431,7 +431,7 @@ public function testServiceController() */ public function testStatusController() { - $statRelayd = new \OPNsense\Relayd\Api\StatusController; + $statRelayd = new \OPNsense\Relayd\Api\StatusController(); $response = $statRelayd->sumAction(); $this->assertEquals($response['result'], 'ok'); $this->assertEquals($response['rows'][0]['type'], 'relay'); @@ -451,7 +451,7 @@ public function testStatusController() */ public function testCleanup() { - $svcRelayd = new \OPNsense\Relayd\Api\ServiceController; + $svcRelayd = new \OPNsense\Relayd\Api\ServiceController(); $response = $svcRelayd->stopAction(); $this->assertEquals($response['response'], "OK\n\n"); diff --git a/net/siproxd/src/opnsense/mvc/app/controllers/OPNsense/Siproxd/Api/DomainController.php b/net/siproxd/src/opnsense/mvc/app/controllers/OPNsense/Siproxd/Api/DomainController.php index 1f88dd8cc6..fb1d6957f8 100644 --- a/net/siproxd/src/opnsense/mvc/app/controllers/OPNsense/Siproxd/Api/DomainController.php +++ b/net/siproxd/src/opnsense/mvc/app/controllers/OPNsense/Siproxd/Api/DomainController.php @@ -1,4 +1,5 @@ @@ -53,7 +54,7 @@ public function getAction() public function setAction() { - $result = array("result"=>"failed"); + $result = array("result" => "failed"); if ($this->request->isPost()) { // load model and update with provided data $mdlDomain = new Domain(); @@ -64,7 +65,7 @@ public function setAction() if (!array_key_exists("validations", $result)) { $result["validations"] = array(); } - $result["validations"]["domain.".$msg->getField()] = $msg->getMessage(); + $result["validations"]["domain." . $msg->getField()] = $msg->getMessage(); } // serialize model to config and save if ($valMsgs->count() == 0) { @@ -180,7 +181,7 @@ public function toggle_handler($uuid, $elements, $element) if ($this->request->isPost()) { $mdlSetting = $this->getModel(); if ($uuid != null) { - $node = $mdlSetting->getNodeByReference($elements . '.'. $element .'.' . $uuid); + $node = $mdlSetting->getNodeByReference($elements . '.' . $element . '.' . $uuid); if ($node != null) { if ($node->enabled->__toString() == "1") { $result['result'] = "Disabled"; diff --git a/net/siproxd/src/opnsense/mvc/app/controllers/OPNsense/Siproxd/Api/GeneralController.php b/net/siproxd/src/opnsense/mvc/app/controllers/OPNsense/Siproxd/Api/GeneralController.php index daee08cf42..9254887bbb 100644 --- a/net/siproxd/src/opnsense/mvc/app/controllers/OPNsense/Siproxd/Api/GeneralController.php +++ b/net/siproxd/src/opnsense/mvc/app/controllers/OPNsense/Siproxd/Api/GeneralController.php @@ -50,7 +50,7 @@ public function getAction() public function setAction() { - $result = array("result"=>"failed"); + $result = array("result" => "failed"); if ($this->request->isPost()) { // load model and update with provided data $mdlGeneral = new General(); @@ -62,7 +62,7 @@ public function setAction() if (!array_key_exists("validations", $result)) { $result["validations"] = array(); } - $result["validations"]["general.".$msg->getField()] = $msg->getMessage(); + $result["validations"]["general." . $msg->getField()] = $msg->getMessage(); } // serialize model to config and save diff --git a/net/siproxd/src/opnsense/mvc/app/controllers/OPNsense/Siproxd/Api/UserController.php b/net/siproxd/src/opnsense/mvc/app/controllers/OPNsense/Siproxd/Api/UserController.php index 8d3ff5985e..2cf9305343 100644 --- a/net/siproxd/src/opnsense/mvc/app/controllers/OPNsense/Siproxd/Api/UserController.php +++ b/net/siproxd/src/opnsense/mvc/app/controllers/OPNsense/Siproxd/Api/UserController.php @@ -1,4 +1,5 @@ @@ -53,7 +54,7 @@ public function getAction() public function setAction() { - $result = array("result"=>"failed"); + $result = array("result" => "failed"); if ($this->request->isPost()) { // load model and update with provided data $mdlUser = new User(); @@ -64,7 +65,7 @@ public function setAction() if (!array_key_exists("validations", $result)) { $result["validations"] = array(); } - $result["validations"]["user.".$msg->getField()] = $msg->getMessage(); + $result["validations"]["user." . $msg->getField()] = $msg->getMessage(); } // serialize model to config and save if ($valMsgs->count() == 0) { @@ -180,7 +181,7 @@ public function toggle_handler($uuid, $elements, $element) if ($this->request->isPost()) { $mdlSetting = $this->getModel(); if ($uuid != null) { - $node = $mdlSetting->getNodeByReference($elements . '.'. $element .'.' . $uuid); + $node = $mdlSetting->getNodeByReference($elements . '.' . $element . '.' . $uuid); if ($node != null) { if ($node->enabled->__toString() == "1") { $result['result'] = "Disabled"; 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 51b5e41bf2..9c0caff43e 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_permuser_list() @@ -147,7 +147,7 @@ function miniupnpd_configure_do($verbose = false) } $if = get_real_interface($iface); /* above function returns iface if fail */ - if ($if!=$iface) { + if ($if != $iface) { $addr = find_interface_ip($if); /* check that the interface has an ip address before adding parameters */ if (is_ipaddr($addr)) { @@ -173,8 +173,8 @@ function miniupnpd_configure_do($verbose = false) } /* set upload and download bitrates */ if (!empty($upnp_config['download']) && !empty($upnp_config['upload'])) { - $download = $upnp_config['download']*1000; - $upload = $upnp_config['upload']*1000; + $download = $upnp_config['download'] * 1000; + $upload = $upnp_config['upload'] * 1000; $config_text .= "bitrate_down={$download}\n"; $config_text .= "bitrate_up={$upload}\n"; } @@ -201,8 +201,8 @@ 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 .= "uuid=" . miniupnpd_uuid() . "\n"; + $config_text .= "serial=" . strtoupper(substr(miniupnpd_uuid(), 0, 8)) . "\n"; /* set model number */ $config_text .= "model_number=" . trim(shell_exec('opnsense-version -v')) . "\n"; diff --git a/net/wireguard/src/opnsense/mvc/app/controllers/OPNsense/Wireguard/Api/ClientController.php b/net/wireguard/src/opnsense/mvc/app/controllers/OPNsense/Wireguard/Api/ClientController.php index f06cf41ce8..e8f131eca6 100644 --- a/net/wireguard/src/opnsense/mvc/app/controllers/OPNsense/Wireguard/Api/ClientController.php +++ b/net/wireguard/src/opnsense/mvc/app/controllers/OPNsense/Wireguard/Api/ClientController.php @@ -1,4 +1,5 @@ * diff --git a/net/wireguard/src/opnsense/mvc/app/controllers/OPNsense/Wireguard/Api/ServerController.php b/net/wireguard/src/opnsense/mvc/app/controllers/OPNsense/Wireguard/Api/ServerController.php index eff42b557e..c7e00b8d6f 100644 --- a/net/wireguard/src/opnsense/mvc/app/controllers/OPNsense/Wireguard/Api/ServerController.php +++ b/net/wireguard/src/opnsense/mvc/app/controllers/OPNsense/Wireguard/Api/ServerController.php @@ -1,4 +1,5 @@ * @@ -50,7 +51,7 @@ public function addServerAction($uuid = null) { if ($this->request->isPost() && $this->request->hasPost("server")) { if ($uuid != null) { - $node = $this->getModel()->getNodeByReference('servers.server.'.$uuid); + $node = $this->getModel()->getNodeByReference('servers.server.' . $uuid); } else { $node = $this->getModel()->servers->server->Add(); } @@ -65,7 +66,7 @@ public function addServerAction($uuid = null) } return $this->validateAndSave($node, 'server'); } - return array("result"=>"failed"); + return array("result" => "failed"); } public function delServerAction($uuid) { @@ -75,7 +76,7 @@ public function setServerAction($uuid = null) { if ($this->request->isPost() && $this->request->hasPost("server")) { if ($uuid != null) { - $node = $this->getModel()->getNodeByReference('servers.server.'.$uuid); + $node = $this->getModel()->getNodeByReference('servers.server.' . $uuid); } else { $node = $this->getModel()->servers->server->Add(); } @@ -90,7 +91,7 @@ public function setServerAction($uuid = null) } return $this->validateAndSave($node, 'server'); } - return array("result"=>"failed"); + return array("result" => "failed"); } public function toggleServerAction($uuid) { diff --git a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/Api/WolController.php b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/Api/WolController.php index 6d24dd75dd..e56554a27b 100644 --- a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/Api/WolController.php +++ b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/Api/WolController.php @@ -112,7 +112,7 @@ private function wakeHostByNode($wolent, &$result) return $result; } $broadcast_ip = escapeshellarg($this->calculateSubnetBroadcast($ipaddr, $cidr)); - $result['status'] = trim($backend->configdRun("wol wake {$broadcast_ip} ". escapeshellarg((string)$wolent->mac))); + $result['status'] = trim($backend->configdRun("wol wake {$broadcast_ip} " . escapeshellarg((string)$wolent->mac))); } private function getInterfaceIP($if) { diff --git a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/IndexController.php b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/IndexController.php index 046b103500..f4b40c0c0d 100644 --- a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/IndexController.php +++ b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/IndexController.php @@ -1,4 +1,5 @@ getField()] = $msg->getMessage(); + $result["validation"]["network." . $msg->getField()] = $msg->getMessage(); } if ($validationMessages->count() == 0) { unset($result["validations"]); diff --git a/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/IndexController.php b/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/IndexController.php index e924a9aee5..77197c0f09 100644 --- a/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/IndexController.php +++ b/net/zerotier/src/opnsense/mvc/app/controllers/OPNsense/Zerotier/IndexController.php @@ -1,4 +1,5 @@