當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserDB::updateUser方法代碼示例

本文整理匯總了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);
 }
開發者ID:hidetobara,項目名稱:voices,代碼行數:12,代碼來源:TestUserInfo.php

示例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();
     }
 }
開發者ID:JHDeStip,項目名稱:Stippers,代碼行數:50,代碼來源:ProfileController.php

示例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();
     }
 }
開發者ID:JHDeStip,項目名稱:Stippers,代碼行數:87,代碼來源:EditUserController.php


注:本文中的UserDB::updateUser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。