PHP Class BanModel, vanilla

Since: 2.0.18
Inheritance: extends Gdn_Model
Afficher le fichier Open project: vanilla/vanilla Class Usage Examples

Protected Properties

Свойство Type Description
$_AllBans * @var array
$instance The singleton instance of this class.

Méthodes publiques

Méthode Description
_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.

Method Details

_BeforeGet() public méthode

Add ban data to all Get requests.
Since: 2.0.18
public _BeforeGet ( )

__construct() public méthode

Defines the related database table name.
public __construct ( )

allBans() public static méthode

Get and store list of current bans.
Since: 2.0.18
public static allBans ( )

applyBan() public méthode

Convert bans to new type.
Since: 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() public méthode

Ban users that meet conditions given.
Since: 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.
Résultat array

checkUser() public static méthode

Add ban data to all Get requests.
Since: 2.0.18
public static checkUser ( $User, Gdn_Validation $Validation = null, boolean $UpdateBlocks = false, &$BansFound = null ) : boolean
$Validation Gdn_Validation
$UpdateBlocks boolean
Résultat boolean Whether user is banned.

delete() public méthode

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.
Résultat boolean Returns **true** on success or **false** on failure.

explodeBans() public static méthode

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.
Résultat array Returns an array of the set bits.

instance() public static méthode

Get the singleton instance of the {@link BanModel} class.
public static instance ( ) : BanModel
Résultat BanModel Returns the singleton instance of this class.

isBanned() public static méthode

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.
Résultat boolean Returns true if the value is banned or false otherwise.

save() public méthode

Save data about ban from form.
Since: 2.0.18
public save ( array $FormPostValues, array $Settings = false )
$FormPostValues array
$Settings array

saveUser() public méthode

Change ban data on a user (ban or unban them).
Since: 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() public static méthode

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.
Résultat integer Returns the new banned value.

setCounts() public méthode

Set number of banned users in $Data.
Since: 2.0.18
public setCounts ( array &$Data )
$Data array

Property Details

$_AllBans protected_oe static_oe property

* @var array
protected static $_AllBans

$instance protected_oe static_oe property

The singleton instance of this class.
protected static $instance