예제 #1
0
function connect_user_bind_params()
{
    global $_G;
    connect_merge_member();
    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' => $_G['setting']['connectsiteid'], 'avatar_input' => $avatar_input, 'avatar_agent' => $agent, 'site_ucenter_id' => UC_APPID);
    return $params;
}
예제 #2
0
 function spacecp_profile_bottom()
 {
     global $_G;
     if (submitcheck('profilesubmit')) {
         $_G['group']['maxsigsize'] = $_G['group']['maxsigsize'] < 200 ? 200 : $_G['group']['maxsigsize'];
         return;
     }
     if ($_G['uid'] && $_G['setting']['connect']['allow']) {
         require_once libfile('function/connect');
         connect_merge_member();
         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'] = connect_get_oauth_signature('http://cp.discuz.qq.com/connect/getSignature', $arr, 'GET', $_G['member']['conuinsecret']);
             $result = connect_output_php('http://cp.discuz.qq.com/connect/getSignature?' . http_build_query($arr, '', '&'));
             if ($result['status'] == 0) {
                 $js = 'a.onclick = function () { seditor_insertunit(\'sightml\', \'[wb=' . $result['result']['username'] . ']' . $result['result']['signature_url'] . '[/wb]\'); };';
             } else {
                 $js = 'a.onclick = function () { showDialog(\'' . lang('plugin/qqconnect', 'connect_wbsign_no_account') . '\'); };';
             }
         } else {
             $js = 'a.onclick = function () { showDialog(\'' . lang('plugin/qqconnect', 'connect_wbsign_no_bind') . '\'); };';
         }
         return '<script type="text/javascript">if($(\'sightmlsml\')) {' . 'var a = document.createElement(\'a\');a.href = \'javascript:;\';a.style.background = \'url(\' + STATICURL + \'image/common/weibo.png) no-repeat 0 2px\';' . 'a.onmouseover = function () { showTip(this); };a.setAttribute(\'tip\', \'' . lang('plugin/qqconnect', 'connect_wbsign_tip') . '\');' . $js . '$(\'sightmlsml\').parentNode.appendChild(a);' . '}</script>';
     }
 }
예제 #3
0
    showmessage('to_login', '', array(), array('showmsg' => true, 'login' => 1));
}
$op = !empty($_G['gp_op']) ? $_G['gp_op'] : '';
$referer = dreferer();
if (submitcheck('connectsubmit')) {
    if ($op == 'config') {
        $ispublishfeed = !empty($_G['gp_ispublishfeed']) ? 1 : 0;
        $ispublisht = !empty($_G['gp_ispublisht']) ? 1 : 0;
        DB::query("UPDATE " . DB::table('common_member_connect') . " SET conispublishfeed='{$ispublishfeed}', conispublisht='{$ispublisht}' WHERE uid='{$_G['uid']}'");
        if (!$ispublishfeed || !$ispublisht) {
            dsetcookie('connect_synpost_tip');
        }
        showmessage('qqconnect:connect_config_success', $referer);
    } elseif ($op == 'unbind') {
        require_once libfile('function/connect');
        connect_merge_member();
        $connect_member = DB::fetch_first("SELECT * FROM " . DB::table('common_member_connect') . " WHERE uid='{$_G['uid']}'");
        if ($connect_member['conuinsecret']) {
            if ($_G['member']['conisregister']) {
                if ($_G['gp_newpassword1'] !== $_G['gp_newpassword2']) {
                    showmessage('profile_passwd_notmatch', $referer);
                }
                if (!$_G['gp_newpassword1'] || $_G['gp_newpassword1'] != addslashes($_G['gp_newpassword1'])) {
                    showmessage('profile_passwd_illegal', $referer);
                }
            }
            $response = connect_user_unbind();
            if (!isset($response['status']) || $response['status'] !== 0) {
                if (!isset($response['status'])) {
                    connect_errlog('100', lang('connect', 'connect_errlog_server_no_response'));
                } else {
예제 #4
0
 function _viewthread_share_method_output()
 {
     global $_G, $postlist;
     require_once libfile('function/connect');
     $extrajs = '';
     if ($GLOBALS['page'] == 1 && $_G['forum_firstpid'] && $GLOBALS['postlist'][$_G['forum_firstpid']]['invisible'] == 0 && TIMESTAMP - $_G['forum_thread']['dateline'] < 43200) {
         $_G['connect']['feed_js'] = $_G['connect']['t_js'] = $feedlogstatus = $tlogstatus = false;
         if ((!getstatus($_G['forum_thread']['status'], 7) || !getstatus($_G['forum_thread']['status'], 8)) && $_G['forum_thread']['displayorder'] >= 0 && $_G['member']['conisbind'] && $_G['uid'] == $_G['forum_thread']['authorid']) {
             $_G['connect']['feed_log'] = DB::fetch_first("SELECT * FROM " . DB::table('connect_feedlog') . " WHERE tid='{$_G['tid']}'");
             if ($_G['connect']['feed_log']) {
                 $_G['connect']['feed_interval'] = 300;
                 $_G['connect']['feed_publish_max'] = 1000;
                 if (getstatus($_G['connect']['feed_log']['status'], 1) || getstatus($_G['connect']['feed_log']['status'], 2) && TIMESTAMP - $_G['connect']['feed_log']['lastpublished'] > $_G['connect']['feed_interval'] && $_G['connect']['feed_log']['publishtimes'] < $_G['connect']['feed_publish_max']) {
                     $_G['connect']['feed_js'] = $feedlogstatus = true;
                 }
                 if (getstatus($_G['connect']['feed_log']['status'], 3) || getstatus($_G['connect']['feed_log']['status'], 4) && TIMESTAMP - $_G['connect']['feed_log']['lastpublished'] > $_G['connect']['feed_interval'] && $_G['connect']['feed_log']['publishtimes'] < $_G['connect']['feed_publish_max']) {
                     $_G['connect']['t_js'] = $tlogstatus = true;
                 }
                 if ($feedlogstatus || $tlogstatus) {
                     $status = $feedlogstatus ? setstatus(2, 1, $status) : $status;
                     $status = $tlogstatus ? setstatus(4, 1, $status) : $status;
                     DB::query("UPDATE " . DB::table('connect_feedlog') . " SET status='{$status}', lastpublished='{$_G['timestamp']}', publishtimes=publishtimes+1 WHERE tid='{$_G['tid']}'");
                 }
             }
         }
         if ($feedlogstatus || $tlogstatus) {
             $newstatus = $_G['forum_thread']['status'];
             $newstatus = $feedlogstatus ? setstatus(7, 1, $newstatus) : $newstatus;
             $newstatus = $tlogstatus ? setstatus(8, 1, $newstatus) : $newstatus;
             DB::query("UPDATE " . DB::table('forum_thread') . " SET status='{$newstatus}' WHERE tid='{$_G['tid']}'");
         }
         if ($_G['connect']['feed_js'] || $_G['connect']['t_js']) {
             $params = array();
             $params['thread_id'] = $_G['tid'];
             $params['ts'] = TIMESTAMP;
             $params['type'] = bindec(($_G['connect']['t_js'] ? '1' : '0') . ($_G['connect']['feed_js'] ? '1' : '0'));
             $params['sig'] = connect_get_sig($params, connect_get_sig_key());
             $jsurl = $_G['connect']['discuz_new_feed_url'] . '&' . cloud_http_build_query($params, '', '&');
             $extrajs = connect_output_javascript($jsurl);
         }
     }
     $_G['connect']['thread_url'] = $_G['siteurl'] . $GLOBALS['canonical'];
     $_G['connect']['qzone_share_url'] = $_G['siteurl'] . 'home.php?mod=spacecp&ac=plugin&id=qqconnect:spacecp&pluginop=share&sh_type=1&thread_id=' . $_G['tid'];
     $_G['connect']['weibo_share_url'] = $_G['siteurl'] . 'home.php?mod=spacecp&ac=plugin&id=qqconnect:spacecp&pluginop=share&sh_type=2&thread_id=' . $_G['tid'];
     $_G['connect']['pengyou_share_url'] = $_G['siteurl'] . 'home.php?mod=spacecp&ac=plugin&id=qqconnect:spacecp&pluginop=share&sh_type=3&thread_id=' . $_G['tid'];
     $_G['connect']['qzone_share_api'] = $_G['connect']['qzone_public_share_url'] . '?url=' . urlencode($_G['connect']['thread_url']);
     $_G['connect']['pengyou_share_api'] = $_G['connect']['qzone_public_share_url'] . '?to=pengyou&url=' . urlencode($_G['connect']['thread_url']);
     $params = array('oauth_consumer_key' => $_G['setting']['connectappid'], 'title' => $GLOBALS['postlist'][$_G['forum_firstpid']]['subject'], 'url' => $_G['connect']['thread_url']);
     $params['sig'] = connect_get_sig($params, connect_get_sig_key());
     $_G['connect']['t_share_api'] = $_G['connect']['url'] . '/mblog/redirect?' . cloud_http_build_query($params, '', '&');
     $_G['connect']['first_post'] = daddslashes($GLOBALS['postlist'][$_G['forum_firstpid']]);
     if ($_G['connect']['first_post']['anonymous']) {
         $_G['connect']['first_post']['authorid'] = 0;
         $_G['connect']['first_post']['author'] = '';
     }
     $_G['gp_connect_autoshare'] = !empty($_G['gp_connect_autoshare']) ? 1 : 0;
     $_G['connect']['weibo_appkey'] = $_G['connect']['weibo_public_appkey'];
     if ($this->allow && $_G['setting']['connect']['mblog_app_key']) {
         $_G['connect']['weibo_appkey'] = $_G['setting']['connect']['mblog_app_key'];
     }
     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 ($postlist[$_G['connect']['first_post']['pid']]['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;
         }
         $key = md5($attachment['aid'] . '|' . $bigWidth . '|' . $bigHeight);
         $bigImageURL = $_G['siteurl'] . 'forum.php?mod=image&aid=' . $attachment['aid'] . '&size=' . $bigWidth . 'x' . $bigHeight . '&key=' . rawurlencode($key) . '&type=fixnone&nocache=1';
         $share_images[] = urlencode($bigImageURL);
     }
     $_G['connect']['share_images'] = implode('|', $share_images);
     connect_merge_member();
     return tpl_viewthread_share_method() . $extrajs;
 }