Commit 9cf468ad authored by Franco Fichtner's avatar Franco Fichtner

mvc: three more of those count() thingies

(cherry picked from commit 84a99758)
parent 4c627928
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
/** /**
* Copyright (C) 2015 Deciso B.V. * Copyright (C) 2015 Deciso B.V.
*
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -25,8 +24,8 @@ ...@@ -25,8 +24,8 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*
*/ */
namespace OPNsense\Base; namespace OPNsense\Base;
use OPNsense\Core\Config; use OPNsense\Core\Config;
...@@ -200,7 +199,7 @@ class ControllerBase extends ControllerRoot ...@@ -200,7 +199,7 @@ class ControllerBase extends ControllerRoot
$this->view->menuSystem = $menu->getItems("/ui".$this->router->getRewriteUri()); $this->view->menuSystem = $menu->getItems("/ui".$this->router->getRewriteUri());
// set theme in ui_theme template var, let template handle its defaults (if there is no theme). // set theme in ui_theme template var, let template handle its defaults (if there is no theme).
if ($cnf->object()->theme != null && !empty($cnf->object()->theme) && if ($cnf->object()->theme->count() > 0 && !empty($cnf->object()->theme) &&
is_dir('/usr/local/opnsense/www/themes/'.(string)$cnf->object()->theme) is_dir('/usr/local/opnsense/www/themes/'.(string)$cnf->object()->theme)
) { ) {
$this->view->ui_theme = $cnf->object()->theme; $this->view->ui_theme = $cnf->object()->theme;
......
<?php <?php
/** /**
* Copyright (C) 2016 Deciso B.V. * Copyright (C) 2016 Deciso B.V.
*
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -24,10 +24,8 @@ ...@@ -24,10 +24,8 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*
*/ */
namespace OPNsense\Diagnostics\Api; namespace OPNsense\Diagnostics\Api;
use \OPNsense\Base\ApiControllerBase; use \OPNsense\Base\ApiControllerBase;
...@@ -45,7 +43,7 @@ class InterfaceController extends ApiControllerBase ...@@ -45,7 +43,7 @@ class InterfaceController extends ApiControllerBase
// collect interface names // collect interface names
$intfmap = array(); $intfmap = array();
$config = Config::getInstance()->object(); $config = Config::getInstance()->object();
if ($config->interfaces != null) { if ($config->interfaces->count() > 0) {
foreach ($config->interfaces->children() as $key => $node) { foreach ($config->interfaces->children() as $key => $node) {
$intfmap[(string)$node->if] = !empty((string)$node->descr) ? (string)$node->descr : $key; $intfmap[(string)$node->if] = !empty((string)$node->descr) ? (string)$node->descr : $key;
} }
......
...@@ -135,7 +135,7 @@ class ACL ...@@ -135,7 +135,7 @@ class ACL
// gather user / group data from config.xml // gather user / group data from config.xml
$config = Config::getInstance()->object(); $config = Config::getInstance()->object();
if ($config->system != null) { if ($config->system->count() > 0) {
foreach ($config->system->children() as $key => $node) { foreach ($config->system->children() as $key => $node) {
if ($key == 'user') { if ($key == 'user') {
$this->legacyUsers[$node->name->__toString()] = array(); $this->legacyUsers[$node->name->__toString()] = array();
......
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