Method to activate a user
static boolean
activateUser
(string $activation)
-
string
$activation: Activation string
Method to add a user to a group.
static boolean
addUserToGroup
(integer $userId, integer $groupId)
-
integer
$userId: The id of the user.
-
integer
$groupId: The id of the group.
Clear all expired tokens for all users.
static mixed
clearExpiredTokens
()
Generate a random password
static string
genRandomPassword
([integer $length = 16])
-
integer
$length: Length of the password to generate
Formats a password using the current encryption.
static string
getCryptedPassword
(string $plaintext, [string $salt = ''], [string $encryption = 'bcrypt'], [boolean $show_encrypt = false])
-
string
$plaintext: The plaintext password to encrypt.
-
string
$salt: The salt to use to encrypt the password. [] If not present, a new salt will be generated.
-
string
$encryption: The kind of password encryption to use. Defaults to md5-hex.
-
boolean
$show_encrypt: Some password systems prepend the kind of encryption to the crypted password ({SHA}, etc). Defaults to false.
Gets the user profile information
static object
getProfile
([integer $userId = 0])
-
integer
$userId: The id of the user.
Method to get the remember me cookie data
static mixed
getRememberCookieData
()
Returns a salt for the appropriate kind of password encryption.
Optionally takes a seed and a plaintext password, to extract the seed of an existing password, or for encryption types that use the plaintext in the generation of the salt.
static string
getSalt
([string $encryption = 'md5-hex'], [string $seed = ''], [string $plaintext = ''])
-
string
$encryption: The kind of password encryption to use. Defaults to md5-hex.
-
string
$seed: The seed to get the salt from (probably a previously generated password). Defaults to generating a new seed.
-
string
$plaintext: The plaintext password that we're generating a salt for. Defaults to none.
Method to get a hashed user agent string that does not include browser version.
Used when frequent version changes cause problems.
static string
getShortHashedUserAgent
()
Method to get a list of groups a user is in.
static array
getUserGroups
(integer $userId)
-
integer
$userId: The id of the user.
Returns userid if a user exists
static integer
getUserId
(string $username)
-
string
$username: The username to search on.
Method to remove a cookie record from the database and the browser
static boolean
invalidateCookie
(string $userId, string $cookieName)
-
string
$userId: User ID for this user
-
string
$cookieName: Series id (cookie name decoded)
Method to remove a user from a group.
static boolean
removeUserFromGroup
(integer $userId, integer $groupId)
-
integer
$userId: The id of the user.
-
integer
$groupId: The id of the group.
Method to set the groups for a user.
static boolean
setUserGroups
(integer $userId, array $groups)
-
integer
$userId: The id of the user.
-
array
$groups: An array of group ids to put the user in.
Converts to allowed 64 characters for APRMD5 passwords.
static string
_toAPRMD5
(string $value, integer $count)
-
string
$value: The value to convert.
-
integer
$count: The number of characters to convert.