From 8db3b0e5eca43e4aa485fb06a539dd8c6d06e802 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 21 Oct 2020 07:42:38 +0200 Subject: [PATCH] plugins: style sweep --- .../inc/plugins.inc.d/dyndns/phpDynDNS.inc | 4 +- .../AcmeClient/LeAutomationFactory.php | 2 +- .../AcmeClient/LeValidationFactory.php | 2 +- .../scripts/OPNsense/AcmeClient/lecert.php | 6 ++- .../mvc/app/library/OPNsense/Backup/Git.php | 39 +++++++++---------- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns/phpDynDNS.inc b/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns/phpDynDNS.inc index 61d2f06b4..c21cab989 100644 --- a/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns/phpDynDNS.inc +++ b/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns/phpDynDNS.inc @@ -680,9 +680,9 @@ class updatedns * dnsUser ("Username" field in OPNsense) should be the subdomain / A-record ("myrecord" in 2nd-level domain) * dnsPass should be the Gandi-API key */ - $server = "https://dns.api.gandi.net/api/v5/domains/". $this->_dnsHost . "/records/" . $this->_dnsUser . "/A"; + $server = "https://dns.api.gandi.net/api/v5/domains/" . $this->_dnsHost . "/records/" . $this->_dnsUser . "/A"; - $body = '{"rrset_ttl":"' . "300" . '", "rrset_values":["'. $this->_dnsIP . '"]}'; + $body = '{"rrset_ttl":"' . "300" . '", "rrset_values":["' . $this->_dnsIP . '"]}'; curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); diff --git a/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeAutomationFactory.php b/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeAutomationFactory.php index 82a8e857d..044b5d840 100644 --- a/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeAutomationFactory.php +++ b/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeAutomationFactory.php @@ -29,7 +29,7 @@ namespace OPNsense\AcmeClient; -use \OPNsense\AcmeClient\AcmeClient; +use OPNsense\AcmeClient\AcmeClient; /** * Class LeAutomationFactory diff --git a/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeValidationFactory.php b/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeValidationFactory.php index 5786a8f33..1a2611d21 100644 --- a/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeValidationFactory.php +++ b/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeValidationFactory.php @@ -29,7 +29,7 @@ namespace OPNsense\AcmeClient; -use \OPNsense\AcmeClient\AcmeClient; +use OPNsense\AcmeClient\AcmeClient; /** * Class LeValidationFactory diff --git a/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/lecert.php b/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/lecert.php index a01df9d55..3b3d61bda 100755 --- a/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/lecert.php +++ b/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/lecert.php @@ -142,8 +142,10 @@ function main() $force = isset($options['force']) ? true : false; // Verify mode and arguments - if (empty($options) || isset($options['h']) || isset($options['help']) || - (isset($options['mode']) and !validateMode($options['mode']))) { + if ( + empty($options) || isset($options['h']) || isset($options['help']) || + (isset($options['mode']) and !validateMode($options['mode'])) + ) { // Not enough or invalid arguments specified. help(); } elseif (($options['mode'] === 'issue') && (isset($options['cert']) || isset($options['all']))) { diff --git a/sysutils/git-backup/src/opnsense/mvc/app/library/OPNsense/Backup/Git.php b/sysutils/git-backup/src/opnsense/mvc/app/library/OPNsense/Backup/Git.php index 6a2fdc0ec..b9626d211 100644 --- a/sysutils/git-backup/src/opnsense/mvc/app/library/OPNsense/Backup/Git.php +++ b/sysutils/git-backup/src/opnsense/mvc/app/library/OPNsense/Backup/Git.php @@ -105,17 +105,17 @@ class Git extends Base implements IBackupProvider /** * @inheritdoc */ - public function setConfiguration($conf) - { - $mdl = new GitSettings(); - $this->setModelProperties($mdl, $conf); - $validation_messages = $this->validateModel($mdl); - if (empty($validation_messages)) { - $mdl->serializeToConfig(); - Config::getInstance()->save(); - } - return $validation_messages; - } + public function setConfiguration($conf) + { + $mdl = new GitSettings(); + $this->setModelProperties($mdl, $conf); + $validation_messages = $this->validateModel($mdl); + if (empty($validation_messages)) { + $mdl->serializeToConfig(); + Config::getInstance()->save(); + } + return $validation_messages; + } /** * Backup is responsible for initialising the local repo and pusing it to upstream. @@ -148,21 +148,20 @@ class Git extends Base implements IBackupProvider // When there are unprocessed config backups, flush them out. (new Backend())->configdRun("system event config_changed"); // configure upstream - exec("cd {$targetdir} && ". - "{$git} config core.sshCommand ". - "\"ssh -i {$ident_file} -o StrictHostKeyChecking=accept-new -o PasswordAuthentication=no\"" - ); + exec("cd {$targetdir} && " . + "{$git} config core.sshCommand " . + "\"ssh -i {$ident_file} -o StrictHostKeyChecking=accept-new -o PasswordAuthentication=no\""); $url = (string)$mdl->url; $pos = strpos($url, '//'); // inject credentials in url (either username or username:password, depending on transport) - if (stripos(trim((string)$mdl->url),'http') === 0) { + if (stripos(trim((string)$mdl->url), 'http') === 0) { $cred = urlencode((string)$mdl->user) . ":" . urlencode((string)$mdl->password); - $url = substr($url,0, $pos+2) . "{$cred}@" . substr($url, $pos+2); + $url = substr($url, 0, $pos + 2) . "{$cred}@" . substr($url, $pos + 2); } else { - $url = substr($url,0, $pos+2) . urlencode((string)$mdl->user) . "@" . substr($url, $pos+2); + $url = substr($url, 0, $pos + 2) . urlencode((string)$mdl->user) . "@" . substr($url, $pos + 2); } exec("cd {$targetdir} && git remote remove origin"); - exec("cd {$targetdir} && git remote add origin ". escapeshellarg($url)); + exec("cd {$targetdir} && git remote add origin " . escapeshellarg($url)); $pushtxt = shell_exec( "(cd {$targetdir} && git push origin " . escapeshellarg("master:{$mdl->branch}") . " && echo '__exit_ok__') 2>&1" @@ -179,7 +178,7 @@ class Git extends Base implements IBackupProvider $error_type = "unknown error, check log for details"; } if (!empty($error_type)) { - syslog(LOG_ERR, "git-backup {$error_type} (".str_replace("\n", " ", $pushtxt).")"); + syslog(LOG_ERR, "git-backup {$error_type} (" . str_replace("\n", " ", $pushtxt) . ")"); throw new \Exception($error_type); } else { // return filelist in git