cpmsg('cloudaddons_download_error', '', 'error', array('ErrorCode' => 103));
 }
 $typedir = array('plugin' => 'source/plugin', 'template' => 'template', 'pack' => '.');
 if (!$typedir[$_GET['type']]) {
     dir_clear($tmpdir);
     cloudaddons_faillog($_GET['rid'], 104);
     cpmsg('cloudaddons_download_error', '', 'error', array('ErrorCode' => 104));
 }
 if ($_GET['type'] != 'pack') {
     $descdir = DISCUZ_ROOT . $typedir[$_GET['type']] . '/';
     $subdir = $_GET['key'];
 } else {
     $descdir = DISCUZ_ROOT;
     $subdir = '';
 }
 $unwriteabledirs = cloudaddons_dirwriteable($descdir, $subdir, $tmpdir);
 if ($unwriteabledirs) {
     if (!submitcheck('settingsubmit')) {
         showtips(cplang('cloudaddons_unwriteabledirs', array('basedir' => $typedir[$_GET['type']] != '.' ? $typedir[$_GET['type']] : '/', 'unwriteabledirs' => implode(', ', $unwriteabledirs))));
         siteftp_form("cloudaddons&operation=download&addonids={$_GET['addonids']}&i={$addoni}&end=" . rawurlencode($_GET['end']) . "&step=2&md5hash=" . $_GET['md5hash'] . '&timestamp=' . $_GET['timestamp']);
         exit;
     } else {
         siteftp_check($_GET['siteftp'], $typedir[$_GET['type']]);
     }
 }
 $descdir .= $subdir;
 cloudaddons_comparetree($tmpdir, $descdir, $tmpdir, $_GET['key'] . '.' . $_GET['type'], 1);
 if (!empty($_G['treeop']['oldchange']) && empty($_GET['confirmed'])) {
     cpmsg('cloudaddons_install_files_changed', '', 'form', array('files' => implode('<br />', $_G['treeop']['oldchange'])));
 }
 cloudaddons_copytree($tmpdir, $descdir);
Example #2
0
function pick_install()
{
    global $_G;
    $tmpdir = DISCUZ_ROOT . './data/download/dxc_temp';
    if (!is_dir($tmpdir)) {
        cpmsg(milu_lang('cloudaddons_download_error'), '', 'error');
        //数据下载错误
    }
    $_GET['type'] = 'plugin';
    $_GET['key'] = 'milu_pick';
    $to_version = $_GET['version'];
    $to_version_dateline = $_GET['version_dateline'];
    if (!libfile('function/cloudaddons')) {
        exit('error01:file not found');
    }
    require_once libfile('function/cloudaddons');
    $descdir = DISCUZ_ROOT . 'source/plugin/';
    $subdir = 'milu_pick';
    $unwriteabledirs = cloudaddons_dirwriteable($descdir, $subdir, $tmpdir);
    if ($unwriteabledirs) {
        //目录不可写
        showtips(milu_lang('cloudaddons_unwriteabledirs', array('basedir' => 'source/plugin', 'unwriteabledirs' => implode(', ', $unwriteabledirs))));
        exit;
    }
    $descdir .= $subdir;
    cloudaddons_comparetree($tmpdir, $descdir, $tmpdir, $_GET['key'] . '.' . $_GET['type'] . 'vip', 1);
    if (!empty($_G['treeop']['oldchange']) && empty($_GET['confirmed'])) {
        cpmsg(milu_lang('cloudaddons_install_files_changed', array('files' => implode('<br />', $_G['treeop']['oldchange']))), '', 'form', '');
    }
    cloudaddons_copytree($tmpdir, $descdir);
    $client_info = get_client_info();
    $_GET['end'] = 'Status=End&ID=milu_pick_vip.plugin&SN=' . $client_info['domain'] . '&RevisionID=' . $client_info['domain'] . '&RevisionDateline=' . $client_info['domain'];
    cloudaddons_savemd5($_GET['key'] . '.' . $_GET['type'] . 'vip', $_GET['end'], $_G['treeop']['md5']);
    cloudaddons_deltree($tmpdir);
    //成功之后的一些动作
    $set['pick_tips']['check_version'] = 0;
    pick_common_set($set);
    $charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
    $locale = '';
    if ($charset == 'BIG5') {
        $locale = 'TC';
    } elseif ($charset == 'GBK') {
        $locale = 'SC';
    } elseif ($charset == 'UTF8') {
        if ($_G['config']['output']['language'] == 'zh_cn') {
            $locale = 'SC';
        } elseif ($_G['config']['output']['language'] == 'zh_tw') {
            $locale = 'TC';
        }
    }
    $xml_ext = 'discuz_plugin_milu_pick_' . $locale . '_' . $charset . '.xml';
    $xml_file = $descdir . '/' . $xml_ext;
    if (!file_exists($xml_file)) {
        cpmsg(milu_lang('xml_no_found', array('f' => $xml_ext)), '', 'error');
    }
    //xml文件丢失
    require_once libfile('class/xml');
    $data = file_get_contents($xml_file);
    $data_arr = xml2array($data);
    $xml_data = exportarray($data_arr['Data'], 0);
    $installtype = $locale . '_' . $charset;
    pluginupgrade($xml_data, $installtype);
    $auth_file = PICK_DIR . '/data/pick_auth.txt';
    $upgrade_file = $descdir . '/upgrade.php';
    if (file_exists($upgrade_file)) {
        $_GET['fromversion'] = PICK_VERSION;
        include $upgrade_file;
        if (!$finish) {
            cpmsg_error(milu_lang('up_fail'));
        }
    }
    @unlink($auth_file);
    cpmsg('plugins_upgrade_succeed', PICK_GO . "pick_info", 'succeed', array('toversion' => $to_version . ' ' . $to_version_dateline));
}