net: PSR12 conversion

This commit is contained in:
Franco Fichtner
2019-10-07 22:01:00 +02:00
parent 2fd60b43a9
commit 752a9d88b4
64 changed files with 142 additions and 72 deletions
@@ -41,7 +41,7 @@ class ServiceController extends ApiControllerBase
$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 @@ class ServiceController extends ApiControllerBase
$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 @@ class ServiceController extends ApiControllerBase
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 @@ class ServiceController extends ApiControllerBase
$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;
@@ -59,7 +59,7 @@ class SettingsController extends ApiControllerBase
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 @@ class SettingsController extends ApiControllerBase
*/
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 @@ class SettingsController extends ApiControllerBase
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
@@ -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;
}
@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
@@ -52,7 +53,7 @@ class ClientController extends ApiMutableModelControllerBase
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 @@ class ClientController extends ApiMutableModelControllerBase
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 @@ class ClientController extends ApiMutableModelControllerBase
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";
@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com>
@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
@@ -49,7 +50,7 @@ class EapController extends ApiControllerBase
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 @@ class EapController extends ApiControllerBase
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
@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
@@ -49,7 +50,7 @@ class GeneralController extends ApiControllerBase
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 @@ class GeneralController extends ApiControllerBase
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
@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2019 Michael Muenz <m.muenz@gmail.com>
@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
@@ -53,7 +54,7 @@ class UserController extends ApiMutableModelControllerBase
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 @@ class UserController extends ApiMutableModelControllerBase
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 @@ class UserController extends ApiMutableModelControllerBase
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";
@@ -1,4 +1,5 @@
<?php
namespace OPNsense\Freeradius;
use OPNsense\Base\BaseModel;
@@ -1,4 +1,5 @@
<?php
namespace OPNsense\Freeradius;
use OPNsense\Base\BaseModel;
@@ -1,4 +1,5 @@
<?php
namespace OPNsense\Freeradius;
use OPNsense\Base\BaseModel;
@@ -1,4 +1,5 @@
<?php
namespace OPNsense\Freeradius;
use OPNsense\Base\BaseModel;
@@ -1,4 +1,5 @@
<?php
namespace OPNsense\Freeradius;
use OPNsense\Base\BaseModel;
@@ -1,4 +1,5 @@
<?php
namespace OPNsense\Freeradius;
use OPNsense\Base\BaseModel;
@@ -1,4 +1,5 @@
<?php
namespace OPNsense\Freeradius;
use OPNsense\Base\BaseModel;
@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 Fabian Franz
@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2017 Frank Wall
* Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 Fabian Franz
@@ -48,7 +49,7 @@ class GeneralController extends ApiControllerBase
}
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();
@@ -60,7 +61,7 @@ class GeneralController extends ApiControllerBase
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

Some files were not shown because too many files have changed in this diff Show More