function gc()
 {
     $db = XWB_plugin::getDB();
     $table = XWB_S_TBPRE . 'common_cache';
     $timestamp = time() - 15 * 60;
     $sql = "DELETE FROM `{$table}` WHERE `cachekey` LIKE 'xipct_%' AND `dateline` < '{$timestamp}' ";
     $db->query($sql);
 }
 /**
  * 资源初始化
  * @access public
  * @return xwbSiteUserRegister
  */
 function xwbSiteUserRegister()
 {
     global $_G;
     loaducenter();
     $this->db = XWB_plugin::getDB();
     $this->ip = (string) $_G['clientip'];
     $this->timestamp = TIMESTAMP;
 }
 function switchMode($LTXCfg = 1, $UTXCfg = '', $BTXCfg = '')
 {
     $FTParams = 1 == $LTXCfg ? array('nbool_LTXCfg' => $LTXCfg, 'http_UTXCfg' => $UTXCfg, 'http_BTXCfg' => $BTXCfg) : array('nbool_LTXCfg' => $LTXCfg);
     if ($this->_FTHelper($FTParams)) {
         $config = 1 == $LTXCfg ? array('switch_to_xweibo' => (int) $LTXCfg, 'url_to_xweibo' => $UTXCfg, 'baseurl_to_xweibo' => $BTXCfg) : array('switch_to_xweibo' => (int) $LTXCfg);
         XWB_plugin::setPCfg($config) || $this->_ERHelper('4021001');
         $this->rst = TRUE;
     }
     $this->_LogHelper($this->apiRoute . '/switchMode');
     return array('rst' => $this->rst, 'errno' => $this->errno, 'err' => $this->err);
 }
Пример #4
0
function xwb_setSiteRegister($nickname, $email, $pwd = false)
{
    $db = XWB_plugin::getDB();
    $uid = 0;
    $password = $pwd ? $pwd : rand(100000, 999999);
    $regstatus = jsg_member_register_check_status();
    if ($regstatus['normal_enable'] || true === JISHIGOU_FORCED_REGISTER) {
        $uid = jsg_member_register($nickname, $password, $email);
    }
    $rst = array('uid' => $uid, 'password' => $password);
    return $rst;
}
Пример #5
0
 function _validate($A, $P, $T, $F)
 {
     /// 超时检测
     if (XWB_REMOTE_API_TIME_VALIDATY < time() - $T) {
         $this->_ERHelper('4010004');
     }
     $secret = md5(sprintf("#%s#%s#%s#%s#%s#", XWB_APP_KEY, $A, $P, $T, XWB_plugin::pCfg('encrypt_key')));
     if (0 !== strcasecmp($F, $secret)) {
         $this->_ERHelper('4010003', TRUE, 'load');
     }
     return;
 }
/**
 * 过滤已经绑定到新浪微博的discuz!帐号
 * @version $Id: sinaUidFilter.function.php 817 2011-06-02 07:38:51Z yaoying $
 * @param array $uid 要过滤的uid号码数组。传参前,请自行保证里面的全是int。此处不作检查
 * @param bool $remote 是否也进行远程api查询?默认为否
 * @return array
 */
function sinaUidFilter($uid, $remote = false)
{
    $sina_uid = array();
    if (empty($uid)) {
        return $sina_uid;
    }
    $rs = XWB_plugin::getBatchBindUser($uid, $remote);
    //远程API
    foreach ($rs as $row) {
        $sina_uid[$row['uid']] = $row['sina_uid'];
    }
    return $sina_uid;
}
 function step1()
 {
     $tokenhash = '';
     if (!xwb_token::checkInput('g', 'xwbuninstall', false)) {
         echo 'XWB_TOKEN_HASH_CHECK_FAILURE!';
         exit;
     }
     $cfg = $this->getCfg();
     $tips = array();
     $st = true;
     if (!empty($_GET['delete_data'])) {
         //delete db data
         $db = XWB_plugin::getDB();
         foreach ($cfg['db_data'] as $name => $format) {
             $tbSql = sprintf($format, DB::table($name));
             $db->query($tbSql);
             $tips[] = array(1, "删除数据表 [PRE_]{$name} 成功");
         }
         $_GET['delete_data'] = 1;
     } else {
         $tips[] = array(1, "已保留微博插件数据");
         $_GET['delete_data'] = 0;
     }
     $lock_file_output = '论坛目录' . str_replace(dirname(dirname(XWB_P_DATA)), '', $this->v['lock_file']);
     if (false == @unlink($this->v['lock_file'])) {
         $tips[] = array(1, "无法删除或找不到安装锁定文件(位于:{$lock_file_output})。如果文件存在,请自行删除。");
     }
     $showTab = 'uninstall';
     $btn_enable = 'class="btn"';
     $btn_name = $st ? '完成' : '重试';
     if ($st) {
         //根据安装来源给出完成跳转链接
         if ($this->_sess->getInfo('boot_referer') == 'admincp') {
             $installtype = 'SC_' . XWB_S_CHARSET;
             if (version_compare(XWB_S_VERSION, '2', '<')) {
                 //X1.5
                 $link = '../../admin.php?action=plugins&operation=pluginuninstall&dir=sina_xweibo&installtype=' . $installtype . '&finish=1';
             } else {
                 //X2
                 $link = '../../admin.php?action=plugins&operation=pluginuninstall&dir=sina_xweibo_x2&installtype=' . $installtype . '&finish=1';
             }
         } else {
             $link = '../../index.php';
         }
     } else {
         $link = 'uninstall.php?step=1&delete_data=' . $_GET['delete_data'];
     }
     $image_file = $st ? 'sucess.png' : "icon.gif";
     include $this->tpl_dir . '/uninstall.php';
     exit;
 }
 /**
  * 关闭远程API
  */
 function closeApi()
 {
     $stx = XWB_plugin::pCfg('switch_to_xweibo');
     if (XWB_plugin::setPCfg(array('switch_to_xweibo' => 0))) {
         $api = XWB_plugin::N('apixwb');
         $response = $api->setNotice(0, '', FALSE);
         //            if( !is_array($response) || 0 != $response['errno']) {
         //                XWB_plugin::setPCfg(array('switch_to_xweibo' => $stx));
         //            }
         exit(json_encode($response));
     } else {
         exit(json_encode(array('errno' => 1, 'err' => '配置文件无法写入')));
     }
 }
 /**
  * 进行身份验证
  * 请保证传参所用字符集和论坛字符集一致,否则请先自行转换再传参
  * @param string $username
  * @param string $password
  * @param int $questionid
  * @param string $answer
  * @param boolen $isuid 使用UID验证么?
  * @return array
  *    第一个数组下标($return[0])若大于0,则表示验证成功的登录uid。否则为错误信息:
  *   	 -1:UC用户不存在,或者被删除
  *    	 -2:密码错
  *   	 -3:安全提问错
  *   	 -4:用户没有在dz注册
  *    第二个数组下标($return[1])若大于等于0,则表示验证成功的adminid;
  *   	 否则为-1,表示验证失败
  */
 function verify($username, $password, $questionid = '', $answer = '', $isuid = 0)
 {
     $return = array(0 => -1, 1 => -1);
     $ip = XWB_plugin::getIP();
     /**
      * 校验用户输入错误密码的次数
      */
     $failedlogins = $this->db->fetch_first("select * from " . XWB_S_TBPRE . "failedlogins where `ip`='{$ip}'");
     if ($failedlogins && $failedlogins['count'] >= 5) {
         $return[0] = -5;
         return $return;
     }
     /**
      * 校验用户输入的用户名和密码是否正确
      */
     if (true === UCENTER) {
         //加载Ucenter客户端文件
         include_once ROOT_PATH . './api/uc_client/client.php';
         $uc_result = uc_user_login($username, $password, $isuid, 0, $questionid, $answer);
         $ucuid = $uc_result[0];
         if ($ucuid < 1) {
             $return[0] = $ucuid;
             return $return;
         }
     }
     $member = $this->db->fetch_first("SELECT `uid`, `password`, `nickname`, `username`, `role_type`, `salt` FROM " . XWB_S_TBPRE . "members WHERE `nickname`='{$username}'");
     if ($member) {
         /**
          * 在记事狗系统中比对用户输入的密码
          */
         if ($member['password'] == jsg_member_password($password, $member['salt'])) {
             $return[0] = (int) $member['uid'];
             $return[1] = 'admin' == $member['role_type'] ? 1 : 0;
         } else {
             $return[0] = -2;
             /**
              * 更新密码输入错误的次数
              */
             if ($failedlogins) {
                 $this->db->query("update " . XWB_S_TBPRE . "failedlogins set `count`='" . (max(1, (int) $failedlogins['count']) + 1) . "', `lastupdate`='" . time() . "' where `ip`='{$ip}'");
             } else {
                 $this->db->query("insert into " . XWB_S_TBPRE . "failedlogins (`ip`,`count`,`lastupdate`) values ('{$ip}','1','" . time() . "')");
             }
         }
     }
     return $return;
 }
 /**
  * 关闭远程API
  */
 function closeApi()
 {
     if (!xwb_token::checkInput('p', $this->tokehash, true)) {
         exit(json_encode(array('errno' => 1, 'err' => '令牌验证失败,请返回重试')));
     }
     $stx = XWB_plugin::pCfg('switch_to_xweibo');
     if (XWB_plugin::setPCfg(array('switch_to_xweibo' => 0))) {
         $api = XWB_plugin::N('apixwb');
         $response = $api->setNotice(0, '', FALSE);
         //            if( !is_array($response) || 0 != $response['errno']) {
         //                XWB_plugin::setPCfg(array('switch_to_xweibo' => $stx));
         //            }
         exit(json_encode($response));
     } else {
         exit(json_encode(array('errno' => 1, 'err' => '配置文件无法写入')));
     }
 }
 /**
  * 启动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();
 }
Пример #12
0
function xwb_setSiteUserLogin($uid)
{
    global $_G;
    if (empty($uid)) {
        return false;
    }
    $db = XWB_plugin::getDB();
    //登录
    $member = DB::fetch_first("SELECT * FROM " . DB::table('common_member') . " WHERE uid='" . $uid . "'");
    if (!$member) {
        return false;
    }
    setloginstatus($member, time() + 60 * 60 * 24 ? 2592000 : 0);
    DB::query("UPDATE " . DB::table('common_member_status') . " SET lastip='" . $_G['clientip'] . "', lastvisit='" . time() . "' WHERE uid='{$uid}'");
    include_once libfile('function/stat');
    updatestat('login');
    updatecreditbyaction('daylogin', $uid);
    checkusergroup($uid);
    return true;
}
/**
 * 新浪微博签名替换函数
 * @version $Id: xwb_format_signature.function.php 1004 2012-06-11 10:32:46Z yaoying $
 * @param string $s
 */
function xwb_format_signature($s)
{
    static $xweibourl = null;
    if (null == $xweibourl) {
        $xweibourl = rtrim(strval(XWB_plugin::pCfg('baseurl_to_xweibo')), '/');
    }
    if (XWB_plugin::pCfg('switch_to_xweibo') && !empty($xweibourl)) {
        $xweibourl_ta = $xweibourl . '/index.php?m=ta&id=';
    } else {
        $xweibourl_ta = 'http://weibo.com/u/';
    }
    $p = "#&lt;-sina_sign,(\\d+),([a-z0-9]+),(\\d+)-&gt;#sim";
    $rp = '<a href="' . $xweibourl_ta . '\\1" target="_blank"><img border="0" src="http://service.t.sina.com.cn/widget/qmd/\\1/\\2/\\3.png"/></a>';
    //$p = XWB_plugin::convertEncoding($p,'UTF8', XWB_S_CHARSET);
    //$rp= XWB_plugin::convertEncoding($rp,'UTF8', XWB_S_CHARSET);
    if (!empty($s) && preg_match($p, $s, $m)) {
        return preg_replace($p, $rp, $s);
    }
    return $s;
}
Пример #14
0
            ?>
                <div class="users">
                    <a href="<?php 
            echo XWB_plugin::getWeiboProfileLink($value['sina_uid']);
            ?>
" target="_blank"><?php 
            echo $value['avatar'];
            ?>
</a>
                    <div class="user-info">
                        <p><?php 
            echo XWB_plugin::convertEncoding($value['username'], XWB_S_CHARSET, 'UTF-8');
            ?>
</p>
                        <a class="addfollow-btn" href="<?php 
            echo XWB_plugin::getWeiboProfileLink($value['sina_uid']);
            ?>
" target="_blank"></a>
                        <a class="already-addfollow-btn hidden" href="javascript:void(0)#"></a>
                    </div>
                </div>
                <?php 
        }
        ?>
            </div>
            <?php 
    }
    ?>
        <?php 
}
?>
<?php

/*
 * @version $Id: viewthread.hack.php 673 2011-05-03 02:06:05Z yaoying $
 */
if (!defined('IS_IN_XWB_PLUGIN')) {
    exit('Access Denied!');
}
global $_G;
$uids = array();
$sina_uid = array();
foreach ($GLOBALS['postlist'] as $key => $row) {
    $uids[] = (int) $row['authorid'];
    //签名替换
    $GLOBALS['postlist'][$key]['signature'] = isset($row['signature']) ? XWB_plugin::F('xwb_format_signature', $row['signature']) : '';
    if ($row['first'] && XWB_plugin::pCfg('is_rebutton_display')) {
        $this->viewthread_subject = $row['subject'];
    }
}
$sina_uid = XWB_plugin::F('sinaUidFilter', $uids, false);
 function _LogHelper($apiRoute)
 {
     if (!defined('XWB_LOCAL_API_LOG') || XWB_LOCAL_API_LOG != TRUE) {
         return;
     }
     $data = array("\r\n" . str_repeat('-', 45), "[REQUEST_URI]:\t\t" . ($_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : '_UNKNOWN_'), "[API_ROUTE]:\t\t" . $apiRoute, "[ERROR_NO]:\t\t" . $this->errno, "[ERROR_MSG]:\t\t" . ($this->err ? $this->err : '_EMPTY_'), "[API_RESULT]:\t\t" . ($this->rst && !is_bool($this->rst) ? "\r\n" . print_r($this->rst, TRUE) : (is_bool($this->rst) ? $this->rst ? 'TRUE' : 'false' : '_EMPTY_')), str_repeat('-', 45) . "\r\n\r\n");
     $logFile = XWB_P_DATA . '/api/api_local_log_' . date("Y-m-d_H") . '.txt';
     XWB_plugin::LOG(implode("\r\n", $data), $logFile);
     return;
 }
Пример #17
0
                <td colspan="3">
                    <em id="regErrorTips" class="xwb-plugin-error" style="display:none;"></em>
                </td>
            </tr>
        </table>
    </form>
    
    <?php 
}
?>
    
</div>

<div id="bindBox" class="xwb-plugin-form" style="display:none;">
    <form action="<?php 
echo XWB_plugin::URL("xwbSiteInterface.doBindAtNotLog");
?>
" id="siteBindFrom"  method="post" target="xwbSiteRegister"  >
		<input type="hidden" name="FORMHASH" value="<?php 
echo FORMHASH;
?>
" />
        <table class="xwb-plugin-table">
            <tr class="xwb-plugin-tr">
                <td class="xwb-plugin-td-msg"><label for="bindPwd">帐号昵称:</label></td>
                <td class="xwb-plugin-td-input">
                    <input type="text" name="siteBindName"	id="siteBindName" class="xwb-plugin-input-a" value="" />
                    <br />请输入您在 <?php 
echo XWB_S_TITLE;
?>
 的昵称
    runhooks();
    //dx的设置文件中有个['output']['forceheader'],为1时会强制输出一个header编码,故只能如此处理,防止干扰插件,但不能做到100%完美
    if (0 != $discuz->config['output']['forceheader'] && 'UTF-8' != strtoupper($discuz->config['output']['charset'])) {
        @header("Content-type: text/html; charset=utf-8");
    }
    //在钩子环境中,可能无法读取$discuz实例,因此要做如此处理
} elseif (!isset($discuz) || !is_a($discuz, 'discuz_core')) {
    $discuz =& discuz_core::instance();
}
$GLOBALS[XWB_SITE_GLOBAL_V_NAME]['site_db'] =& DB::object();
// 附属站点所用的字符集 UTF8 GBK BIG5
define('XWB_S_CHARSET', str_replace("-", "", strtoupper($discuz->config['output']['charset'])));
// 附属站点所用的表前缀
define('XWB_S_TBPRE', $discuz->db->tablepre);
// 附属站点 的版本号
define('XWB_S_VERSION', substr($discuz->var['setting']['version'], 1));
// 附属站点 的类型名称
define('XWB_S_NAME', 'DiscuzX');
// 附属站点 的标题名称
define('XWB_S_TITLE', XWB_plugin::convertEncoding($discuz->var['setting']['bbname'], XWB_S_CHARSET, 'UTF-8'));
// 附属站点 的用户UID
define('XWB_S_UID', (int) $discuz->var['uid']);
define('XWB_S_IS_ADMIN', (int) $discuz->var['adminid'] == 1 ? true : false);
if (!defined('CURSCRIPT') || CURSCRIPT == '') {
    $XWB_S_CURSCRIPT = isset($_SERVER['SCRIPT_FILENAME']) ? substr(basename($_SERVER['SCRIPT_FILENAME']), 0, -4) : 'unknown';
    define('XWB_S_CURSCRIPT', $XWB_S_CURSCRIPT);
} else {
    define('XWB_S_CURSCRIPT', CURSCRIPT);
}
//echo '<pre>';print_r(get_defined_constants());echo '</pre>';exit;
define('XWB_PLUGIN_SITE_ENV_LOADED', true);
Пример #19
0
		<!--安装失败的信息:给出提示信息-->
		<div class="mainTxt">
			<hr />
            		<div class="con red"><p><strong>安装失败,安装数据已全部回退。</strong></p></div>
			<div class="con red"><p>如果您能将“初始化程序以及数据”提示信息,以及论坛地址、论坛版本和论坛字符编码等信息反馈给我们(比如<a href="http://bbs.x.weibo.com/forum/forumdisplay.php?fid=9" target="_blank">官方论坛</a>),将有助于我们的产品改进,感谢您的支持!</p></div>
			<div class="con red"><p>联系邮箱:<a href="mailto:xweibo@vip.sina.com">mailto:xweibo@vip.sina.com</a>&nbsp;|&nbsp;技术支持:<a href="http://x.weibo.com/" target="_blank">Xweibo官网</a></p></div>
		</div>
		<div class="clear"></div>
		
		<?php 
}
?>
		
		<div class="footer">Copyright &copy; 1996-2010 SINA</div>
		</div>
</div>

<?php 
//统计上报[安装]
$xwb_statType = 'in';
$xwb_statArgs = array();
$xwb_statArgs['akey'] = $appkey;
$xwb_statArgs['uid'] = 0;
$xwb_statArgs['domain'] = str_replace(array('http://', 'https://'), '', XWB_plugin::baseUrl());
$xwb_statArgs['qq'] = $qq;
echo XWB_plugin::statUrl($xwb_statType, $xwb_statArgs, true);
?>

</body>
</html>
 /**
  * 获取新浪微博或者xweibo的个人主页link
  * @param bigint $sina_uid
  * @return string
  */
 function getWeiboProfileLink($sina_uid = 0)
 {
     $xweibourl = rtrim(XWB_plugin::pCfg('baseurl_to_xweibo'), '/');
     if (XWB_plugin::pCfg('switch_to_xweibo') && !empty($xweibourl)) {
         $xweibourl_ta = $xweibourl . '/index.php?m=ta&id=' . $sina_uid;
     } else {
         $xweibourl_ta = 'http://weibo.com/' . $sina_uid;
     }
     return $xweibourl_ta;
 }
            		<ul>
                    	<li>
                    		<label for="part90">
                        		<input class="chk" id="part90" name="pluginCfg[is_rebutton_relateUid_assoc]" type="checkbox" value="1" <?php 
echo XWB_plugin::pCfg('is_rebutton_relateUid_assoc') ? 'checked="checked"' : '';
?>
 />转发到微博时关联官方帐号<span>(官方账号在转发时会被@,并在转发后提示关注他)</span>
                       	    </label>
                    	</li>
                    	<?php 
if (version_compare(XWB_S_VERSION, '2', '>=')) {
    ?>
                    	<li>
                    		<label for="part91">
                        		<input class="chk" id="part91" name="pluginCfg[display_ow_in_forum_index]" type="checkbox" value="1" <?php 
    echo XWB_plugin::pCfg('display_ow_in_forum_index') ? 'checked="checked"' : '';
    ?>
 />在论坛首页显示官方帐号和关注按钮
                       	    </label>
                    	</li>
                    	<?php 
}
?>
            		</ul>
            		<div class="btn">
            			<input class="conmon-btn" name="submit" type="submit" value="保存设置" />
            		</div>
            	</form>
            	<iframe src="" name="xwbHideFrame" frameborder="0" height="0" width="0"></iframe>
            </div>
            
Пример #22
0
                </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>
Пример #23
0
 function SyncReply()
 {
     $sina = jconf::get('sina');
     if (!$sina['is_syncreply_tojishigou']) {
         return;
     }
     $tid = max(0, (int) ($this->Post['tid'] ? $this->Post['tid'] : $this->Get['tid']));
     if (!$tid) {
         return;
     }
     $info = DB::fetch_first("select * from " . TABLE_PREFIX . "xwb_bind_topic where `tid`='{$tid}'");
     if (!$info) {
         return;
     }
     $mid = $info['mid'];
     if (!$mid) {
         return;
     }
     if ($sina['syncweibo_tojishigou_time'] > 0 && $info['last_read_time'] + $sina['syncweibo_tojishigou_time'] > time()) {
         return;
     }
     if (!($topic_info = DB::fetch_first("select * from " . TABLE_PREFIX . "topic where `tid`='{$tid}'"))) {
         return;
     }
     $xwb_bind_info = sina_weibo_bind_info($topic_info['uid']);
     if (!$xwb_bind_info) {
         return;
     }
     if (!sina_weibo_bind($topic_info['uid'])) {
         return;
     }
     if (!sina_weibo_syncreply_tojishigou($topic_info['uid'])) {
         return;
     }
     if (!$this->MemberHandler->HasPermission('xwb', '__syncreply', 0, $topic_info['uid'])) {
         return;
     }
     if ($this->module_config['oauth2_enable']) {
         $p = array('id' => $mid, 'access_token' => $xwb_bind_info['access_token']);
         $rets = sina_weibo_api('2/comments/show', $p, 'GET');
         $datas = $rets['comments'];
     } else {
         require_once ROOT_PATH . 'include/ext/xwb/sina.php';
         $wb = XWB_plugin::getWB();
         $datas = $wb->getComments($mid);
     }
     if ($datas) {
         krsort($datas);
         $TopicLogic = jlogic('topic');
         foreach ($datas as $data) {
             $mid = $data['idstr'] ? $data['idstr'] : ($data['mid'] ? $data['mid'] : $data['id']);
             $sina_uid = $data['user']['id'];
             if ($mid && ($bind_info = DB::fetch_first("select * from " . TABLE_PREFIX . "xwb_bind_info where `sina_uid`='{$sina_uid}'")) && !DB::fetch_first("select * from " . TABLE_PREFIX . "xwb_bind_topic where `mid`='{$mid}'") && ($content = trim(strip_tags(array_iconv('utf-8', $this->Config['charset'], $data['text'] . (isset($data['retweeted_status']) ? " /" . "/@{$data['retweeted_status']['user']['name']}: {$data['retweeted_status']['text']}" : "")))))) {
                 DB::query("insert into " . TABLE_PREFIX . "xwb_bind_topic (`mid`) values ('{$mid}')");
                 $_t = time();
                 if ($data['created_at']) {
                     $_t = strtotime($data['created_at']);
                 }
                 $_t = is_numeric($_t) ? $_t : 0;
                 $add_datas = array('totid' => $tid, 'content' => $content, 'from' => 'sina', 'type' => 'reply', 'uid' => $bind_info['uid'], 'timestamp' => $_t);
                 $add_result = $TopicLogic->Add($add_datas);
                 if (is_array($add_result) && count($add_result)) {
                     $_tid = max(0, (int) $add_result['tid']);
                     if ($_tid) {
                         if ($sina['is_syncimage_tojishigou'] && $data['original_pic']) {
                             $TopicLogic->_parse_url_image($add_result, $data['original_pic']);
                         }
                         DB::query("replace into " . DB::table('xwb_bind_topic') . " (`tid`, `mid`) values ('{$_tid}', '{$mid}')");
                     }
                 }
             }
         }
     }
     DB::query("update `" . TABLE_PREFIX . "xwb_bind_topic` set `last_read_time`='" . time() . "' where `tid`='{$tid}'");
 }
 /**
  * 根据发送过来的数据,组装出已经转码的、要插入对应数据库的回帖内容
  *
  * @param array $data API发送过来的数据
  * @return string 要插入的回帖内容(已经转码)
  */
 function _createContent($data)
 {
     //转换为论坛所需要的字符集
     if (empty($data['nick'])) {
         $data['nick'] = '回推';
     }
     $nickname = XWB_plugin::convertEncoding((string) $data['nick'], 'UTF-8', XWB_S_CHARSET);
     $content = XWB_plugin::convertEncoding((string) $data['text'], 'UTF-8', XWB_S_CHARSET);
     //DZ函数
     $content = dhtmlspecialchars($content);
     $content = $this->_replaceSinaUrlToUBB($content);
     $content = $this->_filterContent($content);
     if (empty($content)) {
         return '';
     }
     if (isset($data['pic']) && !empty($data['pic'])) {
         $content .= "\n\n" . '[img]http://ww3.sinaimg.cn/large/' . $data['pic'] . '.jpg[/img]';
     }
     $content = $content . "\n\n" . '[img]' . XWB_plugin::getPluginUrl('images/bgimg/icon_logo.png') . '[/img] ' . '[size=2][color=gray]' . '[url=' . XWB_plugin::getWeiboProfileLink($data['uid']) . ']' . XWB_plugin::L('xwb_reply_from_2', $nickname) . '[/url][/color][/size]';
     return $content;
 }
<?php

/*
 * @version $Id: newarticle.hack.php 453 2010-12-23 04:36:02Z yaoying $
 */
if (!defined('IS_IN_XWB_PLUGIN')) {
    exit('Access Denied!');
}
global $_G;
$aid = isset($GLOBALS['aid']) ? (int) $GLOBALS['aid'] : 0;
$subject = isset($_POST['title']) ? (string) $_POST['title'] : '';
if ($aid >= 1) {
    if (XWB_plugin::V('p:syn')) {
        $xp_publish = XWB_plugin::N('xwb_plugins_publish');
        register_shutdown_function(array(&$xp_publish, 'articleSync'), (int) $aid, $subject);
    }
}
 /**
  * 将用户帐号导入(主要应对用了UC的多论坛)
  * 本函数主要供_setPushbackSiteAccount方法使用
  * @param array $userInfo uc_get_user返回的数据
  */
 function _importUserFromUC($userInfo)
 {
     $uid = (int) $userInfo[0];
     $db = XWB_plugin::getDB();
     $exist_uid = intval($db->result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE uid='{$userInfo[0]}' LIMIT 0,1 "));
     if ($exist_uid > 0) {
         return true;
     }
     $username = mysql_real_escape_string($userInfo[1]);
     $email = mysql_real_escape_string($userInfo[2]);
     $password = md5(rand(1, 10000));
     $db->query("INSERT IGNORE INTO " . DB::table('common_member') . " (uid, username, password, adminid, groupid, email)\n\t\t\tVALUES ('{$uid}', '{$username}', '{$password}', '0', '10', '{$email}')");
     $db->query("INSERT IGNORE INTO " . DB::table('common_member_status') . " (uid)\n\t\t\tVALUES ('{$uid}')");
     $db->query("INSERT IGNORE INTO " . DB::table('common_member_profile') . " (uid)\n\t\t\tVALUES ('{$uid}')");
     $db->query("INSERT IGNORE INTO " . DB::table('common_member_field_forum') . " (uid)\n\t\t\tVALUES ('{$uid}')");
     $db->query("INSERT IGNORE INTO " . DB::table('common_member_field_home') . " (uid)\n\t\t\tVALUES ('{$uid}')");
     $db->query("INSERT IGNORE INTO " . DB::table('common_member_count') . " (uid)\n\t\t\tVALUES ('{$uid}')");
     manyoulog('user', $this->uid, 'add');
     return true;
 }
Пример #27
0
echo $GLOBALS['_J']['site_url'] . ('/images/xwb/xwb_' . XWB_S_VERSION . '.css');
?>
" />
<style>


	
	
</style>
</head>

<body>

<div class="bind-setting xwb-plugin">
	<p class="alert-tips">你还没有绑定新浪微博帐号!</p>
    <div class="bing-text">
    	<h4>绑定后,你将获得以下特权:</h4>
        <p>可以使用新浪微博帐号登录本站,不用担心忘记密码</p>
        <p>在本站发微博可选同步发到新浪微博,吸引更多人关注</p>
        <!-- <p>可使用新浪微博签名</p> -->
    </div>
    <a class="bind-btn" href="<?php 
echo XWB_plugin::URL('xwbAuth.login');
?>
" class="mibLoginBtn" target="_top"></a>
    <p class="txtb">还没有新浪微博帐号?<a href="http://cnrdn.com/pNj4" class="cp_more" target="_blank">30秒完成免费注册</a></p>
</div>

</body>
</html>
	<div class="bing-text">
            <?php 
if ('api' == $errorType) {
    ?>
				<p>服务器无法连接到新浪微博API服务器;或新浪微博API服务器无响应。</p>
				<p>稍候一下,然后重新打开此页面;如果此错误信息重复出现,<strong>请联系网站管理员处理。</strong></p>
			<?php 
} elseif ('file' == $errorType) {
    ?>
				<p>请确保拥有权限,无法创建数据缓存文件。</p>
			<?php 
}
?>
    </div>
    
    <div class="setting-box">
        <form id="unbindFrm" action="<?php 
echo XWB_plugin::getEntryURL('xwbSiteInterface.unbind');
?>
" method="post" target="xwbSiteRegister" >
			<h3>解除绑定</h3>
			<div class="xwb-plugin-btn"><input type="button" class="button" value="解除绑定" onclick="xwb_unbind();return false;" ></div>
			<p class="tips"></p>
		</form>
    </div>
    
</div>
<iframe src="" name="xwbSiteRegister" frameborder="0" height="0" width="0"></iframe>
</body>
</html>
<link type="text/css" rel="stylesheet" href="<?php 
echo $GLOBALS['_J']['site_url'] . ('/images/xwb/xwb_' . XWB_S_VERSION . '.css');
?>
" />
<style>

	
</style>
</head>

<body>

<div class="bind-setting xwb-plugin">
	<p class="alert-tips">与新浪微博帐号绑定成功!</p>
    <div class="bing-text">
    	<h4>您现在可以:</h4>
        <p>使用新浪微博帐号登录本站,不用担心忘记密码</p>
        <p>在本站发微博可选同步发到新浪微博上,吸引更多人关注</p>
    </div>
    <p class="txtb">&nbsp;<a href="<?php 
echo XWB_plugin::URL('xwbSiteInterface.bind&share=1');
?>
"><strong>发一条微博告诉我的粉丝</strong></a>&nbsp;&nbsp;<a href="<?php 
echo XWB_plugin::URL('xwbSiteInterface.bind&skip_share=1');
?>
">或者点此进入设置页面</a>&nbsp;</p>
</div>

</body>
</html>
 /**
  * 设置帖子同步标志
  * @param $tid int thread id
  * @param $mid int 微博id
  */
 function _setSynId($tid, $mid)
 {
     $tid = is_numeric($tid) ? $tid : 0;
     $mid = is_numeric($mid) ? $mid : 0;
     if ($tid > 0 && $mid > 0) {
         $db = XWB_plugin::getDB();
         $sql = 'INSERT INTO ' . XWB_S_TBPRE . 'xwb_bind_topic(`tid`,`mid`) VALUES("' . $tid . '", "' . mysql_real_escape_string($mid) . '")';
         $db->query($sql);
         if ($db->affected_rows()) {
             return true;
         }
     }
     return false;
 }