本文整理汇总了PHP中UserAccount::QuerySingle方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAccount::QuerySingle方法的具体用法?PHP UserAccount::QuerySingle怎么用?PHP UserAccount::QuerySingle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAccount
的用法示例。
在下文中一共展示了UserAccount::QuerySingle方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: btnRecoverPassword_Click
protected function btnRecoverPassword_Click()
{
$blnError = false;
$objUserAccount = null;
if (!filter_var($this->txtEmail->Text, FILTER_VALIDATE_EMAIL)) {
$blnError = true;
} else {
$objUserAccount = UserAccount::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::UserAccount()->EmailAddress, $this->txtEmail->Text), QQ::Equal(QQN::UserAccount()->ActiveFlag, '1')));
if (!$objUserAccount) {
$blnError = true;
}
}
if (!$blnError) {
// Hide password reset controls and show instructions
$this->txtEmail->Visible = false;
$this->btnRecoverPassword->Display = false;
$this->lblForgotPassword->Text = sprintf('A link to reset your password has been sent to:<br/><strong>%s</strong>', $this->txtEmail->Text);
$this->lblForgotPassword->FontUnderline = false;
$this->lblForgotPassword->Cursor = null;
$this->lblForgotPassword->RemoveAllActions('onclick');
$this->lblForgotPassword->Display = true;
$this->lblForgotPassword->Blink();
// Re-enable login controls
$this->txtUsername->Enabled = $this->txtPassword->Enabled = $this->btnLogin->Enabled = true;
$this->txtUsername->Focus();
$objUserAccount->SendPasswordResetEmail();
} else {
$this->txtEmail->Warning = 'Unrecognized email address';
$this->txtEmail->Blink();
$this->txtEmail->Focus();
$this->txtEmail->Select();
}
}
示例2: LoadByUserAccountIdPortableUserPin
public function LoadByUserAccountIdPortableUserPin($intUserAccountId, $strPortableUserPin)
{
return UserAccount::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::UserAccount()->UserAccountId, $intUserAccountId), QQ::Equal(QQN::UserAccount()->PortableUserPin, $strPortableUserPin)));
/*$strQuery = "SELECT * FROM `user_account` where `user_account_id`='$intUserAccountId' AND `portable_user_pin`='$strPortableUserPin'";
$objDatabase = QApplication::$Database[1];
// Perform the Query
$objDbResult = $objDatabase->Query($strQuery);
$mixArray = $objDbResult->FetchArray();
if ($mixArray) {
return $mixArray;
}
return false;*/
}
示例3: btnSave_Click
protected function btnSave_Click($strFormId, $strControlId, $strParameter)
{
$blnError = false;
if ($this->txtPassword->Text != $this->txtPasswordConfirm->Text) {
$blnError = true;
$this->txtPassword->Warning = "The passwords do not match, please re-enter.";
$this->txtPassword->Text = "";
$this->txtPasswordConfirm->Text = "";
} else {
if (!($this->blnEditMode && $this->txtPassword->Text == '') && strlen($this->txtPassword->Text) < 8) {
$blnError = true;
$this->txtPassword->Warning = "Password must be at least 8 characters.";
}
}
// Check for a valid email address
if (!filter_var($this->txtEmailAddress->Text, FILTER_VALIDATE_EMAIL)) {
$blnError = true;
$this->txtEmailAddress->Warning = 'Please enter a valid email address';
}
// Do not allow duplicate email addresses
$objUserAccountDupe = UserAccount::LoadByEmailAddress($this->txtEmailAddress->Text);
if ($this->blnEditMode && $objUserAccountDupe && $objUserAccountDupe->UserAccountId != $this->objUserAccount->UserAccountId || !$this->blnEditMode && $objUserAccountDupe) {
$blnError = true;
$this->txtEmailAddress->Warning = 'A user account with that email address already exists.';
}
$intUserLimit = is_numeric(QApplication::$TracmorSettings->UserLimit) ? QApplication::$TracmorSettings->UserLimit : 99999;
// Do not allow creation of a new active user if user limit will be exceeded
if (!$this->blnEditMode && $this->chkActiveFlag->Checked) {
if (UserAccount::CountActive() >= $intUserLimit) {
$blnError = true;
$this->chkActiveFlag->Warning = "You have exceeded your user limit.";
}
}
// Do not allow activation of a disabled user if the user limit will be exceeded
if ($this->blnEditMode && $this->chkActiveFlag->Checked && !$this->objUserAccount->ActiveFlag) {
if (UserAccount::CountActive() >= $intUserLimit) {
$blnError = true;
$this->chkActiveFlag->Warning = "You have exceeded your user limit.";
}
}
// Do not allow duplicate usernames
if ($this->blnEditMode) {
$objUserAccountDuplicate = UserAccount::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::UserAccount()->Username, $this->txtUsername->Text), QQ::NotEqual(QQN::UserAccount()->UserAccountId, $this->objUserAccount->UserAccountId)));
} else {
$objUserAccountDuplicate = UserAccount::QuerySingle(QQ::Equal(QQN::UserAccount()->Username, $this->txtUsername->Text));
}
if ($objUserAccountDuplicate) {
$blnError = true;
$this->btnCancel->Warning = 'A user account already exists with that username. Please choose another.';
}
// Do not allow deactivation of owner account
$this->objOwnerAccount = UserAccount::LoadOwner();
if ($this->blnEditMode && $this->objOwnerAccount && $this->objOwnerAccount->UserAccountId == $this->objUserAccount->UserAccountId && !$this->chkActiveFlag->Checked) {
$blnError = true;
$this->btnCancel->Warning = 'This user cannot be deactivated because they are the account owner.';
}
if (!$blnError) {
try {
$this->UpdateUserAccountFields();
$this->objUserAccount->Save();
QApplication::Redirect('user_account_list.php');
} catch (QExtendedOptimisticLockingException $objExc) {
$this->btnCancel->Warning = sprintf('This user account has been updated by another user. You must <a href="user_account_edit.php?intUserAccountId=%s">Refresh</a> to edit this user account.', $this->objUserAccount->UserAccountId);
}
}
}
示例4: LoadByUsername
/**
* Load a single UserAccount object,
* by Username Index(es)
* @param string $strUsername
* @return UserAccount
*/
public static function LoadByUsername($strUsername, $objOptionalClauses = null)
{
return UserAccount::QuerySingle(QQ::Equal(QQN::UserAccount()->Username, $strUsername), $objOptionalClauses);
}
示例5: LoadByEmailAddress
/**
* Load a single UserAccount object,
* by EmailAddress Index(es)
* @param string $strEmailAddress
* @return UserAccount
*/
public static function LoadByEmailAddress($strEmailAddress, $objOptionalClauses = null)
{
return UserAccount::QuerySingle(QQ::Equal(QQN::UserAccount()->EmailAddress, $strEmailAddress), $objOptionalClauses);
}
示例6: LoadByUsername
/**
* Load a single UserAccount object,
* by Username Index(es)
* @param string $strUsername
* @return UserAccount
*/
public static function LoadByUsername($strUsername)
{
return UserAccount::QuerySingle(QQ::Equal(QQN::UserAccount()->Username, $strUsername));
}
示例7: btnSave_Click
protected function btnSave_Click($strFormId, $strControlId, $strParameter)
{
$blnError = false;
if ($this->txtPassword->Text != $this->txtPasswordConfirm->Text) {
$blnError = true;
$this->txtPassword->Warning = "The passwords do not match, please re-enter.";
$this->txtPassword->Text = "";
$this->txtPasswordConfirm->Text = "";
}
$intUserLimit = is_numeric(QApplication::$TracmorSettings->UserLimit) ? QApplication::$TracmorSettings->UserLimit : 99999;
// Do not allow creation of a new active user if user limit will be exceeded
if (!$this->blnEditMode && $this->chkActiveFlag->Checked) {
if (UserAccount::CountActive() >= $intUserLimit) {
$blnError = true;
$this->chkActiveFlag->Warning = "You have exceeded your user limit.";
}
}
// Do not allow activation of a disabled user if the user limit will be exceeded
if ($this->blnEditMode && $this->chkActiveFlag->Checked && !$this->objUserAccount->ActiveFlag) {
if (UserAccount::CountActive() >= $intUserLimit) {
$blnError = true;
$this->chkActiveFlag->Warning = "You have exceeded your user limit.";
}
}
// Do not allow duplicate usernames
if ($this->blnEditMode) {
$objUserAccountDuplicate = UserAccount::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::UserAccount()->Username, $this->txtUsername->Text), QQ::NotEqual(QQN::UserAccount()->UserAccountId, $this->objUserAccount->UserAccountId)));
} else {
$objUserAccountDuplicate = UserAccount::QuerySingle(QQ::Equal(QQN::UserAccount()->Username, $this->txtUsername->Text));
}
if ($objUserAccountDuplicate) {
$blnError = true;
$this->btnCancel->Warning = 'A user account already exists with that username. Please choose another.';
}
if (!$blnError) {
try {
$this->UpdateUserAccountFields();
$this->objUserAccount->Save();
QApplication::Redirect('user_account_list.php');
} catch (QExtendedOptimisticLockingException $objExc) {
$this->btnCancel->Warning = sprintf('This user account has been updated by another user. You must <a href="user_account_edit.php?intUserAccountId=%s">Refresh</a> to edit this user account.', $this->objUserAccount->UserAccountId);
}
}
}