* Changed bans processing
This commit is contained in:
parent
2b87573bfd
commit
bddd5467af
4 changed files with 19 additions and 14 deletions
|
@ -12,12 +12,17 @@ class Delete extends Method
|
|||
*
|
||||
* @param array $ids
|
||||
*
|
||||
* @return BanList
|
||||
* @return BanList\Model
|
||||
*/
|
||||
public function delete(array $ids)
|
||||
{
|
||||
if (! empty($ids)) {
|
||||
$this->c->DB->exec('DELETE FROM ::bans WHERE id IN (?ai:ids)', [':ids' => $ids]);
|
||||
$vars = [
|
||||
':ids' => $ids
|
||||
];
|
||||
$sql = 'DELETE FROM ::bans WHERE id IN (?ai:ids)';
|
||||
|
||||
$this->c->DB->exec($sql, $vars);
|
||||
$this->model->load();
|
||||
}
|
||||
return $this->model;
|
||||
|
|
|
@ -10,7 +10,7 @@ class Load extends Method
|
|||
* Загружает список банов из БД
|
||||
* Создает кеш
|
||||
*
|
||||
* @return BanList
|
||||
* @return BanList\Model
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ class Load extends Method
|
|||
if (null !== $ips) {
|
||||
foreach (\explode(' ', $ips) as $ip) {
|
||||
$ip = \trim($ip);
|
||||
if ($ip != '') {
|
||||
if ('' != $ip) {
|
||||
$ipList[$ip] = $row['id'];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace ForkBB\Models;
|
||||
namespace ForkBB\Models\BanList;
|
||||
|
||||
use ForkBB\Models\Model;
|
||||
use ForkBB\Models\Model as ParentModel;
|
||||
|
||||
class BanList extends Model
|
||||
class Model extends ParentModel
|
||||
{
|
||||
/**
|
||||
* Загружает список банов из кеша/БД
|
||||
*
|
||||
* @return BanList
|
||||
* @return BanList\Model
|
||||
*/
|
||||
public function init()
|
||||
{
|
|
@ -86,7 +86,7 @@ return [
|
|||
'Func' => \ForkBB\Core\Func::class,
|
||||
|
||||
'config' => '@ConfigModel:init',
|
||||
'bans' => '@ModelBanList:init',
|
||||
'bans' => '@BanListModel:init',
|
||||
'censorship' => '@CensorshipModel:init',
|
||||
'stats' => '@StatsModel:init',
|
||||
'admins' => '@AdminListModel:init',
|
||||
|
@ -180,11 +180,11 @@ return [
|
|||
|
||||
'OnlineInfo' => \ForkBB\Models\Online\Info::class,
|
||||
|
||||
'ModelBanList' => \ForkBB\Models\BanList::class,
|
||||
'BanListLoad' => \ForkBB\Models\BanList\Load::class,
|
||||
'BanListCheck' => \ForkBB\Models\BanList\Check::class,
|
||||
'BanListDelete' => \ForkBB\Models\BanList\Delete::class,
|
||||
'BanListIsBanned' => \ForkBB\Models\BanList\IsBanned::class,
|
||||
'BanListModel' => \ForkBB\Models\BanList\Model::class,
|
||||
'BanListModelLoad' => \ForkBB\Models\BanList\Load::class,
|
||||
'BanListModelCheck' => \ForkBB\Models\BanList\Check::class,
|
||||
'BanListModelDelete' => \ForkBB\Models\BanList\Delete::class,
|
||||
'BanListModelIsBanned' => \ForkBB\Models\BanList\IsBanned::class,
|
||||
|
||||
'CensorshipModel' => \ForkBB\Models\Censorship\Model::class,
|
||||
'CensorshipModelRefresh' => \ForkBB\Models\Censorship\Refresh::class,
|
||||
|
|
Loading…
Add table
Reference in a new issue