mirror of
https://github.com/slawkens/myaac.git
synced 2026-02-06 21:26:22 +01:00
Merge branch 'develop' into feature/2fa
This commit is contained in:
18
system/src/Models/AccountBan.php
Normal file
18
system/src/Models/AccountBan.php
Normal 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'
|
||||
];
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user