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


PHP XWB_plugin::delBindUser方法代码示例

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


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

示例1: unbind

 /**
  * 解除绑定
  */
 function unbind()
 {
     if (XWB_S_UID < 1 || !XWB_plugin::pCfg('is_account_binding')) {
         XWB_plugin::showError('网站管理员关闭了插件功能“新浪微博绑定”。请稍后再试。');
     }
     XWB_plugin::delBindUser(XWB_S_UID);
     //远程API
     $sess = XWB_plugin::getUser();
     $sess->clearInfo();
     dsetcookie($this->_getBindCookiesName(XWB_S_UID), -1, 604800);
     echo json_encode(array('ok' => 1));
 }
开发者ID:chibimiku,项目名称:xweibo_for_discuz_x2_php7,代码行数:15,代码来源:xwbSiteInterface.mod.php

示例2: _delBindCheck

 /**
  * 当发现用户取消授权后,对其进行解绑操作
  * 属于本插件特殊用途的函数,仅用于方法oAuthRequest中
  */
 function _delBindCheck($errmsg)
 {
     if (XWB_S_UID <= 0) {
         return false;
     }
     if (false === strpos(str_replace(' ', '', strtolower($errmsg)), 'accessorwasrevoked')) {
         return false;
     }
     XWB_plugin::delBindUser(XWB_S_UID);
     //远程API
     $sess = XWB_plugin::getUser();
     $sess->clearToken();
     dsetcookie($this->_getBindCookiesName(XWB_S_UID), -1, 604800);
     return true;
 }
开发者ID:Jaedeok-seol,项目名称:discuz_template,代码行数:19,代码来源:weibo2_0.class.php

示例3: authCallBack

 function authCallBack()
 {
     if (!XWB_plugin::pCfg('is_account_binding')) {
         XWB_plugin::showError('网站管理员关闭了插件功能“新浪微博绑定”。请稍后再试。');
     }
     //--------------------------------------------------------------------
     global $_G;
     $sess = XWB_plugin::getUser();
     $waiting_site_bind = $sess->getInfo('waiting_site_bind');
     if (empty($waiting_site_bind)) {
         //XWB_plugin::deny();
         $siteUrl = XWB_plugin::siteUrl(0);
         XWB_plugin::redirect($siteUrl, 3);
     }
     $sess->setOAuthKey(array(), true);
     //--------------------------------------------------------------------
     $wbApi = XWB_plugin::getWB();
     $db = XWB_plugin::getDB();
     $last_key = $wbApi->getAccessToken(XWB_plugin::V('r:oauth_verifier'));
     //print_r($last_key);
     if (!isset($last_key['oauth_token']) || !isset($last_key['oauth_token_secret'])) {
         $api_error_origin = isset($last_key['error']) ? $last_key['error'] : 'UNKNOWN ERROR. MAYBE SERVER CAN NOT CONNECT TO SINA API SERVER';
         $api_error = isset($last_key['error_CN']) && !empty($last_key['error_CN']) && 'null' != $last_key['error_CN'] ? $last_key['error_CN'] : '';
         XWB_plugin::LOG("[WEIBO CLASS]\t[ERROR]\t#{$wbApi->req_error_count}\t{$api_error}\t{$wbApi->last_req_url}\tERROR ARRAY:\r\n" . print_r($last_key, 1));
         XWB_plugin::showError("服务器获取Access Token失败;请稍候再试。<br />错误原因:{$api_error}[{$api_error_origin}]");
     }
     $sess->setOAuthKey($last_key, true);
     $wbApi->setConfig();
     $uInfo = $wbApi->verifyCredentials();
     $sess->setInfo('sina_uid', $uInfo['id']);
     $sess->setInfo('sina_name', $uInfo['screen_name']);
     //print_r($uInfo);
     //--------------------------------------------------------------------
     /// 此帐号是否已经在当前站点中绑定
     $sinaHasBinded = false;
     $stat_is_bind_type = 0;
     if (defined('XWB_S_UID') && XWB_S_UID > 0) {
         $bInfo = XWB_plugin::getBUById(XWB_S_UID, $uInfo['id']);
     } else {
         $bInfo = XWB_plugin::getBindUser($uInfo['id'], 'sina_uid');
         //远程API
     }
     if (!is_array($bInfo) && (defined('XWB_S_UID') && XWB_S_UID > 0)) {
         $bInfo = XWB_plugin::getBindUser(XWB_S_UID, 'site_uid');
         //登录状态下再查一次API,确保没有绑定
     }
     if (!empty($bInfo) && is_array($bInfo)) {
         $sinaHasBinded = true;
         dsetcookie($this->_getBindCookiesName($bInfo['uid']), (string) $bInfo['sina_uid'], 604800);
         //核查存储的access token是否有更新,有更新则进行自动更新
         if ($bInfo['sina_uid'] == $uInfo['id'] && ($bInfo['token'] != $last_key['oauth_token'] || $bInfo['tsecret'] != $last_key['oauth_token_secret'])) {
             XWB_plugin::updateBindUser($bInfo['uid'], $bInfo['sina_uid'], (string) $last_key['oauth_token'], (string) $last_key['oauth_token_secret'], $uInfo['screen_name']);
             //远程API
         }
     }
     //--------------------------------------------------------------------
     /// 决定在首页中显示什么浮层
     $tipsType = '';
     //xwb_tips_type
     //已在论坛登录
     if (defined('XWB_S_UID') && XWB_S_UID) {
         if ($sinaHasBinded) {
             //$sinaHasBinded为true时,$bInfo必定存在
             if (XWB_S_UID != $bInfo['uid'] || $bInfo['sina_uid'] != $uInfo['id']) {
                 $tipsType = 'hasBinded';
                 $sess->clearToken();
             } else {
                 $tipsType = 'autoLogin';
             }
         } else {
             //远程API
             $rst = XWB_plugin::addBindUser(XWB_S_UID, $uInfo['id'], (string) $last_key['oauth_token'], (string) $last_key['oauth_token_secret'], $uInfo['screen_name']);
             if (!$rst) {
                 echo "DB ERROR";
                 exit;
                 return false;
             }
             $tipsType = 'bind';
             dsetcookie($this->_getBindCookiesName(XWB_S_UID), (string) $uInfo['id'], 604800);
             //正向绑定统计上报
             $sess->appendStat('bind', array('uid' => $uInfo['id'], 'type' => 1));
         }
     } else {
         //从 wb 登录后 检查用户是否绑定,如果绑定了 则在附属站点自
         if ($sinaHasBinded) {
             require_once XWB_P_ROOT . '/lib/xwbSite.inc.php';
             $result = xwb_setSiteUserLogin((int) $bInfo['uid']);
             if (false == $result) {
                 dsetcookie($this->_getBindCookiesName($bInfo['uid']), -1, 604800);
                 XWB_plugin::delBindUser($bInfo['uid']);
                 //远程API
                 $tipsType = 'siteuserNotExist';
             } else {
                 $stat_is_bind_type = 1;
                 $tipsType = 'autoLogin';
             }
         } else {
             //已登录WB,没有附属站点的帐号 引导注册
             $sess->setInfo('waiting_site_reg', '1');
             $tipsType = 'reg';
//.........这里部分代码省略.........
开发者ID:Jaedeok-seol,项目名称:discuz_template,代码行数:101,代码来源:xwbAuth.mod.php


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