PHP Class Gdn_CookieIdentity, vanilla

ファイルを表示 Open project: vanilla/vanilla Class Usage Examples

Public Properties

Property Type Description
$CookieDomain string
$CookieHashMethod boolean
$CookieName string
$CookiePath string
$CookieSalt string
$PersistExpiry string
$SessionExpiry string
$UserID integer | null
$VolatileMarker string

Public Methods

Method Description
__construct ( null $Config = null )
checkCookie ( $CookieName, null $CookieHashMethod = null, null $CookieSalt = null ) : boolean Validate security of our cookie.
checkVolatileMarker ( $CheckUserID ) : boolean
deleteCookie ( $CookieName, null $Path = null, null $Domain = null ) Remove a cookie.
getCookiePayload ( string $CookieName ) : array Get the pieces that make up our cookie data.
getIdentity ( ) : integer Returns the unique id assigned to the user in the database (retrieved from the session cookie if the cookie authenticates) or FALSE if not found or authentication fails.
hasVolatileMarker ( $CheckUserID ) : boolean
init ( null $Config = null )
setCookie ( string $CookieName, string $KeyData, mixed $CookieContents, integer $CookieExpires, string $Path = null, string $Domain = null, string $CookieHashMethod = null, string $CookieSalt = null ) : void Set a cookie, using specified path, domain, salt and hash method
setIdentity ( integer $UserID, boolean $Persist = false ) Generates the user's session cookie.
setVolatileMarker ( integer $UserID ) : void

Protected Methods

Method Description
_checkCookie ( $CookieName ) : boolean
_clearIdentity ( ) Destroys the user's session cookie - essentially de-authenticating them.
_deleteCookie ( $CookieName ) Remove a cookie.
_setCookie ( string $CookieName, string $KeyData, mixed $CookieContents, integer $CookieExpires ) : void Set a cookie, using path, domain, salt, and hash method from core config

Method Details

__construct() public method

public __construct ( null $Config = null )
$Config null

_checkCookie() protected method

protected _checkCookie ( $CookieName ) : boolean
$CookieName
return boolean

_clearIdentity() protected method

Destroys the user's session cookie - essentially de-authenticating them.
protected _clearIdentity ( )

_deleteCookie() protected method

Remove a cookie.
protected _deleteCookie ( $CookieName )
$CookieName

_setCookie() protected method

Set a cookie, using path, domain, salt, and hash method from core config
protected _setCookie ( string $CookieName, string $KeyData, mixed $CookieContents, integer $CookieExpires ) : void
$CookieName string Name of the cookie
$KeyData string
$CookieContents mixed
$CookieExpires integer
return void

checkCookie() public static method

Validate security of our cookie.
public static checkCookie ( $CookieName, null $CookieHashMethod = null, null $CookieSalt = null ) : boolean
$CookieName
$CookieHashMethod null
$CookieSalt null
return boolean

checkVolatileMarker() public method

public checkVolatileMarker ( $CheckUserID ) : boolean
$CheckUserID
return boolean

deleteCookie() public static method

Remove a cookie.
public static deleteCookie ( $CookieName, null $Path = null, null $Domain = null )
$CookieName
$Path null
$Domain null

getCookiePayload() public static method

Get the pieces that make up our cookie data.
public static getCookiePayload ( string $CookieName ) : array
$CookieName string
return array

getIdentity() public method

Returns the unique id assigned to the user in the database (retrieved from the session cookie if the cookie authenticates) or FALSE if not found or authentication fails.
public getIdentity ( ) : integer
return integer

hasVolatileMarker() public method

public hasVolatileMarker ( $CheckUserID ) : boolean
$CheckUserID
return boolean

init() public method

public init ( null $Config = null )
$Config null

setCookie() public static method

Set a cookie, using specified path, domain, salt and hash method
public static setCookie ( string $CookieName, string $KeyData, mixed $CookieContents, integer $CookieExpires, string $Path = null, string $Domain = null, string $CookieHashMethod = null, string $CookieSalt = null ) : void
$CookieName string Name of the cookie
$KeyData string
$CookieContents mixed
$CookieExpires integer
$Path string Optional. Cookie path (auto load from config)
$Domain string Optional. Cookie domain (auto load from config)
$CookieHashMethod string Optional. Cookie hash method (auto load from config)
$CookieSalt string Optional. Cookie salt (auto load from config)
return void

setIdentity() public method

Generates the user's session cookie.
public setIdentity ( integer $UserID, boolean $Persist = false )
$UserID integer The unique id assigned to the user in the database.
$Persist boolean Should the user's session remain persistent across visits?

setVolatileMarker() public method

public setVolatileMarker ( integer $UserID ) : void
$UserID integer
return void

Property Details

$CookieDomain public_oe property

public string $CookieDomain
return string

$CookieHashMethod public_oe property

public bool $CookieHashMethod
return boolean

$CookieName public_oe property

public string $CookieName
return string

$CookiePath public_oe property

public string $CookiePath
return string

$CookieSalt public_oe property

public string $CookieSalt
return string

$PersistExpiry public_oe property

public string $PersistExpiry
return string

$SessionExpiry public_oe property

public string $SessionExpiry
return string

$UserID public_oe property

public int|null $UserID
return integer | null

$VolatileMarker public_oe property

public string $VolatileMarker
return string