Merge branch 'develop' into feature/2fa

This commit is contained in:
slawkens
2026-01-31 12:31:28 +01:00
11 changed files with 98 additions and 34 deletions

View File

@@ -0,0 +1,18 @@
<?php
namespace MyAAC\Models;
use Illuminate\Database\Eloquent\Model;
class AccountBan extends Model {
protected $table = TABLE_PREFIX . 'account_bans';
public $timestamps = false;
protected $fillable = [
'account_id',
'reason', 'banned_at',
'expires_at', 'banned_by'
];
}

View File

@@ -122,18 +122,21 @@ class Settings implements \ArrayAccess
public static function display($plugin, $settings): array
{
$settingsDb = ModelsSettings::where('name', $plugin)->pluck('value', 'key')->toArray();
$config = [];
require BASE . 'config.local.php';
foreach ($config as $key => $value) {
if (is_bool($value)) {
$settingsDb[$key] = $value ? 'true' : 'false';
}
elseif (is_array($value)) {
$settingsDb[$key] = $value;
}
else {
$settingsDb[$key] = (string)$value;
if ($plugin === 'core') {
$config = [];
require BASE . 'config.local.php';
foreach ($config as $key => $value) {
if (is_bool($value)) {
$settingsDb[$key] = $value ? 'true' : 'false';
}
elseif (is_array($value)) {
$settingsDb[$key] = $value;
}
else {
$settingsDb[$key] = (string)$value;
}
}
}

View File

@@ -3,6 +3,7 @@
namespace MyAAC\Twig;
use Twig\Environment;
use Twig\Loader\ArrayLoader as Twig_ArrayLoader;
class EnvironmentBridge extends Environment
{
@@ -25,4 +26,21 @@ class EnvironmentBridge extends Environment
return parent::render($name, $context);
}
public function renderInline($content, array $context = []): string
{
$oldLoader = $this->getLoader();
$twig_loader_array = new Twig_ArrayLoader(array(
'content.html' => $content
));
$this->setLoader($twig_loader_array);
$ret = $this->render('content.html', $context);
$this->setLoader($oldLoader);
return $ret;
}
}