PHP Класс BanModel, vanilla

С версии: 2.0.18
Наследование: extends Gdn_Model
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_AllBans * @var array
$instance The singleton instance of this class.

Открытые методы

Метод Описание
_BeforeGet ( ) Add ban data to all Get requests.
__construct ( ) Defines the related database table name.
allBans ( ) Get and store list of current bans.
applyBan ( array $NewBan = null, array $OldBan = null ) Convert bans to new type.
banWhere ( array $Ban ) : array Ban users that meet conditions given.
checkUser ( $User, Gdn_Validation $Validation = null, boolean $UpdateBlocks = false, &$BansFound = null ) : boolean Add ban data to all Get requests.
delete ( array | integer $where = [], array | true $options = [] ) : boolean Remove a ban.
explodeBans ( integer $banned ) : array Explode a banned bit mask into an array of ban constants.
instance ( ) : BanModel Get the singleton instance of the {@link BanModel} class.
isBanned ( integer $banned, integer $reason ) : boolean Check whether or not a banned value is banned for a given reason.
save ( array $FormPostValues, array $Settings = false ) Save data about ban from form.
saveUser ( array $User, boolean $BannedValue, array | false $Ban = false ) Change ban data on a user (ban or unban them).
setBanned ( integer $banned, boolean $value, integer $reason ) : integer Set the banned mask value for a reason and return the new value.
setCounts ( array &$Data ) Set number of banned users in $Data.

Описание методов

_BeforeGet() публичный Метод

Add ban data to all Get requests.
С версии: 2.0.18
public _BeforeGet ( )

__construct() публичный Метод

Defines the related database table name.
public __construct ( )

allBans() публичный статический Метод

Get and store list of current bans.
С версии: 2.0.18
public static allBans ( )

applyBan() публичный Метод

Convert bans to new type.
С версии: 2.0.18
public applyBan ( array $NewBan = null, array $OldBan = null )
$NewBan array Data about the new ban.
$OldBan array Data about the old ban.

banWhere() публичный Метод

Ban users that meet conditions given.
С версии: 2.0.18
public banWhere ( array $Ban ) : array
$Ban array Data about the ban. Valid keys are BanType and BanValue. BanValue is what is to be banned. Valid values for BanType are email, ipaddress or name.
Результат array

checkUser() публичный статический Метод

Add ban data to all Get requests.
С версии: 2.0.18
public static checkUser ( $User, Gdn_Validation $Validation = null, boolean $UpdateBlocks = false, &$BansFound = null ) : boolean
$Validation Gdn_Validation
$UpdateBlocks boolean
Результат boolean Whether user is banned.

delete() публичный Метод

Remove a ban.
public delete ( array | integer $where = [], array | true $options = [] ) : boolean
$where array | integer The where clause to delete or an integer value.
$options array | true An array of options to control the delete.
Результат boolean Returns **true** on success or **false** on failure.

explodeBans() публичный статический Метод

Explode a banned bit mask into an array of ban constants.
public static explodeBans ( integer $banned ) : array
$banned integer The banned bit mask to explode.
Результат array Returns an array of the set bits.

instance() публичный статический Метод

Get the singleton instance of the {@link BanModel} class.
public static instance ( ) : BanModel
Результат BanModel Returns the singleton instance of this class.

isBanned() публичный статический Метод

Check whether or not a banned value is banned for a given reason.
public static isBanned ( integer $banned, integer $reason ) : boolean
$banned integer The banned value.
$reason integer The reason for the banning or an empty string to check if banned for any reason. This should be one of the `BanModel::BAN_*` constants.
Результат boolean Returns true if the value is banned or false otherwise.

save() публичный Метод

Save data about ban from form.
С версии: 2.0.18
public save ( array $FormPostValues, array $Settings = false )
$FormPostValues array
$Settings array

saveUser() публичный Метод

Change ban data on a user (ban or unban them).
С версии: 2.0.18
public saveUser ( array $User, boolean $BannedValue, array | false $Ban = false )
$User array
$BannedValue boolean Whether user is banned.
$Ban array | false An array representing the specific auto-ban.

setBanned() публичный статический Метод

Set the banned mask value for a reason and return the new value.
public static setBanned ( integer $banned, boolean $value, integer $reason ) : integer
$banned integer The current banned value.
$value boolean The new ban value for the given reason.
$reason integer The reason for the banning. This should be one of the `BanModel::BAN_*` constants.
Результат integer Returns the new banned value.

setCounts() публичный Метод

Set number of banned users in $Data.
С версии: 2.0.18
public setCounts ( array &$Data )
$Data array

Описание свойств

$_AllBans защищенное статическое свойство

* @var array
protected static $_AllBans

$instance защищенное статическое свойство

The singleton instance of this class.
protected static $instance