CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
User Class Reference
Inheritance diagram for User:
[legend]

## Public Member Functions
| __construct ($UserInfoOne=NULL, $UserInfoTwo=NULL)
| Status ()
| StatusMessage ($StatusCode=NULL)
| Delete ()
| Id ()
| Name ()
| GetBestName ()
| Get the best available name associated with a user, i.e., the real name or, if it isn't available, the user name. More...
| LastLocation ($NewLocation=NULL)
| LastActiveDate ()
| LastIPAddress ()
| Get ($FieldName)
| GetDate ($FieldName, $Format="")
| Set ($FieldName, $NewValue)
| Login ($UserName, $Password, $IgnorePassword=FALSE)
| Logout ()
| GetPasswordSalt ($UserName)
| IsLoggedIn ()
| IsNotLoggedIn ()
| ChangePassword ($OldPassword, $NewPassword, $NewPasswordAgain)
| SetPassword ($NewPassword)
| SetEncryptedPassword ($NewEncryptedPassword)
| CreateNewUserWithEMailedPassword ($UserName, $EMail, $EMailAgain, $TemplateFile="Axis--User--EMailTemplate.txt")
| CreateNewUserAndMailPasswordFromFile ($UserName, $EMail, $EMailAgain, $TemplateFile="Axis--User--EMailTemplate.txt")
| CreateNewUserAndMailPassword ($UserName, $EMail, $EMailAgain, $EMailSubject, $EMailBody)
| GetActivationCode ()
| IsActivationCodeGood ($Code)
| IsActivated ($NewValue=DB_NOVALUE)
| GetResetCode ()
| IsResetCodeGood ($Code)
| GetMailChangeCode ()
| IsMailChangeCodeGood ($Code)
| SendEMail ($TemplateTextOrFileName, $FromAddress=NULL, $MoreSubstitutions=NULL, $ToAddress=NULL)
| HasPriv ($Privilege, $Privileges=NULL)
| Check whether user has specified privilege(s). More...
| GrantPriv ($Privilege)
| RevokePriv ($Privilege)
| GetPrivList ()
| SetPrivList ($NewPrivileges)
| GetUniqueCode ($SeedString, $CodeLength)
| GetRandomPassword ($PasswordMinLength=6, $PasswordMaxLength=8)
| UpdateValue ($FieldName, $NewValue=DB_NOVALUE)
| GivePriv ($Privilege)

## Static Public Member Functions
static | SetEmailFunction ($NewValue)
| Set email function to use instead of mail(). More...
static | GetSqlQueryForUsersWithPriv ($Privilege, $Privileges=NULL)
| Get an SQL query that will return IDs of all users that have the specified privilege flags. More...
static | GetSqlQueryForUsersWithoutPriv ($Privilege, $Privileges=NULL)
| Get an SQL query that will return IDs of all users that do not have the specified privilege flags. More...
static | IsValidUserName ($UserName)
static | IsValidPassword ($Password)
static | IsValidLookingEMailAddress ($EMail)
static | NormalizeEMailAddress ($EMailAddress)
static | NormalizeUserName ($UserName)
static | NormalizePassword ($Password)

## Protected Attributes
| $DB
| $UserId = NULL
| $Result
| $LoggedIn

## Detailed Description

Definition at line 41 of file User.php.

## Constructor & Destructor Documentation

User::__construct | ( |  | $UserInfoOne = `NULL`,
|  |  | $UserInfoTwo = `NULL`
| ) |  |

Definition at line 45 of file User.php.

References U_NOSUCHUSER, and U_OKAY.

## Member Function Documentation

User::ChangePassword | ( |  | $OldPassword,
|  |  | $NewPassword,
|  |  | $NewPasswordAgain
| ) |  |

Definition at line 446 of file User.php.

References $Result, IsValidPassword(), SetPassword(), U_BADPASSWORD, U_ILLEGALPASSWORD, U_NOTLOGGEDIN, U_OKAY, and U_PASSWORDSDONTMATCH.

User::CreateNewUserAndMailPassword | ( |  | $UserName,
|  |  | $EMail,
|  |  | $EMailAgain,
|  |  | $EMailSubject,
|  |  | $EMailBody
| ) |  |

Definition at line 524 of file User.php.

References $Result, GetRandomPassword(), IsValidLookingEMailAddress(), Set(), U_EMAILSDONTMATCH, U_ILLEGALEMAIL, U_MAILINGERROR, and U_OKAY.

Referenced by CreateNewUserAndMailPasswordFromFile().

Here is the caller graph for this function:

User::CreateNewUserAndMailPasswordFromFile | ( |  | $UserName,
|  |  | $EMail,
|  |  | $EMailAgain,
|  |  | $TemplateFile = `"Axis--User--EMailTemplate.txt"`
| ) |  |

Definition at line 511 of file User.php.

References CreateNewUserAndMailPassword().

Referenced by CreateNewUserWithEMailedPassword().

Here is the caller graph for this function:

User::CreateNewUserWithEMailedPassword | ( |  | $UserName,
|  |  | $EMail,
|  |  | $EMailAgain,
|  |  | $TemplateFile = `"Axis--User--EMailTemplate.txt"`
| ) |  |

Definition at line 503 of file User.php.

References CreateNewUserAndMailPasswordFromFile().

User::Delete | ( |  | ) |

Definition at line 158 of file User.php.

References $Result, and U_OKAY.

User::Get | ( |  | $FieldName | ) |

Definition at line 246 of file User.php.

References UpdateValue().

Referenced by GetBestName(), GetMailChangeCode(), GetUniqueCode(), LastActiveDate(), LastIPAddress(), LastLocation(), Name(), and SendEMail().

Here is the caller graph for this function:

User::GetActivationCode | ( |  | ) |

Definition at line 595 of file User.php.

References GetUniqueCode().

Referenced by IsActivationCodeGood(), and SendEMail().

Here is the caller graph for this function:

User::GetBestName | ( |  | ) |

Get the best available name associated with a user, i.e., the real name or, if it isn't available, the user name.

Returns
  Returns the best available name for the user.

Definition at line 202 of file User.php.

References Get().

User::GetDate | ( |  | $FieldName,
|  |  | $Format = `""`
| ) |  |

Definition at line 255 of file User.php.

User::GetMailChangeCode | ( |  | ) |

Definition at line 631 of file User.php.

References Get(), and GetUniqueCode().

Referenced by IsMailChangeCodeGood(), and SendEMail().

Here is the caller graph for this function:

User::GetPasswordSalt | ( |  | $UserName | ) |

Definition at line 396 of file User.php.

References $Result.

User::GetPrivList | ( |  | ) |

Definition at line 931 of file User.php.

User::GetRandomPassword | ( |  | $PasswordMinLength = `6`,
|  |  | $PasswordMaxLength = `8`
| ) |  |

Definition at line 1044 of file User.php.

Referenced by CreateNewUserAndMailPassword().

Here is the caller graph for this function:

User::GetResetCode | ( |  | ) |

Definition at line 616 of file User.php.

References GetUniqueCode().

Referenced by IsResetCodeGood(), and SendEMail().

Here is the caller graph for this function:

static User::GetSqlQueryForUsersWithoutPriv | ( |  | $Privilege,
|  |  | $Privileges = `NULL`
| ) |  |
| static

Get an SQL query that will return IDs of all users that do not have the specified privilege flags.

This method is useful primarily for subqueries.

Parameters

  mixed | $Privilege | Privilege or array of privileges.
  mixed | $Privileges | One or more additional privileges. (variable length argument list) (OPTIONAL)

Returns
  SQL query to retrieve user IDs.

Definition at line 846 of file User.php.

static User::GetSqlQueryForUsersWithPriv | ( |  | $Privilege,
|  |  | $Privileges = `NULL`
| ) |  |
| static

Get an SQL query that will return IDs of all users that have the specified privilege flags.

This method is useful primarily for subqueries.

Parameters

  mixed | $Privilege | Privilege or array of privileges.
  mixed | $Privileges | One or more additional privileges. (variable length argument list) (OPTIONAL)

Returns
  SQL query to retrieve user IDs.

Definition at line 803 of file User.php.

User::GetUniqueCode | ( |  | $SeedString,
|  |  | $CodeLength
| ) |  |

Definition at line 963 of file User.php.

References Get().

Referenced by GetActivationCode(), GetMailChangeCode(), and GetResetCode().

Here is the caller graph for this function:

User::GivePriv | ( |  | $Privilege | ) |

Definition at line 1062 of file User.php.

References GrantPriv().

User::GrantPriv | ( |  | $Privilege | ) |

Definition at line 881 of file User.php.

References $Result, U_ERROR, U_NOTLOGGEDIN, and U_OKAY.

Referenced by GivePriv(), and SetPrivList().

Here is the caller graph for this function:

User::HasPriv | ( |  | $Privilege,
|  |  | $Privileges = `NULL`
| ) |  |

Check whether user has specified privilege(s).

Parameters

  mixed | $Privilege | Privilege or array of privileges.
  mixed | $Privileges | One or more additional privileges. (variable length argument list) (OPTIONAL)

Returns
  TRUE if user has one or more of specified privilege(s), otherwise FALSE.

Definition at line 747 of file User.php.

User::Id | ( |  | ) |

Definition at line 188 of file User.php.

References $UserId.

User::IsActivated | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 610 of file User.php.

References UpdateValue().

User::IsActivationCodeGood | ( |  | $Code | ) |

Definition at line 603 of file User.php.

References GetActivationCode().

User::IsLoggedIn | ( |  | ) |

Definition at line 433 of file User.php.

References $LoggedIn.

User::IsMailChangeCodeGood | ( |  | $Code | ) |

Definition at line 639 of file User.php.

References GetMailChangeCode().

User::IsNotLoggedIn | ( |  | ) |

Definition at line 437 of file User.php.

References $LoggedIn.

User::IsResetCodeGood | ( |  | $Code | ) |

Definition at line 624 of file User.php.

References GetResetCode().

static User::IsValidLookingEMailAddress | ( |  | $EMail | ) |
| static

Definition at line 1012 of file User.php.

Referenced by CreateNewUserAndMailPassword(), and UserFactory\TestNewUserValues().

Here is the caller graph for this function:

static User::IsValidPassword | ( |  | $Password | ) |
| static

Definition at line 999 of file User.php.

Referenced by ChangePassword(), and UserFactory\TestNewUserValues().

Here is the caller graph for this function:

static User::IsValidUserName | ( |  | $UserName | ) |
| static

Definition at line 986 of file User.php.

Referenced by UserFactory\FindUserNames(), and UserFactory\TestNewUserValues().

Here is the caller graph for this function:

User::LastActiveDate | ( |  | ) |

Definition at line 236 of file User.php.

References Get().

User::LastIPAddress | ( |  | ) |

Definition at line 240 of file User.php.

References Get().

User::LastLocation | ( |  | $NewLocation = `NULL` | ) |

Definition at line 216 of file User.php.

References Get().

User::Login | ( |  | $UserName,
|  |  | $Password,
|  |  | $IgnorePassword = `FALSE`
| ) |  |

Definition at line 291 of file User.php.

References $Result, $UserId, U_BADPASSWORD, U_NOSUCHUSER, U_NOTACTIVATED, and U_OKAY.

User::Logout | ( |  | ) |

Definition at line 378 of file User.php.

User::Name | ( |  | ) |

Definition at line 192 of file User.php.

References Get().

static User::NormalizeEMailAddress | ( |  | $EMailAddress | ) |
| static

Definition at line 1026 of file User.php.

Referenced by UserFactory\EMailAddressIsInUse(), and UserFactory\TestNewUserValues().

Here is the caller graph for this function:

static User::NormalizePassword | ( |  | $Password | ) |
| static

Definition at line 1038 of file User.php.

Referenced by UserFactory\TestNewUserValues().

Here is the caller graph for this function:

static User::NormalizeUserName | ( |  | $UserName | ) |
| static

Definition at line 1032 of file User.php.

Referenced by UserFactory\CreateNewUser(), UserFactory\TestNewUserValues(), and UserFactory\UserNameExists().

Here is the caller graph for this function:

User::RevokePriv | ( |  | $Privilege | ) |

Definition at line 916 of file User.php.

References $Result, U_NOTLOGGEDIN, and U_OKAY.

User::SendEMail | ( |  | $TemplateTextOrFileName,
|  |  | $FromAddress = `NULL`,
|  |  | $MoreSubstitutions = `NULL`,
|  |  | $ToAddress = `NULL`
| ) |  |

Definition at line 646 of file User.php.

References $Result, Get(), GetActivationCode(), GetMailChangeCode(), GetResetCode(), Status(), U_MAILINGERROR, U_OKAY, and U_TEMPLATENOTFOUND.

User::Set | ( |  | $FieldName,
|  |  | $NewValue
| ) |  |

Definition at line 278 of file User.php.

References $Result, U_NOTLOGGEDIN, U_OKAY, and UpdateValue().

Referenced by CreateNewUserAndMailPassword().

Here is the caller graph for this function:

static User::SetEmailFunction | ( |  | $NewValue | ) |
| static

Set email function to use instead of mail().

Parameters

  callback | $NewValue | Callable email function or method that accepts the same arguments as mail().

Definition at line 177 of file User.php.

Referenced by CWUser\__construct().

Here is the caller graph for this function:

User::SetEncryptedPassword | ( |  | $NewEncryptedPassword | ) |

Definition at line 497 of file User.php.

References UpdateValue().

User::SetPassword | ( |  | $NewPassword | ) |

Definition at line 487 of file User.php.

References UpdateValue().

Referenced by ChangePassword().

Here is the caller graph for this function:

User::SetPrivList | ( |  | $NewPrivileges | ) |

Definition at line 942 of file User.php.

References GrantPriv(), and U_NOTLOGGEDIN.

User::Status | ( |  | ) |

Definition at line 115 of file User.php.

References $Result.

Referenced by SendEMail().

Here is the caller graph for this function:

User::StatusMessage | ( |  | $StatusCode = `NULL` | ) |

Definition at line 121 of file User.php.

References $Result, U_BADPASSWORD, U_DUPLICATEEMAIL, U_DUPLICATEUSERNAME, U_EMAILSDONTMATCH, U_ERROR, U_ILLEGALEMAIL, U_ILLEGALPASSWORD, U_ILLEGALUSERNAME, U_MAILINGERROR, U_NOSUCHUSER, U_NOTLOGGEDIN, U_OKAY, U_PASSWORDSDONTMATCH, and U_TEMPLATENOTFOUND.

User::UpdateValue | ( |  | $FieldName,
|  |  | $NewValue = `DB_NOVALUE`
| ) |  |

Definition at line 1055 of file User.php.

Referenced by Get(), IsActivated(), Set(), SetEncryptedPassword(), and SetPassword().

Here is the caller graph for this function:

## Member Data Documentation

User::$DB
| protected

Definition at line 976 of file User.php.

Referenced by CWUser\FetchAssociatedResource(), and SPTUser\GetCryptKey().

User::$LoggedIn
| protected

Definition at line 979 of file User.php.

Referenced by IsLoggedIn(), and IsNotLoggedIn().

User::$Result
| protected

Definition at line 978 of file User.php.

Referenced by ChangePassword(), CreateNewUserAndMailPassword(), Delete(), CWUser\EmailWrapper(), GetPasswordSalt(), GrantPriv(), Login(), RevokePriv(), SendEMail(), Set(), Status(), and StatusMessage().

User::$UserId = NULL
| protected

Definition at line 977 of file User.php.

Referenced by CWUser\FetchAssociatedResource(), Id(), and Login().

The documentation for this class was generated from the following file:

- lib/AxisPHP/User.php