當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XWB_plugin::getUser方法代碼示例

本文整理匯總了PHP中XWB_plugin::getUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP XWB_plugin::getUser方法的具體用法?PHP XWB_plugin::getUser怎麽用?PHP XWB_plugin::getUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XWB_plugin的用法示例。


在下文中一共展示了XWB_plugin::getUser方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: xwb_uninstall

 function xwb_uninstall()
 {
     global $_xwb_install;
     $this->tpl_dir = dirname(__FILE__) . '/tpl';
     $this->v = $_xwb_install;
     $this->_sess = XWB_plugin::getUser();
     $this->_chkIsAdmin();
 }
開發者ID:chibimiku,項目名稱:xweibo_for_discuz_x2_php7,代碼行數:8,代碼來源:xwb_uninstall.class.php

示例2: _getSinaUserInfo

 /**
  * 獲取當前授權的單個登錄新浪用戶資料(保護方法)
  */
 function _getSinaUserInfo()
 {
     $xwb_user = XWB_plugin::getUser();
     $sina_id = $xwb_user->getInfo('sina_uid');
     if (is_numeric($sina_id) && $sina_id > 0) {
         $wb = XWB_plugin::getWB();
         $wb->is_exit_error = false;
         $this->sina_userinfo = (array) $wb->getUserShow($sina_id);
     }
 }
開發者ID:Jaedeok-seol,項目名稱:discuz_template,代碼行數:13,代碼來源:sinaFaceSync.class.php

示例3: isset

                </div>
                <?php 
}
?>
                
            </div>
            

            
            
            
            
            
        </div>
        <b class="bg_regBot">&nbsp;</b>
    </div>
</div>
<?php 
$xwb_sess = XWB_plugin::getUser();
$xwb_statInfo = $xwb_sess->getStat();
foreach ($xwb_statInfo as $k => $stat) {
    $xwb_statType = isset($stat['xt']) ? (string) $stat['xt'] : 'unknown';
    echo XWB_plugin::statUrl($xwb_statType, $stat, true);
}
if (!empty($xwb_statInfo)) {
    $xwb_sess->clearStat();
}
?>
</body>
</html>
開發者ID:Jaedeok-seol,項目名稱:discuz_template,代碼行數:30,代碼來源:share_msg.tpl.php

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

示例5: bind

 function bind()
 {
     if (!XWB_plugin::pCfg('is_account_binding')) {
         XWB_plugin::showError('新浪微博綁定功能已經關閉!');
     }
     if (XWB_S_UID > 0 && XWB_plugin::isUserBinded()) {
         $xwb_user = XWB_plugin::getUser();
         $sina_id = $xwb_user->getInfo('sina_uid');
         $wb = XWB_plugin::getWB();
         $wb->is_exit_error = false;
         $sina_user_info = $wb->getUserShow($sina_id);
         if (isset($sina_user_info['error_code']) || isset($sina_user_info['error'])) {
             include XWB_P_ROOT . '/tpl/xwb_cenbind_error.tpl.php';
         } else {
             $db = XWB_plugin::getDB();
             $share = XWB_plugin::V("R:share");
             $share_msg = '';
             if ($share) {
                 $bind_info = $db->fetch_first("select * from " . XWB_S_TBPRE . "xwb_bind_info where `uid`='" . XWB_S_UID . "'");
                 $share_time = $bind_info['share_time'];
                 if (!$share_time) {
                     $share_time = time();
                     $db->query("update " . XWB_S_TBPRE . "xwb_bind_info set `share_time`='" . $share_time . "' where `uid`='" . XWB_S_UID . "'");
                     jclass('misc')->update_account_bind_info(XWB_S_UID, '', '', 1);
                     $share_msg = "<img src='" . (XWB_plugin::baseUrl() . XWB_plugin::URL('&code=enter&share_time=' . $share_time)) . "' width='0' height='0' />";
                 }
             } else {
                 /**
                  * 分享給好友顯示頁麵
                  */
                 $skip_share = XWB_plugin::V("R:skip_share");
                 if (!$skip_share) {
                     $bind_info = $db->fetch_first("select * from " . XWB_S_TBPRE . "xwb_bind_info where `uid`='" . XWB_S_UID . "'");
                     if (!$bind_info['share_time']) {
                         include XWB_P_ROOT . '/tpl/xwb_cenbind_share.tpl.php';
                         exit;
                     }
                 }
             }
             $screen_name = $sina_user_info['screen_name'];
             $profile = XWB_plugin::O('xwbUserProfile');
             $setting = $profile->get('bind_setting', 1);
             $tojishigou = $profile->get('synctopic_tojishigou', 0);
             $reply_tojishigou = $profile->get('syncreply_tojishigou', 0);
             include XWB_P_ROOT . '/tpl/xwb_cenbind_on.tpl.php';
         }
     } else {
         include XWB_P_ROOT . '/tpl/xwb_cenbind_off.tpl.php';
     }
 }
開發者ID:YouthAndra,項目名稱:huaitaoo2o,代碼行數:50,代碼來源:xwbSiteInterface.mod.php

示例6: doShare

 /**
  * 帖子轉發
  */
 function doShare()
 {
     if (!XWB_plugin::pCfg('is_rebutton_display') || !XWB_plugin::isRequestBy('POST')) {
         XWB_plugin::showError('網站管理員關閉了插件功能“新浪微博分享”。請稍後再試。');
     }
     $sess = XWB_plugin::getUser();
     /* 判斷是否外部轉發 */
     if (1 != $sess->getInfo('forshare')) {
         XWB_plugin::showError('禁止外部轉發');
     }
     /* 銷毀 SESSION['forshare'] 變量*/
     $sess->delInfo('forshare');
     /* 判斷轉發時間間隔 */
     $shareTime = intval(XWB_plugin::pCfg('wbx_share_time'));
     if ($shareTime >= time() - intval($sess->getInfo('sharetime'))) {
         XWB_plugin::showError("轉發過快,轉發間隔為 {$shareTime} 秒");
     }
     /* 獲取用戶信息 */
     $rst = $this->_getUserInfo();
     if (isset($rst['error_no']) && 0 < $rst['error_no']) {
         $this->_showTip($rst['error']);
     }
     /* 獲取傳遞信息 */
     $message = trim(strval(XWB_plugin::V('p:message')));
     $pic = trim(strval(XWB_plugin::V('p:share_pic')));
     if (empty($message)) {
         $this->_showTip('錯誤:轉發信息不能為空.', $rst);
     }
     /* 轉發主題 */
     $xp_publish = XWB_plugin::N('xwb_plugins_publish');
     $ret = $xp_publish->sendShare($message, $pic);
     /* 寫入 SESSION 發布時間 */
     $sess->setInfo('sharetime', time());
     /* 錯誤處理 */
     if ($ret === false || $ret === null) {
         $this->_showTip('錯誤:係統錯誤!', $rst);
     }
     if (isset($ret['error_code']) && isset($ret['error'])) {
         $error_code_se = substr($ret['error'], 0, 5);
         if ('400' == $ret['error_code'] && '40025' == $error_code_se) {
             $ret['error'] = '錯誤:不能發布相同的微博!';
         } else {
             $ret['error'] = '錯誤:係統錯誤!';
         }
         $this->_showTip($ret['error'], $rst);
     }
     $this->_showTip('轉發成功!', $rst);
 }
開發者ID:chibimiku,項目名稱:xweibo_for_discuz_x2_php7,代碼行數:51,代碼來源:xwbSiteInterface.mod.php

示例7: _getOAuthUrl

 function _getOAuthUrl()
 {
     static $aurl = null;
     if (!empty($aurl)) {
         return $aurl;
     }
     $sess = XWB_plugin::getUser();
     $sess->clearToken();
     $wbApi = XWB_plugin::getWB();
     $keys = $wbApi->getRequestToken();
     if (!isset($keys['oauth_token']) || !isset($keys['oauth_token_secret'])) {
         $api_error_origin = isset($keys['error']) ? $keys['error'] : 'UNKNOWN ERROR. MAYBE SERVER CAN NOT CONNECT TO SINA API SERVER';
         $api_error = isset($keys['error_CN']) && !empty($keys['error_CN']) && 'null' != $keys['error_CN'] ? $keys['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($keys, 1));
         XWB_plugin::showError("服務器獲取Request Token失敗;請稍候再試。<br />錯誤原因:{$api_error}[{$api_error_origin}]");
     }
     //print_r($keys);
     $aurl = $wbApi->getAuthorizeURL($keys['oauth_token'], false, XWB_plugin::getEntryURL('xwbAuth.authCallBack'));
     $sess->setOAuthKey($keys, false);
     return rtrim($aurl, '&');
 }
開發者ID:Jaedeok-seol,項目名稱:discuz_template,代碼行數:21,代碼來源:xwbAuth.mod.php

示例8: shareSync

 /**
  * 分享同步
  * @param integer $sid
  * @param array $arr
  */
 function shareSync($sid, $arr)
 {
     global $_G;
     $type = $title = $pic = '';
     if (isset($arr['image']) && !empty($arr['image']) && XWB_plugin::pCfg('is_upload_image')) {
         $pic = str_replace('.thumb.jpg', '', $arr['image']);
     }
     switch (strtolower($arr['type'])) {
         case 'space':
             $type = 'username';
             break;
         case 'blog':
             $type = 'subject';
             break;
         case 'album':
             $type = 'albumname';
             break;
         case 'pic':
             $type = 'albumname';
             break;
         case 'thread':
             $type = 'subject';
             break;
         case 'article':
             $type = 'title';
             break;
         case 'link':
         case 'video':
         case 'music':
         case 'flash':
             $type = 'link';
             break;
         default:
             break;
     }
     $arr['body_data'] = unserialize($arr['body_data']);
     if (empty($type)) {
         return false;
     } elseif ('link' != $type) {
         $pattern = '/^<a[ ]+href[ ]*=[ ]*"([a-zA-Z0-9\\/\\\\@:%_+.~#*?&=\\-]+)"[ ]*>(.+)<\\/a>$/';
         preg_match($pattern, $arr['body_data'][$type], $match);
         if (3 !== count($match)) {
             return false;
         }
         $link = $_G['siteurl'] . $match[1];
         if (1 == XWB_plugin::pcfg('link_visit_promotion')) {
             $link .= '&fromuid=' . $_G['uid'];
         }
         $title = 'pic' == $type ? $arr['body_data']['title'] : $match[2];
     } else {
         $link = $arr['body_data']['data'];
     }
     $message = !empty($arr['body_general']) ? (string) $arr['body_general'] : (string) $arr['title_template'];
     if (!empty($title)) {
         $message = $this->_convert($message . ' | ' . $title);
     } else {
         $message = $this->_convert($message);
     }
     $link = ' ' . $link;
     $length = 140 - ceil(strlen(urlencode($link)) * 0.5);
     $message = $this->_substr($message, $length);
     $message .= $link;
     $wb = XWB_plugin::getWB();
     // 同步到微博
     if (!empty($pic)) {
         $ret = $wb->upload($message, $pic, null, null, false);
         if (isset($ret['error_code']) && 400 == (int) $ret['error_code']) {
             $ret = $wb->update($message, false);
         }
     } else {
         $ret = $wb->update($message, false);
     }
     //同步微博後的ID
     if (!empty($ret['id'])) {
         //@todo json_decode可能存在解析超過int最大數的錯誤(#47644)問題
         $mid = $ret['id'];
         $this->insertSyncId($sid, $ret['id'], 'share');
         //日誌同步統計上報
         $sess = XWB_plugin::getUser();
         $sess->appendStat('ryz', array('uid' => XWB_plugin::getBindInfo("sina_uid"), 'mid' => $mid, 'type' => 4));
     }
 }
開發者ID:Jaedeok-seol,項目名稱:discuz_template,代碼行數:87,代碼來源:xwb_plugins_publish.class.php


注:本文中的XWB_plugin::getUser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。