src: style and whitespace sweep

This commit is contained in:
Franco Fichtner 2021-05-19 15:21:56 +02:00
parent 2ba6da4eef
commit 06e1c552d9
13 changed files with 14253 additions and 14252 deletions

View File

@ -1536,7 +1536,7 @@ function ipsec_configure_do($verbose = false, $interface = '')
$inactivityline = '';
}
if (!empty($ph1ent['keyingtries'])) {
$keyingtriesline = "keyingtries = " ;
$keyingtriesline = "keyingtries = ";
$keyingtriesline .= $ph1ent['keyingtries'] == -1 ? "%forever" : $ph1ent['keyingtries'];
} else {
$keyingtriesline = '';

View File

@ -45,7 +45,7 @@ class LogController extends ApiControllerBase
$searchPhrase = '';
// create filter to sanitize input data
$filter = new Filter([
'query' => function($value){
'query' => function ($value) {
return preg_replace("/[^0-9,a-z,A-Z, ,*,\-,_,.,\#]/", "", $value);
}
]);

View File

@ -44,7 +44,10 @@ class LvtemplateController extends ApiMutableModelControllerBase
{
return $this->searchBase(
"templates.template",
array('name', 'filters', 'or'), "name", null, SORT_NATURAL|SORT_FLAG_CASE
array('name', 'filters', 'or'),
"name",
null,
SORT_NATURAL | SORT_FLAG_CASE
);
}
@ -67,5 +70,4 @@ class LvtemplateController extends ApiMutableModelControllerBase
{
return $this->delBase("templates.template", $uuid);
}
}

View File

@ -174,7 +174,7 @@ class ServiceController extends ApiMutableServiceControllerBase
$this->sessionClose();
// create filter to sanitize input data
$filter = new Filter([
'query' => function($value){
'query' => function ($value) {
return preg_replace("/[^0-9,a-z,A-Z, ,*,\-,_,.,\#]/", "", $value);
}
]);

View File

@ -71,7 +71,7 @@ class SettingsController extends ApiMutableModelControllerBase
$this->sessionClose();
// create filter to sanitize input data
$filter = (new FilterFactory())->newInstance();
$filter->set('query', function($value){
$filter->set('query', function ($value) {
return preg_replace("/[^0-9,a-z,A-Z, ,*,\-,_,.,\#]/", "", $value);
});

View File

@ -161,5 +161,4 @@ abstract class Base
{
return $this->lastAuthErrors;
}
}

View File

@ -466,7 +466,7 @@ class Config extends Singleton
/**
* send config change to audit log including the context we currently know of.
*/
private function auditLogChange($backup_filename, $revision=null)
private function auditLogChange($backup_filename, $revision = null)
{
openlog("audit", LOG_ODELAY, LOG_AUTH);
$append_message = "";

View File

@ -123,7 +123,7 @@ class FilterRule extends Rule
// reply-to gateway set, when found map to reply attribute, otherwise skip keyword
if (!empty($this->gatewayMapping[$rule['reply-to']])) {
$if = $this->gatewayMapping[$rule['reply-to']]['interface'];
if (!empty($this->gatewayMapping[$rule['reply-to']]['gateway'])){
if (!empty($this->gatewayMapping[$rule['reply-to']]['gateway'])) {
$gw = $this->gatewayMapping[$rule['reply-to']]['gateway'];
$rule['reply'] = "reply-to ( {$if} {$gw} ) ";
} else {

View File

@ -86,17 +86,17 @@ class Util
*/
public static function isWildcard($network)
{
$tmp = explode('/', $network);
if (count($tmp) == 2) {
if (self::isIpAddress($tmp[0]) && self::isIpAddress($tmp[1])) {
if (strpos($tmp[0], ':') !== false && strpos($tmp[1], ':') !== false) {
return true;
} elseif (strpos($tmp[0], ':') === false && strpos($tmp[1], ':') === false) {
return true;
}
}
}
return false;
$tmp = explode('/', $network);
if (count($tmp) == 2) {
if (self::isIpAddress($tmp[0]) && self::isIpAddress($tmp[1])) {
if (strpos($tmp[0], ':') !== false && strpos($tmp[1], ':') !== false) {
return true;
} elseif (strpos($tmp[0], ':') === false && strpos($tmp[1], ':') === false) {
return true;
}
}
}
return false;
}
/**

View File

@ -41,7 +41,7 @@ class M1_0_0 extends BaseModelMigration
public function run($model)
{
if ((empty((string)$model->type) || (string)$model->type == "devel") && !empty((string)$model->mirror) ) {
if ((empty((string)$model->type) || (string)$model->type == "devel") && !empty((string)$model->mirror)) {
$is_business = stripos((string)$model->mirror, "opnsense-update.deciso.com") > 1;
if ($is_business) {
$model->type = "business";

View File

@ -235,7 +235,7 @@ class AliasContentField extends BaseField
{
$messages = array();
foreach ($this->getItems($data) as $pnetwork) {
if (!Util::isSubnet("0000".$pnetwork)) {
if (!Util::isSubnet("0000" . $pnetwork)) {
$messages[] = sprintf(
gettext('Entry "%s" is not a valid partial ipv6 net definition (e.g. ::1000/64).'),
$pnetwork

File diff suppressed because it is too large Load Diff

View File

@ -293,7 +293,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
continue;
}
$slease = [];
$slease['ip'] = $static['ipaddrv6'];
$slease['ip'] = Net_IPv6::compress($static['ipaddrv6']);
$slease['if'] = $static['interface'];
$slease['type'] = 'static';
$slease['duid'] = $static['duid'];