当前位置: 首页>>代码示例>>PHP>>正文


PHP UserAccount类代码示例

本文整理汇总了PHP中UserAccount的典型用法代码示例。如果您正苦于以下问题:PHP UserAccount类的具体用法?PHP UserAccount怎么用?PHP UserAccount使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了UserAccount类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: resetPassword

 /**
  * Resets user's password and send it to email
  * @param UserAccount $user
  */
 public function resetPassword(UserAccount $user)
 {
     if ($user->status != UserAccount::STATUS_ACTIVE) {
         if (!$this->allowActivationOnPasswordReset) {
             throw new CException('Can\'t reset password for inactive users.');
         } else {
             $identity = Identity::model()->findByAttributes(array('user_id' => $user->id, 'type' => Identity::TYPE_EMAIL, 'status' => Identity::STATUS_NEED_CONFIRMATION));
             $identity->userIdentityConfirmation->confirm();
         }
     }
     $emailAddr = $user->getActiveEmail();
     $newPassword = $this->randomPassword();
     $user->setPassword($newPassword);
     $user->save(false, array('password'));
     $email = new YiiMailer('resetPassword', $data = array('newPassword' => $newPassword, 'description' => $description = 'Password reset'));
     $email->setSubject($description);
     $email->setTo($emailAddr);
     $email->setFrom(Yii::app()->params['noreplyAddress'], Yii::app()->name, FALSE);
     Yii::log('Sendign reset password mail to ' . $emailAddr);
     if ($email->send()) {
         Yii::log('Ok');
     } else {
         Yii::log('Failed');
         throw new CException('Failed to send the email');
     }
 }
开发者ID:vasiliy-pdk,项目名称:aes,代码行数:30,代码来源:UserAccountModule.php

示例2: delete

 public function delete($aId)
 {
     foreach ($aId as $row) {
         try {
             $oAccount = new UserAccount($row);
             $oAccount->delete();
         } catch (Exception $e) {
             $this->addError($e->getMessage());
         }
     }
     $this->jumpBack();
 }
开发者ID:gudwin,项目名称:extasy,代码行数:12,代码来源:index.php

示例3: generate

 public function generate()
 {
     $parseData = array('name' => $this->szName);
     if (!empty($this->currentUserId)) {
         try {
             $user = new UserAccount($this->currentUserId);
             $parseData['currentUser'] = $user->getParseData();
         } catch (Exception $e) {
         }
     }
     return UParser::parsePHPFile(__DIR__ . DIRECTORY_SEPARATOR . 'tpl/userselect.tpl', $parseData);
 }
开发者ID:gudwin,项目名称:extasy,代码行数:12,代码来源:userselect.php

示例4: veriflyAction

 public function veriflyAction()
 {
     switch ($this->request->getPost('type')) {
         case "login":
             break;
         case "register":
             $this->tag->setTitle('注册中。。。');
             $username = $this->request->getPost('username');
             $email = $this->request->getPost("email");
             if (CheckController::usernameCheck($username)) {
                 $errmsg .= "用户名已存在辣~";
             }
             if (CheckController::emailCheck($email)) {
                 $errmsg .= "邮箱已经被使用辣~";
             }
             if (!$errmsg) {
                 $token = md5($username . $username . $regtime);
                 //创建用于激活识别码
                 $token_exptime = time() + 60 * 60 * 24;
                 //过期时间为24小时后
                 $user = new UserAccount();
                 $user->username = $username;
                 //用户名
                 $user->email = $email;
                 //邮箱
                 $user->regtime = time();
                 //注册时间
                 $user->salt = rand(100000, 999999);
                 //随机生成salt值
                 $user->password = md5(md5('12345678') . $user->salt);
                 //默认密码12346
                 $user->token = $token;
                 //激活识别码
                 $user->token_exptime = $token_exptime;
                 //验证超时时间
                 if ($user->save() == true) {
                     $this->tag->setTitle('注册成功 | FiSkinAlcon');
                     $this->flash->success("注册成功!一封激活邮件已发往您的邮箱,请及时登录查看喵~");
                 } else {
                     $this->tag->setTitle('新用户注册 | FiSkinAlcon');
                     foreach ($user->getMessages() as $message) {
                         $errmsg .= getMessage() . "<br/>";
                     }
                     $this->flash->error($errmsg);
                 }
             }
             break;
     }
 }
开发者ID:lss233,项目名称:FiSkinAlcon,代码行数:49,代码来源:SignController.php

示例5: saveUser

 public function saveUser($sender, $params)
 {
     $results = $errors = array();
     try {
         Dao::beginTransaction();
         if (!isset($params->CallbackParameter->firstName) || ($firstName = trim($params->CallbackParameter->firstName)) === '') {
             throw new Exception('System Error: firstName is mandatory!');
         }
         if (!isset($params->CallbackParameter->lastName) || ($lastName = trim($params->CallbackParameter->lastName)) === '') {
             throw new Exception('System Error: lastName is mandatory!');
         }
         if (!isset($params->CallbackParameter->userName) || ($userName = trim($params->CallbackParameter->userName)) === '') {
             throw new Exception('System Error: userName is mandatory!');
         }
         if (!isset($params->CallbackParameter->roleid) || !($role = Role::get($params->CallbackParameter->roleid)) instanceof Role) {
             throw new Exception('System Error: role is mandatory!');
         }
         $newpassword = trim($params->CallbackParameter->newpassword);
         if (!isset($params->CallbackParameter->userid) || !($userAccount = UserAccount::get($params->CallbackParameter->userid)) instanceof UserAccount) {
             $userAccount = new UserAccount();
             $person = new Person();
             if ($newpassword === '') {
                 throw new Exception('System Error: new password is mandatory!');
             }
             $newpassword = sha1($newpassword);
         } else {
             $person = $userAccount->getPerson();
             if ($newpassword === '') {
                 $newpassword = $userAccount->getPassword();
             } else {
                 $newpassword = sha1($newpassword);
             }
         }
         //double check whether the username has been used
         $users = UserAccount::getAllByCriteria('username=? and id!=?', array($userName, $userAccount->getId()), false, 1, 1);
         if (count($users) > 0) {
             throw new Exception('Username(=' . $userName . ') has been used by another user, please choose another one!');
         }
         $person->setFirstName($firstName)->setLastName($lastName)->save();
         $userAccount->setUserName($userName)->setPassword($newpassword)->setPerson($person)->save();
         $results = $userAccount->clearRoles()->addRole($role)->getJson();
         Dao::commitTransaction();
     } catch (Exception $ex) {
         Dao::rollbackTransaction();
         $errors[] = $ex->getMessage();
     }
     $params->ResponseData = StringUtilsAbstract::getJson($results, $errors);
 }
开发者ID:larryu,项目名称:magento-b2b,代码行数:48,代码来源:UsersController.php

示例6: getSearchLinkStatuses

 /**
  * Get data and output in JSON
  *
  * @return void
  * @access public
  */
 public function getSearchLinkStatuses()
 {
     $metalib = new MetaLib();
     if (!$metalib->available()) {
         // MetaLib not enabled
         return $this->output(array(), JSON::STATUS_OK);
     }
     // Cache values and status in an array
     $results = array();
     $authorized = UserAccount::isAuthorized();
     foreach ($_REQUEST['id'] as $id) {
         $ird = explode('.', $id, 2);
         if (!isset($ird[1])) {
             continue;
         }
         $ird = $ird[1];
         $irdInfo = $metalib->getIRDInfo($ird);
         if ($irdInfo && ($authorized || strcasecmp($irdInfo['access'], 'guest') == 0)) {
             $results[] = array('id' => $id, 'status' => $irdInfo['searchable'] ? 'allowed' : 'nonsearchable');
         } else {
             $results[] = array('id' => $id, 'status' => 'denied');
         }
     }
     return $this->output($results, JSON::STATUS_OK);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:31,代码来源:JSON_MetaLib.php

示例7: launch

 function launch($msg = null)
 {
     global $interface;
     global $configArray;
     global $user;
     if (!($user = UserAccount::isLoggedIn())) {
         require_once 'Login.php';
         Login::launch();
         exit;
     }
     // Save Data
     if (isset($_REQUEST['tagId'])) {
         //Remove the tag for the user.
         $resource = new Resource();
         if (isset($_REQUEST['resourceId'])) {
             $resource = $resource->staticGet('record_id', $_REQUEST['resourceId']);
             $resource->removeTag($_REQUEST['tagId'], $user, false);
             header('Location: ' . $configArray['Site']['path'] . '/Record/' . $_REQUEST['resourceId']);
             exit;
         } else {
             $resource->removeTag($_REQUEST['tagId'], $user, true);
             header('Location: ' . $configArray['Site']['path'] . '/MyResearch/Favorites');
             exit;
         }
     } else {
         //No id provided to delete raise an error?
         PEAR_Singleton::raiseError(new PEAR_Error('Tag Id Missing'));
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:29,代码来源:RemoveTag.php

示例8: factoryColumn

 protected function factoryColumn($userLogin)
 {
     $user = \UserAccount::getByLogin($userLogin);
     $this->column = new SocialNetworks('testName', [], null);
     $this->column->setDocument($user);
     return $this->column;
 }
开发者ID:gudwin,项目名称:extasy,代码行数:7,代码来源:SocialNetworksTest.php

示例9: __construct

 /**
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     global $configArray;
     global $user;
     global $interface;
     //$interface->caching = 1;
     // Setup Search Engine Connection
     $this->db = ConnectionManager::connectToIndex();
     // Connect to Database
     $this->catalog = ConnectionManager::connectToCatalog();
     // Set up object for formatting dates and times:
     $this->dateFormat = new VuFindDate();
     // Register Library Catalog Account
     if (isset($_POST['submit']) && !empty($_POST['submit'])) {
         if (isset($_POST['cat_username']) && isset($_POST['cat_password'])) {
             $username = $_POST['cat_username'];
             if (isset($_POST['login_target'])) {
                 $username = $_POST['login_target'] . '.' . $username;
             }
             $result = UserAccount::processCatalogLogin($username, $_POST['cat_password']);
             if ($result) {
                 $interface->assign('user', $user);
             } else {
                 $interface->assign('loginError', 'Invalid Patron Login');
             }
         }
     }
     // Retrieve the record from the index
     if (!($record = $this->db->getRecord($_REQUEST['id']))) {
         PEAR::raiseError(new PEAR_Error('Record Does Not Exist'));
     }
     $this->setRecord($_REQUEST['id'], $record);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:38,代码来源:Record.php

示例10: saveItem

 /**
  * (non-PHPdoc)
  * @see DetailsPageAbstract::saveItem()
  */
 public function saveItem($sender, $param)
 {
     $results = $errors = array();
     try {
         Dao::beginTransaction();
         $task = null;
         if (isset($param->CallbackParameter->id) && !($task = Task::get(trim($param->CallbackParameter->id))) instanceof Task) {
             throw new Exception('Invalid Task passed in!');
         }
         if (!isset($param->CallbackParameter->instructions) || ($instructions = trim($param->CallbackParameter->instructions)) === '') {
             throw new Exception('Instructions are required!');
         }
         if (!isset($param->CallbackParameter->customerId) || !($customer = Customer::get(trim($param->CallbackParameter->customerId))) instanceof Customer) {
             throw new Exception('Invalid Customer Passed in!');
         }
         $tech = isset($param->CallbackParameter->techId) ? UserAccount::get(trim($param->CallbackParameter->techId)) : null;
         $order = isset($param->CallbackParameter->orderId) ? Order::get(trim($param->CallbackParameter->orderId)) : null;
         $dueDate = new UDate(trim($param->CallbackParameter->dueDate));
         $status = isset($param->CallbackParameter->statusId) ? TaskStatus::get(trim($param->CallbackParameter->statusId)) : null;
         if (!$task instanceof Task) {
             $task = Task::create($customer, $dueDate, $instructions, $tech, $order);
         } else {
             $task->setCustomer($customer)->setDueDate($dueDate)->setInstructions($instructions)->setTechnician($tech)->setFromEntityId($order instanceof Order ? $order->getId() : '')->setFromEntityName($order instanceof Order ? get_class($order) : '')->setStatus($status)->save();
         }
         // 			$results['url'] = '/task/' . $task->getId() . '.html?' . $_SERVER['QUERY_STRING'];
         $results['item'] = $task->getJson();
         Dao::commitTransaction();
     } catch (Exception $ex) {
         Dao::rollbackTransaction();
         $errors[] = $ex->getMessage();
     }
     $param->ResponseData = StringUtilsAbstract::getJson($results, $errors);
 }
开发者ID:larryu,项目名称:magento-b2b,代码行数:37,代码来源:Controller.php

示例11: launch

 function launch($msg = null)
 {
     global $interface;
     global $configArray;
     if (!($user = UserAccount::isLoggedIn())) {
         require_once 'Login.php';
         Login::launch();
         exit;
     }
     // Save Data
     if (isset($_POST['submit'])) {
         $this->saveChanges($user);
         // After changes are saved, send the user back to an appropriate page;
         // either the list they were viewing when they started editing, or the
         // overall favorites list.
         if (isset($_REQUEST['list_id'])) {
             $nextAction = 'MyList/' . $_REQUEST['list_id'];
         } elseif (isset($_REQUEST['lists'])) {
             if (is_array($_REQUEST['lists'])) {
                 $nextAction = 'MyList/' . $_REQUEST['lists'][0];
             } else {
                 $nextAction = 'MyList/' . $_REQUEST['lists'];
             }
         } else {
             $nextAction = 'Home';
         }
         header('Location: ' . $configArray['Site']['path'] . '/MyResearch/' . $nextAction);
         exit;
     }
     // Setup Search Engine Connection
     $class = $configArray['Index']['engine'];
     $db = new $class($configArray['Index']['url']);
     if ($configArray['System']['debugSolr']) {
         $db->debug = true;
     }
     // Get Record Information
     $resource = new Resource();
     $resource->record_id = $_GET['id'];
     $resource->source = $_GET['source'];
     if ($resource->find(true)) {
         $interface->assign('resource', $resource);
     }
     // Record ID
     $interface->assign('recordId', $_GET['id']);
     // Retrieve saved information about record
     $saved = $user->getSavedData($_GET['id'], $_GET['source']);
     // Add tag information
     $savedData = array();
     foreach ($saved as $current) {
         // If we're filtering to a specific list, skip any other lists:
         if (isset($_GET['list_id']) && $current->list_id != $_GET['list_id']) {
             continue;
         }
         $savedData[] = array('listId' => $current->list_id, 'listTitle' => $current->list_title, 'notes' => $current->notes, 'tags' => $this->getTags($user, $current->list_id));
     }
     $interface->assign('savedData', $savedData);
     $interface->assign('listFilter', $_GET['list_id']);
     $interface->setTemplate('edit.tpl');
     $interface->display('layout.tpl');
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:60,代码来源:Edit.php

示例12: Form_PreRender

 protected function Form_PreRender()
 {
     $objExpansionMap[UserAccount::ExpandCreatedByObject] = true;
     $objExpansionMap[UserAccount::ExpandRole] = true;
     // Get Total Count b/c of Pagination
     $this->dtgUserAccount->TotalItemCount = UserAccount::CountAll();
     if ($this->dtgUserAccount->TotalItemCount == 0) {
         $this->dtgUserAccount->ShowHeader = false;
     } else {
         $objClauses = array();
         if ($objClause = $this->dtgUserAccount->OrderByClause) {
             array_push($objClauses, $objClause);
         }
         if ($objClause = $this->dtgUserAccount->LimitClause) {
             array_push($objClauses, $objClause);
         }
         if ($objClause = QQ::Expand(QQN::UserAccount()->CreatedByObject)) {
             array_push($objClauses, $objClause);
         }
         if ($objClause = QQ::Expand(QQN::UserAccount()->Role)) {
             $this->dtgUserAccount->DataSource = UserAccount::LoadAll($objClauses);
         }
         $this->dtgUserAccount->ShowHeader = true;
     }
 }
开发者ID:proxymoron,项目名称:tracmor,代码行数:25,代码来源:user_account_list.php

示例13: launch

 /**
  * Process incoming parameters and display the page.
  *
  * @return void
  * @access public
  */
 public function launch()
 {
     global $interface;
     global $configArray;
     // Don't let bots crawl holdings
     $this->disallowBots();
     if (!$this->hasHoldings && !(isset($configArray['Site']['ajaxRecordTabs']) && $configArray['Site']['ajaxRecordTabs'])) {
         $url = $configArray['Site']['url'] . "/Record/" . $_REQUEST['id'] . "/Description";
         header('Location: ' . $url);
     }
     // Do not cache holdings page
     $interface->caching = 0;
     // See if patron is logged in to pass details onto get holdings for
     // holds / recalls
     $patron = UserAccount::isLoggedIn() ? UserAccount::catalogLogin() : false;
     if (PEAR::isError($patron)) {
         $patron = false;
     }
     $interface->setPageTitle($this->recordDriver->getBreadcrumb());
     // Only fetch holdings if we actually need them (not needed for the basic page part of holdings when using ajax record tabs)
     if (!isset($configArray['Site']['ajaxRecordTabs']) || !$configArray['Site']['ajaxRecordTabs'] || isset($_REQUEST['subPage'])) {
         $interface->assign('holdingsMetadata', $this->recordDriver->getHoldings($patron));
     }
     $interface->assign('subTemplate', 'view-holdings.tpl');
     $interface->setTemplate('view.tpl');
     // Set Messages
     $interface->assign('infoMsg', $this->infoMsg);
     $interface->assign('errorMsg', $this->errorMsg);
     // Display Page
     $interface->display('layout.tpl');
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:37,代码来源:Holdings.php

示例14: Login

 function Login()
 {
     global $configArray;
     // Fetch Salt
     $salt = $this->generateSalt();
     // HexDecode Password
     $password = pack('H*', $_GET['password']);
     // Decrypt Password
     /*
     require_once 'Crypt/Blowfish.php';
     $cipher = new Crypt_Blowfish($salt);
     $password = $cipher->decrypt($_GET['password']);
     */
     /*
     require_once 'Crypt/XXTEA.php';
     $cipher = new Crypt_XXTEA();
     $cipher->setKey($salt);
     $password = $cipher->decrypt($password);
     */
     require_once 'Crypt/rc4.php';
     $password = rc4Encrypt($salt, $password);
     // Put the username/password in POST fields where the authentication module
     // expects to find them:
     $_POST['username'] = $_GET['username'];
     $_POST['password'] = $password;
     // Authenticate the user:
     $user = UserAccount::login();
     if (PEAR_Singleton::isError($user)) {
         return 'Error';
     } else {
         return 'True';
     }
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:33,代码来源:Home.php

示例15: Authenticate

 public static function Authenticate($intModuleId = null)
 {
     if (array_key_exists('intUserAccountId', $_SESSION)) {
         $objUserAccount = UserAccount::Load($_SESSION['intUserAccountId']);
         if ($objUserAccount) {
             // Assign the UserAccount object to the globally available QApplication
             QApplication::$objUserAccount = $objUserAccount;
             // If they are not in the admin panel
             if ($intModuleId) {
                 $objRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, $intModuleId);
                 // If they do not have access to this module
                 if (!$objRoleModule->AccessFlag) {
                     QApplication::Redirect('../common/trespass.php');
                 } else {
                     QApplication::$objRoleModule = $objRoleModule;
                 }
             } elseif (!$objUserAccount->AdminFlag) {
                 QApplication::Redirect('../common/trespass.php');
             }
         } else {
             QApplication::Redirect('../common/trespass.php');
         }
     } else {
         QApplication::Redirect('../login.php');
     }
 }
开发者ID:heshuai64,项目名称:einv2,代码行数:26,代码来源:prepend.inc.php


注:本文中的UserAccount类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。