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


PHP SaeTClientV2::show_user_by_id方法代码示例

本文整理汇总了PHP中SaeTClientV2::show_user_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeTClientV2::show_user_by_id方法的具体用法?PHP SaeTClientV2::show_user_by_id怎么用?PHP SaeTClientV2::show_user_by_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SaeTClientV2的用法示例。


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

示例1: callback

 /**
  * 从Callback返回时
  */
 public function callback()
 {
     if (isset($_REQUEST['code'])) {
         $keys = array();
         $keys['code'] = $_REQUEST['code'];
         $keys['redirect_uri'] = WB_CALLBACK_URL;
         try {
             $token = $this->sina->getAccessToken('code', $keys);
         } catch (OAuthException $e) {
         }
     }
     if ($token) {
         $_SESSION['token'] = $token;
         setcookie('weibojs_' . $this->sina->client_id, http_build_query($token));
         $c = new SaeTClientV2(WB_AKEY, WB_SKEY, $token['access_token']);
         $ms = $c->home_timeline();
         // done
         $uid_get = $c->get_uid();
         $uid = $uid_get['uid'];
         $user = $c->show_user_by_id($uid);
         //根据ID获取用户等基本信息
         $_SESSION['token']['name'] = $user['name'];
         echo "\n\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\twindow.opener.callback_exec('Sina' , {$uid} , '{$user['name']}',false);\n\t\t\t\t\t\twindow.close();\n\t\t\t\t\t</script>";
     } else {
         echo '授权失败';
     }
 }
开发者ID:Capitalwang,项目名称:shehuahk,代码行数:30,代码来源:Sina_oauth.php

示例2: userInfo

 function userInfo()
 {
     $c = new SaeTClientV2(WB_AKEY, WB_SKEY, $_SESSION['sina']['token']['access_token']);
     $uid = $this->get_openid();
     return $user = $c->show_user_by_id($uid);
     //根据ID获取用户等基本信息
 }
开发者ID:yunsite,项目名称:tp-coupon,代码行数:7,代码来源:sina.class.php

示例3: weibocallback

 public function weibocallback($code)
 {
     $cfg = K::$system->config->get('connect');
     if (defined('IN_MOBILE')) {
         $mobile = K::$system->config->get('mobile');
         $callback = $mobile['url'] . '/' . K::M('helper/link')->mklink('passport:weibocallback');
     } else {
         $site = K::$system->config->get('site');
         $callback = $site['siteurl'] . '/' . K::M('helper/link')->mklink('passport:weibocallback');
     }
     if (empty($cfg['weibo_is_open'])) {
         $this->err->add('很抱歉网站管理员还未开启微博登录功能', 201);
         return false;
     }
     $keys = array();
     $keys['code'] = $code;
     $keys['redirect_uri'] = $callback;
     $o = new SaeTOAuthV2($cfg['weibo_app_id'], $cfg['weibo_app_key']);
     try {
         $token = $o->getAccessToken('code', $keys);
     } catch (OAuthException $e) {
         $this->err->add($e->getMessage(), 201);
         return false;
     }
     $c = new SaeTClientV2($cfg['weibo_app_id'], $cfg['weibo_app_key'], $token['access_token']);
     $ms = $c->home_timeline();
     // done
     $uid_get = $c->get_uid();
     $uid = $uid_get['uid'];
     $user_message = $c->show_user_by_id($uid);
     //根据ID获取用户等基本信息
     return $this->login($uid, $user_message);
 }
开发者ID:a195474368,项目名称:ejiawang,代码行数:33,代码来源:weibo.mdl.php

示例4: actionReturn

 function actionReturn()
 {
     $o = new \SaeTOAuthV2($this->app_key, $this->app_secret);
     if ($_REQUEST['code']) {
         $keys = array();
         $keys['code'] = $_REQUEST['code'];
         $keys['redirect_uri'] = $this->url;
         try {
             $token = $o->getAccessToken('code', $keys);
             $access_token = $token['access_token'];
             $c = new \SaeTClientV2($this->app_key, $this->app_secret, $access_token);
             $uid_get = $c->get_uid();
             $uid = $uid_get['uid'];
             $me = $c->show_user_by_id($uid);
             $me['name'] = $me['screen_name'];
             $me['options'] = array('url' => $me['profile_url']);
             $r = $this->member_get_third_set_user($me, $this->oauth_id, $access_token);
             flash('success', __('login success'));
             $this->redirect(return_url());
         } catch (OAuthException $e) {
             flash('error', __('login error'));
             $this->redirect(return_url());
         }
     }
     exit;
 }
开发者ID:rocketyang,项目名称:mincms,代码行数:26,代码来源:SinaController.php

示例5: callback

 function callback()
 {
     $o = new SaeTOAuthV2(c('weibo_akey'), c('weibo_skey'));
     if (isset($_REQUEST['code'])) {
         $keys = array();
         $keys['code'] = $_REQUEST['code'];
         $keys['redirect_uri'] = 'http://' . c('site_domain') . '/?c=weibo&a=callback';
         try {
             $token = $o->getAccessToken('code', $keys);
         } catch (OAuthException $e) {
         }
         $_SESSION['weibo_token'] = $token;
         // get user info
         $c = new SaeTClientV2(c('weibo_akey'), c('weibo_skey'), atoken());
         $info = $c->show_user_by_id(wbuid());
         if (strlen($info['name']) < 1) {
             return info_page('登入失败,请去吃点零食后重试');
         }
         $_SESSION['weibo_uid'] = $info['name'];
         $_SESSION['uname'] = $info['name'];
         $_SESSION['avatar'] = $info['profile_image_url'];
         //print_r( $_SESSION );
         header("Location: /?a=index");
     }
 }
开发者ID:oxmcvusd,项目名称:nowboard,代码行数:25,代码来源:weibo.class.php

示例6: WB_callback

function WB_callback()
{
    $o = new SaeTOAuthV2(WB_AKEY, WB_SKEY);
    if (isset($_REQUEST['code'])) {
        $keys = array();
        $keys['code'] = $_REQUEST['code'];
        //                $login_type = getvaluebykey('login_type');
        //                $userid = getvaluebykey('userid');
        //                print_r($userid);exit;
        //                $headpic = getvaluebykey('headpic');
        //                $emailnum  = getvaluebykey('emailnum');
        $keys['redirect_uri'] = WB_CALLBACK_URL;
        //.'?login_type='.$login_type.'_'.$userid.'_'.$headpic.'_'.$emailnum;
        try {
            $token = $o->getAccessToken('code', $keys);
            //print_r($token);
        } catch (OAuthException $e) {
        }
    }
    if ($token) {
        $_SESSION['token'] = $token;
        $c1 = new SaeTClientV2(WB_AKEY, WB_SKEY, $token['access_token']);
        $userinfo = $c1->show_user_by_id($token[uid]);
        setcookie('weibojs_' . $o->client_id, http_build_query($token));
        $cb_arr = array('access_token' => $token['access_token'], 'openid' => $token[uid], 'nick' => $userinfo['name']);
        return $cb_arr;
    }
}
开发者ID:yonglinchen,项目名称:shopping,代码行数:28,代码来源:callback.php

示例7: AuthCallback_sina

/**
 * 此函数,供Callback处调用,如果返回false,认证失败,否则返回以下哈希表:
 *   last_key  ->  callback得到的last_key
 *   oauth_token ->  上述lastkey中的oauth_token
 *   oauth_token_secret -> 上述lastkey中的oauth_token_secret
 *   user_id -> 用户ID
 *   user_name ->  用户昵称
 *   user_email -> 暂不提供
 */
function AuthCallback_sina()
{
    // 取得新浪Auth对象
    $sinaappkey = $_SESSION['sinaappkey'];
    $sinasecret = $_SESSION['sinasecret'];
    $o = new SaeTOAuthV2($sinaappkey, $sinasecret);
    if (isset($_REQUEST['code'])) {
        $keys = array();
        $keys['code'] = $_REQUEST['code'];
        $keys['redirect_uri'] = $_SESSION['wb_callback_url'];
        try {
            $last_key = $o->getAccessToken('code', $keys);
        } catch (OAuthException $e) {
        }
    }
    if ($last_key) {
        $rtn = array();
        $rtn['last_key'] = $last_key;
        $rtn['oauth_token'] = $keys['code'];
        $rtn['oauth_token_secret'] = $last_key['access_token'];
        $client = new SaeTClientV2($sinaappkey, $sinasecret, $last_key['access_token']);
        $uid_get = $client->get_uid();
        $rtn['user_id'] = $uid_get['uid'];
        $user_message = $client->show_user_by_id($rtn['user_id']);
        $rtn['user_name'] = $user_message['screen_name'];
        return $rtn;
    } else {
        return $last_key;
    }
}
开发者ID:apachesep,项目名称:joomla-weibo,代码行数:39,代码来源:weibo.sina.php

示例8: array

 function get_info()
 {
     if ($this->dx_auth->is_logged_in()) {
         echo "你已经登陆了";
     } else {
         $this->load->model('m_open');
         session_start();
         require_once APPPATH . 'libraries/weibo/config.php';
         require_once APPPATH . 'libraries/weibo/saetv2.ex.class.php';
         $o = new SaeTOAuthV2(WB_AKEY, WB_SKEY);
         $o->set_debug(DEBUG_MODE);
         if (isset($_REQUEST['code'])) {
             $keys = array();
             // 验证state
             $state = $_REQUEST['state'];
             if (empty($state) || $state !== $_SESSION['weibo_state']) {
                 echo '非法请求!';
                 exit;
             }
             unset($_SESSION['weibo_state']);
             $keys['code'] = $_REQUEST['code'];
             $keys['redirect_uri'] = WB_CALLBACK_URL;
             try {
                 $token = $o->getAccessToken('code', $keys);
             } catch (OAuthException $e) {
             }
         }
         if ($token) {
             $_SESSION['token'] = $token;
             setcookie('weibojs_' . $o->client_id, http_build_query($token));
             //echo "success";
             $c = new SaeTClientV2(WB_AKEY, WB_SKEY, $_SESSION['token']['access_token']);
             $c->set_debug(DEBUG_MODE);
             $uid_get = $c->get_uid();
             $uid = $uid_get['uid'];
             if (!$uid) {
                 echo "error";
             }
             $user = $c->show_user_by_id($uid);
             //根据ID获取用户等基本信息
             //echo $user['screen_name'];
             if ($this->m_open->is_id($uid)) {
                 $this->m_open->login($uid);
                 //echo "登陆";
                 //echo $uid;
                 //$c->update( "坑爹的api终于调好了");
                 redirect('line');
             } else {
                 $this->m_open->register($user);
                 $this->m_open->create($user);
                 //echo $uid;
                 //echo "注册";
                 redirect('line');
             }
         } else {
             echo "fail";
         }
     }
 }
开发者ID:bullda,项目名称:CI_weibo_login,代码行数:59,代码来源:open.php

示例9: get_user_info

function get_user_info($config, $oauth_data)
{
    $c = new SaeTClientV2($config['appid'], $config['appkey'], $oauth_data['oauth_openid']);
    $get = $c->get_uid();
    $m = $c->show_user_by_id($get['uid']);
    //根据ID获取用户等基本信息
    return array('name' => $m['name'], 'avatar' => $m['profile_image_url']);
}
开发者ID:rainbow88,项目名称:hummel,代码行数:8,代码来源:sina.php

示例10: callback

 /**
  * 授权回调地址
  */
 public function callback()
 {
     if (empty($_GET['code'])) {
         throw new Typecho_Exception(_t('无效请求!'));
     }
     //跳转
     if (!class_exists('SaeTOAuthV2')) {
         require_once './saetv2.ex.class.php';
     }
     $saeto_client = new SaeTOAuthV2($this->config->client_id, $this->config->client_secret);
     //取access_token
     $access_token = $saeto_client->getAccessToken('code', array('code' => trim($_GET['code']), 'redirect_uri' => $this->config->callback_url));
     if (empty($access_token) || !is_array($access_token) || empty($access_token['uid'])) {
         throw new Typecho_Exception(_t('获取access_token失败,请返回重新授权!'));
     }
     $table = $this->db->getPrefix() . self::$tableName;
     $query = $this->db->query("SELECT * FROM {$table} WHERE openid='{$access_token['uid']}' AND plateform='sina'");
     $users_oauth = $this->db->fetchRow($query);
     if (!empty($users_oauth['uid'])) {
         //该新浪帐号已经绑定了用户
         if (Typecho_Widget::widget('Widget_User')->hasLogin()) {
             /** 直接返回 */
             $this->response->redirect(Typecho_Widget::widget('Widget_Options')->index);
         } else {
             //让其直接登陆
             $this->setUserLogin($users_oauth['uid']);
             if (!Typecho_Widget::widget('Widget_User')->pass('contributor', true)) {
                 /** 不允许普通用户直接跳转后台 */
                 $this->response->redirect(Typecho_Widget::widget('Widget_Options')->profileUrl);
             } else {
                 $this->response->redirect(Typecho_Widget::widget('Widget_Options')->adminUrl);
             }
         }
         exit;
     }
     //该新浪帐号未绑定过
     /** 如果已经登录 */
     if (Typecho_Widget::widget('Widget_User')->hasLogin()) {
         /** 直接绑定 */
         $cookieUid = Typecho_Cookie::get('__typecho_uid');
         $this->bindOauthUser($cookieUid, $access_token['uid'], 'sina', $access_token['expires_in']);
         $this->response->redirect(Typecho_Widget::widget('Widget_Options')->index);
     } else {
         //取用户信息
         $saetc_client = new SaeTClientV2($this->config->client_id, $this->config->client_secret, $access_token['access_token']);
         $weibo_user = $saetc_client->show_user_by_id($access_token['uid']);
         //创建用户
         $uid = $this->registerFromWeiboUser($weibo_user);
         if (!$uid) {
             throw new Typecho_Exception(_t('创建帐号失败,请联系管理员!'));
         }
         $this->setUserLogin($uid);
         $this->bindOauthUser($uid, $access_token['uid'], 'sina', $access_token['expires_in']);
         $this->response->redirect(Typecho_Widget::widget('Widget_Options')->profileUrl);
     }
     //构造用户帐号
     exit;
 }
开发者ID:duxiangfei,项目名称:plugins,代码行数:61,代码来源:AuthorizeAction.php

示例11: getUserName

 private function getUserName()
 {
     $c = new SaeTClientV2(WB_AKEY, WB_SKEY, $_SESSION['token']['access_token']);
     $ms = $c->home_timeline();
     $uid_get = $c->get_uid();
     $uid = $uid_get['uid'];
     $user_message = $c->show_user_by_id($uid);
     return $user_message['screen_name'];
 }
开发者ID:lianjie5664,项目名称:Chassis,代码行数:9,代码来源:IndexAction.class.php

示例12: getUser

 /**
  * 獲取用戶信息
  * @param type $access_token
  * @return type
  * Array ( [id] => 3767777785 [idstr] => 3767777785 [class] => 1 
  * [screen_name] => soqugame [name] => soqugame 
  * [province] => 11 [city] => 1 [location] => 北京 东城区 [description] => [url] => 
  * [profile_image_url] => http://tp2.sinaimg.cn/3767777785/50/0/1 
  * [profile_url] => u/3767777785 [domain] => [weihao] => [gender] => m [followers_count] => 3 [friends_count] => 18 [statuses_count] => 0 [favourites_count] => 0 [created_at] => Tue Sep 03 16:48:05 +0800 2013 [following] => [allow_all_act_msg] => [geo_enabled] => 1 [verified] => 1 [verified_type] => 2 [remark] => [ptype] => 0 [allow_all_comment] => 1 [avatar_large] => http://tp2.sinaimg.cn/3767777785/180/0/1 [avatar_hd] => http://tp2.sinaimg.cn/3767777785/180/0/1 [verified_reason] => 上海搜趣广告有限公司 [follow_me] => [online_status] => 0 [bi_followers_count] => 0 [lang] => zh-cn [star] => 0 [mbtype] => 0 [mbrank] => 0 [block_word] => 0 )
  */
 public function getUser($access_token)
 {
     $c = new SaeTClientV2($this->_params['WB_AKEY'], $this->_params['WB_SKEY'], $access_token);
     $ms = $c->home_timeline();
     // done
     $uid_get = $c->get_uid();
     $uid = $uid_get['uid'];
     $user_message = $c->show_user_by_id($uid);
     //根据ID获取用户等基本信息
     return $user_message;
 }
开发者ID:pbchen,项目名称:thirdLoginAPI,代码行数:21,代码来源:YafWeibo.php

示例13: getUserInfo

 function getUserInfo()
 {
     require_once dirname(__FILE__) . "/API/saetv2.ex.class.php";
     $token = ISession::get('token');
     $c = new SaeTClientV2(ISession::get('apiKey'), ISession::get('apiSecret'), $token['access_token']);
     $ms = $c->home_timeline();
     $uid_get = $c->get_uid();
     $uid = $uid_get['uid'];
     $user_message = $c->show_user_by_id($uid);
     $userInfo = array();
     $userInfo['id'] = $uid;
     $userInfo['name'] = isset($user_message['screen_name']) ? $user_message['screen_name'] : '';
     return $userInfo;
 }
开发者ID:yongge666,项目名称:sunupedu,代码行数:14,代码来源:sina.php

示例14: getUserInfo

 public function getUserInfo($request_args)
 {
     is_null($request_args['code']) && exit;
     $oauth = new SaeTOAuthV2($this->setting['app_key'], $this->setting['app_secret']);
     $keys = array('code' => $request_args['code'], 'redirect_uri' => $this->redirect_uri);
     $token = $oauth->getAccessToken('code', $keys);
     $client = new SaeTClientV2($this->setting['app_key'], $this->setting['app_secret'], $token['access_token']);
     $user = $client->show_user_by_id($token['uid']);
     $result['keyid'] = $user['id'];
     $result['keyname'] = $user['name'];
     $result['keyavatar_small'] = $user['profile_image_url'];
     $result['keyavatar_big'] = $user['avatar_large'];
     $result['bind_info'] = $token;
     return $result;
 }
开发者ID:kid2682,项目名称:SMZDM,代码行数:15,代码来源:sina.php

示例15: wbcallback

 public function wbcallback()
 {
     Vendor('Weibo.saetv2#ex#class');
     $o = new \SaeTOAuthV2(C('weibo.wb_akey'), C('weibo.wb_skey'));
     if (isset($_REQUEST['code'])) {
         $keys = array();
         $keys['code'] = $this->_request('code');
         $keys['redirect_uri'] = C('weibo.wb_callback_url');
         try {
             $token = $o->getAccessToken('code', $keys);
         } catch (OAuthException $e) {
         }
     }
     if ($token) {
         // 获取用户信息
         $c = new SaeTClientV2(C('weibo.wb_akey'), C('weibo.wb_skey'), $token['access_token']);
         // $ms  = $c->home_timeline(); // done
         $uid_get = $c->get_uid();
         $uid = $uid_get['uid'];
         $uinfo = $c->show_user_by_id($uid);
         //根据ID获取用户等基本信息
         // 查询是否已经绑定
         $this->user_model = D('user');
         $user = $this->user_model->field('id,email,password')->where(array('wb_token' => $token['access_token'], 'wb_openid' => $uid))->find();
         // echo $this->user_model->getLastSql();
         if ($user['id'] > 0) {
             // 登录用户
             if ($this->user_model->login($user['id'], $user['email'], $user['password'])) {
                 //TODO:跳转到登录前页面
                 $this->success('登录成功!', session('rebackurl'));
             } else {
                 $this->error($model->getError());
             }
         } else {
             session('avatar', $uinfo['avatar_hd']);
             session('openid', $uinfo['id']);
             session('token', $token['access_token']);
             session('uname', $uinfo['screen_name']);
             session('oatype', 'wb_');
             //print_r($uinfo);
             $this->redirect('join');
         }
     } else {
         $this->error('授权失败。');
     }
 }
开发者ID:kjzwj,项目名称:jcms,代码行数:46,代码来源:oauthAction.class.php


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