Пример #1
0
 function Discuz_Cloud_Client($debug = false)
 {
     if (!defined('IN_DISCUZ')) {
         exit('Access Denied');
     }
     global $_G;
     require_once DISCUZ_ROOT . './source/discuz_version.php';
     $this->my_status = !empty($_G['setting']['my_app_status']) ? $_G['setting']['my_app_status'] : '';
     $this->cloud_status = !empty($_G['setting']['cloud_status']) ? $_G['setting']['cloud_status'] : '';
     $this->siteId = !empty($_G['setting']['my_siteid']) ? $_G['setting']['my_siteid'] : '';
     $this->siteKey = !empty($_G['setting']['my_sitekey']) ? $_G['setting']['my_sitekey'] : '';
     $this->siteName = !empty($_G['setting']['bbname']) ? $_G['setting']['bbname'] : '';
     $this->uniqueId = $siteuniqueid = DB::result_first("SELECT svalue FROM " . DB::table('common_setting') . " WHERE skey='siteuniqueid'");
     $this->siteUrl = $_G['siteurl'];
     $this->charset = CHARSET;
     $this->timeZone = !empty($_G['setting']['timeoffset']) ? $_G['setting']['timeoffset'] : '';
     $this->UCenterUrl = !empty($_G['setting']['ucenterurl']) ? $_G['setting']['ucenterurl'] : '';
     $this->language = $_G['config']['output']['language'] ? $_G['config']['output']['language'] : 'zh_CN';
     $this->productType = 'DISCUZX';
     $this->productVersion = defined('DISCUZ_VERSION') ? DISCUZ_VERSION : '';
     $this->productRelease = defined('DISCUZ_RELEASE') ? DISCUZ_RELEASE : '';
     $this->timestamp = TIMESTAMP;
     require_once libfile('function/cloud');
     $this->apiVersion = cloud_get_api_version();
     $this->siteUid = $_G['uid'];
     $this->Client = new Cloud_Client($this->siteId, $this->siteKey);
     if ($debug) {
         $this->Client->debug = true;
         $this->debug = true;
     }
     if ($_G['setting']['cloud_api_ip']) {
         $this->setCloudIp($_G['setting']['cloud_api_ip']);
     }
 }
Пример #2
0
function manyouSync()
{
    global $_G;
    $setting = $_G['setting'];
    $my_url = 'http://api.manyou.com/uchome.php';
    $mySiteId = empty($_G['setting']['my_siteid']) ? '' : $_G['setting']['my_siteid'];
    $siteName = $_G['setting']['bbname'];
    $siteUrl = $_G['siteurl'];
    $ucUrl = rtrim($_G['setting']['ucenterurl'], '/') . '/';
    $siteCharset = $_G['charset'];
    $siteTimeZone = $_G['setting']['timeoffset'];
    $mySiteKey = empty($_G['setting']['my_sitekey']) ? '' : $_G['setting']['my_sitekey'];
    $siteKey = DB::result_first("SELECT svalue FROM " . DB::table('common_setting') . " WHERE skey='siteuniqueid'");
    $siteLanguage = $_G['config']['output']['language'];
    $siteVersion = $_G['setting']['version'];
    $myVersion = cloud_get_api_version();
    $productType = 'DISCUZX';
    $siteRealNameEnable = '';
    $siteRealAvatarEnable = '';
    $siteEnableApp = intval($setting['my_app_status']);
    $key = $mySiteId . $siteName . $siteUrl . $ucUrl . $siteCharset . $siteTimeZone . $siteRealNameEnable . $mySiteKey . $siteKey;
    $key = md5($key);
    $siteTimeZone = urlencode($siteTimeZone);
    $siteName = urlencode($siteName);
    $register = false;
    $postString = sprintf('action=%s&productType=%s&key=%s&mySiteId=%d&siteName=%s&siteUrl=%s&ucUrl=%s&siteCharset=%s&siteTimeZone=%s&siteEnableRealName=%s&siteEnableRealAvatar=%s&siteKey=%s&siteLanguage=%s&siteVersion=%s&myVersion=%s&siteEnableApp=%s&from=cloud', 'siteRefresh', $productType, $key, $mySiteId, $siteName, $siteUrl, $ucUrl, $siteCharset, $siteTimeZone, $siteRealNameEnable, $siteRealAvatarEnable, $siteKey, $siteLanguage, $siteVersion, $myVersion, $siteEnableApp);
    $response = @dfsockopen($my_url, 0, $postString, '', false, $setting['my_ip']);
    $res = unserialize($response);
    if (!$response) {
        $res['errCode'] = 111;
        $res['errMessage'] = 'Empty Response';
        $res['result'] = $response;
    } elseif (!$res) {
        $res['errCode'] = 110;
        $res['errMessage'] = 'Error Response';
        $res['result'] = $response;
    }
    if ($res['errCode']) {
        cpmsg('cloud_sync_failure', '', 'error', array('errCode' => $res['errCode'], 'errMessage' => $res['errMessage']));
    }
}
Пример #3
0
 function Security_Cloud_Client($debug = false)
 {
     if (!defined('IN_DISCUZ')) {
         exit('Access Denied');
     }
     global $_G;
     require_once DISCUZ_ROOT . './source/discuz_version.php';
     $this->siteId = !empty($_G['setting']['my_siteid']) ? $_G['setting']['my_siteid'] : '';
     $this->siteKey = !empty($_G['setting']['my_sitekey']) ? $_G['setting']['my_sitekey'] : '';
     $this->siteUrl = $_G['siteurl'];
     require_once libfile('function/cloud');
     $this->apiVersion = cloud_get_api_version();
     $this->siteUid = $_G['member']['uid'];
     $this->Client = new Cloud_Client($this->siteId, $this->siteKey);
     if ($debug) {
         $this->Client->debug = true;
         $this->debug = true;
     }
     if ($_G['setting']['cloud_api_ip']) {
         $this->Client->cloudApiIp = $_G['setting']['cloud_api_ip'];
     }
 }
Пример #4
0
function show()
{
    global $_G;
    $clientVersion = '2';
    include_once DISCUZ_ROOT . '/source/discuz_version.php';
    $release = DISCUZ_RELEASE;
    $fix = defined(DISCUZ_FIXBUG) ? DISCUZ_FIXBUG : '';
    $cloudApi = cloud_get_api_version();
    include_once libfile('function/admincp');
    $isfounder = checkfounder($_G['member']);
    $sId = $_G['setting']['my_siteid'];
    $version = $_G['setting']['version'];
    $adminId = $_G['adminid'];
    $openId = getOpenId2($_G['uid']);
    $uid = $_G['uid'];
    $groupId = $_G['groupid'];
    $ts = TIMESTAMP;
    $sig = '';
    if ($sId) {
        $params = array('s_id' => $sId, 'product_version' => $version, 'product_release' => $release, 'fix_bug' => $fix, 'is_founder' => $isfounder, 's_url' => $_G[siteurl], 'admin_id' => $adminId, 'open_id' => $openId, 'uid' => $uid, 'group_id' => $groupId, 'last_send_time' => $_COOKIE['dctips']);
        ksort($params);
        $str = buildArrayQuery($params, '', '&');
        $sig = md5(sprintf('%s|%s|%s', $str, $_G['setting']['my_sitekey'], $ts));
    }
    $jsCode = <<<EOF
\t\t<div id="discuz_tips" style="display:none;"></div>
\t\t<script type="text/javascript">
\t\t\tvar discuzSId = '{$sId}';
\t\t\tvar discuzVersion = '{$version}';
\t\t\tvar discuzRelease = '{$release}';
\t\t\tvar discuzApi = '{$cloudApi}';
\t\t\tvar discuzIsFounder = '{$isfounder}';
\t\t\tvar discuzFixbug = '{$fix}';
\t\t\tvar discuzAdminId = '{$adminId}';
\t\t\tvar discuzOpenId = '{$openId}';
\t\t\tvar discuzUid = '{$uid}';
\t\t\tvar discuzGroupId = '{$groupId}';
\t\t\tvar ts = '{$ts}';
\t\t\tvar sig = '{$sig}';
\t\t\tvar discuzTipsCVersion = '{$clientVersion}';
\t\t</script>
\t\t<script src="http://discuz.gtimg.cn/cloud/scripts/discuz_tips.js?v=1" type="text/javascript" charset="UTF-8"></script>
EOF;
    echo $jsCode;
}
Пример #5
0
 function onCloudSetApps($apps)
 {
     if (!is_array($apps)) {
         return false;
     }
     require_once libfile('function/cloud');
     $res = array();
     $res['apiVersion'] = cloud_get_api_version();
     foreach ($apps as $appName => $status) {
         $res[$appName] = setcloudappstatus($appName, $status, false, false);
     }
     require_once libfile('function/cache');
     updatecache(array('plugin', 'setting', 'styles'));
     $res['siteInfo'] = $this->_getBaseInfo();
     return $res;
 }