First commit

This commit is contained in:
2025-06-18 10:24:27 +08:00
commit ebc39cd5dd
3873 changed files with 412712 additions and 0 deletions

View File

@@ -0,0 +1,98 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cloud_connect.php 33756 2013-08-10 06:32:48Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Util.php';
$utilService = new Cloud_Service_Util();
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Connect.php';
$connectService = new Cloud_Service_Connect();
$op = $_GET['op'];
$_GET['anchor'] = in_array($_GET['anchor'], array('setting', 'service')) ? $_GET['anchor'] : 'setting';
$current = array($_GET['anchor'] => 1);
if (!$_G['inajax']) {
cpheader();
}
if ($_GET['anchor'] == 'setting') {
$setting = C::t('common_setting')->fetch_all_setting(array('extcredits', 'connect', 'connectsiteid', 'connectsitekey', 'regconnect', 'connectappid', 'connectappkey'));
$setting['connect'] = (array)dunserialize($setting['connect']);
if(!submitcheck('connectsubmit')) {
include_once libfile('function/forumlist');
$forumselect = array();
$forumselect['t'] = '<select name="connectnew[t][fids][]" multiple="multiple" size="10">'.forumselect(FALSE, 0, 0, TRUE).'</select>';
if($setting['connect']['t']['fids']) {
foreach($setting['connect']['t']['fids'] as $v) {
$forumselect['t'] = str_replace('<option value="'.$v.'">', '<option value="'.$v.'" selected>', $forumselect['t']);
}
}
$connectrewardcredits = $connectgroup = $connectguestgroup = '';
$setting['extcredits'] = dunserialize($setting['extcredits']);
for($i = 0; $i <= 8; $i++) {
if($setting['extcredits'][$i]['available']) {
$extcredit = 'extcredits'.$i.' ('.$setting['extcredits'][$i]['title'].')';
$connectrewardcredits .= '<option value="'.$i.'" '.($i == intval($setting['connect']['register_rewardcredit']) ? 'selected' : '').'>'.($i ? $extcredit : $lang['none']).'</option>';
}
}
$groups = C::t('common_usergroup')->fetch_all_by_type('special');
foreach($groups as $group) {
$connectgroup .= "<option value=\"{$group['groupid']}\" ".($group['groupid'] == $setting['connect']['register_groupid'] ? 'selected' : '').">{$group['grouptitle']}</option>\n";
$connectguestgroup .= "<option value=\"{$group['groupid']}\" ".($group['groupid'] == $setting['connect']['guest_groupid'] ? 'selected' : '').">{$group['grouptitle']}</option>\n";
}
showformheader('plugins&operation=config&do='.$pluginid.'&identifier=qqconnect&pmod=admincp', 'connectsubmit');
showtableheader();
showsetting('connect_setting_allow', 'connectnew[allow]', $setting['connect']['allow'], 'radio', 0, 1);
showsetting('App Id', 'connectappidnew', $setting['connectappid'], 'text', '', 0, $scriptlang['qqconnect']['connect_appid_desc']);
showsetting('App Key', 'connectappkeynew', $setting['connectappkey'], 'text');
showsetting('setting_access_guest_connect_group', '', '', '<select name="connectnew[guest_groupid]"><option value="0">'.$lang['usergroups_system_0'].'</option>'.$connectguestgroup.'</select>');
showsetting('setting_access_register_connect_birthday', 'connectnew[register_birthday]', $setting['connect']['register_birthday'], 'radio');
showsetting('setting_access_register_connect_gender', 'connectnew[register_gender]', $setting['connect']['register_gender'], 'radio');
showsetting('setting_access_register_connect_uinlimit', 'connectnew[register_uinlimit]', $setting['connect']['register_uinlimit'], 'text');
showsetting('setting_access_register_connect_credit', '', '', '<select name="connectnew[register_rewardcredit]">'.$connectrewardcredits.'</select>');
showsetting('setting_access_register_connect_addcredit', 'connectnew[register_addcredit]', $setting['connect']['register_addcredit'], 'text');
showsetting('setting_access_register_connect_group', '', '', '<select name="connectnew[register_groupid]"><option value="0">'.$lang['usergroups_system_0'].'</option>'.$connectgroup.'</select>');
showsetting('setting_access_register_connect_regverify', 'connectnew[register_regverify]', $setting['connect']['register_regverify'], 'radio');
showsetting('setting_access_register_connect_invite', 'connectnew[register_invite]', $setting['connect']['register_invite'], 'radio');
showsetting('setting_access_register_connect_newbiespan', 'connectnew[newbiespan]', $setting['connect']['newbiespan'], 'text');
showtagfooter('tbody');
showsubmit('connectsubmit');
showtablefooter();
showformfooter();
} else {
$_GET['connectnew'] = array_merge($setting['connect'], $_GET['connectnew']);
$_GET['connectnew']['like_url'] = '';
$_GET['connectnew']['turl_code'] = '';
$connectnew = serialize($_GET['connectnew']);
$regconnectnew = !$setting['connect']['allow'] && $_GET['connectnew']['allow'] ? 1 : $setting['regconnect'];
C::t('common_setting')->update_batch(array(
'regconnect' => $regconnectnew,
'connect' => $connectnew,
'connectappid' => $_GET['connectappidnew'],
'connectappkey' => $_GET['connectappkeynew'],
));
updatecache(array('setting', 'fields_register', 'fields_connect_register'));
cpmsg('connect_update_succeed', 'action=plugins&operation=config&do='.$pluginid.'&identifier=qqconnect&pmod=admincp', 'succeed');
}
}

View File

@@ -0,0 +1,304 @@
<?php
/**
* [Discuz! X] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: connect.class.php 34497 2014-05-09 09:05:09Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class plugin_qqconnect_base {
public $retryInterval = 60;
public $retryMax = 5;
public $retryAvaiableTime = 1800;
function init() {
global $_G;
include_once template('qqconnect:module');
if(!$_G['setting']['connect']['allow'] || $_G['setting']['bbclosed']) {
return;
}
$this->allow = true;
}
function common_base() {
global $_G;
if(!isset($_G['connect'])) {
$_G['connect']['qzone_public_share_url'] = 'https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey';
$_G['connect']['referer'] = !$_G['inajax'] && CURSCRIPT != 'member' ? $_G['basefilename'].($_SERVER['QUERY_STRING'] ? '?'.$_SERVER['QUERY_STRING'] : '') : dreferer();
$_G['connect']['login_url'] = $_G['siteurl'].'connect.php?mod=login&op=init&referer='.urlencode($_G['connect']['referer'] ? $_G['connect']['referer'] : 'index.php');
$_G['connect']['callback_url'] = $_G['siteurl'].'connect.php?mod=login&op=callback';
$_G['connect']['discuz_new_feed_url'] = $_G['siteurl'].'connect.php?mod=feed&op=new&formhash=' . formhash();
$_G['connect']['discuz_new_post_feed_url'] = $_G['siteurl'].'connect.php?mod=feed&op=new&action=post&formhash=' . formhash();
$_G['connect']['discuz_new_share_url'] = $_G['siteurl'].'home.php?mod=spacecp&ac=plugin&id=qqconnect:spacecp&pluginop=new';
$_G['connect']['discuz_sync_tthread_url'] = $_G['siteurl'].'home.php?mod=spacecp&ac=plugin&id=qqconnect:spacecp&pluginop=sync_tthread&formhash=' . formhash();
$_G['connect']['discuz_change_qq_url'] = $_G['siteurl'].'connect.php?mod=login&op=change';
$_G['connect']['auth_fields'] = array(
'is_user_info' => 1,
'is_feed' => 0,
);
if($_G['uid']) {
dsetcookie('connect_is_bind', $_G['member']['conisbind'], 31536000);
if(!$_G['member']['conisbind'] && $_G['cookie']['connect_login']) {
$_G['cookie']['connect_login'] = 0;
dsetcookie('connect_login');
}
}
if (!$_G['uid'] && $_G['connectguest']) {
if ($_G['cookie']['connect_qq_nick']) {
$_G['member']['username'] = $_G['cookie']['connect_qq_nick'];
} else {
$connectGuest = C::t('#qqconnect#common_connect_guest')->fetch($conopenid);
if ($connectGuest['conqqnick']) {
$_G['member']['username'] = $connectGuest['conqqnick'];
}
}
}
if($this->allow && !$_G['uid'] && !defined('IN_MOBILE')) {
$_G['setting']['pluginhooks']['global_login_text'] = tpl_login_bar();
}
}
}
}
class plugin_qqconnect extends plugin_qqconnect_base {
var $allow = false;
function __construct() {
$this->init();
}
function common() {
$this->common_base();
}
function discuzcode($param) {
global $_G;
if($param['caller'] == 'discuzcode') {
$_G['discuzcodemessage'] = preg_replace('/\[wb=(.+?)\](.+?)\[\/wb\]/', '', $_G['discuzcodemessage']);
}
if($param['caller'] == 'messagecutstr') {
$_G['discuzcodemessage'] = preg_replace('/\[tthread=(.+?)\](.*?)\[\/tthread\]/', '', $_G['discuzcodemessage']);
}
}
function global_login_extra() {
global $_G;
if(!$this->allow) {
return;
}
return tpl_global_login_extra();
}
function global_usernav_extra1() {
global $_G;
if(!$this->allow) {
return;
}
if (!$_G['uid'] && !$_G['connectguest']) {
return;
}
if(!$_G['member']['conisbind']) {
return tpl_global_usernav_extra1();
}
}
function _allowconnectfeed() {
if(!$this->allow) {
return;
}
global $_G;
return $_G['uid'] && $_G['setting']['connect']['allow'] && $_G['setting']['connect']['feed']['allow'] && ($_G['forum']['status'] == 3 && $_G['setting']['connect']['feed']['group'] || $_G['forum']['status'] != 3 && (!$_G['setting']['connect']['feed']['fids'] || in_array($_G['fid'], $_G['setting']['connect']['feed']['fids'])));
}
function _allowconnectt() {
if(!$this->allow) {
return;
}
global $_G;
return $_G['uid'] && $_G['setting']['connect']['allow'] && $_G['setting']['connect']['t']['allow'] && ($_G['forum']['status'] == 3 && $_G['setting']['connect']['t']['group'] || $_G['forum']['status'] != 3 && (!$_G['setting']['connect']['t']['fids'] || in_array($_G['fid'], $_G['setting']['connect']['t']['fids'])));
}
function _viewthread_share_method_output() {
global $_G;
$_G['connect']['qq_share_url'] = $_G['siteurl'] . 'home.php?mod=spacecp&ac=plugin&id=qqconnect:spacecp&pluginop=share&sh_type=4&thread_id=' . $_G['tid'];
$_G['connect']['first_post'] = $postlist[$_G['forum_firstpid']];
if ($_G['connect']['first_post']['anonymous']) {
$_G['connect']['first_post']['authorid'] = 0;
$_G['connect']['first_post']['author'] = '';
}
if ($_G['group']['allowgetimage'] && $_G['thread']['price'] == 0) {
if (trim($_G['forum']['viewperm'])) {
$allowViewPermGroupIds = explode("\t", trim($_G['forum']['viewperm']));
}
if (trim($_G['forum']['getattachperm'])) {
$allowViewAttachGroupIds = explode("\t", trim($_G['forum']['getattachperm']));
}
$bigWidth = '400';
$bigHeight = '400';
$share_images = array();
foreach ($_G['connect']['first_post']['attachments'] as $attachment) {
if ($attachment['isimage'] == 0 || $attachment['price'] > 0
|| $attachment['readperm'] > $_G['group']['readaccess']
|| ($allowViewPermGroupIds && !in_array($_G['groupid'], $allowViewPermGroupIds))
|| ($allowViewAttachGroupIds && !in_array($_G['groupid'], $allowViewAttachGroupIds))) {
continue;
}
$bigImageURL = $_G['siteurl'] . getforumimg($attachment['aid'], 1, $bigWidth, $bigHeight, 'fixnone');
$share_images[] = urlencode($bigImageURL);
}
$_G['connect']['share_images'] = implode('|', $share_images);
}
return tpl_viewthread_share_method($jsurl);
}
}
class plugin_qqconnect_member extends plugin_qqconnect {
function connect_member() {
global $_G, $seccodecheck, $secqaacheck, $connect_guest;
if($this->allow) {
if($_G['uid'] && $_G['member']['conisbind']) {
dheader('location: '.$_G['siteurl'].'index.php');
}
$connect_guest = array();
if($_G['connectguest'] && (submitcheck('regsubmit', 0, $seccodecheck, $secqaacheck) || submitcheck('loginsubmit', 1, $seccodestatus))) {
if(!$_GET['auth_hash']) {
$_GET['auth_hash'] = $_G['cookie']['con_auth_hash'];
}
$conopenid = authcode($_GET['auth_hash']);
$connect_guest = C::t('#qqconnect#common_connect_guest')->fetch($conopenid);
if(!$connect_guest) {
dsetcookie('con_auth_hash');
showmessage('qqconnect:connect_login_first');
}
}
}
}
function logging_member() {
global $_G;
if($this->allow && $_G['connectguest'] && $_GET['action'] == 'login') {
if ($_G['inajax']) {
showmessage('qqconnect:connectguest_message_complete_or_bind');
} else {
dheader('location: '.$_G['siteurl'].'member.php?mod=connect&ac=bind');
}
}
}
function register_member() {
global $_G;
if($this->allow && $_G['connectguest']) {
if ($_G['inajax']) {
showmessage('qqconnect:connectguest_message_complete_or_bind');
} else {
dheader('location: '.$_G['siteurl'].'member.php?mod=connect');
}
}
}
function logging_method() {
if(!$this->allow) {
return;
}
return tpl_login_bar();
}
function register_logging_method() {
if(!$this->allow) {
return;
}
return tpl_login_bar();
}
function connect_input_output() {
if(!$this->allow) {
return;
}
global $_G;
$_G['setting']['pluginhooks']['register_input'] = tpl_register_input();
}
function connect_bottom_output() {
if(!$this->allow) {
return;
}
global $_G;
$_G['setting']['pluginhooks']['register_bottom'] = tpl_register_bottom();
}
}
class plugin_qqconnect_forum extends plugin_qqconnect {
function viewthread_share_method_output() {
return $this->_viewthread_share_method_output();
}
}
class plugin_qqconnect_group extends plugin_qqconnect {
function viewthread_share_method_output() {
return $this->_viewthread_share_method_output();
}
}
class mobileplugin_qqconnect extends plugin_qqconnect_base {
var $allow = false;
function __construct() {
global $_G;
if(!$_G['setting']['connect']['allow'] || $_G['setting']['bbclosed']) {
return;
}
$this->allow = true;
}
function common() {
$this->common_base();
}
}
class mobileplugin_qqconnect_member extends mobileplugin_qqconnect {
function connect_member() {
global $_G, $seccodecheck, $secqaacheck, $connect_guest;
if($this->allow) {
if($_G['uid'] && $_G['member']['conisbind']) {
dheader('location: '.$_G['siteurl'].'index.php');
}
$connect_guest = array();
if($_G['connectguest'] && (submitcheck('regsubmit', 0, $seccodecheck, $secqaacheck) || submitcheck('loginsubmit', 1, $seccodestatus))) {
if(!$_GET['auth_hash']) {
$_GET['auth_hash'] = $_G['cookie']['con_auth_hash'];
}
$conopenid = authcode($_GET['auth_hash']);
$connect_guest = C::t('#qqconnect#common_connect_guest')->fetch($conopenid);
if(!$connect_guest) {
dsetcookie('con_auth_hash');
showmessage('qqconnect:connect_login_first');
}
}
}
}
}

View File

@@ -0,0 +1,40 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: connect_check.php 31305 2012-08-09 06:36:16Z liudongdong $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Util.php';
$utilService = new Cloud_Service_Util();
$op = !empty($_GET['op']) ? $_GET['op'] : '';
if (!in_array($op, array('cookie'))) {
$connectService->connectAjaxOuputMessage('0', '1');
}
if ($op == 'cookie') {
loadcache('connect_login_report_date');
$cookieLogins = C::t('common_setting')->fetch_setting('connect_login_times');
if (dgmdate(TIMESTAMP, 'Y-m-d') != $_G['cache']['connect_login_report_date']) {
if (!discuz_process::islocked('connect_login_report', 600)) {
$result = $connectService->connectCookieLoginReport($cookieLogins);
if (isset($result['status']) && $result['status'] == 0) {
$date = dgmdate(TIMESTAMP, 'Y-m-d');
C::t('common_setting')->update_setting('connect_login_times', 0);
C::t('common_setting')->update_setting('connect_login_report_date', $date);
savecache('connect_login_report_date', $date);
}
}
discuz_process::unlock('connect_login_report');
}
}
include template('common/header_ajax');
include template('common/footer_ajax');

View File

@@ -0,0 +1,156 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: connect_config.php 33543 2013-07-03 06:01:33Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(empty($_G['uid'])) {
showmessage('to_login', '', array(), array('showmsg' => true, 'login' => 1));
}
$op = !empty($_GET['op']) ? $_GET['op'] : '';
$referer = dreferer();
if(submitcheck('connectsubmit')) {
if($op == 'config') { // debug 修改QQ绑定设置
$ispublisht = !empty($_GET['ispublisht']) ? 1 : 0;
C::t('#qqconnect#common_member_connect')->update($_G['uid'],
array(
'conispublisht' => $ispublisht,
)
);
if (!$ispublisht) {
dsetcookie('connect_synpost_tip');
}
showmessage('qqconnect:connect_config_success', $referer);
} elseif($op == 'unbind') {
$connect_member = C::t('#qqconnect#common_member_connect')->fetch($_G['uid']);
$_G['member'] = array_merge($_G['member'], $connect_member);
if ($connect_member['conuinsecret']) {
if($_G['member']['conisregister']) {
if($_G['setting']['strongpw']) {
$strongpw_str = array();
if(in_array(1, $_G['setting']['strongpw']) && !preg_match("/\d+/", $_GET['newpassword1'])) {
$strongpw_str[] = lang('member/template', 'strongpw_1');
}
if(in_array(2, $_G['setting']['strongpw']) && !preg_match("/[a-z]+/", $_GET['newpassword1'])) {
$strongpw_str[] = lang('member/template', 'strongpw_2');
}
if(in_array(3, $_G['setting']['strongpw']) && !preg_match("/[A-Z]+/", $_GET['newpassword1'])) {
$strongpw_str[] = lang('member/template', 'strongpw_3');
}
if(in_array(4, $_G['setting']['strongpw']) && !preg_match("/[^a-zA-z0-9]+/", $_GET['newpassword1'])) {
$strongpw_str[] = lang('member/template', 'strongpw_4');
}
if($strongpw_str) {
showmessage(lang('member/template', 'password_weak').implode(',', $strongpw_str));
}
}
if($_GET['newpassword1'] !== $_GET['newpassword2']) {
showmessage('profile_passwd_notmatch', $referer);
}
if(!$_GET['newpassword1'] || $_GET['newpassword1'] != addslashes($_GET['newpassword1'])) {
showmessage('profile_passwd_illegal', $referer);
}
}
} else { // debug 因为老用户access token等信息所以没法通知connect所以直接在本地解绑就行了不fopen connect
if($_G['member']['conisregister']) {
if($_GET['newpassword1'] !== $_GET['newpassword2']) {
showmessage('profile_passwd_notmatch', $referer);
}
if(!$_GET['newpassword1'] || $_GET['newpassword1'] != addslashes($_GET['newpassword1'])) {
showmessage('profile_passwd_illegal', $referer);
}
}
}
C::t('#qqconnect#common_member_connect')->delete($_G['uid']);
C::t('common_member')->update($_G['uid'], array('conisbind' => 0));
C::t('#qqconnect#connect_memberbindlog')->insert(
array(
'uid' => $_G['uid'],
'uin' => $_G['member']['conopenid'],
'type' => 2,
'dateline' => $_G['timestamp'],
)
);
if($_G['member']['conisregister']) {
loaducenter();
uc_user_edit(addslashes($_G['member']['username']), null, $_GET['newpassword1'], null, 1);
}
foreach($_G['cookie'] as $k => $v) {
dsetcookie($k);
}
$_G['uid'] = $_G['adminid'] = 0;
$_G['username'] = $_G['member']['password'] = '';
showmessage('qqconnect:connect_config_unbind_success', 'member.php?mod=logging&action=login');
}
} else {
if($_G['inajax'] && $op == 'synconfig') {
C::t('#qqconnect#common_member_connect')->update($_G['uid'],
array(
'conispublisht' => 0,
)
);
dsetcookie('connect_synpost_tip');
} elseif($op == 'weibosign') {
if($_GET['hash'] != formhash()) {
showmessage('submit_invalid');
}
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Connect.php';
$connectService = new Cloud_Service_Connect();
$connectService->connectMergeMember();
if($_G['member']['conuin'] && $_G['member']['conuinsecret']) {
$arr = array();
$arr['oauth_consumer_key'] = $_G['setting']['connectappid'];
$arr['oauth_nonce'] = mt_rand();
$arr['oauth_timestamp'] = TIMESTAMP;
$arr['oauth_signature_method'] = 'HMAC_SHA1';
$arr['oauth_token'] = $_G['member']['conuin'];
ksort($arr);
$arr['oauth_signature'] = $connectService->connectGetOauthSignature('http://api.discuz.qq.com/connect/getSignature', $arr, 'GET', $_G['member']['conuinsecret']);
$arr['version'] = 'qzone1.0';
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Util.php';
$utilService = new Cloud_Service_Util();
$result = $connectService->connectOutputPhp('http://api.discuz.qq.com/connect/getSignature?' . $utilService->httpBuildQuery($arr, '', '&'));
if ($result['status'] == 0) {
$connectService->connectAjaxOuputMessage('[wb=' . $result['result']['username'] . ']' . $result['result']['signature_url'] . '[/wb]', 0);
} else {
$connectService->connectAjaxOuputMessage('connect_wbsign_no_account', $result['status']);
}
} else {
$connectService->connectAjaxOuputMessage('connect_wbsign_no_bind', -1);
}
} else {
dheader('location: home.php?mod=spacecp&ac=plugin&id=qqconnect:spacecp');
}
}

View File

@@ -0,0 +1,292 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: connect_feed.php 36278 2016-12-09 07:52:35Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (trim($_GET['formhash']) != formhash()) {
exit('Access Denied');
}
$params = $_GET;
$op = !empty($_GET['op']) ? $_GET['op'] : '';
$action = !empty($_GET['action']) ? $_GET['action'] : 'thread';
if (!in_array($op, array('new'))) {
$connectService->connectJsOutputMessage('', 'undefined_action', 1);
}
if ($op == 'new') {
if ($action == 'thread') {
$tid = trim(intval($_GET['thread_id']));
if (empty($tid)) {
$connectService->connectJsOutputMessage('', 'connect_thread_id_miss', 1);
}
$connectService->connectMergeMember();
$post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($tid, 0);
$thread = C::t('forum_thread')->fetch_by_tid_displayorder($tid, 0);
$feedlog = C::t('#qqconnect#connect_feedlog')->fetch_by_tid($thread['tid']);
if ($_G['uid'] != $thread['authorid']) {
$connectService->connectJsOutputMessage('', 'connect_about', 2);
}
if (!getstatus($thread['status'], 7) && !getstatus($thread['status'], 8)) {
$connectService->connectJsOutputMessage('', 'connect_about', 2);
}
if ($feedlog['publishtimes'] >= 5 || $_G['timestamp'] - $thread['dateline'] > 1800) {
$connectService->connectJsOutputMessage('', 'connect_about', 2);
}
$f_type = trim(dintval($_GET['type']));
$msglower = strtolower($post['message']);
if(strpos($msglower, '[/quote]') !== FALSE) {
$post['message'] = preg_replace('/\[quote\].*\[\/quote\](\r\n|\n|\r){0,}/is', '', $post['message']);
}
if(strpos($msglower, '[/media]') !== FALSE) {
$post['message'] = preg_replace("/\[media=([\w%,]+)\]\s*([^\[\<\r\n]+?)\s*\[\/media\]/is", '', $post['message']);
}
if(strpos($msglower, '[/flash]') !== FALSE) {
$post['message'] = preg_replace("/\[flash(=(\d+),(\d+))?\]\s*([^\[\<\r\n]+?)\s*\[\/flash\]/is", '', $post['message']);
}
if(strpos($msglower, '[/hide]') !== FALSE) {
$post['message'] = preg_replace("/\[hide[=]?(d\d+)?[,]?(\d+)?\]\s*(.*?)\s*\[\/hide\]/is", '', $post['message']);
}
$html_content = $connectService->connectParseBbcode($post['message'], $thread['fid'], $post['pid'], $post['htmlon'], $attach_images);
$html_content = strip_tags(preg_replace('/(&nbsp;)+/', ' ', $html_content));
if($_G['setting']['rewritestatus'] && is_array($_G['setting']['rewritestatus']) && in_array('forum_viewthread', $_G['setting']['rewritestatus'])) {
$url = rewriteoutput('forum_viewthread', 1, $_G['siteurl'], $tid);
} else {
$url = $_G['siteurl'].'forum.php?mod=viewthread&tid='.$tid;
}
$qzone_params = array(
'title' => $thread['subject'],
'url' => $url,
'summary' => $html_content,
'nswb' => '1',
);
$_t_content = lang('plugin/qqconnect', 'connect_feed_iam');
$_t_content .= '#' . cutstr($_G['setting']['bbname'], 20,'') . '#';
$_t_content .= lang('plugin/qqconnect', 'connect_feed_published_thread', array('subject' => cutstr($thread['subject'], 120)));
$_t_content .= cutstr($html_content, 80);
$_t_content .= ' ' . $url;
$t_params = array(
'content' => $_t_content,
);
if($attach_images && is_array($attach_images)) {
$attach_image = array_shift($attach_images);
$qzone_params['images'] = $attach_image['big'];
$t_params['pic'] = $attach_image['path'];
$t_params['remote'] = $attach_image['remote'];
}
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/ConnectOAuth.php';
$connectOAuthClient = new Cloud_Service_Client_ConnectOAuth();
$feed_succ = $weibo_succ = false;
if(getstatus($f_type, 1)) {
try {
$response = $connectOAuthClient->connectAddShare($_G['member']['conopenid'], $_G['member']['conuin'], $_G['member']['conuinsecret'], $qzone_params);
$f_type = setstatus(1, 0, $f_type);
if ($response['ret'] == 0) {
$feed_succ = true;
}
} catch(Exception $e) {
if($e->getCode()) {
$f_type = setstatus(1, 0, $f_type);
$shareErrorCode = $e->getCode();
}
$feed_succ = false;
}
}
if(getstatus($f_type, 2)) {
try {
if ($t_params['pic']) {
$method = 'connectAddPicT';
} else {
$method = 'connectAddT';
}
$response = $connectOAuthClient->$method($_G['member']['conopenid'], $_G['member']['conuin'], $_G['member']['conuinsecret'], $t_params);
if($response['data']['id']) {
if($_G['setting']['connect']['t']['reply'] && $thread['tid'] && !$thread['closed'] && !getstatus($thread['status'], 3) && empty($_G['forum']['replyperm'])) {
$memberConnect = C::t('#qqconnect#common_member_connect')->fetch($thread['authorid']);
$conopenid = $memberConnect['conopenid'];
C::t('#qqconnect#connect_tthreadlog')->insert(array(
'twid' => $response['data']['id'],
'tid' => $tid,
'conopenid' => $conopenid,
'pagetime' => 0,
'lasttwid' => '0',
'nexttime' => $_G['timestamp'] + 30 * 60,
'updatetime' => 0,
'dateline' => $_G['timestamp'],
));
}
}
$f_type = setstatus(2, 0, $f_type);
if ($response['ret'] == 0) {
$weibo_succ = true;
}
} catch(Exception $e) {
if($e->getCode()) {
$f_type = setstatus(2, 0, $f_type);
$weiboErrorCode = $e->getCode();
}
$weibo_succ = false;
}
}
$thread_status = $thread['status'];
$feedlog_status = $feedlog['status'];
if ($feed_succ) {
$thread_status = setstatus(7, 0, $thread_status);
$feedlog_status = setstatus(2, 1, $feedlog_status);
$feedlog_status = setstatus(1, 0, $feedlog_status);
}
if ($weibo_succ) {
$thread_status = setstatus(8, 0, $thread_status);
$thread_status = setstatus(14, 1, $thread_status);
$feedlog_status = setstatus(4, 1, $feedlog_status);
$feedlog_status = setstatus(3, 0, $feedlog_status);
}
if ($feed_succ || $weibo_succ) {
C::t('#qqconnect#connect_feedlog')->update_by_tid($thread['tid'],
array(
'status' => $feedlog_status,
'lastpublished' => $_G['timestamp'],
'publishtimes' => $feedlog['publishtimes'] + 1,
));
C::t('forum_thread')->update($thread['tid'], array('status' => $thread_status));
}
if(!$shareErrorCode && !$weiboErrorCode) {
$connectService->connectJsOutputMessage(lang('plugin/qqconnect', 'connect_feed_sync_success'), '', 0);
} else {
C::t('#qqconnect#connect_feedlog')->update_by_tid($thread['tid'],
array(
'lastpublished' => $_G['timestamp'],
'publishtimes' => $feedlog['publishtimes'] + 1,
));
$connectService->connectJsOutputMessage('', '', $shareErrorCode.'|'.$weiboErrorCode);
}
} elseif ($action == 'post') {
$tid = trim(intval($_GET['thread_id']));
$pid = trim(intval($_GET['post_id']));
if (empty($pid)) {
$connectService->connectJsOutputMessage('', 'connect_thread_id_miss', 1);
}
$thread = C::t('forum_thread')->fetch_by_tid_displayorder($tid, 0);
$post = C::t('forum_post')->fetch_post('tid:'.$tid, $pid);
if (empty($thread) || empty($post)) {
$connectService->connectJsOutputMessage('', 'connect_thread_id_miss', 1);
}
if ($_G['uid'] != $post['authorid']) {
$connectService->connectJsOutputMessage('', 'connect_about', 2);
}
$feedlog = C::t('#qqconnect#connect_postfeedlog')->fetch_by_pid($pid);
if (!$feedlog || $feedlog['publishtimes'] >= 5 || $_G['timestamp'] - $post['dateline'] > 1800) {
$connectService->connectJsOutputMessage('', 'connect_about', 2);
}
$connectService->connectMergeMember();
$msglower = strtolower($post['message']);
if(strpos($msglower, '[/quote]') !== FALSE) {
$post['message'] = preg_replace('/\[quote\].*\[\/quote\](\r\n|\n|\r){0,}/is', '', $post['message']);
}
if(strpos($msglower, '[/media]') !== FALSE) {
$post['message'] = preg_replace("/\[media=([\w%,]+)\]\s*([^\[\<\r\n]+?)\s*\[\/media\]/is", '', $post['message']);
}
if(strpos($msglower, '[/flash]') !== FALSE) {
$post['message'] = preg_replace("/\[flash(=(\d+),(\d+))?\]\s*([^\[\<\r\n]+?)\s*\[\/flash\]/is", '', $post['message']);
}
$html_content = $connectService->connectParseBbcode($post['message'], $post['fid'], $post['pid'], $post['htmlon'], $attach_images);
$html_content = strip_tags(preg_replace('/(&nbsp;)+/', ' ', $html_content));
$url = $_G['siteurl'].'forum.php?mod=redirect&goto=findpost&ptid='.$tid.'&pid='.$pid;
$_t_content = lang('plugin/qqconnect', 'connect_feed_iam');
$_t_content .= '#' . cutstr($_G['setting']['bbname'], 20,'') . '#';
$_t_content .= lang('plugin/qqconnect', 'connect_feed_published_post', array('subject' => cutstr($thread['subject'], 120)));
$_t_content .= cutstr($html_content, 80);
$_t_content .= ' ' . $url;
$t_params = array(
'content' => $_t_content,
);
if($attach_images && is_array($attach_images)) {
$attach_image = array_shift($attach_images);
$t_params['pic'] = $attach_image['path'];
$t_params['remote'] = $attach_image['remote'];
}
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/ConnectOAuth.php';
$connectOAuthClient = new Cloud_Service_Client_ConnectOAuth();
$weibo_succ = false;
try {
if ($t_params['pic']) {
$method = 'connectAddPicT';
} else {
$method = 'connectAddT';
}
$response = $connectOAuthClient->$method($_G['member']['conopenid'], $_G['member']['conuin'], $_G['member']['conuinsecret'], $t_params);
if ($response['ret'] == 0) {
$weibo_succ = true;
}
} catch(Exception $e) {
if($e->getCode()) {
$weiboErrorCode = $e->getCode();
}
$weibo_succ = false;
}
if ($weibo_succ) {
$feedlog_status = $feedlog['status'];
$feedlog_status = setstatus(4, 1, $feedlog_status);
$feedlog_status = setstatus(3, 0, $feedlog_status);
C::t('#qqconnect#connect_postfeedlog')->update_by_pid($pid,
array(
'status' => $feedlog_status,
'lastpublished' => $_G['timestamp'],
'publishtimes' => $feedlog['publishtimes'] + 1,
));
}
if(!$weiboErrorCode) {
dsetcookie('connect_sync_post');
$connectService->connectJsOutputMessage(lang('plugin/qqconnect', 'connect_feed_sync_success'), '', 0);
} else {
C::t('#qqconnect#connect_postfeedlog')->update_by_pid($pid,
array(
'lastpublished' => $_G['timestamp'],
'publishtimes' => $feedlog['publishtimes'] + 1,
));
$connectService->connectJsOutputMessage('', '', $weiboErrorCode);
}
}
}

View File

@@ -0,0 +1,327 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: connect_login.php 33793 2013-08-14 07:26:06Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$op = !empty($_GET['op']) ? $_GET['op'] : '';
if(!in_array($op, array('init', 'callback', 'change'))) {
showmessage('undefined_action');
}
$referer = dreferer();
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/ConnectOAuth.php';
try {
$connectOAuthClient = new Cloud_Service_Client_ConnectOAuth();
} catch(Exception $e) {
showmessage('qqconnect:connect_app_invalid');
}
if($op == 'init') {
if($_G['member']['conisbind'] && $_GET['reauthorize']) {
if($_GET['formhash'] == FORMHASH) {
$connectService->connectMergeMember();
} else {
showmessage('submit_invalid');
}
}
$callback = $_G['connect']['callback_url'] . '&referer=' . urlencode($_GET['referer']);
try {
dsetcookie('con_request_uri', $callback);
$redirect = $connectOAuthClient->getOAuthAuthorizeURL_V2($callback);
if(defined('IN_MOBILE') || $_GET['oauth_style'] == 'mobile') {
$redirect .= '&display=mobile';
}
} catch(Exception $e) {
showmessage('qqconnect:connect_get_request_token_failed_code', $referer, array('codeMessage' => getErrorMessage($e->getmessage()), 'code' => $e->getmessage()));
}
dheader('Location:' . $redirect);
} elseif($op == 'callback') {
$params = $_GET;
if(!isset($params['receive'])) {
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Util.php';
$utilService = new Cloud_Service_Util();
echo '<script type="text/javascript">setTimeout("window.location.href=\'connect.php?receive=yes&'.str_replace("'", "\'", $utilService->httpBuildQuery($_GET, '', '&')).'\'", 1)</script>';
exit;
}
if($_GET['state'] != md5(FORMHASH)){
showmessage('qqconnect:connect_get_access_token_failed', $referer);
}
try {
$response = $connectOAuthClient->connectGetOpenId_V2($_G['cookie']['con_request_uri'], $_GET['code']);
} catch(Exception $e) {
showmessage('qqconnect:connect_get_access_token_failed_code', $referer, array('codeMessage' => getErrorMessage($e->getmessage()), 'code' => $e->getmessage()));
}
dsetcookie('con_request_token');
dsetcookie('con_request_token_secret');
$conuintoken = $response['access_token'];
$conopenid = strtoupper($response['openid']);
if(!$conuintoken || !$conopenid) {
showmessage('qqconnect:connect_get_access_token_failed', $referer);
}
loadcache('connect_blacklist');
if(in_array($conopenid, array_map('strtoupper', $_G['cache']['connect_blacklist']))) {
$change_qq_url = $_G['connect']['discuz_change_qq_url'];
showmessage('qqconnect:connect_uin_in_blacklist', $referer, array('changeqqurl' => $change_qq_url));
}
$referer = $referer && (strpos($referer, 'logging') === false) && (strpos($referer, 'mod=login') === false) ? $referer : 'index.php';
if($params['uin']) {
$old_conuin = $params['uin'];
}
$is_notify = true;
$conispublishfeed = 0;
$conispublisht = 0;
$is_user_info = 1;
$is_feed = 0;
$user_auth_fields = 1;
$cookie_expires = 2592000;
dsetcookie('client_created', TIMESTAMP, $cookie_expires);
dsetcookie('client_token', $conopenid, $cookie_expires);
$connect_member = array();
$fields = array('uid', 'conuin', 'conuinsecret', 'conopenid');
if($old_conuin) {
$connect_member = C::t('#qqconnect#common_member_connect')->fetch_fields_by_openid($old_conuin, $fields);
}
if(empty($connect_member)) {
$connect_member = C::t('#qqconnect#common_member_connect')->fetch_fields_by_openid($conopenid, $fields);
}
if($connect_member) {
$member = getuserbyuid($connect_member['uid']);
if($member) {
if(!$member['conisbind']) {
C::t('#qqconnect#common_member_connect')->delete($connect_member['uid']);
unset($connect_member);
} else {
$connect_member['conisbind'] = $member['conisbind'];
}
} else {
C::t('#qqconnect#common_member_connect')->delete($connect_member['uid']);
unset($connect_member);
}
}
$connect_is_unbind = $params['is_unbind'] == 1 ? 1 : 0;
if($connect_is_unbind && $connect_member && !$_G['uid'] && $is_notify) {
dsetcookie('connect_js_name', 'user_bind', 86400);
dsetcookie('connect_js_params', base64_encode(serialize(array('type' => 'registerbind'))), 86400);
}
if($_G['uid']) {
if($connect_member && $connect_member['uid'] != $_G['uid']) {
showmessage('qqconnect:connect_register_bind_uin_already', $referer, array('username' => $_G['member']['username']));
}
$isqqshow = 0;
$current_connect_member = C::t('#qqconnect#common_member_connect')->fetch($_G['uid']);
if($_G['member']['conisbind'] && $current_connect_member['conopenid']) {
if(strtoupper($current_connect_member['conopenid']) != $conopenid) {
showmessage('qqconnect:connect_register_bind_already', $referer);
}
C::t('#qqconnect#common_member_connect')->update($_G['uid'], array(
'conuintoken' => $conuintoken,
'conopenid' => $conopenid,
'conisregister' => 0,
'conisfeed' => 1,
'conisqqshow' => $isqqshow,
));
} else { // debug 当前登录的论坛账号并没有绑定任何QQ号则可以绑定当前的这个QQ号
if(empty($current_connect_member)) {
C::t('#qqconnect#common_member_connect')->insert(array(
'uid' => $_G['uid'],
'conuin' => '',
'conuintoken' => $conuintoken,
'conopenid' => $conopenid,
'conispublishfeed' => $conispublishfeed,
'conispublisht' => $conispublisht,
'conisregister' => 0,
'conisfeed' => 1,
'conisqqshow' => $isqqshow,
));
} else {
C::t('#qqconnect#common_member_connect')->update($_G['uid'],
array(
'conuintoken' => $conuintoken,
'conopenid' => $conopenid,
'conispublishfeed' => $conispublishfeed,
'conispublisht' => $conispublisht,
'conisregister' => 0,
'conisfeed' => 1,
'conisqqshow' => $isqqshow,
)
);
}
C::t('common_member')->update($_G['uid'], array('conisbind' => '1'));
C::t('#qqconnect#common_connect_guest')->delete($conopenid);
}
if($is_notify) {
dsetcookie('connect_js_name', 'user_bind', 86400);
dsetcookie('connect_js_params', base64_encode(serialize(array('type' => 'loginbind'))), 86400);
}
dsetcookie('connect_login', 1, 31536000);
dsetcookie('connect_is_bind', '1', 31536000);
dsetcookie('connect_uin', $conopenid, 31536000);
dsetcookie('stats_qc_reg', 3, 86400);
C::t('#qqconnect#connect_memberbindlog')->insert(
array(
'uid' => $_G['uid'],
'uin' => $conopenid,
'type' => 1,
'dateline' => $_G['timestamp'],
)
);
showmessage('qqconnect:connect_register_bind_success', $referer);
} else {
if($connect_member) { // debug 此分支是用户直接点击QQ登录并且这个QQ号已经绑好一个论坛账号了将直接登进论坛了
C::t('#qqconnect#common_member_connect')->update($connect_member['uid'], array(
'conuintoken' => $conuintoken,
'conopenid' => $conopenid,
'conisfeed' => 1,
));
$params['mod'] = 'login';
connect_login($connect_member);
loadcache('usergroups');
$usergroups = $_G['cache']['usergroups'][$_G['groupid']]['grouptitle'];
$param = array('username' => $_G['member']['username'], 'usergroup' => $_G['group']['grouptitle']);
C::t('common_member_status')->update($connect_member['uid'], array('lastip'=>$_G['clientip'], 'lastvisit'=>TIMESTAMP, 'lastactivity' => TIMESTAMP));
$ucsynlogin = '';
if($_G['setting']['allowsynlogin']) {
loaducenter();
$ucsynlogin = uc_user_synlogin($_G['uid']);
}
dsetcookie('stats_qc_login', 3, 86400);
showmessage('login_succeed', $referer, $param, array('extrajs' => $ucsynlogin));
} else { // debug 此分支是用户直接点击QQ登录并且这个QQ号还未绑定任何论坛账号将将跳转到一个新页引导用户注册个新论坛账号或绑一个已有的论坛账号
$auth_hash = authcode($conopenid, 'ENCODE');
$insert_arr = array(
'conuintoken' => $conuintoken,
'conopenid' => $conopenid,
);
$connectGuest = C::t('#qqconnect#common_connect_guest')->fetch($conopenid);
if ($connectGuest['conqqnick']) {
$insert_arr['conqqnick'] = $connectGuest['conqqnick'];
} else {
try {
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/ConnectOAuth.php';
$connectOAuthClient = new Cloud_Service_Client_ConnectOAuth();
$connectUserInfo = $connectOAuthClient->connectGetUserInfo_V2($conopenid, $conuintoken);
if ($connectUserInfo['nickname']) {
$connectUserInfo['nickname'] = strip_tags($connectUserInfo['nickname']);
$insert_arr['conqqnick'] = $connectUserInfo['nickname'];
}
} catch(Exception $e) {
}
}
if ($insert_arr['conqqnick']) {
dsetcookie('connect_qq_nick', $insert_arr['conqqnick'], 86400);
}
C::t('#qqconnect#common_connect_guest')->insert($insert_arr, false, true);
dsetcookie('con_auth_hash', $auth_hash, 86400);
dsetcookie('connect_js_name', 'guest_ptlogin', 86400);
dsetcookie('stats_qc_login', 4, 86400);
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Util.php';
$utilService = new Cloud_Service_Util();
$refererParams = explode('/', $referer);
$mobileId = $refererParams[count($refererParams) - 1];
if (substr($mobileId, 0, 7) == 'Mobile_') {
showmessage('login_succeed', $referer);
} else {
$referer = 'member.php?mod=connect&referer='.urlencode($referer);
$utilService->redirect($referer);
}
}
}
} elseif($op == 'change') {
$callback = $_G['connect']['callback_url'] . '&referer=' . urlencode($_GET['referer']);
try {
dsetcookie('con_request_uri', $callback);
$redirect = $connectOAuthClient->getOAuthAuthorizeURL_V2($callback);
if(defined('IN_MOBILE') || $_GET['oauth_style'] == 'mobile') {
$redirect .= '&display=mobile';
}
} catch(Exception $e) {
showmessage('qqconnect:connect_get_request_token_failed_code', $referer, array('codeMessage' => getErrorMessage($e->getmessage()), 'code' => $e->getmessage()));
}
dheader('Location:' . $redirect);
}
function connect_login($connect_member) {
global $_G;
if(!($member = getuserbyuid($connect_member['uid'], 1))) {
return false;
} else {
if(isset($member['_inarchive'])) {
C::t('common_member_archive')->move_to_master($member['uid']);
}
}
require_once libfile('function/member');
$cookietime = 1296000;
setloginstatus($member, $cookietime);
dsetcookie('connect_login', 1, $cookietime);
dsetcookie('connect_is_bind', '1', 31536000);
dsetcookie('connect_uin', $connect_member['conopenid'], 31536000);
return true;
}
function getErrorMessage($errroCode) {
$str = sprintf('connect_error_code_%d', $errroCode);
return lang('plugin/qqconnect', $str);
}

View File

@@ -0,0 +1,67 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: connect_user.php 29265 2012-03-31 06:03:26Z yexinhao $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('NOROBOT', TRUE);
include template('common/header');
$op = !empty($_GET['op']) ? trim($_GET['op'], '/') : '';
if(!in_array($op, array('get'))) {
connect_error_output('undefined_action');
}
if($_GET['hash'] != formhash()) {
connect_error_output('submit_invalid');
}
if($op == 'get') {
$conopenid = authcode($_G['cookie']['con_auth_hash']);
$connect_guest = C::t('#qqconnect#common_connect_guest')->fetch($conopenid);
if(!$connect_guest) {
dsetcookie('con_auth_hash');
connect_error_output('qqconnect:connect_login_first');
}
$conuin = $connect_guest['conuin'];
$conuinsecret = $connect_guest['conuinsecret'];
if($conuin && $conuinsecret && $conopenid) {
try {
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/ConnectOAuth.php';
$connectOAuthClient = new Cloud_Service_Client_ConnectOAuth();
$connect_user_info = $connectOAuthClient->connectGetUserInfo($conopenid, $conuin, $conuinsecret);
} catch(Exception $e) {
connect_error_output();
}
if ($connect_user_info['nickname']) {
$qq_nick = $connect_user_info['nickname'];
$connect_nickname = $connectService->connectFilterUsername($qq_nick);
}
loaducenter();
$ucresult = uc_user_checkname($connect_nickname);
$first_available_username = '';
if($ucresult >= 0) {
$first_available_username = $connect_nickname;
}
echo $first_available_username;
}
}
include template('common/footer');
function connect_error_output($error = '') {
include template('common/footer');
exit;
}

View File

@@ -0,0 +1,298 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
<item id="Title"><![CDATA[Discuz! Plugin]]></item>
<item id="Data">
<item id="plugin">
<item id="available"><![CDATA[1]]></item>
<item id="adminid"><![CDATA[1]]></item>
<item id="name"><![CDATA[QQ互联]]></item>
<item id="identifier"><![CDATA[qqconnect]]></item>
<item id="description"><![CDATA[]]></item>
<item id="datatables"><![CDATA[]]></item>
<item id="directory"><![CDATA[qqconnect/]]></item>
<item id="copyright"><![CDATA[Comsenz Inc.]]></item>
<item id="version"><![CDATA[2.1.7]]></item>
<item id="__modules">
<item id="0">
<item id="name"><![CDATA[connect]]></item>
<item id="param"><![CDATA[]]></item>
<item id="menu"><![CDATA[]]></item>
<item id="url"><![CDATA[]]></item>
<item id="type"><![CDATA[11]]></item>
<item id="adminid"><![CDATA[0]]></item>
<item id="displayorder"><![CDATA[0]]></item>
<item id="navtitle"><![CDATA[]]></item>
<item id="navicon"><![CDATA[]]></item>
<item id="navsubname"><![CDATA[]]></item>
<item id="navsuburl"><![CDATA[]]></item>
</item>
<item id="1">
<item id="name"><![CDATA[connect]]></item>
<item id="param"><![CDATA[]]></item>
<item id="menu"><![CDATA[]]></item>
<item id="url"><![CDATA[]]></item>
<item id="type"><![CDATA[28]]></item>
<item id="adminid"><![CDATA[0]]></item>
<item id="displayorder"><![CDATA[0]]></item>
<item id="navtitle"><![CDATA[]]></item>
<item id="navicon"><![CDATA[]]></item>
<item id="navsubname"><![CDATA[]]></item>
<item id="navsuburl"><![CDATA[]]></item>
</item>
<item id="2">
<item id="name"><![CDATA[admincp]]></item>
<item id="param"><![CDATA[ac=setting]]></item>
<item id="menu"><![CDATA[设置]]></item>
<item id="url"><![CDATA[]]></item>
<item id="type"><![CDATA[3]]></item>
<item id="adminid"><![CDATA[0]]></item>
<item id="displayorder"><![CDATA[0]]></item>
<item id="navtitle"><![CDATA[]]></item>
<item id="navicon"><![CDATA[]]></item>
<item id="navsubname"><![CDATA[]]></item>
<item id="navsuburl"><![CDATA[]]></item>
</item>
<item id="3">
<item id="name"><![CDATA[spacecp]]></item>
<item id="param"><![CDATA[]]></item>
<item id="menu"><![CDATA[QQ绑定]]></item>
<item id="url"><![CDATA[]]></item>
<item id="type"><![CDATA[7]]></item>
<item id="adminid"><![CDATA[0]]></item>
<item id="displayorder"><![CDATA[1]]></item>
<item id="navtitle"><![CDATA[]]></item>
<item id="navicon"><![CDATA[]]></item>
<item id="navsubname"><![CDATA[]]></item>
<item id="navsuburl"><![CDATA[]]></item>
</item>
</item>
</item>
<item id="version"><![CDATA[X3.2,X3.3,X3.4,X3.5]]></item>
<item id="installfile"><![CDATA[install.php]]></item>
<item id="upgradefile"><![CDATA[upgrade.php]]></item>
<item id="language">
<item id="scriptlang">
<item id="qqconnect_closed"><![CDATA[抱歉QQ互联功能尚未开启]]></item>
<item id="connect_appid_desc"><![CDATA[请填写在QQ互联(connect.qq.com)申请的 appid 和 appkey]]></item>
<item id="connect_app_invalid"><![CDATA[抱歉QQ互联功能暂时不可用]]></item>
<item id="connect_register_bind_already"><![CDATA[抱歉该用户已绑定过另一个QQ用户无法再次绑定]]></item>
<item id="connect_register_uinlimit"><![CDATA[抱歉每个QQ账号只能注册 {limit} 个账号]]></item>
<item id="connect_register_closed"><![CDATA[QQ注册功能已关闭]]></item>
<item id="connect_register_bind"><![CDATA[绑定已有账号]]></item>
<item id="connect_register_profile"><![CDATA[完善账号信息]]></item>
<item id="connect_get_access_token_failed"><![CDATA[抱歉,当前存在网络问题或服务器繁忙,请您稍候再试。谢谢。]]></item>
<item id="connect_get_access_token_failed_code"><![CDATA[抱歉,当前存在网络问题或服务器繁忙,详细错误:{codeMessage},错误代码:<a target=_blank href="https://wiki.connect.qq.com/%e5%85%ac%e5%85%b1%e8%bf%94%e5%9b%9e%e7%a0%81%e8%af%b4%e6%98%8e">{code}</a>,请您稍候再试。谢谢。]]></item>
<item id="connect_get_request_token_failed"><![CDATA[抱歉,当前存在网络问题或服务器繁忙,请您稍候再试。谢谢。]]></item>
<item id="connect_get_request_token_failed_code"><![CDATA[抱歉,当前存在网络问题或服务器繁忙,详细错误:{codeMessage},错误代码:<a target=_blank href="https://wiki.connect.qq.com/%e5%85%ac%e5%85%b1%e8%bf%94%e5%9b%9e%e7%a0%81%e8%af%b4%e6%98%8e">{code}</a>,请您稍候再试。谢谢。]]></item>
<item id="connect_register_bind_uin_already"><![CDATA[抱歉该QQ用户已绑定了本站的另一个用户无法再次绑定]]></item>
<item id="connect_config_success"><![CDATA[QQ互联设置更新成功]]></item>
<item id="connect_login_first"><![CDATA[请先使用QQ互联登录再进行此操作]]></item>
<item id="connect_config_unbind_failed"><![CDATA[抱歉解绑失败请重试使用QQ登录后再进行解绑操作]]></item>
<item id="connect_config_unbind_busy"><![CDATA[抱歉,当前存在网络问题或服务器繁忙,请您稍候再尝试解绑。谢谢。]]></item>
<item id="connect_config_unbind_busy_code"><![CDATA[抱歉,当前存在网络问题或服务器繁忙,详细错误:{codeMessage},错误代码:<a target=_blank href="https://wiki.connect.qq.com/%e5%85%ac%e5%85%b1%e8%bf%94%e5%9b%9e%e7%a0%81%e8%af%b4%e6%98%8e">{code}</a>,请您稍候再尝试解绑。谢谢。]]></item>
<item id="connect_config_unbind_success"><![CDATA[您的论坛账号和QQ账号解除绑定成功。]]></item>
<item id="connect_uin_in_blacklist"><![CDATA[抱歉此QQ账号已被本站屏蔽您可以<a href="{changeqqurl}">更换其他QQ账号登录</a>]]></item>
<item id="connect_reauth_success"><![CDATA[QQ互联授权修改成功]]></item>
<item id="connect_register_bind_success"><![CDATA[您的账号与QQ账号绑定成功]]></item>
<item id="connect_register_bind_need_inactive"><![CDATA[抱歉您的账号尚未激活请先激活后再绑定QQ账号]]></item>
<item id="connect_reply_filter_smiley"><![CDATA[/微笑 /撇嘴 /色 /发呆 /得意 /流泪 /害羞 /闭嘴 /睡 /大哭 /尴尬 /发怒 /调皮 /呲牙 /惊讶 /难过 /酷 /冷汗 /抓狂 /吐 /偷笑 /可爱 /白眼 /傲慢 /饥饿 /困 /惊恐 /流汗 /憨笑 /大兵 /奋斗 /咒骂 /疑问 /嘘 /晕 /折磨 /衰 /骷髅 /敲打 /再见 /擦汗 /抠鼻 /鼓掌 /糗大了 /坏笑 /左哼哼 /右哼哼 /哈欠 /鄙视 /委屈 /快哭了 /阴险 /亲亲 /吓 /可怜 /菜刀 /西瓜 /啤酒 /篮球 /乒乓 /咖啡 /饭 /猪头 /玫瑰 /凋谢 /示爱 /爱心 /心碎 /蛋糕 /闪电 /炸弹 /刀 /足球 /瓢虫 /便便 /月亮 /太阳 /礼物 /拥抱 /强 /弱 /握手 /胜利 /抱拳 /勾引 /拳头 /差劲 /爱你 /NO /OK /爱情 /飞吻 /跳跳 /发抖 /怄火 /转圈 /磕头 /回头 /跳绳 /挥手 /激动 /街舞 /献吻 /左太极 /右太极]]></item>
<item id="connect_register_mobile_bind_error"><![CDATA[您需要在电脑版完善资料或绑定已有账号,才能继续本操作]]></item>
<item id="connect_broadcast_success"><![CDATA[转播成功]]></item>
<item id="connect_feed_sync_success"><![CDATA[同步发 Feed 成功]]></item>
<item id="connect_share_token_outofdate"><![CDATA[为了您的账号安全请使用QQ账号重新登录将为您升级账号安全机制<br/><br/>点击<a href={login_url}><img src=static/image/common/qq_login.gif class=vm alt=QQ登录 /></a>页面将发生跳转]]></item>
<item id="connect_share_success"><![CDATA[分享成功]]></item>
<item id="connect_qzone_share_same_url"><![CDATA[该文章您已经分享过,不需要重复分享]]></item>
<item id="connect_qzone_weibo_same_content"><![CDATA[该文章您已经转播过,不需要重复转播]]></item>
<item id="connect_user_unauthorized"><![CDATA[抱歉,您未授权分享主题,点击<a href={login_url}><img src=static/image/common/qq_login.gif class=vm alt=QQ登录 /></a>,马上完善授权]]></item>
<item id="connect_errlog_server_no_response"><![CDATA[服务器无响应]]></item>
<item id="connect_server_busy"><![CDATA[抱歉,当前存在网络问题或服务器繁忙,请您稍候再试。谢谢。]]></item>
<item id="connect_server_busy_code"><![CDATA[抱歉,当前存在网络问题或服务器繁忙,详细错误:{codeMessage},错误代码:{code},请您稍候再试。谢谢。]]></item>
<item id="connectguest_message_complete_or_bind"><![CDATA[抱歉,您尚未 <a href="member.php?mod=connect" class="xi2">完善账号信息</a> 或 <a href="member.php?mod=connect&ac=bind" class="xi2">绑定已有账号</a>,无法进行此操作]]></item>
<item id="connect_error_code_999"><![CDATA[请求失败]]></item>
<item id="connect_error_code_10001"><![CDATA[QQ 互联 APPID 无效]]></item>
<item id="connect_error_code_10002"><![CDATA[QQ 互联插件异常,请更新程序后重新安装]]></item>
<item id="connect_error_code_10003"><![CDATA[QQ 互联插件异常,请更新程序后重新安装]]></item>
<item id="connect_error_code_10004"><![CDATA[QQ 互联插件异常,请更新程序后重新安装]]></item>
<item id="connect_error_code_10005"><![CDATA[网站服务器时间误差超过 5 分钟]]></item>
<item id="connect_error_code_10006"><![CDATA[QQ 互联 APPID 无效]]></item>
<item id="connect_error_code_11000"><![CDATA[QQ 互联 APPKEY 无效]]></item>
<item id="connect_error_code_11001"><![CDATA[QQ 互联 APPID 被禁用]]></item>
<item id="connect_error_code_30001"><![CDATA[QQ 互联 APPID 无效]]></item>
<item id="connect_error_code_30002"><![CDATA[QQ 互联插件异常,请更新程序后重新安装]]></item>
<item id="connect_error_code_30003"><![CDATA[QQ 互联插件异常,请更新程序后重新安装]]></item>
<item id="connect_error_code_30004"><![CDATA[QQ 互联插件异常,请更新程序后重新安装]]></item>
<item id="connect_error_code_30005"><![CDATA[网站服务器时间误差超过 5 分钟]]></item>
<item id="connect_error_code_30006"><![CDATA[QQ 互联插件异常,请更新程序后重新安装]]></item>
<item id="connect_error_code_30007"><![CDATA[QQ 互联插件异常,请更新程序后重新安装]]></item>
<item id="connect_error_code_30008"><![CDATA[APPID 未注册,请重新开通 QQ 互联服务]]></item>
<item id="connect_error_code_31000"><![CDATA[QQ 互联插件异常,请更新程序后重新安装]]]></item>
<item id="connect_error_code_31001"><![CDATA[QQ 互联插件异常,请更新程序后重新安装]]]></item>
<item id="connect_error_code_31002"><![CDATA[QQ 互联 APPID 被禁用]]></item>
<item id="connect_error_code_100000"><![CDATA[缺少参数response_type或response_type非法。]]></item>
<item id="connect_error_code_100001"><![CDATA[缺少参数client_id。]]></item>
<item id="connect_error_code_100002"><![CDATA[缺少参数client_secret。]]></item>
<item id="connect_error_code_100003"><![CDATA[http head中缺少Authorization。]]></item>
<item id="connect_error_code_100004"><![CDATA[缺少参数grant_type或grant_type非法。]]></item>
<item id="connect_error_code_100005"><![CDATA[缺少参数code。]]></item>
<item id="connect_error_code_100006"><![CDATA[缺少refresh token。]]></item>
<item id="connect_error_code_100007"><![CDATA[缺少access token。]]></item>
<item id="connect_error_code_100008"><![CDATA[该appid不存在。]]></item>
<item id="connect_error_code_100009"><![CDATA[client_secret即appkey非法。]]></item>
<item id="connect_error_code_100010"><![CDATA[回调地址不合法,常见原因请见:回调地址常见问题及修改方法]]></item>
<item id="connect_error_code_100011"><![CDATA[APP不处于上线状态。]]></item>
<item id="connect_error_code_100012"><![CDATA[HTTP请求非post方式。]]></item>
<item id="connect_error_code_100013"><![CDATA[access token非法。]]></item>
<item id="connect_error_code_100014"><![CDATA[access token过期。 token过期时间为3个月。如果存储的access token过期请重新走登录流程根据使用Authorization_Code获取Access_Token或使用Implicit_Grant方式获取Access_Token获取新的access token值。]]></item>
<item id="connect_error_code_100015"><![CDATA[access token废除。 token被回收或者被用户删除。请重新走登录流程根据使用Authorization_Code获取Access_Token或使用Implicit_Grant方式获取Access_Token获取新的access token值。]]></item>
<item id="connect_error_code_100016"><![CDATA[access token验证失败。]]></item>
<item id="connect_error_code_100017"><![CDATA[获取appid失败。]]></item>
<item id="connect_error_code_100018"><![CDATA[获取code值失败。]]></item>
<item id="connect_error_code_100019"><![CDATA[用code换取access token值失败。]]></item>
<item id="connect_error_code_100020"><![CDATA[code被重复使用。code是一次性有效的开发者此时应该引导用户重新登录授权重新获取code而不是重试token接口]]></item>
<item id="connect_error_code_100021"><![CDATA[获取access token值失败。]]></item>
<item id="connect_error_code_100022"><![CDATA[获取refresh token值失败。]]></item>
<item id="connect_error_code_100023"><![CDATA[获取app具有的权限列表失败。]]></item>
<item id="connect_error_code_100024"><![CDATA[获取某OpenID对某appid的权限列表失败。]]></item>
<item id="connect_error_code_100025"><![CDATA[获取全量api信息、全量分组信息。]]></item>
<item id="connect_error_code_100026"><![CDATA[设置用户对某app授权api列表失败。]]></item>
<item id="connect_error_code_100027"><![CDATA[设置用户对某app授权时间失败。]]></item>
<item id="connect_error_code_100028"><![CDATA[缺少参数which。]]></item>
<item id="connect_error_code_100029"><![CDATA[错误的http请求。]]></item>
<item id="connect_error_code_100030"><![CDATA[用户没有对该api进行授权或用户在腾讯侧删除了该api的权限。请用户重新走登录、授权流程对该api进行授权。]]></item>
<item id="connect_error_code_100031"><![CDATA[第三方应用没有对该api操作的权限。请发送邮件进行OpenAPI权限申请。]]></item>
<item id="connect_error_code_100032"><![CDATA[过载,一开始未细分时可以用。]]></item>
<item id="connect_error_code_100033"><![CDATA[缺少UIN参数。]]></item>
<item id="connect_error_code_100034"><![CDATA[缺少skey参数。]]></item>
<item id="connect_error_code_100035"><![CDATA[用户未登陆。]]></item>
<item id="connect_error_code_100036"><![CDATA[RefreshToken失效。]]></item>
<item id="connect_error_code_100037"><![CDATA[RefreshToken已过期]]></item>
<item id="connect_error_code_100038"><![CDATA[RefreshToken已废除]]></item>
<item id="connect_error_code_100039"><![CDATA[RefreshToken到达调用上限。]]></item>
<item id="connect_error_code_100040"><![CDATA[RefreshToken的AppKey非法。]]></item>
<item id="connect_error_code_100041"><![CDATA[RefreshToken,AppID非法。]]></item>
<item id="connect_error_code_100042"><![CDATA[RefreshToken非法。]]></item>
<item id="connect_error_code_100043"><![CDATA[APP处于暂停状态。]]></item>
<item id="connect_error_code_100044"><![CDATA[错误的signMd5校验失败请求签名与官网填写的签名不一致。]]></item>
<item id="connect_error_code_100045"><![CDATA[用户改密token失效。]]></item>
<item id="connect_error_code_100046"><![CDATA[g_tk校验失败。]]></item>
<item id="connect_error_code_100048"><![CDATA[没有设置companyID。]]></item>
<item id="connect_error_code_100049"><![CDATA[APPID没有权限(get_unionid)。]]></item>
<item id="connect_error_code_100050"><![CDATA[OPENID解密失败一般是openid和appid不匹配。]]></item>
<item id="connect_error_code_100051"><![CDATA[调试模式无权限。]]></item>
<item id="connect_error_code_100052"><![CDATA[APPID没有权限获取paytoken和openid]]></item>
<item id="connect_error_code_100053"><![CDATA[ip没有权限获取用户登录信息]]></item>
<item id="connect_error_code_100054"><![CDATA[查询用户近期登录记录时缺少uin参数]]></item>
<item id="connect_error_code_100055"><![CDATA[查询用户授权信息失败]]></item>
<item id="connect_error_code_100056"><![CDATA[该用户近期没有授权记录]]></item>
<item id="connect_error_code_100057"><![CDATA[APPID没有使用skey换code或token的权限]]></item>
<item id="connect_error_code_100058"><![CDATA[openid非法]]></item>
<item id="connect_error_code_100059"><![CDATA[ip没有权限使用接口]]></item>
<item id="connect_error_code_100060"><![CDATA[禁止登录]]></item>
<item id="connect_error_code_100061"><![CDATA[非法apptoken]]></item>
<item id="connect_error_code_100062"><![CDATA[应用频率限制]]></item>
<item id="connect_error_code_100063"><![CDATA[获取openid失败]]></item>
<item id="connect_error_code_100065"><![CDATA[获取delegatetoken失败]]></item>
<item id="connect_error_code_100066"><![CDATA[没有权限获取delegatetoken]]></item>
<item id="connect_error_code_100067"><![CDATA[code过期]]></item>
<item id="connect_error_code_100068"><![CDATA[非法code]]></item>
<item id="connect_error_code_110401"><![CDATA[请求的应用不存在。]]></item>
<item id="connect_error_code_110404"><![CDATA[请求参数缺少appid。]]></item>
<item id="connect_error_code_110405"><![CDATA[登录请求被限制,请稍后在登录。]]></item>
<item id="connect_error_code_110406"><![CDATA[应用没有通过审核。]]></item>
<item id="connect_error_code_110500"><![CDATA[获取用户授权信息失败。]]></item>
<item id="connect_error_code_110501"><![CDATA[获取应用的授权信息失败]]></item>
<item id="connect_error_code_110502"><![CDATA[设置用户授权失败]]></item>
<item id="connect_error_code_110503"><![CDATA[获取token失败]]></item>
<item id="connect_error_code_110504"><![CDATA[系统内部错误]]></item>
<item id="connect_error_code_110505"><![CDATA[参数错误]]></item>
<item id="connect_error_code_110506"><![CDATA[获取APP info信息失败]]></item>
<item id="connect_error_code_110507"><![CDATA[校验APP info 签名信息失败]]></item>
<item id="connect_error_code_110508"><![CDATA[获取code失败]]></item>
<item id="connect_error_code_110509"><![CDATA[SKEY校验失败]]></item>
<item id="connect_error_code_110510"><![CDATA[Disable]]></item>
<item id="connect_feed_iam"><![CDATA[我在]]></item>
<item id="connect_feed_published_thread"><![CDATA[发表了《{subject}》:]]></item>
<item id="connect_feed_published_post"><![CDATA[参与了《{subject}》的讨论:]]></item>
<item id="connect_spacecp_share_a_post"><![CDATA[分享一个好帖#{bbname}#《{subject}》:{message}]]></item>
<item id="connect_spacecp_share_qq_default"><![CDATA[看看这个吧,还不错哦,也许你会喜欢^_^]]></item>
<item id="connect_post_sync_method"><![CDATA[将此回复同步到]]></item>
</item>
<item id="templatelang">
<item id="connect_header_login"><![CDATA[QQ登录]]></item>
<item id="connect_header_login_tip"><![CDATA[只需一步,快速开始]]></item>
<item id="connect_register_by"><![CDATA[您也可以通过]]></item>
<item id="connect_or"><![CDATA[或者]]></item>
<item id="connect_register_complete"><![CDATA[完善一点信息,马上开始浏览]]></item>
<item id="connect_register_bind"><![CDATA[绑定已有账号]]></item>
<item id="connect_register_profile"><![CDATA[完善账号信息]]></item>
<item id="connect_register_has_id"><![CDATA[已有账号?]]></item>
<item id="connect_register_new_username"><![CDATA[输入新用户名]]></item>
<item id="connect_register_used_usernames"><![CDATA[常用名]]></item>
<item id="connect_register_available_usernames_count"><![CDATA[个可用]]></item>
<item id="connect_register_email"><![CDATA[邮箱]]></item>
<item id="connect_register_birthday"><![CDATA[生日]]></item>
<item id="connect_register_sex"><![CDATA[性别]]></item>
<item id="connect_register_noid"><![CDATA[没有账号?]]></item>
<item id="connect_register_new"><![CDATA[注册新账号]]></item>
<item id="connect_register_avatar"><![CDATA[头像]]></item>
<item id="connect_register_sex_male"><![CDATA[男]]></item>
<item id="connect_register_sex_female"><![CDATA[女]]></item>
<item id="connect_register_sex_secret"><![CDATA[保密]]></item>
<item id="connect_register_public_email"><![CDATA[公开邮箱地址]]></item>
<item id="connect_register_agree"><![CDATA[同意服务条款]]></item>
<item id="connect_register_must_agree"><![CDATA[您必须同意服务条款后才能注册]]></item>
<item id="connect_register_finish"><![CDATA[完成,继续浏览]]></item>
<item id="connect_register_bind_window_button"><![CDATA[绑定账号]]></item>
<item id="connect_register_bind_title"><![CDATA[输入已有的本站账号将与您的QQ账号进行绑定]]></item>
<item id="connect_register_bind_success"><![CDATA[您的账号与QQ账号绑定成功]]></item>
<item id="connect_register_bind_need_inactive"><![CDATA[您的账号还未激活请先激活后再绑定QQ账号]]></item>
<item id="connect_config"><![CDATA[QQ绑定]]></item>
<item id="connect_config_bind"><![CDATA[点击按钮立刻绑定QQ账号]]></item>
<item id="connect_config_bindinfo"><![CDATA[您已将本站账号 <strong>{$_G[member][username]}</strong> 与QQ号码绑定]]></item>
<item id="connect_config_bind_setting"><![CDATA[绑定设置]]></item>
<item id="connect_config_title"><![CDATA[使用QQ账号绑定本站您可以...]]></item>
<item id="connect_config_desc_title1"><![CDATA[用QQ账号轻松登录]]></item>
<item id="connect_config_desc_content1"><![CDATA[无需记住本站的账号和密码随时使用QQ账号密码轻松登录]]></item>
<item id="connect_config_newpassword_comment"><![CDATA[您目前使用的是QQ账号绑定本站您可以在这里设置独立密码只有设置了独立密码后本站需要填写密码的相应功能才可使用]]></item>
<item id="connect_config_desc_title2"><![CDATA[把本站精彩内容分享给好友]]></item>
<item id="connect_config_desc_content2"><![CDATA[每一个精彩内容绝不放过,简单快捷的将论坛主题分享给好友]]></item>
<item id="connect_config_newpassword"><![CDATA[为单独登录站点创建登录密码]]></item>
<item id="connect_config_new_password"><![CDATA[新密码]]></item>
<item id="connect_config_new_password_confirm"><![CDATA[确认密码]]></item>
<item id="connect_config_unbind"><![CDATA[解除已绑定账号?]]></item>
<item id="connect_config_modify_authorization"><![CDATA[修改本站的授权?]]></item>
<item id="connect_config_modify_authorization_desc"><![CDATA[您可根据自己的需要随时增加、取消QQ账号对本站的授权在确保隐私的前提下使用各项功能和服务。]]></item>
<item id="connect_config_set_password"><![CDATA[设置本站密码?]]></item>
<item id="connect_config_unbind_desc1"><![CDATA[您当前是使用QQ账号绑定到 {$_G[setting][bbname]}]]></item>
<item id="connect_config_unbind_desc2"><![CDATA[为了您可以继续使用本站账号 <strong>$_G[member][username]</strong>,请设置本站登录密码]]></item>
<item id="connect_config_unbind_desc3"><![CDATA[您确认要解除与本站账号的绑定关系?]]></item>
<item id="connect_config_unbind_desc4"><![CDATA[您需要使用QQ账号登录才能解除账号绑定关系请点击<a href="member.php?mod=logging&action=logout&formhash={FORMHASH}" class="xi2">这里退出</a>后]]></item>
<item id="connect_config_unbind_desc5"><![CDATA[重新使用QQ账号登录]]></item>
<item id="connect_config_bind_confirm"><![CDATA[确认解除]]></item>
<item id="connect_config_password_comment"><![CDATA[登录本站使用]]></item>
<item id="connect_config_set_password_desc"><![CDATA[因为安全因素考虑,在操作兑换积分、版主管理等行为时需要设置本站密码]]></item>
<item id="connect_post_unbind"><![CDATA[绑定QQ账号轻松分享]]></item>
<item id="connect_access_token_out_of_date_feed"><![CDATA[为了您的账号安全请使用QQ账号重新登录将为您升级账号安全机制<br/><br/>点击<a href="{$_G[connect][login_url]}"><img src="static/image/common/qq_login.gif" class="vm" alt="QQ登录" /></a>页面将发生跳转,请确保您已保存好文章数据]]></item>
<item id="connect_access_token_out_of_date_share"><![CDATA[为了您的账号安全请使用QQ账号重新登录将为您升级账号安全机制<br/><br/>点击<a href="{$_G[connect][login_url]}"><img src="static/image/common/qq_login.gif" class="vm" alt="QQ登录" /></a>页面将发生跳转]]></item>
<item id="connect_access_token_outofdate_button"><![CDATA[我知道了]]></item>
<item id="connect_viewthread_share_to_qzone"><![CDATA[QQ空间]]></item>
<item id="connect_viewthread_share_to_qq"><![CDATA[QQ好友和群]]></item>
<item id="connect_createpassword"><![CDATA[<b>创建密码</b>]]></item>
<item id="connect_uin_limit"><![CDATA[您的QQ账号在本站注册的账号数量达到上限请绑定已有账号或<a href="{$change_qq_url}">更换其他QQ账号</a>]]></item>
<item id="connect_thread_id_miss"><![CDATA[文章id不存在]]></item>
<item id="connect_get_request_token_failed"><![CDATA[服务器繁忙,请稍后再试。]]></item>
<item id="connect_get_access_token_failed"><![CDATA[服务器繁忙,请稍后再试。]]></item>
<item id="connect_share_unbind"><![CDATA[很抱歉由于分享功能升级您需要使用QQ账号重新登录本站即可马上体验全新的分享功能。<br /><span style="font-size: 12px;">提示:点击<a href="member.php?mod=logging&action=logout&formhash={FORMHASH}" class="xi2">这里退出</a>后重新使用QQ账号登录。</span>]]></item>
<item id="connect_share_unbind_know_button"><![CDATA[我知道了]]></item>
<item id="connect_member_register_tip"><![CDATA[完善账号信息可体验本站更多功能]]></item>
<item id="connect_member_loginbind_tip"><![CDATA[绑定已有账号可使用QQ账号快速登录本站]]></item>
<item id="connect_member_register_button_tip"><![CDATA[体验本站更多功能]]></item>
<item id="connect_member_loginbind_button_tip"><![CDATA[使用QQ账号快速登录本站]]></item>
<item id="connect_mobile_login"><![CDATA[使用QQ账号登录]]></item>
</item>
<item id="installlang">
<item id="connect_guest_group_name"><![CDATA[QQ游客]]></item>
</item>
</item>
</item>
</root>

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,193 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: install.php 33885 2013-08-27 06:28:19Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$connect = C::t('common_setting')->fetch_setting('connect', true);
$sql = <<<EOF
CREATE TABLE IF NOT EXISTS pre_common_member_connect (
`uid` mediumint(8) unsigned NOT NULL default '0',
`conuin` char(40) NOT NULL default '',
`conuinsecret` char(16) NOT NULL default '',
`conopenid` char(32) NOT NULL default '',
`conisfeed` tinyint(1) NOT NULL default '0',
`conispublishfeed` tinyint(1) NOT NULL default '0',
`conispublisht` tinyint(1) NOT NULL default '0',
`conisregister` tinyint(1) NOT NULL default '0',
`conisqzoneavatar` tinyint(1) NOT NULL default '0',
`conisqqshow` tinyint(1) NOT NULL default '0',
`conuintoken` char(32) NOT NULL DEFAULT '',
PRIMARY KEY (`uid`),
KEY `conuin` (`conuin`),
KEY `conopenid` (`conopenid`)
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS pre_connect_feedlog (
flid mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
tid mediumint(8) unsigned NOT NULL DEFAULT '0',
uid mediumint(8) unsigned NOT NULL DEFAULT '0',
publishtimes mediumint(8) unsigned NOT NULL DEFAULT '0',
lastpublished int(10) unsigned NOT NULL DEFAULT '0',
dateline int(10) unsigned NOT NULL DEFAULT '0',
`status` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (flid),
UNIQUE KEY tid (tid)
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS pre_connect_postfeedlog (
flid mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
pid int(10) unsigned NOT NULL DEFAULT '0',
uid mediumint(8) unsigned NOT NULL DEFAULT '0',
publishtimes mediumint(8) unsigned NOT NULL DEFAULT '0',
lastpublished int(10) unsigned NOT NULL DEFAULT '0',
dateline int(10) unsigned NOT NULL DEFAULT '0',
`status` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (flid),
UNIQUE KEY pid (pid)
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS pre_connect_memberbindlog (
mblid mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
uid mediumint(8) unsigned NOT NULL DEFAULT '0',
uin char(40) NOT NULL,
`type` tinyint(1) NOT NULL DEFAULT '0',
dateline int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (mblid),
KEY uid (uid),
KEY uin (uin),
KEY dateline (dateline)
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS pre_connect_tthreadlog (
twid char(16) NOT NULL,
tid mediumint(8) unsigned NOT NULL DEFAULT '0',
conopenid char(32) NOT NULL,
pagetime int(10) unsigned DEFAULT '0',
lasttwid char(16) DEFAULT NULL,
nexttime int(10) unsigned DEFAULT '0',
updatetime int(10) unsigned DEFAULT '0',
dateline int(10) unsigned DEFAULT '0',
PRIMARY KEY (twid),
KEY nexttime (tid,nexttime),
KEY updatetime (tid,updatetime)
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS pre_common_uin_black (
uin char(40) NOT NULL,
uid mediumint(8) unsigned NOT NULL DEFAULT '0',
dateline int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (uin),
UNIQUE KEY uid (uid)
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS pre_common_connect_guest (
`conopenid` char(32) NOT NULL default '',
`conuin` char(40) NOT NULL default '',
`conuinsecret` char(16) NOT NULL default '',
`conqqnick` char(100) NOT NULL default '',
`conuintoken` char(32) NOT NULL DEFAULT '',
PRIMARY KEY (conopenid)
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS `pre_connect_disktask` (
`taskid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`aid` int(10) unsigned NOT NULL DEFAULT '0',
`uid` int(10) unsigned NOT NULL DEFAULT '0',
`openid` char(32) NOT NULL DEFAULT '',
`filename` varchar(255) NOT NULL DEFAULT '',
`verifycode` char(32) NOT NULL DEFAULT '',
`status` smallint(6) unsigned NOT NULL DEFAULT '0',
`dateline` int(10) unsigned NOT NULL DEFAULT '0',
`downloadtime` int(10) unsigned NOT NULL DEFAULT '0',
`extra` text,
PRIMARY KEY (`taskid`),
KEY `openid` (`openid`),
KEY `status` (`status`)
) TYPE=INNODB;
REPLACE INTO pre_common_setting VALUES ('regconnect', '1');
EOF;
runquery($sql);
$needCreateGroup = true;
if ($connect['feed']) {
$group = C::t('common_usergroup')->fetch($connect['guest_groupid']);
if ($group) {
$needCreateGroup = false;
}
} else {
$connect = array (
'allow' => '1',
'feed' =>
array (
'allow' => '1',
'group' => '0',
),
't' =>
array (
'allow' => '1',
'group' => '0',
'reply' => 1,
'reply_showauthor' => 1,
),
'like_allow' => '1',
'like_qq' => '',
'turl_allow' => '1',
'turl_qq' => '',
'like_url' => '',
'register_birthday' => '0',
'register_gender' => '0',
'register_uinlimit' => '',
'register_rewardcredit' => '1',
'register_addcredit' => '',
'register_groupid' => '0',
'register_regverify' => '1',
'register_invite' => '0',
'newbiespan' => '',
'turl_code' => '',
'mblog_app_key' => 'abc',
);
}
if ($needCreateGroup) {
$name = $installlang['connect_guest_group_name'];
$userGroupData = array(
'type' => 'special',
'grouptitle' => $name,
'allowvisit' => 1,
'color' => '',
'stars' => '',
);
$newGroupId = C::t('common_usergroup')->insert($userGroupData, true);
$dataField = array(
'groupid' => $newGroupId,
'allowsearch' => 2,
'readaccess' => 1,
'allowgetattach' => 1,
'allowgetimage' => 1,
);
C::t('common_usergroup_field')->insert($dataField);
$connect['guest_groupid'] = $newGroupId;
updatecache('usergroups');
}
$https = json_decode(dfsockopen('https://graph.qq.com/user/get_user_info'));
$connect['oauth2'] = $https->ret == -1 ? 1 : 0;
C::t('common_setting')->update_setting('connect', serialize($connect));
updatecache('setting');
$finish = true;

View File

@@ -0,0 +1,580 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: Connect.php 36278 2016-12-09 07:52:35Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class Cloud_Service_Connect {
const SPECIAL_GID = 7;
protected static $_instance;
public $state = '';
public static function getInstance() {
if (!(self::$_instance instanceof self)) {
self::$_instance = new self();
}
return self::$_instance;
}
public function __construct($siteId = '', $siteKey = '') {
}
public function connectMergeMember() {
global $_G;
static $merged;
if($merged) {
return;
}
$connect_member = C::t('#qqconnect#common_member_connect')->fetch($_G['uid']);
if ($connect_member) {
$_G['member'] = array_merge($_G['member'], $connect_member);
$user_auth_fields = $connect_member['conisfeed'];
if ($user_auth_fields == 0) {
$_G['member']['is_user_info'] = 0;
$_G['member']['is_feed'] = 0;
} elseif ($user_auth_fields == 1) {
$_G['member']['is_user_info'] = 1;
$_G['member']['is_feed'] = 0;
} elseif ($user_auth_fields == 2) {
$_G['member']['is_user_info'] = 1;
$_G['member']['is_feed'] = 0;
} elseif ($user_auth_fields == 3) {
$_G['member']['is_user_info'] = 0;
$_G['member']['is_feed'] = 0;
}
unset($connect_member, $_G['member']['conisfeed']);
}
$merged = true;
}
public function connectUserBindParams() {
global $_G;
$this->connectMergeMember();
getuserprofile('birthyear');
getuserprofile('birthmonth');
getuserprofile('birthday');
switch ($_G['member']['gender']) {
case 1 :
$sex = 'male';
break;
case 2 :
$sex = 'female';
break;
default :
$sex = 'unknown';
}
$is_public_email = 2;
$is_use_qq_avatar = $_G['member']['conisqzoneavatar'] == 1 ? 1 : 2;
$birthday = sprintf('%04d', $_G['member']['birthyear']).'-'.sprintf('%02d', $_G['member']['birthmonth']).'-'.sprintf('%02d', $_G['member']['birthday']);
$agent = md5(time().rand().uniqid());
$inputArray = array (
'uid' => $_G['uid'],
'agent' => $agent,
'time' => TIMESTAMP
);
require_once DISCUZ_ROOT.'./config/config_ucenter.php';
$input = 'uid='.$_G['uid'].'&agent='.$agent.'&time='.TIMESTAMP;
$avatar_input = authcode($input, 'ENCODE', UC_KEY);
$params = array (
'oauth_consumer_key' => $_G['setting']['connectappid'],
'u_id' => $_G['uid'],
'username' => $_G['member']['username'],
'email' => $_G['member']['email'],
'birthday' => $birthday,
'sex' => $sex,
'is_public_email' => $is_public_email,
'is_use_qq_avatar' => $is_use_qq_avatar,
's_id' => null,
'avatar_input' => $avatar_input,
'avatar_agent' => $agent,
'site_ucenter_id' => UC_APPID,
'source' => 'qzone',
);
return $params;
}
public function connectFeedResendJs() {
global $_G;
$jsname = $_G['cookie']['connect_js_name'];
if($jsname != 'feed_resend') {
return false;
}
$params = dunserialize(base64_decode($_G['cookie']['connect_js_params']));
$params['sig'] = $this->connectGetSig($params, $this->connectGetSigKey());
$jsurl = $_G['connect']['discuz_new_feed_url'];
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Util.php';
$utilService = new Cloud_Service_Util();
$jsurl .= '?' . $utilService->httpBuildQuery($params, '', '&');
return $jsurl;
}
public function connectCookieLoginJs() {
global $_G;
return $ajaxUrl = 'connect.php?mod=check&op=cookie';
}
public function connectGetSigKey() {
global $_G;
return $_G['setting']['connectappid'] . '|' . $_G['setting']['connectappkey'];
}
public function connectGetSig($params, $app_key) {
ksort($params);
$base_string = '';
foreach($params as $key => $value) {
$base_string .= $key.'='.$value;
}
$base_string .= $app_key;
return md5($base_string);
}
public function connectParseBbcode($bbcode, $fId, $pId, $isHtml, &$attachImages) {
include_once libfile('function/discuzcode');
$result = preg_replace('/\[hide(=\d+)?\].+?\[\/hide\](\r\n|\s)/i', '', $bbcode);
$result = preg_replace('/\[payto(=\d+)?\].+?\[\/payto\](\r\n|\s)/i', '', $result);
$result = preg_replace('/\[quote\].*\[\/quote\](\r\n|\n|\r){0,}/is', '', $result);
$result = discuzcode($result, 0, 0, $isHtml, 1, 2, 1, 0, 0, 0, 0, 1, 0);
$result = strip_tags($result, '<img><a>');
$result = preg_replace('/<img src="images\//i', "<img src=\"".$_G['siteurl']."images/", $result);
$result = $this->connectParseAttach($result, $fId, $pId, $attachImages, $attachImageThumb);
return $result;
}
public function connectParseAttach($content, $fId, $pId, &$attachImages) {
global $_G;
$permissions = $this->connectGetUserGroupPermissions(self::SPECIAL_GID, $fId);
$visitorPermission = $permissions[self::SPECIAL_GID];
$attachIds = array();
$attachImages = array ();
$attachments = C::t('forum_attachment')->fetch_all_by_id('pid', $pId);
$attachments = C::t('forum_attachment_n')->fetch_all_attachment("pid:$pId", array_keys($attachments));
foreach ($attachments as $k => $attach) {
$aid = $attach['aid'];
if($attach['isimage'] == 0 || $attach['price'] > 0 || $attach['readperm'] > $visitorPermission['readPermission'] || in_array($fId, $visitorPermission['forbidViewAttachForumIds']) || in_array($attach['aid'], $attachIds)) {
continue;
}
$imageItem = array ();
$thumbWidth = '100';
$thumbHeight = '100';
$bigWidth = '400';
$bigHeight = '400';
$thumbImageURL = $_G['siteurl'] . getforumimg($aid, 1, $thumbWidth, $thumbHeight, 'fixwr');
$bigImageURL = $_G['siteurl'] . getforumimg($aid, 1, $bigWidth, $bigHeight, 'fixnone');
$imageItem['aid'] = $aid;
$imageItem['thumb'] = $thumbImageURL;
$imageItem['big'] = $bigImageURL;
if($attach['remote']) {
$imageItem['path'] = $_G['setting']['ftp']['attachurl'].'forum/'.$attach['attachment'];
$imageItem['remote'] = true;
} else {
$imageItem['path'] = $_G['setting']['attachdir'].'forum/'.$attach['attachment'];
}
$attachIds[] = $aid;
$attachImages[] = $imageItem;
}
$this->connectParseAttach_callback_connectParseAttachTag_1($attachNames, 1);
$content = preg_replace_callback('/\[attach\](\d+)\[\/attach\]/i', array($this, 'connectParseAttach_callback_connectParseAttachTag_1'), $content);
return $content;
}
public function connectParseAttach_callback_connectParseAttachTag_1($matches, $action = 0) {
static $attachNames = '';
if($action == 1) {
$attachNames = $matches;
} else {
return $this->connectParseAttachTag($matches[1], $attachNames);
}
}
public function connectParseAttachTag($attachId, $attachNames) {
include_once libfile('function/discuzcode');
if(array_key_exists($attachId, $attachNames)) {
return '<span class="attach"><a href="'.$_G['siteurl'].'/attachment.php?aid='.aidencode($attachId).'">'.$attachNames[$attachId].'</a></span>';
}
return '';
}
function connectGetUserGroupPermissions($gid, $fid) {
global $_G;
loadcache('usergroups');
$fields = array (
'groupid' => 'userGroupId',
'grouptitle' => 'userGroupName',
'readaccess' => 'readPermission',
'allowvisit' => 'allowVisit'
);
$userGroup = C::t('common_usergroup')->fetch_all_usergroup($gid);
$userGroupInfo = array();
foreach ($userGroup as $id => $value) {
$userGroupInfo[$id] = array_merge($value, $_G['cache']['usergroups'][$id]);
$userGroupInfo[$id]['forbidForumIds'] = array ();
$userGroupInfo[$id]['allowForumIds'] = array ();
$userGroupInfo[$id]['specifyAllowForumIds'] = array ();
$userGroupInfo[$id]['allowViewAttachForumIds'] = array ();
$userGroupInfo[$id]['forbidViewAttachForumIds'] = array ();
foreach ($fields as $k => $v) {
$userGroupInfo[$id][$v] = $userGroupInfo[$id][$k];
}
}
$forumField = C::t('forum_forumfield')->fetch($fid);
$allowViewGroupIds = array ();
if($forumField['viewperm']) {
$allowViewGroupIds = explode("\t", $forumField['viewperm']);
}
$allowViewAttachGroupIds = array ();
if($forumField['getattachperm']) {
$allowViewAttachGroupIds = explode("\t", $forumField['getattachperm']);
}
foreach ($userGroupInfo as $groupId => $value) {
if($forumField['password']) {
$userGroupInfo[$groupId]['forbidForumIds'][] = $fid;
continue;
}
$perm = dunserialize($forumField['formulaperm']);
if(is_array($perm)) {
if($perm[0] || $perm[1] || $perm['users']) {
$userGroupInfo[$groupId]['forbidForumIds'][] = $fid;
continue;
}
}
if(!$allowViewGroupIds) {
$userGroupInfo[$groupId]['allowForumIds'][] = $fid;
} elseif (!in_array($groupId, $allowViewGroupIds)) {
$userGroupInfo[$groupId]['forbidForumIds'][] = $fid;
} elseif (in_array($groupId, $allowViewGroupIds)) {
$userGroupInfo[$groupId]['allowForumIds'][] = $fid;
$userGroupInfo[$groupId]['specifyAllowForumIds'][] = $fid;
}
if(!$allowViewAttachGroupIds) {
$userGroupInfo[$groupId]['allowViewAttachForumIds'][] = $fid;
} elseif (!in_array($groupId, $allowViewAttachGroupIds)) {
$userGroupInfo[$groupId]['forbidViewAttachForumIds'][] = $fid;
} elseif (in_array($groupId, $allowViewGroupIds)) {
$userGroupInfo[$groupId]['allowViewAttachForumIds'][] = $fid;
}
}
return $userGroupInfo;
}
public function connectOutputPhp($url, $postData = '') {
global $_G;
$response = dfsockopen($url, 0, $postData, '', false, $_G['setting']['cloud_api_ip']);
$result = (array) dunserialize($response);
return $result;
}
public function connectJsOutputMessage($msg = '', $errMsg = '', $errCode = '') {
$result = array (
'result' => $msg,
'errMessage' => $errMsg,
'errCode' => $errCode
);
echo sprintf('con_handle_response(%s);', json_encode($this->_connectUrlencode($result)));
exit;
}
protected function _connectUrlencode($value) {
if (is_array($value)) {
foreach ($value as $k => $v) {
$value[$k] = $this->_connectUrlencode($v);
}
} else if (is_string($value)) {
$value = urlencode(str_replace(array("\r\n", "\r", "\n", "\"", "\/", "\t"), array('\\n', '\\n', '\\n', '\\"', '\\/', '\\t'), $value));
}
return $value;
}
public function connectCookieLoginParams() {
global $_G;
$this->connectMergeMember();
$oauthToken = $_G['member']['conuin'];
$api_url = $_G['connect']['api_url'].'/connect/discuz/cookieReport';
if($oauthToken) {
$extra = array (
'oauth_token' => $oauthToken
);
$sig_params = $this->connectGetOauthSignatureParams($extra);
$oauth_token_secret = $_G['member']['conuinsecret'];
$sig_params['oauth_signature'] = $this->connectGetOauthSignature($api_url, $sig_params, 'POST', $oauth_token_secret);
$params = array (
'client_ip' => $_G['clientip'],
'u_id' => $_G['uid'],
'version' => 'qzone1.0',
);
$params = array_merge($sig_params, $params);
$params['response_type'] = 'php';
return $params;
} else {
return false;
}
}
function connectAddCookieLogins() {
global $_G;
loadcache('connect_has_setting_count');
if (!$_G['cache']['connect_has_setting_count']) {
$times = C::t('common_setting')->fetch_setting('connect_login_times');
C::t('common_setting')->update_setting('connect_login_times', $times + 1);
savecache('connect_has_setting_count', '1');
} else {
C::t('common_setting')->update_count('connect_login_times', 1);
}
$life = 86400;
$current_date = date('Y-m-d');
dsetcookie('connect_last_report_time', $current_date, $life);
return true;
}
public function connectAjaxOuputMessage($msg = '', $errCode = '') {
@header("Content-type: text/html; charset=".CHARSET);
echo "errCode=$errCode&result=$msg";
exit;
}
public function connectGetOauthSignature($url, $params, $method = 'POST', $oauth_token_secret = '') {
global $_G;
$method = strtoupper($method);
if(!in_array($method, array ('GET', 'POST'))) {
return FALSE;
}
$url = urlencode($url);
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Util.php';
$utilService = new Cloud_Service_Util();
$param_str = urlencode($utilService->httpBuildQuery($params, '', '&'));
$base_string = $method.'&'.$url.'&'.$param_str;
$key = $_G['setting']['connectappkey'].'&'.$oauth_token_secret;
$signature = $utilService->hashHmac('sha1', $base_string, $key);
return $signature;
}
public function connectGetOauthSignatureParams($extra = array ()) {
global $_G;
$params = array (
'oauth_consumer_key' => $_G['setting']['connectappid'],
'oauth_nonce' => $this->_connectGetNonce(),
'oauth_signature_method' => 'HMAC_SHA1',
'oauth_timestamp' => TIMESTAMP
);
if($extra) {
$params = array_merge($params, $extra);
}
ksort($params);
return $params;
}
protected function _connectGetNonce() {
$mt = microtime();
$rand = mt_rand();
return md5($mt.$rand);
}
public function connectParseXml($contents, $getAttributes = true, $priority = 'tag') {
if (!$contents) {
return array();
}
if (!function_exists('xml_parser_create')) {
return array();
}
$parser = xml_parser_create('');
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, trim($contents), $xmlValues);
xml_parser_free($parser);
if (!$xmlValues) {
return;
}
$xmlArray = $parent = array();
$current = &$xmlArray;
$repeatedTagIndex = array();
foreach($xmlValues as $data) {
unset($attributes, $value);
extract($data);
$result = $attributesData = array();
if (isset($value)) {
if ($priority == 'tag') {
$result = $value;
} else {
$result['value'] = $value;
}
}
if (isset($attributes) && $getAttributes) {
foreach ($attributes as $attr => $val) {
if ($priority == 'tag') {
$attributesData[$attr] = $val;
} else {
$result['attr'][$attr] = $val;
}
}
}
if ($type == 'open') {
$parent[$level - 1] = &$current;
if (!is_array($current) || (!in_array($tag, array_keys($current)))) {
$current[$tag] = $result;
if ($attributesData) {
$current[$tag . '_attr'] = $attributesData;
}
$repeatedTagIndex[$tag . '_' . $level] = 1;
$current = &$current[$tag];
} else {
if (isset($current[$tag][0])) {
$current[$tag][$repeatedTagIndex[$tag . '_' . $level]] = $result;
$repeatedTagIndex[$tag . '_' . $level] ++;
} else {
$current[$tag] = array($current[$tag], $result);
$repeatedTagIndex[$tag . '_' . $level] = 2;
if (isset($current[$tag . '_attr'])) {
$current[$tag]['0_attr'] = $current[$tag . '_attr'];
unset($current[$tag . '_attr']);
}
}
$lastItemIndex = $repeatedTagIndex[$tag . '_' . $level] - 1;
$current = &$current[$tag][$lastItemIndex];
}
} elseif($type == 'complete') {
if (!isset($current[$tag])) {
$current[$tag] = $result;
$repeatedTagIndex[$tag . '_' . $level] = 1;
if ($priority == 'tag' && $attributesData) {
$current[$tag . '_attr'] = $attributesData;
}
} else {
if (isset($current[$tag][0]) && is_array($current[$tag])) {
$current[$tag][$repeatedTagIndex[$tag . '_' . $level]] = $result;
if ($priority == 'tag' && $getAttributes && $attributesData) {
$current[$tag][$repeatedTagIndex[$tag . '_' . $level] . '_attr'] = $attributesData;
}
$repeatedTagIndex[$tag . '_' . $level] ++;
} else {
$current[$tag] = array($current[$tag], $result);
$repeatedTagIndex[$tag . '_' . $level] = 1;
if ($priority == 'tag' && $getAttributes) {
if (isset($current[$tag . '_attr'])) {
$current[$tag]['0_attr'] = $current[$tag . '_attr'];
unset($current[$tag . '_attr']);
}
if ($attributesData) {
$current[$tag][$repeatedTagIndex[$tag . '_' . $level] . '_attr'] = $attributesData;
}
}
$repeatedTagIndex[$tag . '_' . $level] ++;
}
}
} elseif($type == 'close') {
$current = &$parent[$level - 1];
}
}
return $xmlArray[key($parent[0])] ? $xmlArray[key($parent[0])] : $xmlArray;
}
public function connectFilterUsername($username) {
$username = str_replace(' ', '_', trim($username));
return cutstr($username, 15, '');
}
public function connectErrlog($errno, $error) {
return true;
}
function connectCookieLoginReport($loginTimes) {
global $_G;
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Util.php';
$utilService = new Cloud_Service_Util();
$response = '';
if ($loginTimes) {
$api_url = $_G['connect']['api_url'].'/connect/discuz/batchCookieReport';
$params = array (
'oauth_consumer_key' => $_G['setting']['connectappid'],
'login_times' => $loginTimes,
'date' => dgmdate(TIMESTAMP - 86400, 'Y-m-d'),
'ts' => TIMESTAMP,
);
$params['sig'] = $this->connectGetSig($params, $this->connectGetSigKey());
$response = $this->connectOutputPhp($api_url.'?', $utilService->httpBuildQuery($params, '', '&'));
} else {
$response = array('status' => 0);
}
return $response;
}
}

View File

@@ -0,0 +1,524 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: ConnectOAuth.php 34191 2013-10-30 08:07:15Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/OAuth.php';
class Cloud_Service_Client_ConnectOAuth extends Cloud_Service_Client_OAuth {
private $_requestTokenURL = 'http://openapi.qzone.qq.com/oauth/qzoneoauth_request_token';
private $_oAuthAuthorizeURL = 'http://openapi.qzone.qq.com/oauth/qzoneoauth_authorize';
private $_accessTokenURL = 'http://openapi.qzone.qq.com/oauth/qzoneoauth_access_token';
private $_getUserInfoURL = 'http://openapi.qzone.qq.com/user/get_user_info';
private $_addShareURL = 'http://openapi.qzone.qq.com/share/add_share';
private $_addTURL = 'http://openapi.qzone.qq.com/t/add_t';
private $_addPicTURL = 'http://openapi.qzone.qq.com/t/add_pic_t';
private $_getReportListURL = 'http://openapi.qzone.qq.com/t/get_repost_list';
private $_oAuthAuthorizeURL_V2 = 'https://graph.qq.com/oauth2.0/authorize';
private $_accessTokenURL_V2 = 'https://graph.qq.com/oauth2.0/token';
private $_openIdURL_V2 = 'https://graph.qq.com/oauth2.0/me';
private $_getUserInfoURL_V2 = 'https://graph.qq.com/user/get_user_info';
private $_addShareURL_V2 = 'https://graph.qq.com/share/add_share';
private $_addTURL_V2 = 'https://graph.qq.com/t/add_t';
private $_addPicTURL_V2 = 'https://graph.qq.com/t/add_pic_t';
const RESPONSE_ERROR = 999;
const RESPONSE_ERROR_MSG = 'request failed';
protected static $_instance;
public static function getInstance($connectAppId = '', $connectAppKey = '', $apiIp = '') {
if (!(self::$_instance instanceof self)) {
self::$_instance = new self($connectAppId = '', $connectAppKey = '', $apiIp = '');
}
return self::$_instance;
}
public function __construct($connectAppId = '', $connectAppKey = '', $apiIp = '') {
if(!$connectAppId || !$connectAppKey) {
global $_G;
$connectAppId = $_G['setting']['connectappid'];
$connectAppKey = $_G['setting']['connectappkey'];
}
$this->setAppkey($connectAppId, $connectAppKey);
if(!$this->_appKey || !$this->_appSecret) {
throw new Exception('connectAppId/connectAppKey Invalid', __LINE__);
}
if(!$apiIp) {
global $_G;
$apiIp = $_G['setting']['connect_api_ip'] ? $_G['setting']['connect_api_ip'] : '';
}
if($apiIp && !$_G['setting']['connect']['oauth2']) {
$this->setApiIp($apiIp);
}
}
public function connectGetRequestToken($callback, $clientIp = '') {
$extra = array();
$extra['oauth_callback'] = rawurlencode($callback);
if ($clientIp) {
$extra['oauth_client_ip'] = $clientIp;
}
$this->setTokenSecret('');
$response = $this->_request($this->_requestTokenURL, $extra);
parse_str($response, $params);
if($params['oauth_token'] && $params['oauth_token_secret']) {
return $params;
} else {
$params['error_code'] = $params['error_code'] ? $params['error_code'] : self::RESPONSE_ERROR;
throw new Exception($params['error_code'], __LINE__);
}
}
public function getOAuthAuthorizeURL($requestToken) {
$params = array(
'oauth_consumer_key' => $this->_appKey,
'oauth_token' => $requestToken,
);
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Util.php';
$utilService = new Cloud_Service_Util();
$oAuthAuthorizeURL = $this->_oAuthAuthorizeURL.'?'.$utilService->httpBuildQuery($params, '', '&');
return $oAuthAuthorizeURL;
}
private function _connectIsValidOpenid($openId, $timestamp, $sig) {
$key = $this->_appSecret;
$str = $openId.$timestamp;
$signature = $this->customHmac($str, $key);
return $sig == $signature;
}
public function connectGetAccessToken($params, $requestTokenSecret) {
if(!$this->_connectIsValidOpenid($params['openid'], $params['timestamp'], $params['oauth_signature'])) {
throw new Exception('openId signature invalid', __LINE__);
}
if(!$params['oauth_token'] || !$params['oauth_vericode']) {
throw new Exception('requestToken/vericode invalid', __LINE__);
}
$extra = array(
'oauth_token' => $params['oauth_token'],
'oauth_vericode' => $params['oauth_vericode'],
);
$this->setTokenSecret($requestTokenSecret);
$response = $this->_request($this->_accessTokenURL, $extra);
parse_str($response, $result);
if($result['oauth_token'] && $result['oauth_token_secret'] && $result['openid']) {
return $result;
} else {
$result['error_code'] = $result['error_code'] ? $result['error_code'] : self::RESPONSE_ERROR;
throw new Exception($result['error_code'], __LINE__);
}
}
public function connectGetUserInfo($openId, $accessToken, $accessTokenSecret) {
$extra = array(
'oauth_token' => $accessToken,
'openid' => $openId,
'format' => 'xml',
);
$this->setTokenSecret($accessTokenSecret);
$response = $this->_request($this->_getUserInfoURL, $extra);
$data = $this->_xmlParse($response);
if(isset($data['ret']) && $data['ret'] == 0) {
return $data;
} else {
throw new Exception($data['msg'], $data['ret']);
}
}
private function _request($requestURL, $extra = array(), $oauthMethod = 'GET', $multi = array()) {
if(!$this->_appKey || !$this->_appSecret) {
throw new Exception('appKey or appSecret not init');
}
if(strtoupper(CHARSET) != 'UTF-8') {
foreach((array)$extra as $k => $v) {
$extra[$k] = diconv($v, CHARSET, 'UTF-8');
}
}
return $this->getRequest($requestURL, $extra, $oauthMethod, $multi);
}
private function _xmlParse($data) {
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Connect.php';
$connectService = new Cloud_Service_Connect();
$data = $connectService->connectParseXml($data);
if (strtoupper(CHARSET) != 'UTF-8') {
$data = $this->_iconv($data, 'UTF-8', CHARSET);
}
if(!isset($data['ret']) && !isset($data['errcode'])) {
$data = array(
'ret' => self::RESPONSE_ERROR,
'msg' => self::RESPONSE_ERROR_MSG
);
}
return $data;
}
private function _iconv($data, $inputCharset, $outputCharset) {
if (is_array($data)) {
foreach($data as $key => $val) {
$value = array_map(array($this, '_iconv'), array($val), array($inputCharset), array($outputCharset));
$result[$key] = $value[0];
}
} else {
$result = diconv($data, $inputCharset, $outputCharset);
}
return $result;
}
public function connectAddShare($openId, $accessToken, $accessTokenSecret, $params) {
if(!$params['title'] || !$params['url']) {
throw new Exception('Required Parameter Missing');
}
$paramsName = array('title', 'url', 'comment', 'summary', 'images', 'source', 'type', 'playurl', 'nswb');
if($params['title']) {
$params['title'] = cutstr($params['title'], 72, '');
}
if($params['comment']) {
$params['comment'] = cutstr($params['comment'], 80, '');
}
if($params['summary']) {
$params['summary'] = cutstr($params['summary'], 160, '');
}
if($params['images']) {
$params['images'] = cutstr($params['images'], 255, '');
}
if($params['playurl']) {
$params['playurl'] = cutstr($params['playurl'], 256, '');
}
$extra = array(
'oauth_token' => $accessToken,
'openid' => $openId,
'format' => 'xml',
);
foreach($paramsName as $name) {
if($params[$name]) {
$extra[$name] = $params[$name];
}
}
$this->setTokenSecret($accessTokenSecret);
$response = $this->_request($this->_addShareURL, $extra, 'POST');
$data = $this->_xmlParse($response);
if(isset($data['ret']) && $data['ret'] == 0) {
return $data;
} else {
throw new Exception($data['msg'], $data['ret']);
}
}
public function connectAddPicT($openId, $accessToken, $accessTokenSecret, $params) {
if(!$params['content'] || !$params['pic']) {
throw new Exception('Required Parameter Missing');
}
$paramsName = array('content', 'pic', 'clientip', 'jing', 'wei', 'syncflag');
$extra = array(
'oauth_token' => $accessToken,
'openid' => $openId,
'format' => 'xml',
);
foreach($paramsName as $name) {
if($params[$name]) {
$extra[$name] = $params[$name];
}
}
$pic = $extra['pic'];
unset($extra['pic']);
$this->setTokenSecret($accessTokenSecret);
$response = $this->_request($this->_addPicTURL, $extra, 'POST', array('pic' => $pic, 'remote' => $params['remote'] ? true : false));
$data = $this->_xmlParse($response);
if(isset($data['ret']) && $data['ret'] == 0) {
return $data;
} else {
throw new Exception($data['msg'], $data['ret']);
}
}
public function connectAddT($openId, $accessToken, $accessTokenSecret, $params) {
if(!$params['content']) {
throw new Exception('Required Parameter Missing');
}
$paramsName = array('content', 'clientip', 'jing', 'wei');
$extra = array(
'oauth_token' => $accessToken,
'openid' => $openId,
'format' => 'xml',
);
foreach($paramsName as $name) {
if($params[$name]) {
$extra[$name] = $params[$name];
}
}
$this->setTokenSecret($accessTokenSecret);
$response = $this->_request($this->_addTURL, $extra, 'POST');
$data = $this->_xmlParse($response);
if(isset($data['ret']) && $data['ret'] == 0) {
return $data;
} else {
throw new Exception($data['msg'], $data['ret']);
}
}
public function connectGetRepostList($openId, $accessToken, $accessTokenSecret, $params) {
if(!isset($params['flag']) || !$params['rootid'] || !isset($params['pageflag']) || !isset($params['pagetime']) || !$params['reqnum'] || !isset($params['twitterid'])) {
throw new Exception('Required Parameter Missing');
}
$paramsName = array('flag', 'rootid', 'pageflag', 'pagetime', 'reqnum', 'twitterid');
$extra = array(
'oauth_token' => $accessToken,
'openid' => $openId,
'format' => 'xml',
);
foreach($paramsName as $name) {
if($params[$name]) {
$extra[$name] = $params[$name];
}
}
$this->setTokenSecret($accessTokenSecret);
$response = $this->_request($this->_getReportListURL, $extra, 'GET');
$data = $this->_xmlParse($response);
if(isset($data['ret']) && $data['ret'] == 0) {
return $data;
} else {
throw new Exception($data['msg'], $data['ret']);
}
}
public function getOAuthAuthorizeURL_V2($redirect_uri) {
$params = array(
'response_type' => 'code',
'client_id' => $this->_appKey,
'redirect_uri' => $redirect_uri,
'state' => md5(FORMHASH),
'scope' => 'get_user_info,add_share,add_t,add_pic_t,get_repost_list',
);
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Util.php';
$utilService = new Cloud_Service_Util();
return $this->_oAuthAuthorizeURL_V2.'?'.$utilService->httpBuildQuery($params, '', '&');
}
public function connectGetOpenId_V2($redirect_uri, $code) {
$params = array(
'grant_type' => 'authorization_code',
'client_id' => $this->_appKey,
'redirect_uri' => $redirect_uri,
'client_secret' => $this->_appSecret,
'code' => $code
);
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Util.php';
$utilService = new Cloud_Service_Util();
$response = $this->dfsockopen($this->_accessTokenURL_V2.'?'.$utilService->httpBuildQuery($params, '', '&'));
parse_str($response, $result);
if($result['access_token'] && $result['refresh_token']) {
$params = array(
'access_token' => $result['access_token']
);
$response = $this->callback($this->dfsockopen($this->_openIdURL_V2.'?'.$utilService->httpBuildQuery($params, '', '&')));
if($response['openid']) {
$result = array(
'openid' => $response['openid'],
'access_token' => $result['access_token']
);
return $result;
} else {
$result['error'] = $result['error'] ? $result['error'] : self::RESPONSE_ERROR;
throw new Exception($result['error'], __LINE__);
}
} else {
$result = $this->callback($response);
$result['error'] = $result['error'] ? $result['error'] : self::RESPONSE_ERROR;
throw new Exception($result['error'], __LINE__);
}
}
public function connectGetUserInfo_V2($openId, $accessToken) {
$params = array(
'access_token' => $accessToken,
'oauth_consumer_key' => $this->_appKey,
'openid' => $openId
);
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Util.php';
$utilService = new Cloud_Service_Util();
$response = $this->dfsockopen($this->_getUserInfoURL_V2.'?'.$utilService->httpBuildQuery($params, '', '&'));
$data = json_decode($response, true);
$data = $this->_iconv($data, 'UTF-8', CHARSET);
if(isset($data['ret']) && $data['ret'] == 0) {
return $data;
} else {
throw new Exception($data['msg'], $data['ret']);
}
}
public function connectAddShare_V2($openId, $accessToken, $params) {
if(!$params['title'] || !$params['url']) {
throw new Exception('Required Parameter Missing');
}
$paramsName = array('title', 'url', 'comment', 'summary', 'images', 'source', 'type', 'playurl', 'nswb');
if($params['title']) {
$params['title'] = diconv(cutstr($params['title'], 72, ''), CHARSET, 'UTF-8');
}
if($params['comment']) {
$params['comment'] = diconv(cutstr($params['comment'], 80, ''), CHARSET, 'UTF-8');
}
if($params['summary']) {
$params['summary'] = diconv(cutstr($params['summary'], 160, ''), CHARSET, 'UTF-8');
}
if($params['images']) {
$params['images'] = cutstr($params['images'], 255, '');
}
if($params['playurl']) {
$params['playurl'] = cutstr($params['playurl'], 256, '');
}
$extra = array(
'access_token' => $accessToken,
'oauth_consumer_key' => $this->_appKey,
'openid' => $openId,
'format' => 'xml',
);
foreach($paramsName as $name) {
if($params[$name]) {
$extra[$name] = $params[$name];
}
}
$response = $this->dfsockopen($this->_addShareURL_V2, $extra);
$data = $this->_xmlParse($response);
if(isset($data['ret']) && $data['ret'] == 0) {
return $data;
} else {
throw new Exception($data['msg'], $data['ret']);
}
}
public function connectAddPicT_V2($openId, $accessToken, $params) {
if(!$params['content'] || !$params['pic']) {
throw new Exception('Required Parameter Missing');
}
$extra = array(
'access_token' => $accessToken,
'oauth_consumer_key' => $this->_appKey,
'openid' => $openId,
'content' => diconv($params['content'], CHARSET, 'UTF-8'),
'format' => 'xml',
);
$response = $this->dfsockopen($this->_addPicTURL_V2, $extra, array('pic' => $params['pic']));
$data = $this->_xmlParse($response);
if(isset($data['ret']) && $data['ret'] == 0) {
return $data;
} else {
throw new Exception($data['msg'], $data['ret']);
}
}
public function connectAddT_V2($openId, $accessToken, $params) {
if(!$params['content']) {
throw new Exception('Required Parameter Missing');
}
$extra = array(
'access_token' => $accessToken,
'oauth_consumer_key' => $this->_appKey,
'openid' => $openId,
'content' => diconv($params['content'], CHARSET, 'UTF-8'),
'format' => 'xml',
);
$response = $this->dfsockopen($this->_addTURL_V2, $extra);
$data = $this->_xmlParse($response);
if(isset($data['ret']) && $data['ret'] == 0) {
return $data;
} else {
throw new Exception($data['msg'], $data['ret']);
}
}
}

View File

@@ -0,0 +1,223 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: OAuth.php 33542 2013-07-03 05:15:00Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class Cloud_Service_Client_OAuth {
protected $_appKey = '';
protected $_appSecret = '';
protected $_apiIp = '';
private $_tokenSecret = '';
private $_boundary = '';
const OAUTH_VERSION = '1.0';
const OAUTH_SIGNATURE_METHOD = 'HMAC-SHA1';
protected static $_instance;
public static function getInstance() {
if (!(self::$_instance instanceof self)) {
self::$_instance = new self();
}
return self::$_instance;
}
public function dfsockopen($requestURL, $queryString = array(), $files = false) {
return dfsockopen($requestURL, 0, $queryString, '', false, $this->_apiIp, 15, TRUE, !$files ? 'URLENCODE' : 'FORMDATA', true, 0, $files);
}
public function callback($response) {
$return = array();
if(strpos($response, "callback") !== false) {
$lpos = strpos($response, "(");
$rpos = strrpos($response, ")");
$response = substr($response, $lpos + 1, $rpos - $lpos - 1);
$return = json_decode($response, true);
if(!is_array($return)) {
$return = array();
}
}
return $return;
}
public function getRequest($requestURL, $extra = array(), $oauthMethod = 'GET', $multi = array()) {
if($multi) {
$imageFile = $this->_getImageBinary($multi);
$extra = array_merge($extra, $imageFile['binary']);
}
$params = $this->_getOAuthSignatureParams($extra);
$params['oauth_signature'] = $this->_getOAuthSignature($requestURL, $params, $oauthMethod, $multi ? TRUE : FALSE);
$queryString = $this->_httpBuildQuery($params, $imageFile['fileInfo']);
if($oauthMethod == 'GET') {
$requestURL = $requestURL.'?'.$queryString;
$queryString = '';
} else {
$requestURL = $requestURL.'?';
}
return $this->dfsockopen($requestURL, $queryString, $multi);
}
public function getTimestamp() {
return time();
}
public function getOAuthNonce() {
return time().(time() % $this->_appKey);
}
protected function setAppKey($appKey, $appSecret) {
$this->_appKey = $appKey;
$this->_appSecret = $appSecret;
}
protected function setTokenSecret($tokenSecret) {
$this->_tokenSecret = $tokenSecret;
}
protected function setApiIp($apiIp) {
$this->_apiIp = $apiIp;
}
public function customHmac($str, $key) {
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Util.php';
$utilService = new Cloud_Service_Util();
return base64_encode($utilService->hashHmac('sha1', $str, $key, true));
}
private function _getOAuthSignatureParams($extra = array()) {
$params = array(
'oauth_consumer_key' => $this->_appKey,
'oauth_nonce' => $this->getOAuthNonce(),
'oauth_signature_method' => self::OAUTH_SIGNATURE_METHOD,
'oauth_timestamp' => $this->getTimestamp(),
'oauth_version' => self::OAUTH_VERSION,
);
if($extra) {
$params = array_merge($params, $extra);
}
uksort($params, 'strcmp');
return $params;
}
private function _httpBuildQuery($params, $multi = array()) {
if(!$params) {
return '';
}
$multiPartBody = '';
if($multi) {
$this->_boundary = uniqid('------------------');
$bodyBoundary = '--'.$this->_boundary;
$endBodyBoundary = $bodyBoundary.'--';
foreach($params as $param => $value) {
if(array_key_exists($param, $multi)) {
$ext = strtolower(substr(strrchr($multi[$param]['file'], '.'), 1, 10));
$fileName = 'picture.'.$ext;
$mime = $multi[$param]['mime'];
$multiPartBody .= $bodyBoundary."\r\n";
$multiPartBody .= 'Content-Disposition: form-data; name="'.$param.'"; filename="'.$fileName.'"'."\r\n";
$multiPartBody .= 'Content-Type: '.$mime."\r\n\r\n";
$multiPartBody .= $value. "\r\n";
} else {
$multiPartBody .= $bodyBoundary . "\r\n";
$multiPartBody .= 'content-disposition: form-data; name="'.$param."\"\r\n\r\n";
$multiPartBody .= $value."\r\n";
}
}
$multiPartBody .= $endBodyBoundary."\r\n";
} else {
foreach($params as $param => $value) {
$multiPartBody .= $comma.$this->rawurlencode($param).'='.$this->rawurlencode($value);
$comma = '&';
}
}
return $multiPartBody;
}
private function _getOAuthSignature($url, $params, $method = 'POST', $multi = FALSE) {
$method = strtoupper($method);
if(!in_array($method, array ('GET', 'POST'))) {
throw new Exception('Request Method Invlid');
}
if ($params['oauth_callback']) {
$params['oauth_callback'] = rawurlencode($params['oauth_callback']);
}
foreach($params as $name => $val) {
$param_str .= $comma.$name.'='.$val;
$comma = '&';
}
if($multi) {
$base_string = $method.'&'.$url.'&'.$param_str;
} else {
$base_string = $method.'&'.$this->rawurlencode($url).'&'.$this->rawurlencode($param_str);
}
$key = $this->_appSecret.'&'.$this->_tokenSecret;
$signature = $this->customHmac($base_string, $key);
return $signature;
}
public function rawurlencode($input) {
if(is_array($input)) {
return array_map(array($this, 'rawurlencode'), $input);
} elseif(is_scalar($input)) {
return str_replace('%7E', '~', rawurlencode($input));
} else {
return '';
}
}
private function _getImageBinary($files) {
$keys = array_keys($files);
$fileInfo = array();
foreach($keys as $key) {
if($key != 'remote') {
$fileInfo[$key]['file'] = $files[$key];
$imgInfo = getimagesize($files[$key]);
$fileInfo[$key]['mime'] = $imgInfo['mime'];
$contents = $use_include_path = null;
if($files['remote']) {
$opt = array(
'http' => array(
'timeout' => 10,
)
);
$contents = stream_context_create($opt);
}
$files[$key] = file_get_contents($files[$key], $use_include_path, $contents);
}
}
unset($files['remote']);
return array('binary' => $files, 'fileInfo' => $fileInfo);
}
}

View File

@@ -0,0 +1,211 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: Util.php 31728 2012-09-25 09:03:42Z zhouxiaobo $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class Cloud_Service_Util {
protected static $_instance;
public static function getInstance() {
if (!(self::$_instance instanceof self)) {
self::$_instance = new self();
}
return self::$_instance;
}
public function __construct() {
}
public function generateSiteSignUrl($params = array(), $isCamelCase = false, $isReturnArray = false) {
global $_G;
$ts = TIMESTAMP;
$sId = $_G['setting']['my_siteid'];
$sKey = $_G['setting']['my_sitekey'];
$uid = $_G['uid'];
if(!is_array($params)) {
$params = array();
}
unset($params['sig'], $params['ts']);
if ($isCamelCase) {
$params['sId'] = $sId;
$params['sSiteUid'] = $uid;
} else {
$params['s_id'] = $sId;
$params['s_site_uid'] = $uid;
}
ksort($params);
$str = $this->httpBuildQuery($params, '', '&');
$sig = md5(sprintf('%s|%s|%s', $str, $sKey, $ts));
$params['ts'] = $ts;
$params['sig'] = $sig;
if(!$isReturnArray) {
$params = $this->httpBuildQuery($params, '', '&');
}
return $params;
}
public function redirect($url, $code = 302) {
@ob_end_clean();
@ob_start();
$errorChars = array();
for ($i = 0; $i <= 31; $i ++) {
$errorChars[] = chr($i);
}
$url = trim(str_replace($errorChars, '', $url));
if (strpos($url, '/') === 0) {
$url = '/' . ltrim($url, '/');
}
@header('Location: ' . $url, true, $code);
exit;
}
public function generateUniqueId() {
$siteuniqueid = C::t('common_setting')->fetch_setting('siteuniqueid');
if(empty($siteuniqueid) || strlen($siteuniqueid) < 16) {
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
$siteuniqueid = 'DX'.$chars[date('y')%60].$chars[date('n')].$chars[date('j')].$chars[date('G')].$chars[date('i')].$chars[date('s')].substr(md5($_G['clientip'].$_G['username'].TIMESTAMP), 0, 4).random(4);
C::t('common_setting')->update_setting('siteuniqueid', $siteuniqueid);
require_once libfile('function/cache');
updatecache('setting');
}
}
public function httpBuildQuery($data, $numeric_prefix='', $arg_separator='', $prefix='') {
$render = array();
if (empty($arg_separator)) {
$arg_separator = @ini_get('arg_separator.output');
empty($arg_separator) && $arg_separator = '&';
}
foreach ((array) $data as $key => $val) {
if (is_array($val) || is_object($val)) {
$_key = empty($prefix) ? "{$key}[%s]" : sprintf($prefix, $key) . "[%s]";
$_render = $this->httpBuildQuery($val, '', $arg_separator, $_key);
if (!empty($_render)) {
$render[] = $_render;
}
} else {
if (is_numeric($key) && empty($prefix)) {
$render[] = urlencode("{$numeric_prefix}{$key}") . "=" . urlencode($val);
} else {
if (!empty($prefix)) {
$_key = sprintf($prefix, $key);
$render[] = urlencode($_key) . "=" . urlencode($val);
} else {
$render[] = urlencode($key) . "=" . urlencode($val);
}
}
}
}
$render = implode($arg_separator, $render);
if (empty($render)) {
$render = '';
}
return $render;
}
public function getApiVersion() {
return '0.6';
}
public function hashHmac($algo, $data, $key, $raw_output = false) {
if (function_exists('hash_hmac')) {
return hash_hmac($algo, $data, $key, $raw_output);
} else {
$algo = strtolower($algo);
$pack = 'H'.strlen(call_user_func($algo, 'test'));
$size = 64;
$opad = str_repeat(chr(0x5C), $size);
$ipad = str_repeat(chr(0x36), $size);
if(strlen($key) > $size) {
$key = str_pad(pack($pack, call_user_func($algo, $key)), $size, chr(0x00));
} else {
$key = str_pad($key, $size, chr(0x00));
}
for ($i = 0; $i < strlen($key) - 1; $i++) {
$opad[$i] = $opad[$i] ^ $key[$i];
$ipad[$i] = $ipad[$i] ^ $key[$i];
}
$output = call_user_func($algo, $opad.pack($pack, call_user_func($algo, $ipad.$data)));
return ($raw_output) ? pack($pack, $output) : $output;
}
}
public function isMobile($status) {
if (getstatus($status, 11) || getstatus($status, 12) || getstatus($status, 13)) {
return true;
}
return false;
}
public function mobileHasSound() {
if (getstatus($status, 13)) {
return true;
}
return false;
}
public function mobileHasPhoto() {
if (getstatus($status, 12) && getstatus($status, 11)) {
return true;
}
return false;
}
public function mobileHasGPS() {
if (getstatus($status, 12)) {
return true;
}
return false;
}
public function isfounder($user) {
global $_G;
$founders = str_replace(' ', '', $_G['config']['admincp']['founder']);
if(!$user['uid'] || $user['groupid'] != 1 || $user['adminid'] != 1) {
return false;
} elseif(empty($founders)) {
return false;
} elseif(strexists(",$founders,", ",{$user['uid']},")) {
return true;
} elseif(!is_numeric($user['username']) && strexists(",$founders,", ",{$user['username']},")) {
return true;
} else {
return FALSE;
}
}
}

View File

View File

@@ -0,0 +1,375 @@
<?php
/**
* [Discuz! X] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp.inc.php 33645 2013-07-25 01:32:20Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$_G['uid']) {
showmessage('not_loggedin', NULL, array(), array('login' => 1));
}
$pluginop = !empty($_GET['pluginop']) ? $_GET['pluginop'] : 'config';
if (!in_array($pluginop, array('config', 'share', 'new', 'sync_tthread'))) {
showmessage('undefined_action');
}
$sh_type = trim(intval($_GET['sh_type']));
$tid = trim(intval($_GET['thread_id']));
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Connect.php';
$connectService = new Cloud_Service_Connect();
if ($pluginop == 'config') {
$connectService->connectMergeMember();
$_G['connect']['is_oauth_user'] = true;
if (empty($_G['member']['conuinsecret'])) {
$_G['connect']['is_oauth_user'] = false;
}
$referer = str_replace($_G['siteurl'], '', dreferer());
if(!empty($_GET['connect_autoshare'])) {
if(strpos($referer, '?') !== false) {
$referer .= '&connect_autoshare=1';
} else {
$referer .= '?connect_autoshare=1';
}
}
$_G['connect']['loginbind_url'] = $_G['siteurl'].'connect.php?mod=login&op=init&type=loginbind&referer='.urlencode($_G['connect']['referer'] ? $_G['connect']['referer'] : 'index.php');
} elseif ($pluginop == 'share') {
$_GET['share_url'] = $_G['connect']['discuz_new_share_url'];
$post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($tid, 0);
$thread = C::t('forum_thread')->fetch_by_tid_displayorder($tid, 0);
require_once libfile('function/post');
$post['message'] = messagesafeclear($post['message']);
$html_content = $connectService->connectParseBbcode($post['message'], $thread['fid'], $post['pid'], $post['htmlon'], $attach_images);
if ($_G['group']['allowgetimage'] && $thread['price'] == 0 && $post['pid']) {
if ($attach_images && is_array($attach_images)) {
$_GET['share_images'] = array_slice($attach_images, 0, 3);
$attach_images = array();
foreach ($_GET['share_images'] as $image) {
$attach_images[] = $image['big'];
}
$_GET['attach_image'] = implode('|', $attach_images);
unset($attach_images);
}
}
if($_GET['sh_type'] == 4){
if($_G['setting']['rewritestatus'] && is_array($_G['setting']['rewritestatus']) && in_array('forum_viewthread', $_G['setting']['rewritestatus'])) {
$url = rewriteoutput('forum_viewthread', 1, $_G['siteurl'], $tid);
} else {
$url = $_G['siteurl'].'forum.php?mod=viewthread&tid='.$tid;
}
$shareqq_params = array(
'url' => $url,
'title' => diconv($thread['subject'], CHARSET, 'UTF-8'),
'summary' => diconv(cutstr(strip_tags(str_replace('&nbsp;', ' ', $html_content)), 80), CHARSET, 'UTF-8'),
'desc' => diconv(lang('plugin/qqconnect', 'connect_spacecp_share_qq_default'), CHARSET, 'UTF-8'),
'site' => 'discuz|',
'style' => '103',
'width' => 50,
'height' => 16
);
$s = '';
foreach($shareqq_params as $key => $val) {
$s .= ($s ? '&' : '').$key.'='.urlencode($val);
}
header('Location: https://connect.qq.com/widget/shareqq/index.html?'.$s);
} else {
$share_message = lang('plugin/qqconnect', 'connect_spacecp_share_a_post', array('bbname' => cutstr($_G['setting']['bbname'], 20,''), 'subject' => cutstr($thread['subject'], 120), 'message' => cutstr(strip_tags(str_replace('&nbsp;', ' ', $html_content)), 80)));
$share_message = str_replace(array('\'', "\r\n", "\r", "\n"), array('"', '', '', ''), $share_message);
}
} elseif ($pluginop == 'new') {
if (trim($_GET['formhash']) != formhash()) {
showmessage('submit_invalid');
}
$sh_type = intval(trim($_POST['sh_type']));
$tid = intval(trim($_POST['thread_id']));
$dialog_id = $_POST['dialog_id'];
$connectService->connectMergeMember();
if($_G['setting']['rewritestatus'] && is_array($_G['setting']['rewritestatus']) && in_array('forum_viewthread', $_G['setting']['rewritestatus'])) {
$url = rewriteoutput('forum_viewthread', 1, $_G['siteurl'], $tid);
} else {
$url = $_G['siteurl'].'forum.php?mod=viewthread&tid='.$tid;
}
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/ConnectOAuth.php';
$connectOAuthClient = new Cloud_Service_Client_ConnectOAuth();
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/Connect.php';
$connectService = new Cloud_Service_Connect();
if($sh_type == 3) {
$firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($tid, 0);
require_once libfile('function/post');
$firstpost['message'] = messagesafeclear($firstpost['message']);
$summary = $connectService->connectParseBbcode($firstpost['message'], $firstpost['fid'], $firstpost['pid'], $firstpost['htmlon'], $attach_images);
$qzone_params = array(
'title' => $_POST['share_subject'],
'url' => $url,
'comment' => $_POST['reason'],
'summary' => strip_tags($summary),
'images' => $_POST['attach_image'],
'nswb' => '1',
);
if(!$_G['setting']['connect']['oauth2'] || !$_G['member']['conuintoken']) {
try {
$response = $connectOAuthClient->connectAddShare($_G['member']['conopenid'], $_G['member']['conuin'], $_G['member']['conuinsecret'], $qzone_params);
} catch(Exception $e) {
$errorCode = $e->getCode();
}
} else {
try {
$response = $connectOAuthClient->connectAddShare_V2($_G['member']['conopenid'], $_G['member']['conuintoken'], $qzone_params);
} catch(Exception $e) {
$errorCode = $e->getCode();
}
}
if($errorCode) {
$code = $errorCode;
if($errorCode == 41001) {
$message = lang('plugin/qqconnect', 'connect_user_unauthorized', array('login_url' => $_G['connect']['login_url'].'&reauthorize=yes&formhash='.FORMHASH));
} elseif($errorCode == 41003 || $errorCode == 40006) { // access token失效或非法
$message = lang('plugin/qqconnect', 'connect_share_token_outofdate', array('login_url' => $_G['connect']['login_url']));
} elseif ($errorCode == 3021) {
$message = lang('plugin/qqconnect', 'connect_qzone_share_same_url');
} else {
$code = 100;
$message = lang('plugin/qqconnect', 'connect_server_busy');
$connectService->connectErrlog($code, lang('plugin/qqconnect', 'connect_errlog_server_no_response'));
}
} else {
$code = $response['ret'];
$message = lang('plugin/qqconnect', 'connect_share_success');
}
} elseif($sh_type == 2) {
$t_params = array(
'content' => $_POST['reason'],
);
$aid = intval($_POST['attach_image_id']);
if ($aid) {
$method = 'connectAddPicT';
$attach = C::t('forum_attachment_n')->fetch_attachment('aid:'.$aid, $aid);
if($attach['remote']) {
$t_params['pic'] = $_G['setting']['ftp']['attachurl'].'forum/'.$attach['attachment'];
$t_params['remote'] = true;
} else {
$t_params['pic'] = $_G['setting']['attachdir'].'forum/'.$attach['attachment'];
}
} else {
$method = 'connectAddT';
}
if(!$_G['setting']['connect']['oauth2'] || !$_G['member']['conuintoken']) {
try {
$response = $connectOAuthClient->$method($_G['member']['conopenid'], $_G['member']['conuin'], $_G['member']['conuinsecret'], $t_params);
} catch(Exception $e) {
$errorCode = $e->getCode();
}
} else {
try {
$method = $method.'_V2';
$response = $connectOAuthClient->$method($_G['member']['conopenid'], $_G['member']['conuintoken'], $t_params);
} catch(Exception $e) {
$errorCode = $e->getCode();
}
}
if($errorCode) {
$code = $errorCode;
if($errorCode == 41001) {
$message = lang('plugin/qqconnect', 'connect_user_unauthorized', array('login_url' => $_G['connect']['login_url'].'&reauthorize=yes&formhash='.FORMHASH));
} elseif($errorCode == 41003 || $errorCode == 40006) { // access token失效或非法
$message = lang('plugin/qqconnect', 'connect_share_token_outofdate', array('login_url' => $_G['connect']['login_url']));
} elseif ($errorCode == 3013) {
$message = lang('plugin/qqconnect', 'connect_qzone_weibo_same_content');
} else {
$code = 100;
$message = lang('plugin/qqconnect', 'connect_server_busy');
$connectService->connectErrlog($code, lang('plugin/qqconnect', 'connect_errlog_server_no_response'));
}
} else {
$thread = C::t('forum_thread')->fetch_thread($tid);
if($response['data']['id'] && $_G['setting']['connect']['t']['reply'] && $thread['tid'] && !$thread['closed'] && !getstatus($thread['status'], 3) && empty($_G['forum']['replyperm'])) {
C::t('#qqconnect#connect_tthreadlog')->insert(array(
'twid' => $response['data']['id'],
'tid' => $tid,
'conopenid' => $_G['member']['conopenid'],
'pagetime' => 0,
'lasttwid' => '0',
'nexttime' => $_G['timestamp'] + 30 * 60,
'updatetime' => 0,
'dateline' => $_G['timestamp'],
));
}
if(!getstatus($thread['status'], 8)) {
C::t('forum_thread')->update($tid, array('status' => setstatus(8, 1, $thread['status'])));
}
$code = $response['ret'];
$message = lang('plugin/qqconnect', 'connect_broadcast_success');
}
}
} elseif($pluginop == 'sync_tthread') {
if (trim($_GET['formhash']) != formhash()) {
showmessage('submit_invalid');
}
if(!$_G['setting']['connect']['t']['reply']) {
exit;
}
$tid = $_GET['tid'];
$processname = 'connect_tthread_'.$tid.'_cache';
if(discuz_process::islocked($processname, 600)) {
exit;
}
$thread = C::t('forum_thread')->fetch_thread($tid);
if(!$thread || $thread['closed'] == 1 || getstatus($thread['status'], 3) || $thread['displayorder'] < 0 || !empty($_G['forum']['replyperm'])) {
discuz_process::unlock($processname);
exit;
}
$updatetime = C::t('#qqconnect#connect_tthreadlog')->fetch_max_updatetime_by_tid($tid);
if($_G['timestamp'] < $updatetime + 10 * 60) {
discuz_process::unlock($processname);
exit;
}
$tthread = C::t('#qqconnect#connect_tthreadlog')->fetch_min_nexttime_by_tid($tid);
if(empty($tthread)) {
discuz_process::unlock($processname);
exit;
}
require_once DISCUZ_ROOT.'/source/plugin/qqconnect/lib/ConnectOAuth.php';
$connectOAuthClient = new Cloud_Service_Client_ConnectOAuth();
$connectmember = C::t('#qqconnect#common_member_connect')->fetch_fields_by_openid($tthread['conopenid']);
$param = array();
$param['format'] = 'xml';
$param['flag'] = '2';
$param['rootid'] = $tthread['twid'];
$param['pageflag'] = 2;
$param['pagetime'] = $tthread['pagetime'];
$param['reqnum'] = 20;
$param['twitterid'] = $tthread['lasttwid'];
try {
$response = $connectOAuthClient->connectGetRepostList($tthread['conopenid'], $connectmember['conuin'], $connectmember['conuinsecret'], $param);
} catch(Exception $e) {
showmessage('qqconnect:server_busy');
}
if($response && $response['ret'] == 0 && $response['data']['info']) {
include_once libfile('function/forum');
$forum = C::t('forum_forum')->fetch($thread['fid']);
$pinvisible = $forum['modnewposts'] ? -2 : 0;
$pids = array();
$i = 0;
$responseinfo = array();
if(!isset($response['data']['info'][0])) {
$responseinfo[] = $response['data']['info'];
} else {
$responseinfo = $response['data']['info'];
krsort($responseinfo);
}
foreach($responseinfo as $post) {
$message = trim($post['text']);
$post['username'] = trim($post['name']);
$post['nick'] = trim($post['nick']);
$message = preg_replace("/((https?|ftp|gopher|news|telnet|rtsp|mms|callto):\/\/|www\.)([a-z0-9\/\-_+=.~!%@?#%&;:$\\()|]+\s*)/i", '', $message);
$message = str_replace(explode(' ', lang('plugin/qqconnect', 'connect_reply_filter_smiley')), '', $message);
if($message) {
$newmessage = censor($message, null, true);
if($message != $newmessage) {
continue;
}
} else {
$message = lang('plugin/qqconnect', 'connect_tthread_broadcast');
}
if($_G['setting']['connect']['t']['reply_showauthor']) {
$message .= '[tthread='.$post['username'].', '.$post['nick'].']'.$post['head'].'[/tthread]';
}
$pid = insertpost(array(
'fid' => $thread['fid'],
'tid' => $thread['tid'],
'first' => '0',
'author' => '',
'authorid' => '0',
'subject' => '',
'dateline' => $_G['timestamp'] + $i,
'message' => $message,
'useip' => '',
'invisible' => $pinvisible,
'anonymous' => '0',
'usesig' => '0',
'htmlon' => '1',
'bbcodeoff' => '0',
'smileyoff' => '0',
'parseurloff' => '0',
'attachment' => '0',
'status' => 16,
));
if($pid) {
$pids[] = $pid;
}
$i++;
}
if($pinvisible) {
updatemoderate('pid', $pids);
C::t('forum_forum')->update_forum_counter($thread['fid'], 0, 0, count($pids), 1);
} else {
$fieldarr = array(
'lastposter' => array(''),
'replies' => count($pids),
);
if($thread['lastpost'] < $_G['timestamp']) {
$fieldarr['lastpost'] = array($_G['timestamp']);
}
C::t('forum_thread')->increase($tid, $fieldarr);
$postionid = C::t('forum_post')->fetch_maxposition_by_tid($thread['posttableid'], $tid);
C::t('forum_thread')->update($tid, array('maxposition' => $postionid));
$thread['shortsubject'] = cutstr($thread['subject'], 80);
$lastpost = "{$thread['tid']}\t{$thread['shortsubject']}\t{$_G['timestamp']}\t".'';
C::t('forum_forum')->update($thread['fid'], array('lastpost' => $lastpost));
C::t('forum_forum')->update_forum_counter($thread['fid'], 0, count($pids), count($pids));
if($forum['type'] == 'sub') {
C::t('forum_forum')->update($forum['fup'], array('lastpost' => $lastpost));
}
}
$setarr['pagetime'] = $post['timestamp'];
$setarr['lasttwid'] = $post['id'];
if(count($responseinfo) < $param['reqnum']) {
$setarr['nexttime'] = $_G['timestamp'] + 2 * 3600;
} else {
$setarr['nexttime'] = $_G['timestamp'] + 30 * 60;
}
} else {
$setarr['nexttime'] = $_G['timestamp'] + 3 * 3600;
}
$setarr['updatetime'] = $_G['timestamp'];
C::t('#qqconnect#connect_tthreadlog')->update($tthread['twid'], $setarr);
discuz_process::unlock($processname);
exit;
}

View File

View File

@@ -0,0 +1,23 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: table_common_connect_guest.php 29265 2012-03-31 06:03:26Z yexinhao $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class table_common_connect_guest extends discuz_table {
public function __construct() {
$this->_table = 'common_connect_guest';
$this->_pk = 'conopenid';
parent::__construct();
}
}

View File

@@ -0,0 +1,43 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: table_common_member_connect.php 29265 2012-03-31 06:03:26Z yexinhao $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class table_common_member_connect extends discuz_table {
private $_fields;
public function __construct() {
$this->_table = 'common_member_connect';
$this->_pk = 'uid';
$this->_fields = array('uid', 'conuin', 'conuinsecret', 'conopenid', 'conisfeed', 'conispublishfeed', 'conispublisht', 'conisregister', 'conisqzoneavatar');
$this->_pre_cache_key = 'common_member_connect_';
$this->_cache_ttl = 0;
parent::__construct();
}
public function fetch_fields_by_openid($openid, $fields = array()) {
$fields = (array)$fields;
if(!empty($fields)) {
$field = implode(',', array_intersect($fields, $this->_fields));
} else {
$field = '*';
}
return DB::fetch_first('SELECT %i FROM %t WHERE conopenid=%s', array($field, $this->_table, $openid));
}
public function update_by_openid($openId, $data) {
return DB::update($this->_table, $data, DB::field('openId', $openId));
}
}

View File

@@ -0,0 +1,23 @@
<?php
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class table_connect_disktask extends discuz_table {
public function __construct() {
$this->_table = 'connect_disktask';
$this->_pk = 'taskid';
parent::__construct();
}
public function delete_by_status($status) {
if (dintval($status)) {
return DB::query('DELETE FROM %t WHERE status = %d', array($this->_table, $status));
}
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: table_connect_tthreadlog.php 27640 2012-02-08 09:48:47Z svn_project_zhangjie $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class table_connect_feedlog extends discuz_table {
public function __construct() {
$this->_table = 'connect_feedlog';
$this->_pk = 'flid';
parent::__construct();
}
public function fetch_by_tid($tid) {
return DB::fetch_first('SELECT * FROM %t WHERE tid=%d', array($this->_table, $tid));
}
public function update_by_tid($tid, $data) {
$tid = dintval($tid);
return DB::update($this->_table, $data, DB::field('tid', $tid));
}
}

View File

@@ -0,0 +1,43 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: table_connect_memberbindlog.php 29265 2012-03-31 06:03:26Z yexinhao $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class table_connect_memberbindlog extends discuz_table {
public function __construct() {
$this->_table = 'connect_memberbindlog';
$this->_pk = 'mblid';
parent::__construct();
}
public function count_uid_by_openid_type($openid, $type) {
$count = (int) DB::result_first('SELECT count(DISTINCT uid) FROM %t WHERE uin=%s AND type=%d', array($this->_table, $openid, $type));
return $count;
}
public function fetch_all_by_openids($openids, $start = 0, $limit = 0) {
$result = array();
if($openids) {
$result = DB::fetch_all('SELECT * FROM '.DB::table($this->_table).' WHERE '.DB::field('uin', $openids).' ORDER BY dateline DESC '.DB::limit($start, $limit));
}
return $result;
}
public function fetch_all_by_uids($uids, $start = 0, $limit = 0) {
$result = array();
if($uids) {
$result = DB::fetch_all('SELECT * FROM '.DB::table($this->_table).' WHERE '.DB::field('uid', $uids).' ORDER BY dateline DESC '.DB::limit($start, $limit));
}
return $result;
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: table_connect_postfeedlog.php 31305 2012-08-09 06:36:16Z liudongdong $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class table_connect_postfeedlog extends discuz_table {
public function __construct() {
$this->_table = 'connect_postfeedlog';
$this->_pk = 'flid';
parent::__construct();
}
public function fetch_by_pid($pid) {
return DB::fetch_first('SELECT * FROM %t WHERE pid=%d', array($this->_table, $pid));
}
public function update_by_pid($pid, $data) {
$pid = dintval($pid);
return DB::update($this->_table, $data, DB::field('pid', $pid));
}
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: table_connect_tthreadlog.php 29265 2012-03-31 06:03:26Z yexinhao $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class table_connect_tthreadlog extends discuz_table {
public function __construct() {
$this->_table = 'connect_tthreadlog';
$this->_pk = 'twid';
parent::__construct();
}
public function fetch_max_updatetime_by_tid($tid) {
return DB::result_first('SELECT updatetime FROM %t WHERE tid=%d ORDER BY updatetime DESC LIMIT 1', array($this->_table, $tid));
}
public function fetch_min_nexttime_by_tid($tid) {
return DB::fetch_first('SELECT * FROM %t WHERE tid=%d ORDER BY nexttime ASC LIMIT 1', array($this->_table, $tid));
}
}

View File

@@ -0,0 +1 @@
.qq_bind { margin-top: -3px; }

View File

@@ -0,0 +1,25 @@
/** forum::viewthread,group::viewthread **/
#share_picture_list { float: left; margin: 10px auto; padding: 0; }
#share_picture_list div.share_picture_box { float: left; text-align: center; width: 120px; }
#share_picture_list div.share_picture_box a { padding: 2px; border: #ddd 2px solid; display: block; width: 100px; height: 100px;}
#share_picture_list div.share_picture_box a:hover { padding: 2px; border: #74CBEC 2px solid; display: block; width: 100px; height: 100px;}
#share_picture_list div.select a { border-color: #74CBEC; }
#share_picture_list div.share_picture_box a img { width: 100px; height: 100px; }
#share_picture_list div div.badge { position: absolute; z-index: 1; margin: -2px 0 0 -2px; width: 112px; height: 112px; display: block; background: transparent url({IMGDIR}/transparent.gif) no-repeat 0 0; cursor: pointer; }
#share_picture_list div.select div.badge { background: transparent url({IMGDIR}/share_img.png) no-repeat 0 0; }
#share_picture_title { overflow: hidden; padding: 0 15px; width: 100%; clear: both; }
#cancel_share_picture_title { padding: 5px 0; }
/** end **/
/** forum,group,home **/
.syn_qq, .syn_tqq, .syn_qq_check, .syn_tqq_check { display: inline-block; margin-top: 3px; width: 19px; height: 19px; background: transparent url({IMGDIR}/connect_post_syn.png) no-repeat 0 0; line-height: 64px; overflow: hidden; vertical-align: top; cursor: pointer; }
.ie6 .syn_qq, .ie6 .syn_tqq, .ie6 .syn_qq_check, .ie6 .syn_tqq_check { display: inline; }
.syn_qq_check { background-position: -22px 0; }
.syn_tqq { background-position: 0 -22px; margin-left: 5px; }
.syn_tqq_check { background-position: -22px -22px; margin-left: 5px; }
/** end **/
/** member **/
.qqregtb { margin-top: 0; padding-top: 5px; background-color: {SPECIALBG}; }
/** end **/

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,297 @@
{eval
function tpl_global_login_extra() {
global $_G;
}
<!--{block return}-->
<div class="fastlg_fm y" style="margin-right: 10px; padding-right: 10px">
<p><a href="{$_G['connect']['login_url']}&statfrom=login_simple"><img src="{IMGDIR}/qq_login.gif" class="vm" alt="{lang qqconnect:connect_header_login}" /></a></p>
<p class="hm xg1" style="padding-top: 2px;">{lang qqconnect:connect_header_login_tip}</p>
</div>
<!--{/block}-->
<!--{eval return $return;}-->
{eval
}
function tpl_global_usernav_extra1() {
global $_G;
}
<!--{block return}-->
<!--{if CURMODULE != 'connect'}-->
<!--{if $_G['connectguest']}-->
<span class="pipe">|</span><a href="member.php?mod=connect" target="_blank" title="{lang qqconnect:connect_member_register_button_tip}">{lang qqconnect:connect_register_profile}</a><span class="pipe">|</span><a href="member.php?mod=connect&ac=bind" target="_blank" title="{lang qqconnect:connect_member_loginbind_button_tip}">{lang qqconnect:connect_register_bind}</a>
<!--{else}-->
<span class="pipe">|</span><a href="connect.php?mod=config" target="_blank"><img src="{IMGDIR}/qq_bind_small.gif" class="qq_bind" align="absmiddle" alt="{lang qqconnect:connect_config}" /></a>
<!--{/if}-->
<!--{/if}-->
<!--{/block}-->
<!--{eval return $return;}-->
{eval
}
function tpl_login_bar() {
global $_G;
}
<!--{block return}-->
<!--{if !$_G['connectguest']}-->
<a href="{$_G['connect']['login_url']}&statfrom=login" target="_top" rel="nofollow"><img src="{IMGDIR}/qq_login.gif" class="vm" /></a>
<!--{/if}-->
<!--{/block}-->
<!--{eval return $return;}-->
{eval
}
function tpl_viewthread_share_method() {
global $_G;
if (!$_G['setting']['connect']['allow']) return;
$connect_thread_subject = addslashes(strip_tags($_G['thread']['subject']));
}
<!--{block return}-->
<a href="{$_G['connect']['qq_share_url']}" id="k_share_to_qq" title="{lang qqconnect:connect_viewthread_share_to_qq}" target="_blank"><i><img src="{IMGDIR}/qq_share.png" alt="{lang qqconnect:connect_viewthread_share_to_qq}" />{lang qqconnect:connect_viewthread_share_to_qq}</i></a>
<a href="#" id="k_qqshare" onclick="postToQzone();return false;" title="{lang qqconnect:connect_viewthread_share_to_qzone}"><i><img src="{IMGDIR}/qzone.gif" alt="{lang qqconnect:connect_viewthread_share_to_qzone}" />{lang qqconnect:connect_viewthread_share_to_qzone}</i></a>
<!--{/block}-->
<!--{eval return $return;}-->
{eval
}
function tpl_viewthread_bottom($jsurl) {
global $_G;
}
<!--{block return}-->
<script type="text/javascript">
function postToQzone(){
var _url = encodeURIComponent(document.location.href);
var _site = encodeURIComponent("{$_G['setting']['bbname']}");
var _title = encodeURIComponent("{$connect_thread_subject}");
var _pics = "{$_G['connect']['share_images']}";
var _from = 'discuz';
var _u = '{$_G['connect']['qzone_public_share_url']}?url='+_url+'&site='+_site+'&title='+_title+'&pics='+_pics+'&from='+_from;
window.open(_u);
}
</script>
<!--{if $_G['member']['conisbind']}-->
<div id="connect_share_unbind" style="display: none;">
<div class="c hm">
<div style="font-size:14px; margin:10px 0;">{lang qqconnect:connect_post_unbind}</div>
<div><a href="connect.php?mod=config&connect_autoshare=1" target="_blank"><img src="{IMGDIR}/qq_bind.gif" align="absmiddle" style="margin-top:5px;" /></a></div>
</div>
<input type="hidden" id="connect_thread_title" name="connect_thread_title" value="{$_G['forum_thread']['subject']}" />
</div>
<!--{/if}-->
<!--{if $jsurl}-->
<script type="text/javascript">_attachEvent(window, 'load', function () { appendscript('{$jsurl}', '', 1, 'utf-8') }, document);</script>
<!--{/if}-->
<!--{/block}-->
<!--{eval return $return;}-->
{eval
}
function tpl_register_input() {
global $_G;
$connect_app_id = $_G['qc']['connect_app_id'];
$connect_openid = $_G['qc']['connect_openid'];
}
<!--{block return}-->
<input type="hidden" id="auth_hash" name="auth_hash" value="{$_G['qc']['connect_auth_hash']}" />
<input type="hidden" id="is_notify" name="is_notify" value="{$_G['qc']['connect_is_notify']}" />
<input type="hidden" id="is_feed" name="is_feed" value="{$_G['qc']['connect_is_feed']}" />
<!--{/block}-->
<!--{eval return $return;}-->
{eval
}
function tpl_register_bottom() {
global $_G;
$loginhash = 'L'.random(4);
$change_qq_url = $_G['connect']['discuz_change_qq_url'];
$qq_nick = $_G['qc']['qq_nick'];
$connect_app_id = $_G['qc']['connect_app_id'];
$connect_openid = $_G['qc']['connect_openid'];
$connect_tab_1 = $_GET['ac'] != 'bind' && $_G['setting']['regconnect'] ? ' class="a"' : '';
$connect_tab_2 = $_GET['ac'] == 'bind' ? ' class="a"' : '';
}
<!--{block js2}-->
<!--{if $_GET['ac'] == 'bind' || $_G['setting']['regconnect']}-->
<div id="loggingbox" class="loggingbox">
<div class="loging_tit cl">
<div class="z">
<p class="welcome mbn cl" style="clear:both; width:100%; "><strong>Hi</strong>,<strong>$_G['member']['username']</strong>, <span class="xg2">{lang connect_member_login_tip}</span></p>
<ul class="tb cl z">
<li id="connect_tab_1"$connect_tab_1><a id="loginlist" href="javascript:;" onclick="connect_switch(1);this.blur();">{lang connect_register_profile}</a></li>
<li id="connect_tab_2"$connect_tab_2><a id="loginlist2" href="javascript:;" onclick="connect_switch(2);this.blur();">{lang connect_register_bind}</a></li>
</ul>
</div>
</div>
</div>
<!--{/if}-->
<!--{/block}-->
{eval
$js2 = str_replace(array("'", "\r", "\n"), array("\'", '', ''), $js2);
}
<!--{block return}-->
<div class="b1lr">
<form method="post" autocomplete="off" name="login" id="loginform_$loginhash" class="cl"{if $_G['setting']['regconnect']} style="display:none"{/if} onsubmit="ajaxpost('loginform_$loginhash', 'returnmessage4', 'returnmessage4', 'onerror');return false;" action="member.php?mod=connect&action=login&loginsubmit=yes{if !empty($_GET['handlekey'])}&handlekey=$_GET[handlekey]{/if}&loginhash=$loginhash">
<div class="c cl bm_c">
<input type="hidden" name="formhash" value="{FORMHASH}" />
<input type="hidden" name="referer" value="{$_G['qc']['dreferer']}" />
<input type="hidden" id="auth_hash" name="auth_hash" value="{$_G['qc']['connect_auth_hash']}" />
<input type="hidden" id="is_notify" name="is_notify" value="{$_G['qc']['connect_is_notify']}" />
<input type="hidden" id="is_feed" name="is_feed" value="{$_G['qc']['connect_is_feed']}" />
<!--{if $_G['qc']['uinlimit']}-->
<div class="rfm">
<table>
<tr>
<th><img src="{IMGDIR}/connect_qq.gif" alt="QQ" class="mtn" /></th>
<td>
{lang qqconnect:connect_uin_limit}
</td>
</tr>
</table>
</div>
<!--{/if}-->
<div class="rfm">
<table>
<tr>
<th>
<!--{if $_G['setting']['autoidselect']}-->
<label for="username">{lang login_id}:</label>
<!--{else}-->
<span class="login_slct">
<select name="loginfield" style="float: left;" width="45" id="loginfield_$loginhash">
<option value="username">{lang username}</option>
<option value="uid">{lang uid}</option>
<option value="email">{lang email}</option>
<option value="secmobile">{lang secmobile}</option>
</select>
</span>
<!--{/if}-->
</th>
<td><input type="text" name="username" id="username_$loginhash" autocomplete="off" size="36" class="txt" value="$username" /></td>
</tr>
</table>
</div>
<div class="rfm">
<table>
<tr>
<th><label for="password3_$loginhash">{lang login_password}:</label></th>
<td><input type="password" id="password3_$loginhash" name="password" size="36" class="txt" /></td>
</tr>
</table>
</div>
<div class="rfm">
<table>
<tr>
<th>{lang security_q}:</th>
<td><select id="loginquestionid_$loginhash" width="213" name="questionid" onchange="if($('loginquestionid_$loginhash').value > 0) $('loginanswer_row_$loginhash').style.display=''; else $('loginanswer_row_$loginhash').style.display='none'">
<option value="0">{lang security_question}</option>
<option value="1">{lang security_question_1}</option>
<option value="2">{lang security_question_2}</option>
<option value="3">{lang security_question_3}</option>
<option value="4">{lang security_question_4}</option>
<option value="5">{lang security_question_5}</option>
<option value="6">{lang security_question_6}</option>
<option value="7">{lang security_question_7}</option>
</select></td>
</tr>
</table>
</div>
<div class="rfm" id="loginanswer_row_$loginhash" style="display:none">
<table>
<tr>
<th>{lang security_a}:</th>
<td><input type="text" name="answer" id="loginanswer_$loginhash" autocomplete="off" size="36" class="txt" /></td>
</tr>
</table>
</div>
</div>
<div class="rfm mbw bw0">
<table>
<tr>
<th>&nbsp;</th>
<td><button class="pn pnc" type="submit" name="loginsubmit" value="true"><strong>{lang qqconnect:connect_register_bind_window_button}</strong></button></td>
</tr>
</table>
</div>
</form>
</div>
<style type="text/css">
.loggingbox { width: 760px; margin: 40px auto 0; }
.loging_tit { border-bottom: 1px solid #CCC; _overflow:hidden; }
.ie_all .loging_tit { height:66px;}
.loggingbox .fm_box { border-bottom:0; padding: 20px 0; }
.loggingbox .welcome { font-size:14px; width:100%; line-height:30px;}
.loggingbox .welcome span { font-size:12px; }
.loggingbox .avt img { margin: 0 5px 5px 0; padding:0; border:0; width:60px; height:60px; }
.loggingbox .tb{ border-bottom: 0; margin-top: 0; padding-left: 0px; }
.loggingbox .tb a { background:#F6F6F6; padding:0 20px; }
.loggingbox .tb .a a { background:#FFF; }
</style>
<script type="text/javascript">
<!--{if $_G['setting']['regconnect']}-->
$('reginfo_a').parentNode.className = '';
$('{$_G['setting']['reginput']['password']}').parentNode.parentNode.parentNode.parentNode.parentNode.style.display = 'none';
$('{$_G['setting']['reginput']['username']}').outerHTML += '$js1';
$('{$_G['setting']['reginput']['password']}').required = 0;
$('{$_G['setting']['reginput']['password2']}').parentNode.parentNode.parentNode.parentNode.parentNode.style.display = 'none';
$('{$_G['setting']['reginput']['password2']}').required = 0;
$('main_hnav').outerHTML = '$js2';
function connect_switch(op) {
$('returnmessage4').className='';
$('returnmessage4').innerHTML='';
if(op == 1) {
$('loginform_$loginhash').style.display='none';$('registerform').style.display='block';
$('connect_tab_1').className = 'a';
$('connect_tab_2').className = '';
//$('connect_login_register_tip').style.display = '';
//$('connect_login_bind_tip').style.display = 'none';
} else {
$('loginform_$loginhash').style.display='block';$('registerform').style.display='none';
$('connect_tab_2').className = 'a';
$('connect_tab_1').className = '';
//$('connect_login_register_tip').style.display = 'none';
//$('connect_login_bind_tip').style.display = '';
}
}
function connect_use_available(value) {
$('{$_G['setting']['reginput']['username']}').value = value;
checkusername(value);
}
<!--{if $_G['qc']['uinlimit']}-->
$('registerformsubmit').disabled = true;
<!--{/if}-->
<!--{if $_GET[action] != 'activation'}-->
$('registerformsubmit').innerHTML = '<span>{lang qqconnect:connect_register_finish}</span>';
<!--{/if}-->
<!--{else}-->
$('layer_reginfo_t').innerHTML = '{lang qqconnect:connect_register_bind}';
<!--{/if}-->
<!--{if $_GET[action] != 'activation'}-->
<!--{if !$_G['setting']['autoidselect']}-->
simulateSelect('loginfield_$loginhash');
<!--{/if}-->
<!--{/if}-->
<!--{if $_G['setting']['regconnect'] && $_GET['ac'] != 'bind'}-->
function connect_get_user_info() {
var x = new Ajax();
x.get('connect.php?mod=user&op=get&hash={FORMHASH}&inajax=1&_r='+Math.random(), function(s){
var nick = s;
if(nick) {
document.getElementById('{$_G['setting']['reginput']['username']}').value = nick;
}
});
}
window.load=connect_get_user_info();
<!--{/if}-->
</script>
<!--{/block}-->
<!--{eval return $return;}-->
{eval
}
}

View File

@@ -0,0 +1,76 @@
<!--{if $_G['member']['conisbind']}-->
<p class="pbm bbda xi1">{lang qqconnect:connect_config_bindinfo}</p>
<br />
<!--{if $_G[member][conisregister]}-->
<h2>
<a href="home.php?mod=spacecp&ac=profile&op=password" class="xi2">{lang qqconnect:connect_config_newpassword}</a>
</h2>
<br />
<!--{/if}-->
<h2>
<a href="javascript:;" onclick="display('unbind');{if $_G[member][conisregister]}$('newpassword1').focus();{/if}" class="xi2">{lang qqconnect:connect_config_unbind}</a>
</h2>
<!--{if $_G[member][conisregister]}-->
<div id="unbind" style="display:none;">
<form action="connect.php?mod=config" method="post" autocomplete="off">
<input type="hidden" name="formhash" value="{FORMHASH}">
<div class="ptm pbm">
<p>{lang qqconnect:connect_config_unbind_desc1}</p>
<p>{lang qqconnect:connect_config_unbind_desc2}</p>
</div>
<div class="password">
<table cellspacing="0" cellpadding="0" class="tfm">
<tr>
<th>{lang qqconnect:connect_config_new_password}</th>
<td><input type="password" size="25" name="newpassword1" id="newpassword1" class="px" value="" /><em class="d">{lang qqconnect:connect_config_password_comment}</em></td>
</tr>
<tr>
<th>{lang qqconnect:connect_config_new_password_confirm}</th>
<td><input type="password" size="25" name="newpassword2" id="newpassword2" class="px" value="" /></td>
</tr>
<tr>
<th></th>
<td>
<input type="hidden" name="op" value="unbind"/>
<button type="submit" name="connectsubmit" value="yes" class="pn pnc"><strong>{lang qqconnect:connect_config_bind_confirm}</strong></button>
</td>
</tr>
</table>
</div>
</form>
</div>
<!--{else}-->
<div id="unbind" style="display:none;">
<form action="connect.php?mod=config" method="post" autocomplete="off">
<input type="hidden" name="formhash" value="{FORMHASH}">
<p class="mtm mbm">
{lang qqconnect:connect_config_unbind_desc3}
</p>
<div>
<input type="hidden" name="op" value="unbind"/>
<button type="submit" name="connectsubmit" value="yes" class="pn pnc"><strong>{lang qqconnect:connect_config_bind_confirm}</strong></button>
</div>
</form>
</div>
<!--{/if}-->
<!--{else}-->
<div class="mtw bm2 cl">
<div class="bm2_b bw0 hm" style="padding-top: 70px;">
<a href="{$_G['connect']['loginbind_url']}"><img src="{IMGDIR}/qq_bind.gif" /></a>
<p class="mtn xg1">{lang qqconnect:connect_config_bind}</p>
</div>
<div class="bm2_b bm2_b_y bw0">
<dl class="xld">
<h2 class="xi1 xs2">{lang qqconnect:connect_config_title}</h2>
<dt>{lang qqconnect:connect_config_desc_title1}</dt>
<dd class="xg1">{lang qqconnect:connect_config_desc_content1}</dd>
<dt>{lang qqconnect:connect_config_desc_title2}</dt>
<dd class="xg1">{lang qqconnect:connect_config_desc_content2}</dd>
</dl>
</div>
</div>
<!--{/if}-->

View File

@@ -0,0 +1,158 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: upgrade.php 33545 2013-07-04 07:06:27Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$sql = '';
$sql .= <<<EOF
CREATE TABLE IF NOT EXISTS pre_connect_postfeedlog (
flid mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
pid int(10) unsigned NOT NULL DEFAULT '0',
uid mediumint(8) unsigned NOT NULL DEFAULT '0',
publishtimes mediumint(8) unsigned NOT NULL DEFAULT '0',
lastpublished int(10) unsigned NOT NULL DEFAULT '0',
dateline int(10) unsigned NOT NULL DEFAULT '0',
`status` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (flid),
UNIQUE KEY pid (pid)
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS pre_connect_tthreadlog (
twid char(16) NOT NULL,
tid mediumint(8) unsigned NOT NULL DEFAULT '0',
conopenid char(32) NOT NULL,
pagetime int(10) unsigned DEFAULT '0',
lasttwid char(16) DEFAULT NULL,
nexttime int(10) unsigned DEFAULT '0',
updatetime int(10) unsigned DEFAULT '0',
dateline int(10) unsigned DEFAULT '0',
PRIMARY KEY (twid),
KEY nexttime (tid,nexttime),
KEY updatetime (tid,updatetime)
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS pre_common_connect_guest (
`conopenid` char(32) NOT NULL default '',
`conuin` char(40) NOT NULL default '',
`conuinsecret` char(16) NOT NULL default '',
`conqqnick` char(100) NOT NULL default '',
`conuintoken` char(32) NOT NULL DEFAULT '',
PRIMARY KEY (conopenid)
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS `pre_connect_disktask` (
`taskid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`aid` int(10) unsigned NOT NULL DEFAULT '0',
`uid` int(10) unsigned NOT NULL DEFAULT '0',
`openid` char(32) NOT NULL DEFAULT '',
`filename` varchar(255) NOT NULL DEFAULT '',
`verifycode` char(32) NOT NULL DEFAULT '',
`status` smallint(6) unsigned NOT NULL DEFAULT '0',
`dateline` int(10) unsigned NOT NULL DEFAULT '0',
`downloadtime` int(10) unsigned NOT NULL DEFAULT '0',
`extra` text,
PRIMARY KEY (`taskid`),
KEY `openid` (`openid`),
KEY `status` (`status`)
) TYPE=INNODB;
EOF;
runquery($sql);
$sql = '';
$columnexisted = false;
$query = DB::query("SHOW COLUMNS FROM ".DB::table('common_member_connect'));
while($temp = DB::fetch($query)) {
if($temp['Field'] == 'conisqqshow') {
$columnexisted = true;
continue;
}
if($temp['Field'] == 'conuintoken') {
$uintokenexisted = true;
continue;
}
}
$sql .= !$columnexisted ? "ALTER TABLE ".DB::table('common_member_connect')." ADD COLUMN conisqqshow tinyint(1) NOT NULL default '0';\n" : '';
$sql .= !$uintokenexisted ? "ALTER TABLE ".DB::table('common_member_connect')." ADD COLUMN conuintoken char(32) NOT NULL DEFAULT '';\n" : '';
$query = DB::query("SHOW COLUMNS FROM ".DB::table('common_connect_guest'));
while($row = DB::fetch($query)) {
if($row['Field'] == 'conqqnick') {
$qqnickexisted = true;
continue;
}
if($row['Field'] == 'conuintoken') {
$guintokenexisted = true;
continue;
}
}
$sql .= !$qqnickexisted ? "ALTER TABLE ".DB::table('common_connect_guest')." ADD COLUMN conqqnick char(100) NOT NULL default '';\n" : '';
$sql .= !$guintokenexisted ? "ALTER TABLE ".DB::table('common_connect_guest')." ADD COLUMN conuintoken char(32) NOT NULL DEFAULT '';\n" : '';
if($sql) {
runquery($sql);
}
$connect = C::t('common_setting')->fetch_setting('connect', true);
if (!array_key_exists('reply', $connect['t'])) {
$connect['t']['reply'] = 1;
}
if (!array_key_exists('reply_showauthor', $connect['t'])) {
$connect['t']['reply_showauthor'] = 1;
}
$needCreateGroup = false;
if ($connect['guest_groupid']) {
$group = C::t('common_usergroup')->fetch($connect['guest_groupid']);
if (!$group) {
$needCreateGroup = true;
}
} else {
$needCreateGroup = true;
}
$newConnect = array();
$name = $extend_lang['connect_guest_group_name'];
if ($needCreateGroup) {
$userGroupData = array(
'type' => 'special',
'grouptitle' => $name,
'allowvisit' => 1,
'color' => '',
'stars' => '',
);
$newGroupId = C::t('common_usergroup')->insert($userGroupData, true);
$dataField = array(
'groupid' => $newGroupId,
'allowsearch' => 2,
'readaccess' => 1,
'allowgetattach' => 1,
'allowgetimage' => 1,
);
C::t('common_usergroup_field')->insert($dataField);
$newConnect['guest_groupid'] = $newGroupId;
}
$https = json_decode(dfsockopen('https://graph.qq.com/user/get_user_info'));
$newConnect['oauth2'] = $https->ret == -1 ? 1 : 0;
$updateData = array_merge($connect, $newConnect);
C::t('common_setting')->update_setting('connect', serialize($updateData));
updatecache('setting');
$finish = true;