Пример #1
0
    $referer = str_replace($_G['siteurl'], '', dreferer());
    if (!empty($_G['gp_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') {
    $_G['gp_share_url'] = $_G['connect']['discuz_new_share_url'];
    $posttable = getposttablebytid($tid);
    $post = DB::fetch_first("SELECT * FROM " . DB::table($posttable) . " WHERE tid = '{$tid}' AND first='1' AND invisible='0'");
    $thread = DB::fetch_first("SELECT * FROM " . DB::table('forum_thread') . " WHERE tid = '{$tid}' AND displayorder >= 0");
    if ($_G['group']['allowgetimage'] && $thread['price'] == 0) {
        connect_parse_bbcode($post['message'], $thread['fid'], $post['pid'], $post['htmlon'], $attach_images);
        if ($attach_images && is_array($attach_images)) {
            $_G['gp_share_images'] = array_slice($attach_images, 0, 3);
            $attach_images = array();
            foreach ($_G['gp_share_images'] as $image) {
                $attach_images[] = $image['big'];
            }
            $_G['gp_attach_image'] = implode('|', $attach_images);
            unset($attach_images);
        }
    }
} elseif ($pluginop == 'new') {
    $sh_type = trim(intval($_G['gp_sh_type']));
    $tid = trim(intval($_G['gp_thread_id']));
    $dialog_id = $_G['gp_dialog_id'];
    $sync_post = $_G['gp_sync_post'];
Пример #2
0
 function _viewthread_share_method_output()
 {
     global $_G;
     require_once libfile('function/connect');
     if ($GLOBALS['page'] == 1 && $_G['forum_firstpid'] && $GLOBALS['postlist'][$_G['forum_firstpid']]['invisible'] == 0) {
         $_G['connect']['feed_js'] = $_G['connect']['t_js'] = false;
         if (!getstatus($_G['forum_thread']['status'], 7) && $_G['forum_thread']['displayorder'] >= 0) {
             $feedlogstatus = false;
             $_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 ($_G['connect']['feed_log'] && $_G['member']['conisbind'] && $_G['uid'] == $_G['forum_thread']['authorid']) {
                     if ($_G['connect']['feed_log']['status'] == 1 || $_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']) {
                         DB::query("UPDATE " . DB::table('connect_feedlog') . " SET status='2', lastpublished='{$_G['timestamp']}', publishtimes=publishtimes+1 WHERE tid='{$_G['tid']}' AND status!=4");
                         $_G['connect']['feed_js'] = $feedlogstatus = true;
                     }
                 }
             } else {
                 $feedlogstatus = true;
             }
         }
         if (!getstatus($_G['forum_thread']['status'], 8) && $_G['forum_thread']['displayorder'] >= 0) {
             $_G['connect']['t_log'] = DB::fetch_first("SELECT * FROM " . DB::table('connect_tlog') . " WHERE tid='{$_G['tid']}'");
             if ($_G['connect']['t_log']) {
                 $_G['connect']['t_interval'] = 300;
                 $_G['connect']['t_publish_max'] = 1000;
                 if ($_G['connect']['t_log'] && $_G['member']['conisbind'] && $_G['uid'] == $_G['forum_thread']['authorid']) {
                     if ($_G['connect']['t_log']['status'] == 1 || $_G['connect']['t_log']['status'] == 2 && TIMESTAMP - $_G['connect']['t_log']['lastpublished'] > $_G['connect']['t_interval'] && $_G['connect']['t_log']['publishtimes'] < $_G['connect']['t_publish_max']) {
                         DB::query("UPDATE " . DB::table('connect_tlog') . " SET status='2', lastpublished='{$_G['timestamp']}', publishtimes=publishtimes+1 WHERE tid='{$_G['tid']}' AND status!=4");
                         $_G['connect']['t_js'] = $tlogstatus = true;
                     }
                 }
             } else {
                 $tlogstatus = true;
             }
         }
         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']}'");
         }
         $_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']]);
         $_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'];
         }
         $extrajs = '';
         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);
         }
         if (!$_G['member']['conisbind'] && $_G['group']['allowgetimage'] && $_G['thread']['price'] == 0) {
             if ($_G['connect']['first_post']['message']) {
                 require_once libfile('function/connect');
                 $post['html_content'] = connect_parse_bbcode($_G['connect']['first_post']['message'], $_G['connect']['first_post']['fid'], $_G['connect']['first_post']['pid'], $_G['connect']['first_post']['htmlon'], $attach_images);
                 if ($attach_images && is_array($attach_images)) {
                     $attach_images = array_slice($attach_images, 0, 3);
                     $share_images = array();
                     foreach ($attach_images as $attach_image) {
                         $share_images[] = urlencode($attach_image['big']);
                     }
                     $_G['connect']['share_images'] = implode('|', $share_images);
                     unset($share_images);
                 }
             }
         }
         connect_merge_member();
         return tpl_viewthread_share_method() . $extrajs;
     }
 }
Пример #3
0
if (empty($tid)) {
    connect_js_ouput_message('', 'connect_thread_id_miss', 1);
}
if ($op == 'new') {
    connect_merge_member();
    $posttable = getposttablebytid($tid);
    $post = DB::fetch_first("SELECT * FROM " . DB::table($posttable) . " WHERE tid = '{$tid}' AND first='1' AND invisible='0'");
    $thread = DB::fetch_first("SELECT * FROM " . DB::table('forum_thread') . " WHERE tid = '{$tid}' AND displayorder >= 0");
    $f_type = trim(intval($_G['gp_type']));
    $api_url = $_G['connect']['api_url'] . '/connect/feed/new';
    $extra = array('oauth_token' => $_G['member']['conuin']);
    $sig_params = connect_get_oauth_signature_params($extra);
    $oauth_token_secret = $_G['member']['conuinsecret'];
    $sig_params['oauth_signature'] = connect_get_oauth_signature($api_url, $sig_params, 'POST', $oauth_token_secret);
    $params = array('client_ip' => $_G['clientip'], 'thread_id' => $tid, 'author_id' => $thread['authorid'], 'author' => $thread['author'], 'forum_id' => $thread['fid'], 'p_id' => $post['pid'], 'u_id' => $_G['uid'], 'subject' => $thread['subject'], 'bbcode_content' => $post['message'], 'read_permission' => $thread['readperm'], 'f_type' => $f_type);
    $params['html_content'] = connect_parse_bbcode($params['bbcode_content'], $params['forum_id'], $params['p_id'], $post['htmlon'], $attach_images);
    if ($attach_images && is_array($attach_images)) {
        $attach_images = array_slice($attach_images, 0, 3);
        $feed_images = array();
        foreach ($attach_images as $attach_image) {
            $feed_images[] = $attach_image['big'];
        }
        $params['attach_images'] = implode('|', $feed_images);
        unset($feed_images);
    }
    $params = array_merge($sig_params, $params);
    $response = connect_output_php($api_url . '?', cloud_http_build_query($params, '', '&'));
    if (!isset($response['status']) || $response['status'] != 0) {
        if (in_array($response['status'], array('4019', '4021'))) {
            dsetcookie('connect_js_name', 'feed_resend');
            dsetcookie('connect_js_params', base64_encode(serialize(array('type' => $f_type, 'thread_id' => $tid, 'ts' => TIMESTAMP))), 86400);