net/quagga: whitespace and style sweep

This commit is contained in:
Franco Fichtner
2017-03-14 07:39:41 +01:00
parent e32e0b7dc6
commit 83cbac10d7
14 changed files with 77 additions and 80 deletions
@@ -36,41 +36,40 @@ use \OPNsense\Core\Config;
class GeneralController extends ApiControllerBase
{
public function getAction()
{
// define list of configurable settings
$result = array();
if ($this->request->isGet()) {
$mdlGeneral = new General();
$result['general'] = $mdlGeneral->getNodes();
public function getAction()
{
// define list of configurable settings
$result = array();
if ($this->request->isGet()) {
$mdlGeneral = new General();
$result['general'] = $mdlGeneral->getNodes();
}
return $result;
}
return $result;
}
public function setAction()
{
$result = array("result"=>"failed");
if ($this->request->isPost()) {
// load model and update with provided data
$mdlGeneral = new General();
$mdlGeneral->setNodes($this->request->getPost("general"));
public function setAction()
{
$result = array("result"=>"failed");
if ($this->request->isPost()) {
// load model and update with provided data
$mdlGeneral = new General();
$mdlGeneral->setNodes($this->request->getPost("general"));
// perform validation
$valMsgs = $mdlGeneral->performValidation();
foreach ($valMsgs as $field => $msg) {
if (!array_key_exists("validations", $result)) {
$result["validations"] = array();
// perform validation
$valMsgs = $mdlGeneral->performValidation();
foreach ($valMsgs as $field => $msg) {
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
if ($valMsgs->count() == 0) {
$mdlGeneral->serializeToConfig();
Config::getInstance()->save();
$result["result"] = "saved";
// serialize model to config and save
if ($valMsgs->count() == 0) {
$mdlGeneral->serializeToConfig();
Config::getInstance()->save();
$result["result"] = "saved";
}
}
return $result;
}
return $result;
}
}
@@ -39,44 +39,44 @@ use \OPNsense\Base\UIModelGrid;
class OspfsettingsController extends ApiMutableModelControllerBase
{
static protected $internalModelName = 'OSPF';
static protected $internalModelClass = '\OPNsense\Quagga\OSPF';
public function getAction()
{
$result = array();
if ($this->request->isGet()) {
$mdlospf = new OSPF();
$result['ospf'] = $mdlospf->getNodes();
static protected $internalModelName = 'OSPF';
static protected $internalModelClass = '\OPNsense\Quagga\OSPF';
public function getAction()
{
$result = array();
if ($this->request->isGet()) {
$mdlospf = new OSPF();
$result['ospf'] = $mdlospf->getNodes();
}
return $result;
}
return $result;
}
public function setAction()
{
$result = array("result"=>"failed");
if ($this->request->isPost()) {
// load model and update with provided data
$mdlospf = new OSPF();
$mdlospf->setNodes($this->request->getPost("ospf"));
public function setAction()
{
$result = array("result"=>"failed");
if ($this->request->isPost()) {
// load model and update with provided data
$mdlospf = new OSPF();
$mdlospf->setNodes($this->request->getPost("ospf"));
// perform validation
$valMsgs = $mdlospf->performValidation();
foreach ($valMsgs as $field => $msg) {
if (!array_key_exists("validations", $result)) {
$result["validations"] = array();
// perform validation
$valMsgs = $mdlospf->performValidation();
foreach ($valMsgs as $field => $msg) {
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
if ($valMsgs->count() == 0) {
$mdlospf->serializeToConfig();
Config::getInstance()->save();
$result["result"] = "saved";
// serialize model to config and save
if ($valMsgs->count() == 0) {
$mdlospf->serializeToConfig();
Config::getInstance()->save();
$result["result"] = "saved";
}
}
return $result;
}
return $result;
}
/////////////////////////////////////////////////////////////////////
@@ -130,7 +130,7 @@ class OspfsettingsController extends ApiMutableModelControllerBase
}
return array();
}
public function addNetworkAction()
{
$result = array("result" => "failed");
@@ -300,13 +300,13 @@ class OspfsettingsController extends ApiMutableModelControllerBase
}
return $result;
}
public function toggleNetworkAction($uuid)
{
return $this->toggle_handler($uuid, 'networks', 'network');
return $this->toggle_handler($uuid, 'networks', 'network');
}
public function toggleInterfaceAction($uuid)
{
return $this->toggle_handler($uuid, 'interfaces', 'interface');
return $this->toggle_handler($uuid, 'interfaces', 'interface');
}
}
@@ -1,5 +1,6 @@
<?php
namespace OPNsense\Quagga;
class BgpController extends \OPNsense\Base\IndexController
{
public function indexAction()
@@ -1,5 +1,6 @@
<?php
namespace OPNsense\Quagga;
class IsisController extends \OPNsense\Base\IndexController
{
public function indexAction()
@@ -1,5 +1,6 @@
<?php
namespace OPNsense\Quagga;
class RipController extends \OPNsense\Base\IndexController
{
public function indexAction()
@@ -9,4 +10,3 @@ class RipController extends \OPNsense\Base\IndexController
$this->view->pick('OPNsense/Quagga/rip');
}
}
@@ -6,4 +6,3 @@
<help>This will activate the ospf service.</help>
</field>
</form>
@@ -6,4 +6,3 @@
<help>This will activate the routing service.</help>
</field>
</form>
@@ -6,4 +6,3 @@
<help>This will activate the ospf service.</help>
</field>
</form>
@@ -33,6 +33,5 @@
<type>checkbox</type>
<help>This will send the information that we have a default gateway, regardless of if it is available.</help>
</field>
</form>
</form>
@@ -6,4 +6,3 @@
<help>This will activate the ospf service.</help>
</field>
</form>
@@ -1,5 +1,6 @@
<?php
namespace OPNsense\Quagga;
use OPNsense\Base\BaseModel;
/*
@@ -1,5 +1,6 @@
<?php
namespace OPNsense\Quagga;
use OPNsense\Base\BaseModel;
/*
@@ -27,4 +27,3 @@ command:/usr/local/etc/rc.d/quagga status;exit 0
parameters:
type:script_output
message:request proxy status
@@ -1,12 +1,12 @@
defaultrouter="NO"
quagga_enable="{% if helpers.exists('OPNsense.quagga.general.enabled') and OPNsense.quagga.general.enabled == '1' %}YES{% else %}NO{% endif %}"
quagga_daemons="zebra{%
if helpers.exists('OPNsense.quagga.ospf.enabled') and OPNsense.quagga.ospf.enabled == '1' %} ospfd{% endif %}{%
if helpers.exists('OPNsense.quagga.rip.enabled') and OPNsense.quagga.ripd.enabled == '1' %} ripd{% endif %}{%
if helpers.exists('OPNsense.quagga.bgp.enabled') and OPNsense.quagga.bgp.enabled == '1' %} bgpd{% endif %}{%
if helpers.exists('OPNsense.quagga.ospf6.enabled') and OPNsense.quagga.ospf6.enabled == '1' %} ospf6d{% endif %}{%
if helpers.exists('OPNsense.quagga.ripng.enabled') and OPNsense.quagga.ripng.enabled == '1' %} ripngd{% endif %}{%
quagga_daemons="zebra{%
if helpers.exists('OPNsense.quagga.ospf.enabled') and OPNsense.quagga.ospf.enabled == '1' %} ospfd{% endif %}{%
if helpers.exists('OPNsense.quagga.rip.enabled') and OPNsense.quagga.ripd.enabled == '1' %} ripd{% endif %}{%
if helpers.exists('OPNsense.quagga.bgp.enabled') and OPNsense.quagga.bgp.enabled == '1' %} bgpd{% endif %}{%
if helpers.exists('OPNsense.quagga.ospf6.enabled') and OPNsense.quagga.ospf6.enabled == '1' %} ospf6d{% endif %}{%
if helpers.exists('OPNsense.quagga.ripng.enabled') and OPNsense.quagga.ripng.enabled == '1' %} ripngd{% endif %}{%
if helpers.exists('OPNsense.quagga.isis.enabled') and OPNsense.quagga.isis.enabled == '1' %} isisd{% endif %}"
#quagga_flags="...."
#quagga_extralibs_path="... ..."