mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 17:14:46 +00:00
src: style sweep
This commit is contained in:
parent
f2e60c18f6
commit
51148ea1cc
@ -43,7 +43,7 @@ class AppConfig
|
||||
/**
|
||||
* construct new application config object, keep $data when not offered.
|
||||
*/
|
||||
public function __construct($new_data=null)
|
||||
public function __construct($new_data = null)
|
||||
{
|
||||
if ($new_data != null) {
|
||||
self::$data = $new_data;
|
||||
@ -94,4 +94,4 @@ class AppConfig
|
||||
self::$obj = json_decode(json_encode(self::$data));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
require_once 'AppConfig.php';
|
||||
|
||||
return new OPNsense\Core\AppConfig(array(
|
||||
|
||||
@ -78,7 +78,7 @@ class DashboardController extends ApiControllerBase
|
||||
'arc' => gettext('ARC'),
|
||||
],
|
||||
'disk' => [
|
||||
'title' => gettext ('Disk usage'),
|
||||
'title' => gettext('Disk usage'),
|
||||
'used' => gettext('Used'),
|
||||
'free' => gettext('Free'),
|
||||
]
|
||||
|
||||
@ -34,7 +34,7 @@ class Csrf
|
||||
* Generate a random URL-safe base64 string.
|
||||
* Usable base64 characters according to https://www.ietf.org/rfc/rfc3548.txt
|
||||
*/
|
||||
public function base64Safe($len=16)
|
||||
public function base64Safe($len = 16)
|
||||
{
|
||||
return rtrim(strtr(base64_encode(random_bytes($len)), "+/", "-_"), '=');
|
||||
}
|
||||
@ -55,4 +55,4 @@ class Csrf
|
||||
'key' => $_SESSION['$PHALCON/CSRF/KEY$']
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,10 +73,12 @@ class AliasNameField extends BaseField
|
||||
"callback" => function ($value) use ($reservedwords) {
|
||||
$result = [];
|
||||
/* avoids single "_" and prefixes of "__" here too */
|
||||
if (!preg_match(
|
||||
'/^([a-zA-Z]|(([_a-zA-Z][a-zA-Z0-9]|[a-zA-Z][_a-zA-Z0-9])[_a-zA-Z0-9]{0,29}))$/',
|
||||
$value
|
||||
)) {
|
||||
if (
|
||||
!preg_match(
|
||||
'/^([a-zA-Z]|(([_a-zA-Z][a-zA-Z0-9]|[a-zA-Z][_a-zA-Z0-9])[_a-zA-Z0-9]{0,29}))$/',
|
||||
$value
|
||||
)
|
||||
) {
|
||||
$result[] = gettext('The name must start with a letter or single underscore, be less than 32 characters and only consist of alphanumeric characters or underscores.');
|
||||
}
|
||||
if (in_array($value, $reservedwords)) {
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . "/../../../app/config/AppConfig.php";
|
||||
|
||||
return new OPNsense\Core\AppConfig(array(
|
||||
|
||||
@ -47,7 +47,7 @@ class AuthGroupFieldTest extends Field_Framework_TestCase
|
||||
{
|
||||
$this->assertInstanceOf('\OPNsense\Base\FieldTypes\AuthGroupField', new AuthGroupField());
|
||||
// switch config to test set for this type
|
||||
(new AppConfig())->update('globals.config_path', __DIR__ . '/AuthGroupFieldTest/');
|
||||
(new AppConfig())->update('globals.config_path', __DIR__ . '/AuthGroupFieldTest/');
|
||||
Config::getInstance()->forceReload();
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ class AuthenticationServerFieldTest extends Field_Framework_TestCase
|
||||
{
|
||||
$this->assertInstanceOf('\OPNsense\Base\FieldTypes\AuthenticationServerField', new AuthenticationServerField());
|
||||
// switch config to test set for this type
|
||||
(new AppConfig())->update('globals.config_path', __DIR__ . '/AuthenticationServerFieldTest/');
|
||||
(new AppConfig())->update('globals.config_path', __DIR__ . '/AuthenticationServerFieldTest/');
|
||||
Config::getInstance()->forceReload();
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ class CertificateFieldTest extends Field_Framework_TestCase
|
||||
{
|
||||
$this->assertInstanceOf('\OPNsense\Base\FieldTypes\CertificateField', new CertificateField());
|
||||
// switch config to test set for this type
|
||||
(new AppConfig())->update('globals.config_path', __DIR__ . '/CertificateFieldTest/');
|
||||
(new AppConfig())->update('globals.config_path', __DIR__ . '/CertificateFieldTest/');
|
||||
Config::getInstance()->forceReload();
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ class InterfaceFieldTest extends Field_Framework_TestCase
|
||||
{
|
||||
$this->assertInstanceOf('\OPNsense\Base\FieldTypes\InterfaceField', new InterfaceField());
|
||||
// switch config to test set for this type
|
||||
(new AppConfig())->update('globals.config_path', __DIR__ . '/InterfaceFieldTest/');
|
||||
(new AppConfig())->update('globals.config_path', __DIR__ . '/InterfaceFieldTest/');
|
||||
Config::getInstance()->forceReload();
|
||||
}
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ class ModelRelationFieldTest extends Field_Framework_TestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
(new AppConfig())->update('globals.config_path', __DIR__ . '/ModelRelationFieldTest/');
|
||||
(new AppConfig())->update('globals.config_path', __DIR__ . '/ModelRelationFieldTest/');
|
||||
Config::getInstance()->forceReload();
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ class NetworkAliasFieldTest extends Field_Framework_TestCase
|
||||
{
|
||||
$this->assertInstanceOf('\OPNsense\Base\FieldTypes\NetworkAliasField', new NetworkAliasField());
|
||||
// switch config to test set for this type
|
||||
(new AppConfig())->update('globals.config_path', __DIR__ . '/NetworkAliasFieldTest/');
|
||||
(new AppConfig())->update('globals.config_path', __DIR__ . '/NetworkAliasFieldTest/');
|
||||
Config::getInstance()->forceReload();
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ class VirtualIPFieldTest extends Field_Framework_TestCase
|
||||
{
|
||||
$this->assertInstanceOf('\OPNsense\Base\FieldTypes\VirtualIPField', new VirtualIPField());
|
||||
// switch config to test set for this type
|
||||
(new AppConfig())->update('globals.config_path', __DIR__ . '/VirtualIPFieldTest/');
|
||||
(new AppConfig())->update('globals.config_path', __DIR__ . '/VirtualIPFieldTest/');
|
||||
Config::getInstance()->forceReload();
|
||||
}
|
||||
|
||||
|
||||
@ -244,5 +244,3 @@ export default class Disk extends BaseWidget {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user