本文整理汇总了PHP中UserDB::updateUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDB::updateUser方法的具体用法?PHP UserDB::updateUser怎么用?PHP UserDB::updateUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDB
的用法示例。
在下文中一共展示了UserDB::updateUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAuthorizeUser
function testAuthorizeUser()
{
$info = new UserInfo($this->data);
$store = new UserDB();
$store->updateUser($info);
$result = $store->authorizeUser($info);
$this->assertEquals($info->userid, $result->userid);
$this->assertEquals($info->username, $result->username);
$fake = new UserInfo(array('username' => 'test', 'password' => 1111));
$result = $store->authorizeUser($fake);
$this->assertEquals(null, $result);
}
示例2: post
public static function post()
{
if (isset($_POST['edit'])) {
$page = new Page();
$page->data['title'] = 'Profiel';
ProfileController::buildProfileTopView($page, true, false);
$page->addView('profile/ProfileEnabledFormBottomView');
ProfileController::buildMembershipDetailsView($page);
$page->showWithMenu();
} elseif (isset($_POST['save'])) {
$page = new Page();
$page->data['title'] = 'Profiel';
$errMsgs = ProfileTopViewValidator::validate($_POST);
if (empty($errMsgs)) {
//If no error: create a new user from posted data and try to save it
$newUser = ProfileController::createUserFromPost();
try {
UserDB::updateUser($_SESSION['Stippers']['Profile']['user'], $newUser);
$page->data['SuccessMessageNoDescriptionWithLinkView']['successTitle'] = 'Gegevens succesvol bijgewerkt';
$page->data['SuccessMessageNoDescriptionWithLinkView']['redirectUrl'] = $_SERVER['REQUEST_URI'];
$page->addView('success/SuccessMessageNoDescriptionWithLinkView');
} catch (UserDBException $ex) {
//Show correct error message for errors
if ($ex->getCode() == UserDBException::USEROUTOFDATE) {
$page->data['ErrorMessageWithDescriptionWithLinkView']['errorTitle'] = 'Gegevens niet bijgewerkt';
$page->data['ErrorMessageWithDescriptionWithLinkView']['errorDescription'] = 'Iemand anders heeft je gegevens in tussentijd al gewijzigd.';
$page->data['ErrorMessageWithDescriptionWithLinkView']['tryAgainUrl'] = $_SERVER['REQUEST_URI'];
$page->addView('error/ErrorMessageWithDescriptionWithLinkView');
} else {
ProfileController::buildProfileTopView($page, true, true);
if ($ex->getCode() == UserDBException::EMAILALREADYEXISTS) {
$page->data['ProfileTopView']['errMsgs']['global'] = '<h2 class="error_message" id="profile_form_error_message">Dit e-mailadres is al in gebruik.</h2>';
} else {
$page->data['ProfileTopView']['errMsgs']['global'] = '<h2 class="error_message" id="profile_form_error_message">Kan gegevens niet bijwerken, probeer het opnieuw.</h2>';
}
$page->addView('profile/ProfileEnabledFormBottomView');
}
}
} else {
//If we had an error we show the views with enabled controls and take data from POST
ProfileController::buildProfileTopView($page, true, true);
$page->addView('profile/ProfileEnabledFormBottomView');
$page->data['ProfileTopView']['errMsgs'] = array_merge($page->data['ProfileTopView']['errMsgs'], $errMsgs);
ProfileController::buildMembershipDetailsView($page);
}
$page->showWithMenu();
} else {
ProfileController::get();
}
}
示例3: post
public static function post()
{
//Redirect to manageuser page if back to results button was clicked
if (isset($_POST['back_to_search_results'])) {
header('Location: manageuser', true, 303);
} elseif (isset($_POST['cancel'])) {
EditUserController::get();
} elseif (isset($_POST['edit'])) {
$page = new Page();
$page->data['title'] = 'Gebruiker bewerken';
EditUserController::buildEditUserTopView($page, true, false);
if ($_SESSION['Stippers']['user']->isAdmin) {
EditUserController::buildEditUserAdminView($page, true, false);
}
if ($_SESSION['Stippers']['user']->isAdmin || $_SESSION['Stippers']['user']->isMoneyManager) {
EditUserController::buildEditUserMoneyManagerView($page);
}
$page->addView('editUser/EditUserEnabledFormBottomView');
EditUserController::buildMembershipDetailsView($page);
$page->showWithMenu();
} else {
$page = new Page();
$page->data['title'] = 'Gebruiker bewerken';
$errMsgs = EditUserTopViewValidator::validate($_POST);
if (empty($errMsgs)) {
//If no error: create a new user from posted data and try to save it
$newUser = EditUserController::createUserFromPost();
try {
UserDB::updateUser($_SESSION['Stippers']['EditUser']['user'], $newUser);
$page->data['SuccessMessageNoDescriptionWithLinkView']['successTitle'] = 'Gebruiker succesvol bijgewerkt';
$page->data['SuccessMessageNoDescriptionWithLinkView']['redirectUrl'] = $_SERVER['REQUEST_URI'];
$page->addView('success/SuccessMessageNoDescriptionWithLinkView');
} catch (UserDBException $ex) {
//Show correct error message for errors
if ($ex->getCode() == UserDBException::USEROUTOFDATE) {
$page->data['ErrorMessageWithDescriptionWithLinkView']['errorTitle'] = 'Gebruiker niet bijgewerkt';
$page->data['ErrorMessageWithDescriptionWithLinkView']['errorDescription'] = 'Iemand anders heeft de gebruiker in tussentijd al gewijzigd.';
$page->data['ErrorMessageWithDescriptionWithLinkView']['tryAgainUrl'] = $_SERVER['REQUEST_URI'];
$page->addView('error/ErrorMessageWithDescriptionWithLinkView');
} else {
EditUserController::buildEditUserTopView($page, true, true);
if ($ex->getCode() == UserDBException::EMAILALREADYEXISTS) {
$page->data['EditUserTopView']['errMsgs']['global'] = '<h2 class="error_message" id="edit_user_form_error_message">Dit e-mailadres is al in gebruik.</h2>';
} else {
$page->data['EditUserTopView']['errMsgs']['global'] = '<h2 class="error_message" id="edit_user_form_error_message">Kan gebruiker niet bijwerken, probeer het opnieuw.</h2>';
}
EditUserController::buildMembershipDetailsView($page);
if ($_SESSION['Stippers']['user']->isAdmin) {
EditUserController::buildEditUserAdminView($page, true, true);
}
if ($_SESSION['Stippers']['user']->isAdmin || $_SESSION['Stippers']['user']->isMoneyManager) {
EditUserController::buildEditUserMoneyManagerView($page);
}
$page->addView('editUser/EditUserEnabledFormBottomView');
}
} catch (Exception $ex) {
EditUserController::buildEditUserTopView($page, true, true);
if ($ex->getCode() == UserDBException::EMAILALREADYEXISTS) {
$page->data['EditUserTopView']['errMsgs']['global'] = '<h2 class="error_message" id="edit_user_form_error_message">Dit e-mailadres is al in gebruik.</h2>';
} else {
$page->data['EditUserTopView']['errMsgs']['global'] = '<h2 class="error_message" id="edit_user_form_error_message">Kan gebruiker niet bijwerken, probeer het opnieuw.</h2>';
}
EditUserController::buildMembershipDetailsView($page);
if ($_SESSION['Stippers']['user']->isAdmin) {
EditUserController::buildEditUserAdminView($page, true, true);
}
if ($_SESSION['Stippers']['user']->isAdmin || $_SESSION['Stippers']['user']->isMoneyManager) {
EditUserController::buildEditUserMoneyManagerView($page);
}
$page->addView('editUser/EditUserEnabledFormBottomView');
}
} else {
//If we had an error we show the views with enabled controls and take data from POST
EditUserController::buildEditUserTopView($page, true, true);
$page->data['EditUserTopView']['errMsgs'] = array_merge($page->data['EditUserTopView']['errMsgs'], $errMsgs);
EditUserController::buildMembershipDetailsView($page);
if ($_SESSION['Stippers']['user']->isAdmin) {
EditUserController::buildEditUserAdminView($page, true, true);
}
if ($_SESSION['Stippers']['user']->isAdmin || $_SESSION['Stippers']['user']->isMoneyManager) {
EditUserController::buildEditUserMoneyManagerView($page);
}
$page->addView('editUser/EditUserEnabledFormBottomView');
}
$page->showWithMenu();
}
}