BlockManager
in package
uses
Loggable
Table of Contents
Properties
- $blockExpiresDate : string
- $database : Database|null
- $failMessages : array<string|int, mixed>
- $isBlockingEnabled : bool
- $isWhitelistEnabled : bool
- $logger : object|null
- $shopEnv : ShopEnv
- $user : User
Methods
- __construct() : mixed
- blockUser() : void
- createTables() : void
- Check if needed tables exist and create them if not
- formatBlockDurationMsg() : string
- getBlockDurationLeft() : int
- initialize() : void
- isUserBlocked() : bool
- log() : void
- queryRestrictions() : array<string|int, mixed>
- setBlockingSettings() : void
- setFailMessages() : void
Properties
$blockExpiresDate
private
string
$blockExpiresDate
= ''
$database
private
Database|null
$database
= null
$failMessages
private
array<string|int, mixed>
$failMessages
= []
$isBlockingEnabled
private
bool
$isBlockingEnabled
= true
$isWhitelistEnabled
private
bool
$isWhitelistEnabled
= true
$logger
private
object|null
$logger
= null
$shopEnv
private
ShopEnv
$shopEnv
$user
private
User
$user
Methods
__construct()
public
__construct(ShopEnv $shopEnv, User $user[, Database|null $database = null ]) : mixed
Parameters
blockUser()
public
blockUser([float $duration = 600 ][, string $reason = 'risk_score_too_high' ][, string $origin = '' ][, string $info = '' ]) : void
Parameters
- $duration : float = 600
- $reason : string = 'risk_score_too_high'
- $origin : string = ''
- $info : string = ''
createTables()
Check if needed tables exist and create them if not
public
createTables() : void
formatBlockDurationMsg()
public
formatBlockDurationMsg(int $blockDurationLeftSeconds[, array<string|int, mixed> $failMessages = [] ]) : string
Parameters
- $blockDurationLeftSeconds : int
- $failMessages : array<string|int, mixed> = []
Return values
stringgetBlockDurationLeft()
public
getBlockDurationLeft() : int
Return values
intinitialize()
public
initialize() : void
isUserBlocked()
public
isUserBlocked() : bool
Return values
boollog()
public
log([mixed $message = '' ][, string $level = 'info' ][, mixed $backtrace = null ][, int $spacing = 0 ]) : void
Parameters
- $message : mixed = ''
- $level : string = 'info'
- $backtrace : mixed = null
- $spacing : int = 0
queryRestrictions()
public
queryRestrictions([string $ip = '' ][, string $user = '' ]) : array<string|int, mixed>
Parameters
- $ip : string = ''
- $user : string = ''
Return values
array<string|int, mixed>setBlockingSettings()
public
setBlockingSettings(array{SECURITY_BLOCKING_ENABLED?: bool, SECURITY_WHITELIST_ENABLED?: bool} $settings) : void
Parameters
- $settings : array{SECURITY_BLOCKING_ENABLED?: bool, SECURITY_WHITELIST_ENABLED?: bool}
setFailMessages()
public
setFailMessages(array<string|int, mixed> $failMessages) : void
Parameters
- $failMessages : array<string|int, mixed>