/**
  * 启动session
  */
 function _session_start()
 {
     $operatorType = defined('XWB_P_SESSION_OPERATOR') ? strtolower(XWB_P_SESSION_OPERATOR) : 'native';
     $storageType = defined('XWB_P_SESSION_STORAGE_TYPE') ? strtolower(XWB_P_SESSION_STORAGE_TYPE) : '';
     //session操作器初始化
     $this->_operator = XWB_plugin::O('session/session_operator_' . $operatorType);
     //session存储器注册到session操作器中
     if (!empty($storageType)) {
         $sessStorage = XWB_plugin::O('session/session_storage_' . $storageType);
         $this->_operator->setStorageHandler($sessStorage);
         //模拟操作器必须要有一个session存储器
     } elseif ('simulator' == $operatorType) {
         //XWB_plugin::showError('管理员设置错误,导致程序被终止。请联系管理员解决。<br />错误原因:You have defined SIMULATOR session operator but does not define a session STORAGE type! SYSTEM HALTED!');
         trigger_error('You have defined SIMULATOR session operator but does not define a session STORAGE type! SYSTEM HALTED!', 256);
     }
     $this->_operator->session_start();
 }
 /**
  * 获取clientUser类别
  * @return clientUser clientUser类
  */
 function &getUser()
 {
     return XWB_plugin::O('clientUser');
 }
 /**
  * 设置评论回推用户
  * @param string $username 用户名,请传参前自行转码到论坛用户的编码
  * @return int 用户uid
  */
 function _setPushbackSiteAccount($username)
 {
     loaducenter();
     $userInfo = uc_get_user($username);
     if (is_array($userInfo) && $userInfo[0] > 0) {
         $this->_importUserFromUC($userInfo);
         return $userInfo[0];
     }
     $email = 'xweibo_user' . rand(1, 99999) . '@sina.com';
     $siteRegister = XWB_plugin::O('xwbSiteUserRegister');
     $uid = $siteRegister->reg($username, $email);
     return $uid > 0 ? $uid : 0;
 }
 function json_encode($s)
 {
     $gloJSON = XWB_plugin::O('servicesJSON');
     $gloJSON->use = 16;
     return $gloJSON->encode($s);
 }
 /**
  * 设置发帖同步
  */
 function bindTopic()
 {
     if (XWB_S_UID < 1 || !XWB_plugin::pCfg('is_account_binding')) {
         XWB_plugin::showError('新浪微博绑定功能已经关闭!');
     }
     $setting = XWB_plugin::V('p:setting');
     $tojishigou = XWB_plugin::V('p:tojishigou');
     $reply_tojishigou = XWB_plugin::V('p:reply_tojishigou');
     $profile = XWB_plugin::O('xwbUserProfile');
     $profile->set(array('bind_setting' => (int) $setting, 'synctopic_tojishigou' => (int) $tojishigou, 'syncreply_tojishigou' => (int) $reply_tojishigou));
     //XWB_plugin::redirect('xwbSiteInterface.bind',2);
     jclass('misc')->update_account_bind_info(XWB_S_UID, '', '', 1);
     echo '<script>parent.tips();</script>';
 }
 /**
  * 用户设置同步选项
  */
 function setUserProfileBind()
 {
     if (XWB_S_UID < 1) {
         XWB_plugin::showError('你尚未登录。');
     } elseif (!XWB_plugin::pCfg('is_account_binding') || !XWB_plugin::isRequestBy('POST')) {
         XWB_plugin::showError('网站管理员关闭了插件功能“新浪微博绑定”。请稍后再试。');
     }
     $set = (array) XWB_plugin::V('p:set');
     $newset = array();
     $inputCheck = array('topic2weibo_checked' => array(0, 1), 'blog2weibo_checked' => array(0, 1), 'article2weibo_checked' => array(0, 1), 'share2weibo' => array(0, 1), 'doing2weibo' => array(0, 1));
     $newset = $this->_filterInput($set, $inputCheck);
     $profile = XWB_plugin::O('xwbUserProfile');
     $profile->set($newset);
     echo '<script>parent.showMsg(\'success\');</script>';
 }
<?php

/*
 * @version $Id: newshare.hack.php 459 2010-12-23 09:06:50Z yaoying $
 */
if (!defined('IS_IN_XWB_PLUGIN')) {
    exit('Access Denied!');
}
global $_G;
$arr = isset($GLOBALS['arr']) ? (array) $GLOBALS['arr'] : array();
$sid = isset($GLOBALS['sid']) ? (int) $GLOBALS['sid'] : 0;
$p = XWB_plugin::O('xwbUserProfile');
$share2weibo = (int) $p->get('share2weibo', 0);
if ($sid > 0 && !empty($arr) && $share2weibo === 1) {
    $xp_publish = XWB_plugin::N('xwb_plugins_publish');
    register_shutdown_function(array(&$xp_publish, 'shareSync'), $sid, $arr);
}
 /**
  * 发表文章页面钩子:同步按钮显示
  */
 function portalcp_bottom_output()
 {
     global $_G;
     $return = '';
     if ('article' != $_G['gp_ac'] || !$_G['uid'] || (!isset($GLOBALS['op']) || 'add' != $GLOBALS['op']) || 'GET' != core_sina_xweibo_x2::getRequestMethod() || false == $this->_start_xweibo(true) || !XWB_plugin::pCfg('is_syncarticle_toweibo')) {
         return $return;
     }
     $lang['xwb_sycn_to_sina'] = XWB_plugin::L('xwb_sycn_to_sina');
     $lang['xwb_sycn_open'] = XWB_plugin::L('xwb_sycn_open');
     $p = XWB_plugin::O('xwbUserProfile');
     $html_checked = (int) $p->get('article2weibo_checked', 1);
     include template($this->pluginid . ':portalcp_newarticle');
     return $return;
 }
Example #9
0
 /**
  * 获取用户设置“新发微博是否自动发到新浪微博”设置。
  * 默认为是
  * @return interger
  */
 function getIsSynPost()
 {
     $p = XWB_plugin::O('xwbUserProfile');
     return (int) $p->get('bind_setting', 1);
 }
Example #10
0
 function setSync()
 {
     $uid = max(0, (int) MEMBER_ID);
     if ($uid < 1) {
         $this->Messager("请先<a href='index.php?mod=login'>点此登录</a>或者<a href='index.php?mod=member'>点此注册</a>一个帐号", null);
     }
     $setting = (int) $this->Get['setting'];
     if ('sina' == $this->Get['type']) {
         define('IS_IN_XWB_PLUGIN', true);
         define('XWB_P_ROOT', ROOT_PATH . 'include/ext/xwb/');
         require_once XWB_P_ROOT . 'sina.php';
         require_once XWB_P_ROOT . 'lib/core.class.php';
         if (XWB_S_UID < 1 || !XWB_plugin::pCfg('is_account_binding')) {
             XWB_plugin::showError('新浪微博绑定功能已经关闭!');
         }
         $tojishigou = XWB_plugin::V('G:tojishigou');
         $reply_tojishigou = XWB_plugin::V('G:reply_tojishigou');
         $profile = XWB_plugin::O('xwbUserProfile');
         $profile->set(array('bind_setting' => (int) $setting, 'synctopic_tojishigou' => (int) $tojishigou, 'syncreply_tojishigou' => (int) $reply_tojishigou));
         $r = jclass('misc')->update_account_bind_info(XWB_S_UID, '', '', 1);
     } elseif ('qq' == $this->Get['type']) {
         $this->DatabaseHandler->Query("update " . TABLE_PREFIX . "qqwb_bind_info set `synctoqq`='{$setting}' where `uid`='{$uid}'");
         $r = jclass('misc')->update_account_bind_info($uid, '', '', 1);
     } elseif ('renren' == $this->Get['type'] && !$setting) {
         $r = $this->DatabaseHandler->Query("delete from " . TABLE_PREFIX . "renren_bind_info where `uid`='{$uid}'");
     } elseif ('kaixin' == $this->Get['type']) {
         $this->DatabaseHandler->Query("delete from " . TABLE_PREFIX . "kaixin_bind_info where `uid`='{$uid}'");
     }
     json_result('ok', $setting ? 0 : 1);
 }
 /**
  * 构造函数
  *
  * @return sinaFaceSync
  */
 function sinaFaceSync()
 {
     $this->_getSinaUserInfo();
     $this->http = XWB_plugin::O('fsockopenHttp');
 }