Esempio n. 1
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;
     }
 }
Esempio n. 2
0
function connect_feed_remove($tid)
{
    global $_G;
    $feedlog = DB::fetch_first("SELECT * FROM " . DB::table('connect_feedlog') . " WHERE tid='{$tid}'");
    if (!$feedlog) {
        return false;
    }
    if ($feedlog['status'] != 4) {
        DB::query("UPDATE " . DB::table('connect_feedlog') . " SET status='4' WHERE tid='{$tid}'");
    }
    $params = array('thread_id' => $tid, 'ts' => TIMESTAMP);
    $params['sig'] = connect_get_sig($params, connect_get_sig_key());
    return sprintf('%s&%s', $_G['connect']['discuz_remove_feed_url'], cloud_http_build_query($params, '', '&'));
}
Esempio n. 3
0
$connectnav = array();
$connectnav[0] = array('connect_menu_setting', 'cloud&operation=connect&anchor=setting', $current['setting']);
$connectnav[1] = array('connect_menu_service', 'cloud&operation=connect&anchor=service', $current['service']);
if (!$_G['inajax']) {
    cpheader();
}
if ($_G['gp_anchor'] == 'service') {
    headerLocation($cloudDomain . '/connect/service/?' . $signUrl);
} elseif ($_G['gp_anchor'] == 'setting') {
    $query = DB::query("SELECT * FROM " . DB::table('common_setting') . " WHERE skey IN ('extcredits', 'connect', 'connectsiteid', 'connectsitekey', 'regconnect')");
    while ($row = DB::fetch($query)) {
        $setting[$row['skey']] = $row['svalue'];
    }
    $setting['connect'] = (array) unserialize($setting['connect']);
    $params = array('s_id' => $setting['connectsiteid'], 'response_type' => 'php');
    $params['sig'] = connect_get_sig($params, $setting['connectsiteid'] . '|' . $setting['connectsitekey']);
    $staturl = $setting['connectsiteid'] ? 'http://connect.manyou.com/site/stats/index?' . http_build_query($params) : '';
    if (!submitcheck('connectsubmit')) {
        shownav('navcloud', 'menu_setting_qqconnect');
        include_once libfile('function/forumlist');
        $forumselect = array();
        foreach (array('feed', 't') as $k) {
            $forumselect[$k] = '<select name="connectnew[' . $k . '][fids][]" multiple="multiple" size="10">' . forumselect(FALSE, 0, 0, TRUE) . '</select>';
            if ($setting['connect'][$k]['fids']) {
                foreach ($setting['connect'][$k]['fids'] as $v) {
                    $forumselect[$k] = str_replace('<option value="' . $v . '">', '<option value="' . $v . '" selected>', $forumselect[$k]);
                }
            }
        }
        $connectrewardcredits = $connectgroup = '';
        $setting['extcredits'] = unserialize($setting['extcredits']);
Esempio n. 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;
 }