From 0798b98a16a4e7cba2c225998a69a2c788ee5a73 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 23 Sep 2022 20:31:42 +0200 Subject: [PATCH] src: whitespace sweep --- src/etc/inc/filter.inc | 3 ++- .../OPNsense/Interfaces/Api/VlanSettingsController.php | 2 +- src/opnsense/mvc/app/models/OPNsense/Interfaces/Vlan.php | 2 +- src/opnsense/scripts/firmware/product.php | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/etc/inc/filter.inc b/src/etc/inc/filter.inc index f1448f350..b10f3a638 100644 --- a/src/etc/inc/filter.inc +++ b/src/etc/inc/filter.inc @@ -89,7 +89,8 @@ function filter_rules_sort() /* strip the sequence numbers again, add uuid's where not available */ for ($i = 0; isset($config['filter']['rule'][$i]); $i++) { unset($config['filter']['rule'][$i]['seq']); - if (empty($config['filter']['rule'][$i]['@attributes']) + if ( + empty($config['filter']['rule'][$i]['@attributes']) && empty($config['filter']['rule'][$i]['@attributes']['uuid']) ) { $config['filter']['rule'][$i]['@attributes'] = ['uuid' => generate_uuid()]; diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/VlanSettingsController.php b/src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/VlanSettingsController.php index 978e14a5c..f503b2ca2 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/VlanSettingsController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/VlanSettingsController.php @@ -58,7 +58,7 @@ class VlanSettingsController extends ApiMutableModelControllerBase /* auto-number new device */ $ifid = 0; foreach ($this->getModel()->vlan->iterateItems() as $node) { - if (preg_match("/^({$prefix})(\d)*$/i",(string)$node->vlanif)) { + if (preg_match("/^({$prefix})(\d)*$/i", (string)$node->vlanif)) { $ifid = max($ifid, (int)filter_var((string)$node->vlanif, FILTER_SANITIZE_NUMBER_INT)); } } diff --git a/src/opnsense/mvc/app/models/OPNsense/Interfaces/Vlan.php b/src/opnsense/mvc/app/models/OPNsense/Interfaces/Vlan.php index 37d96aca4..b77016e76 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Interfaces/Vlan.php +++ b/src/opnsense/mvc/app/models/OPNsense/Interfaces/Vlan.php @@ -53,7 +53,7 @@ class Vlan extends BaseModel break; } elseif (!(strpos((string)$node, (string)$prefix) === 0)) { $messages->appendMessage(new Message( - sprintf(gettext("device name does not match type (e.g. %s_xxx)."), (string)$prefix) , + sprintf(gettext("device name does not match type (e.g. %s_xxx)."), (string)$prefix), $key )); } elseif (!preg_match("/^([a-zA-Z0-9_]){1,16}$/", (string)$node)) { diff --git a/src/opnsense/scripts/firmware/product.php b/src/opnsense/scripts/firmware/product.php index b883e0ba6..fcc146627 100755 --- a/src/opnsense/scripts/firmware/product.php +++ b/src/opnsense/scripts/firmware/product.php @@ -43,7 +43,7 @@ if ($ret != null) { $ret['product_repos'] = implode(', ', $repos); $ret['product_check'] = json_decode(@file_get_contents('/tmp/pkg_upgrade.json'), true); // for business editions, collect license information - if (preg_match('/\/[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}\//i', $product_mirror) && file_exists($licensefile)) { + if (preg_match('/\/[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}\//i', $product_mirror) && file_exists($licensefile)) { $payload = file_get_contents($licensefile); $payload = $payload !== false ? json_decode($payload, true) : null; if (is_array($payload)) {