Esempio n. 1
0
    View::output();
}
//上传zip模板
if ($action == 'upload_zip') {
    LoginAuth::checkToken();
    $zipfile = isset($_FILES['tplzip']) ? $_FILES['tplzip'] : '';
    if ($zipfile['error'] == 4) {
        emDirect("./template.php?action=install&error_d=1");
    }
    if (!$zipfile || $zipfile['error'] >= 1 || empty($zipfile['tmp_name'])) {
        emMsg('模板上传失败');
    }
    if (getFileSuffix($zipfile['name']) != 'zip') {
        emDirect("./template.php?action=install&error_a=1");
    }
    $ret = emUnZip($zipfile['tmp_name'], '../content/templates/', 'tpl');
    switch ($ret) {
        case 0:
            emDirect("./template.php?activate_install=1#tpllib");
            break;
        case -2:
            emDirect("./template.php?action=install&error_e=1");
            break;
        case 1:
        case 2:
            emDirect("./template.php?action=install&error_b=1");
            break;
        case 3:
            emDirect("./template.php?action=install&error_c=1");
            break;
    }
Esempio n. 2
0
    $source_typeurl = '<a href="plugin.php">查看插件</a>';
    include View::getView('header');
    require_once View::getView('store_install');
    include View::getView('footer');
}
if ($action == 'addon') {
    $source = isset($_GET['source']) ? trim($_GET['source']) : '';
    $source_type = isset($_GET['type']) ? trim($_GET['type']) : '';
    if (empty($source)) {
        exit('error');
    }
    $temp_file = emFecthFile(OFFICIAL_SERVICE_HOST . $source);
    if (!$temp_file) {
        exit('error_down');
    }
    $unzip_path = $source_type == 'tpl' ? '../content/templates/' : '../content/plugins/';
    $ret = emUnZip($temp_file, $unzip_path, $source_type);
    @unlink($temp_file);
    switch ($ret) {
        case 0:
            exit('succ');
            break;
        case 1:
        case 2:
            exit('error_dir');
            break;
        case 3:
            exit('error_zip');
            break;
    }
}
Esempio n. 3
0
        emDirect("./plugin.php?error_a=1");
    }
}
//上传zip插件
if ($action == 'upload_zip') {
    $zipfile = isset($_FILES['pluzip']) ? $_FILES['pluzip'] : '';
    if ($zipfile['error'] == 4) {
        emDirect("./plugin.php?action=install&error_d=1");
    }
    if (!$zipfile || $zipfile['error'] >= 1 || empty($zipfile['tmp_name'])) {
        emMsg('插件上传失败');
    }
    if (getFileSuffix($zipfile['name']) != 'zip') {
        emDirect("./plugin.php?action=install&error_a=1");
    }
    $ret = emUnZip($zipfile['tmp_name'], '../content/plugins/', 'plugin');
    switch ($ret) {
        case 0:
            emDirect("./plugin.php?activate_install=1#tpllib");
            break;
        case -1:
            emDirect("./plugin.php?action=install&error_e=1");
            break;
        case 1:
        case 2:
            emDirect("./plugin.php?action=install&error_b=1");
            break;
        case 3:
            emDirect("./plugin.php?action=install&error_c=1");
            break;
    }
Esempio n. 4
0
    include View::getView('header');
    require_once View::getView('index');
    include View::getView('footer');
    View::output();
}
if ($action == 'update' && ROLE == ROLE_ADMIN) {
    $source = isset($_GET['source']) ? trim($_GET['source']) : '';
    $upsql = isset($_GET['upsql']) ? trim($_GET['upsql']) : '';
    if (empty($source)) {
        exit('error');
    }
    $temp_file = emFecthFile(OFFICIAL_SERVICE_HOST . $source);
    if (!$temp_file) {
        exit('error_down');
    }
    $ret = emUnZip($temp_file, '../', 'update');
    @unlink($temp_file);
    switch ($ret) {
        case 1:
        case 2:
            exit('error_dir');
            break;
        case 3:
            exit('error_zip');
            break;
    }
    //update db
    if (!$upsql) {
        exit('succ');
    }
    $DB = Database::getInstance();
Esempio n. 5
0
    emDirect('./data.php?active_import=1');
}
//导入本地备份文件
if ($action == 'import') {
    LoginAuth::checkToken();
    $sqlfile = isset($_FILES['sqlfile']) ? $_FILES['sqlfile'] : '';
    if (!$sqlfile) {
        emMsg('非法提交的信息');
    }
    if ($sqlfile['error'] == 1) {
        emMsg('附件大小超过系统' . ini_get('upload_max_filesize') . '限制');
    } elseif ($sqlfile['error'] > 1) {
        emMsg('上传文件失败,错误码:' . $sqlfile['error']);
    }
    if (getFileSuffix($sqlfile['name']) == 'zip') {
        $ret = emUnZip($sqlfile['tmp_name'], dirname($sqlfile['tmp_name']), 'backup');
        switch ($ret) {
            case -3:
                emDirect('./data.php?error_e=1');
                break;
            case 1:
            case 2:
                emDirect('./data.php?error_d=1');
                break;
            case 3:
                emDirect('./data.php?error_c=1');
                break;
        }
        $sqlfile['tmp_name'] = dirname($sqlfile['tmp_name']) . '/' . str_replace('.zip', '.sql', $sqlfile['name']);
        if (!file_exists($sqlfile['tmp_name'])) {
            emMsg('只能导入emlog备份的压缩包,且不能修改压缩包文件名!');