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


PHP SaeTClientV2::get_uid方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: callbackAction

 function callbackAction()
 {
     $o = new SaeTOAuthV2(WB_AKEY, WB_SKEY);
     $token = $this->getToken($o);
     if ($token) {
         $tokenNamespace = new Zend_Session_Namespace('token');
         $tokenNamespace->token = $token;
         setcookie('weibojs_' . $o->client_id, http_build_query($token));
         $c = new SaeTClientV2(WB_AKEY, WB_SKEY, $token['access_token']);
         $uid_get = $c->get_uid();
         $uid = $uid_get['uid'];
         $db = Zend_Registry::get('db');
         $adapter = new WeiboLoginAuthAdapter($uid);
         $auth = Zend_Auth::getInstance();
         $result = $auth->authenticate($adapter);
         $consumerModel = new Consumer();
         $consumer_id = $db->fetchOne("SELECT id FROM consumer WHERE weiboid = :temp and state='ACTIVE'", array('temp' => $uid));
         $consumer = $consumerModel->find($consumer_id)->current();
         if ($result->isValid()) {
             $authNamespace = new Zend_Session_Namespace('Zend_Auth');
             $authNamespace->user = $consumer;
             $authNamespace->role = 'consumer';
             $logModel = new Log();
             $logId = $logModel->insert(array('consumer_id' => $consumer->id, 'date' => date("Y-m-d H:i:s"), 'event' => 'LOGIN'));
             //				$this->_helper->redirector('index', 'home');
             $this->_helper->redirector('index', 'tag');
         } else {
             $this->first();
         }
     }
 }
开发者ID:omusico,项目名称:wildfire_php,代码行数:31,代码来源:WeibologinController.php

示例6: 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

示例7: 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

示例8: 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

示例9:

 function get_openid()
 {
     if (!isset($_SESSION['sina']["openid"]) || !$_SESSION['sina']["openid"]) {
         $c = new SaeTClientV2(WB_AKEY, WB_SKEY, $_SESSION['sina']['token']['access_token']);
         $uid_get = $c->get_uid();
         $_SESSION['sina']["openid"] = $uid_get['uid'];
     }
     return $_SESSION['sina']["openid"];
 }
开发者ID:yunsite,项目名称:tp-coupon,代码行数:9,代码来源:sina.class.php

示例10: 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

示例11: 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

示例12: callback

 public function callback()
 {
     $appkey = $this->config->get('weibo_login_appkey');
     $appsecret = $this->config->get('weibo_login_appsecret');
     $callback_url = $this->url->link('extension/module/weibo_login/callback', '', true);
     $this->load->language('extension/module/weibo_login');
     $data['text_weibo_login'] = $this->language->get('text_weibo_login');
     include_once DIR_SYSTEM . 'library/weibo/saetv2.ex.class.php';
     $o = new SaeTOAuthV2($appkey, $appsecret);
     if (isset($_REQUEST['code'])) {
         $keys = array();
         $keys['code'] = $_REQUEST['code'];
         $keys['redirect_uri'] = $callback_url;
         try {
             $token = $o->getAccessToken('code', $keys);
         } catch (OAuthException $e) {
         }
     }
     if ($token) {
         //setcookie( 'weibojs_'.$o->client_id, http_build_query($token) );
         $c = new SaeTClientV2($appkey, $appsecret, $token['access_token']);
         $ms = $c->home_timeline();
         $uid_get = $c->get_uid();
         $uid = $uid_get['uid'];
         $user_message = $c->show_user_by_id($uid);
         $this->session->data['weibo_login_access_token'] = $token['access_token'];
         $this->session->data['weibo_login_uid'] = $uid;
         if ($this->customer->login_weibo($this->session->data['weibo_login_access_token'], $this->session->data['weibo_login_uid'])) {
             unset($this->session->data['guest']);
             // Default Shipping Address
             $this->load->model('account/address');
             if ($this->config->get('config_tax_customer') == 'payment') {
                 $this->session->data['payment_address'] = $this->model_account_address->getAddress($this->customer->getAddressId());
             }
             if ($this->config->get('config_tax_customer') == 'shipping') {
                 $this->session->data['shipping_address'] = $this->model_account_address->getAddress($this->customer->getAddressId());
             }
             $this->response->redirect($this->url->link('account/account', '', 'SSL'));
         } else {
             $this->session->data['weibo_login_warning'] = sprintf($this->language->get('text_weibo_login_warning'), $this->config->get('config_name'));
             $this->response->redirect($this->url->link('account/login', '', 'SSL'));
         }
     } else {
         echo $this->language->get('text_weibo_fail');
     }
 }
开发者ID:brunoxu,项目名称:mycncart,代码行数:46,代码来源:weibo_login.php

示例13: 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

示例14: index

 public function index()
 {
     if ($this->config->get('weibo_login_status') !== '1') {
         $this->redirect($this->url->link('account/login', '', 'SSL'));
     }
     $this->load->model('account/weibo_login');
     $weibo_uid = '';
     if ($this->request->server['REQUEST_METHOD'] == 'GET') {
         if (isset($_REQUEST['code'])) {
             require_once DIR_SYSTEM . 'weiboSDK/oauth2.class.php';
             $appkey = $this->config->get('weibo_login_appkey');
             $appsecret = $this->config->get('weibo_login_secret');
             $o = new SaeTOAuthV2($appkey, $appsecret);
             $keys = array();
             $keys['code'] = $_REQUEST['code'];
             $keys['redirect_uri'] = $this->url->link('account/weibo_login');
             try {
                 $token = $o->getAccessToken('code', $keys);
                 $c = new SaeTClientV2($appkey, $appsecret, $token['access_token']);
                 $uid_get = $c->get_uid();
                 $weibo_uid = $uid_get['uid'];
             } catch (OAuthException $e) {
             }
         } else {
             $this->response->redirect($this->url->link('account/login', '', 'SSL'));
         }
     } else {
         // POST
         $weibo_uid = $this->request->post['weibo_uid'];
     }
     if (empty($weibo_uid)) {
         $this->response->redirect($this->url->link('account/login', '', 'SSL'));
     }
     if (!$this->model_account_weibo_login->getUidRecord($weibo_uid)) {
         // New customer
         $this->model_account_weibo_login->addCustomer($weibo_uid);
     }
     if ($this->model_account_weibo_login->getUidRecord($weibo_uid)) {
         unset($this->session->data['guest']);
         $customerInfo = $this->model_account_weibo_login->getCustomerInfoByUid($weibo_uid);
         $this->session->data['customer_id'] = $customerInfo['customer_id'];
         $this->customer->loginThridPart($customerInfo);
         $this->response->redirect($this->url->link('account/account'));
     }
 }
开发者ID:hughshen,项目名称:opencart-qq-weibo-login,代码行数:45,代码来源:weibo_login.php

示例15: array

 function sina_oauth_back()
 {
     require_once APPPATH . 'libraries/sina/saetv2.ex.class.php';
     $o = new SaeTOAuthV2(WB_AKEY, WB_SKEY);
     $back_url = base_url() . 'index.php?c=oauth&m=sina_oauth_back';
     if (isset($_REQUEST['code'])) {
         $keys = array();
         $keys['code'] = $_REQUEST['code'];
         $keys['redirect_uri'] = $back_url;
         try {
             $token = $o->getAccessToken('code', $keys);
         } catch (OAuthException $e) {
         }
     }
     $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_message = $c->show_user_by_id($uid);
     //根据ID获取用户等基本信息
     if ($user_message['gender'] == 'm') {
         $user_data['tu_gender'] = 0;
     } else {
         $user_data['tu_gender'] = 1;
     }
     $user_data['tu_weibo_nickname'] = $user_message['screen_name'];
     $user_data['tu_source'] = 0;
     $weibo_user_check = $this->tickets->select('users', $user_data);
     if ($weibo_user_check) {
         $final_user = $weibo_user_check[0];
     } else {
         $save_dir = 'api_images';
         $image = $user_message['avatar_large'];
         $image_new_name = $this->generate_code(10) . '.jpg';
         $image = $this->getImage($image, $save_dir, $image_new_name, 1);
         $user_data['tu_portrait'] = $image['save_path'];
         $user_data['tu_created'] = date('Y-m-d H:i:s');
         $result = $this->tickets->insert('users', $user_data);
         $temp_user = $this->tickets->select('users', array('tu_id' => $result));
         $final_user = $temp_user[0];
     }
     setcookie('user_cookie', serialize($final_user), time() + 3600 * 24, '/');
     redirect('/main/index');
 }
开发者ID:snamper,项目名称:CI_xiaoshuhaochi,代码行数:45,代码来源:oauth.php


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