本文整理汇总了PHP中Model_User::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_User::getName方法的具体用法?PHP Model_User::getName怎么用?PHP Model_User::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_User
的用法示例。
在下文中一共展示了Model_User::getName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: whenEntering
private function whenEntering()
{
//или выполняем вход
try {
$user = new Model_User($_POST);
$_SESSION['USER'] = $user;
echo 'Вы выполнили вход под именем "' . $user->getName() . '"';
} catch (ErrorException $e) {
echo $e->getMessage();
}
}
示例2: _getUserData
/**
* Store the user's profile data in the database, if it doesn't exist yet.
* @param Zend_Oauth_Token_Access $accesstoken
* @return Void
*/
protected function _getUserData(Zend_Service_Twitter $twitterService, $twitterUserId)
{
$twitterUserData = $twitterService->users->show($twitterUserId);
$userColumns = $this->_mapProperties((array) $twitterUserData->toValue());
$userModel = new Model_User();
$userConditions = $userModel->select()->from($userModel->getName(), $this->_getSessionColumns());
$model = new Model_AuthTwitter();
$model->bindModel('Model_User', array('conditions' => $userConditions, 'rule' => 'User'));
$userData = $model->fetchRow($model->select()->where('twitter_uid = ?', $twitterUserId));
if (!$userData || !$userData->Model_User) {
$userData = $model->createNew($twitterUserId, $userColumns);
} else {
$model->getObserver('Authenticatable')->updateLoginStats($userData->user_id);
$userData = $userData->Model_User;
}
return $userData;
}
示例3: _getUserData
protected function _getUserData($accessToken)
{
$profileData = $this->_getLinkedInInstance()->get(self::LINKED_IN_PROFILE_QUERY);
$newUserData = $this->_mapProperties($profileData);
$userModel = new Model_User();
$userConditions = $userModel->select()->from($userModel->getName(), $this->_getSessionColumns());
$model = new Model_AuthLinkedin();
$model->bindModel('Model_User', array('conditions' => $userConditions, 'rule' => 'User'));
$userData = $model->fetchRow($model->select()->where('linkedin_uid = ?', $profileData['id']));
if (!$userData || !$userData->Model_User) {
$userData = $model->createNew($profileData['id'], $newUserData)->toArray();
// Make sure only the session columns remain
$userData = array_intersect_key($userData, array_fill_keys($this->_getSessionColumns(), null));
} else {
$model->getObserver('Authenticatable')->updateLoginStats($userData->user_id);
$userData = $userData->Model_User;
}
return $userData;
}
示例4: _getUserData
/**
* Store the user's profile data in the database, if it doesn't exist yet.
* @param String $id The openid
* @param Array $props The properties fetched thru Sreg
* @return Void
*/
protected function _getUserData($id, array $props)
{
$ini = Zend_Registry::get('config');
$sessionColumns = Zend_Db_Select::SQL_WILDCARD;
if (!empty($ini->auth->login->sessionColumns)) {
$sessionColumns = $ini->auth->login->sessionColumns;
$sessionColumns = explode(',', $sessionColumns);
}
$userModel = new Model_User();
$userConditions = $userModel->select()->from($userModel->getName(), $sessionColumns);
$model = new Model_AuthOpenId();
$model->bindModel('Model_User', array('conditions' => $userConditions));
$userData = $model->fetchRow($model->select()->where('openid = ?', $id));
if (!$userData || !$userData->Model_User) {
$userData = $model->createNew($id, $this->_mapProperties($props));
} else {
$model->getObserver('Authenticatable')->updateLoginStats($userData->user_id);
$userData = $userData->Model_User;
}
return $userData->getPrimaryKey();
}
示例5: _getPasswordlessModel
protected function _getPasswordlessModel()
{
$authPwlessModel = new Model_AuthPasswordless();
$userModel = new Model_User();
$userConditions = $userModel->select()->from($userModel->getName(), Garp_Auth::getInstance()->getSessionColumns());
$authPwlessModel->bindModel('Model_User', array('conditions' => $userConditions, 'rule' => 'User'));
return $authPwlessModel;
}
示例6: _getUserData
/**
* Store the user's profile data in the database, if it doesn't exist yet.
* @param Array $facebookData The profile data received from Facebook
* @return Void
*/
protected function _getUserData(array $facebookData)
{
$uid = $facebookData['id'];
$ini = Zend_Registry::get('config');
$sessionColumns = Zend_Db_Select::SQL_WILDCARD;
if (!empty($ini->auth->login->sessionColumns)) {
$sessionColumns = $ini->auth->login->sessionColumns;
$sessionColumns = explode(',', $sessionColumns);
}
$userModel = new Model_User();
$userConditions = $userModel->select()->from($userModel->getName(), $sessionColumns);
$model = new Model_AuthFacebook();
$model->bindModel('Model_User', array('conditions' => $userConditions, 'rule' => 'User'));
$userData = $model->fetchRow($model->select()->where('facebook_uid = ?', $uid));
if (!$userData || !$userData->Model_User) {
$userData = $model->createNew(array('facebook_uid' => $uid, 'access_token' => $facebookData['access_token']), $this->_mapProperties($facebookData));
} else {
$model->getObserver('Authenticatable')->updateLoginStats($userData->user_id, array('access_token' => $facebookData['access_token']));
$userData = $userData->Model_User;
}
return $userData;
}
示例7: _getUserData
/**
* Store the user's profile data in the database, if it doesn't exist yet.
* @param Zend_Oauth_Token_Access $accessToken
* @return Void
*/
protected function _getUserData(Zend_Oauth_Token_Access $accessToken)
{
$authVars = $this->_getAuthVars();
$token = $accessToken->getToken();
$tokenSecret = $accessToken->getTokenSecret();
$vimeoService = new Garp_Service_Vimeo_Pro($authVars->consumerKey, $authVars->consumerSecret, $token, $tokenSecret);
$userDataFromVimeo = $vimeoService->people->getInfo($token);
$id = $userDataFromVimeo['id'];
$ini = Zend_Registry::get('config');
$sessionColumns = Zend_Db_Select::SQL_WILDCARD;
if (!empty($ini->auth->login->sessionColumns)) {
$sessionColumns = $ini->auth->login->sessionColumns;
$sessionColumns = explode(',', $sessionColumns);
}
$userModel = new Model_User();
$userConditions = $userModel->select()->from($userModel->getName(), $sessionColumns);
$model = new Model_AuthVimeo();
$model->bindModel('Model_User', array('conditions' => $userConditions));
$userData = $model->fetchRow($model->select()->where('vimeo_id = ?', $id));
if (!$userData || !$userData->Model_User) {
$userData = $model->createNew($id, $accessToken, $this->_mapProperties($userDataFromVimeo));
} else {
$model->getObserver('Authenticatable')->updateLoginStats($userData->user_id);
$userData = $userData->Model_User;
}
return $userData;
}
示例8: mapFriends
/**
* Find friends of logged in user and map to local friends table.
* @param Array $config
* @return Bool Success
*/
public function mapFriends(array $config)
{
$config = $config instanceof Garp_Util_Configuration ? $config : new Garp_Util_Configuration($config);
$config->obligate('bindingModel')->obligate('user_id')->setDefault('accessToken', $this->getAccessToken());
if (!$config['accessToken']) {
// Find the auth record
$authModel = new Model_AuthFacebook();
$authRow = $authModel->fetchRow($authModel->select()->where('user_id = ?', $config['user_id']));
if (!$authRow || !$authRow->access_token) {
return false;
}
// Use the stored access token to create a user session. Me() in the FQL ahead will contain the user's Facebook ID.
// Note that the access token is available for a very limited time. Chances are it's not valid anymore.
$accessToken = $authRow->access_token;
}
try {
$this->_client->setAccessToken($config['accessToken']);
// Find the friends' Facebook UIDs
$friends = $this->_client->api(array('method' => 'fql.query', 'query' => 'SELECT uid2 FROM friend WHERE uid1 = me()'));
// Find local user records
$userModel = new Model_User();
$userTable = $userModel->getName();
$authFbModel = new Model_AuthFacebook();
$authFbTable = $authFbModel->getName();
$fbIds = '';
$friendCount = count($friends);
foreach ($friends as $i => $friend) {
$fbIds .= $userModel->getAdapter()->quote($friend['uid2']);
if ($i < $friendCount - 1) {
$fbIds .= ',';
}
}
$friendQuery = $userModel->select()->setIntegrityCheck(false)->from($userTable, array('id'))->join($authFbTable, $authFbTable . '.user_id = ' . $userTable . '.id', array())->where('facebook_uid IN (' . $fbIds . ')')->order($userTable . '.id');
$localUsers = $userModel->fetchAll($friendQuery);
$localUserCount = count($localUsers);
// Insert new friendships into binding model
$bindingModel = new $config['bindingModel']();
$insertSql = 'INSERT IGNORE INTO ' . $bindingModel->getName() . ' (user1_id, user2_id) VALUES ';
foreach ($localUsers as $i => $localUser) {
$insertSql .= '(' . $localUser->id . ',' . $config['user_id'] . '),';
$insertSql .= '(' . $config['user_id'] . ',' . $localUser->id . ')';
if ($i < $localUserCount - 1) {
$insertSql .= ',';
}
}
$result = $bindingModel->getAdapter()->query($insertSql);
// Clear cache manually, since the table isn't updated thru conventional paths.
Garp_Cache_Manager::purge($bindingModel);
return !!$result;
} catch (Exception $e) {
return false;
}
}