コード例 #1
0
 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';
     }
 }
コード例 #2
0
 /**
  * 显示绑定时的错误信息
  * @param string $errorType 错误类型
  */
 function _showBindError($errorType = 'api')
 {
     $isBind = XWB_plugin::isUserBinded();
     //获取绑定关系
     include XWB_P_ROOT . '/tpl/xwb_bind_error.tpl.php';
     exit;
 }
コード例 #3
0
 /**
  * 显示绑定时的错误信息
  * @param string $errorType 错误类型
  */
 function _showBindError($errorType = 'api')
 {
     $isBind = XWB_plugin::isUserBinded();
     //获取绑定关系
     $unbind_tokenhash = xwb_token::make('unbind', true);
     include XWB_P_ROOT . '/tpl/xwb_bind_error.tpl.php';
     exit;
 }
コード例 #4
0
<?php

/**
 *[JishiGou] (C)2005 - 2099 Cenwor Inc.
 *
 * This is NOT a freeware, use is subject to license terms
 *
 * @Filename newtopic.hack.php $
 *
 * @Author 狐狸<*****@*****.**> $
 *
 * @version $Id: newtopic.hack.php 3699 2013-05-27 07:26:39Z wuliyong $
 */
if (!defined('IS_IN_XWB_PLUGIN')) {
    exit('Access Denied!');
}
if (XWB_plugin::isUserBinded() && XWB_plugin::V('p:syn_to_sina')) {
    $xp_publish = XWB_plugin::N('xwb_plugins_publish');
    $xp_publish->topic((int) ($tid ? $tid : $GLOBALS['jsg_tid']), (int) ($totid ? $totid : $GLOBALS['jsg_totid']), (string) $GLOBALS['jsg_message'], (string) $GLOBALS['jsg_imageid']);
}
コード例 #5
0
 /**
  * 分享评论同步
  * @param int $id 分享id
  * @param string $message 内容
  */
 function shareCommentSync($id, $message)
 {
     global $_G;
     $mid = $this->isSync($id, 'share');
     if (!$mid || !XWB_plugin::isUserBinded()) {
         return;
     }
     $message = $this->_convert($message);
     $link = ' ' . $_G['siteurl'] . "home.php?mod=space&do=share&id={$id}";
     if (1 == XWB_plugin::pcfg('link_visit_promotion')) {
         $link .= '&fromuid=' . $_G['uid'];
     }
     $length = 140 - ceil(strlen(urlencode($link)) * 0.5);
     //2个字母为1个字
     $message = $this->_substr($message, $length);
     $message .= $link;
     //同步到微博
     $wb = XWB_plugin::getWB();
     $rs = $wb->comment($mid, $message, null, false);
 }
コード例 #6
0
 /**
  * 门户文章发表截获钩子检查:是否是在进行文章发表操作、是否可以启动插件、用户是否在绑定状态
  * @return integer 检查结果。0:检查失败;1:发表文章
  */
 function _checkIsArticlePost()
 {
     global $_G;
     static $result = -999;
     if ($result >= 0) {
         return $result;
     }
     if (!in_array($_G['gp_ac'], array('article')) || !$_G['uid'] || 'POST' != $this->getRequestMethod() || false == $this->_start_xweibo(true) || !XWB_plugin::isUserBinded()) {
         $result = 0;
     } elseif (getgpc('articlesubmit') && XWB_plugin::pCfg('is_syncarticle_toweibo')) {
         $result = 1;
     } else {
         $result = 0;
     }
     return $result;
 }