예제 #1
0
 *
 *      $Id: cloud_siteinfo.php 24570 2011-09-26 09:18:58Z yexinhao $
 */
if (!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
    exit('Access Denied');
}
if (submitcheck('syncsubmit')) {
    if ($cloudstatus != 'cloud') {
        cpmsg('cloud_open_first', '', 'succeed', array(), '<p class="marginbot"><a href="###" onclick="top.location = \'' . ADMINSCRIPT . '?frames=yes&action=cloud&operation=open\'" class="lightlink">' . cplang('message_redirect') . '</a></p><script type="text/JavaScript">setTimeout("top.location = \'' . ADMINSCRIPT . '?frames=yes&action=cloud&operation=open\'", 3000);</script>');
    }
    require_once DISCUZ_ROOT . '/api/manyou/Manyou.php';
    $cloudClient = new Discuz_Cloud_Client();
    if ($_G['setting']['my_app_status']) {
        manyouSync();
    }
    $res = $cloudClient->sync();
    if (!$res) {
        cpmsg('cloud_sync_failure', '', 'error', array('errCode' => $cloudClient->errno, 'errMessage' => $cloudClient->errmsg));
    } else {
        cpmsg('cloud_sync_success', '', 'succeed', array(), '<p class="marginbot"><a href="###" onclick="top.location = \'' . ADMINSCRIPT . '?frames=yes&action=cloud&operation=siteinfo\'" class="lightlink">' . cplang('message_redirect') . '</a></p><script type="text/JavaScript">setTimeout("top.location = \'' . ADMINSCRIPT . '?frames=yes&action=cloud&operation=siteinfo\'", 3000);</script>');
    }
} elseif (submitcheck('resetsubmit')) {
    if ($cloudstatus != 'cloud') {
        cpmsg('cloud_open_first', '', 'succeed', array(), '<p class="marginbot"><a href="###" onclick="top.location = \'' . ADMINSCRIPT . '?frames=yes&action=cloud&operation=open\'" class="lightlink">' . cplang('message_redirect') . '</a></p><script type="text/JavaScript">setTimeout("top.location = \'' . ADMINSCRIPT . '?frames=yes&action=cloud&operation=open\'", 3000);</script>');
    }
    require_once DISCUZ_ROOT . '/api/manyou/Manyou.php';
    $cloudClient = new Discuz_Cloud_Client();
    $res = $cloudClient->resetKey();
    if (!$res) {
        cpmsg($cloudClient->errmsg, '', 'error');
    } else {
예제 #2
0
function upgrademanyou($cloudApiIp = '')
{
    global $_G;
    require_once DISCUZ_ROOT . '/api/manyou/Manyou.php';
    $cloudClient = new Discuz_Cloud_Client();
    $returnData = $cloudClient->sync();
    if ($cloudClient->errno == 1 && $cloudApiIp) {
        $cloudClient->setCloudIp($cloudApiIp);
        $returnData = $cloudClient->sync();
        if (!$cloudClient->errno) {
            DB::query("REPLACE INTO " . DB::table('common_setting') . " (`skey`, `svalue`)\r\n\t\t\t\t\t\tVALUES ('cloud_api_ip', '{$cloudApiIp}')");
        }
    }
    if ($cloudClient->errno) {
        $result = array('errCode' => $cloudClient->errno, 'errMessage' => $cloudClient->errmsg);
    } else {
        $result = array('errCode' => 0);
    }
    return $result;
}