예제 #1
0
        }
    } else {
        make_json_error($db->error());
    }
}
/*------------------------------------------------------ */
//-- 备份模版
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'backup') {
    check_authz_json('backup_setting');
    include_once 'includes/cls_phpzip.php';
    $tpl = $_CFG['template'];
    //$tpl = trim($_REQUEST['tpl_name']);
    $filename = '../temp/backup/' . $tpl . '_' . date('Ymd') . '.zip';
    $zip = new PHPZip();
    $done = $zip->zip('../themes/' . $tpl . '/', $filename);
    if ($done) {
        make_json_result($filename);
    } else {
        make_json_error($_LANG['backup_failed']);
    }
}
/*------------------------------------------------------ */
//-- 载入指定库项目的内容
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'load_library') {
    $library = load_library($_CFG['template'], trim($_GET['lib']));
    $message = $library['mark'] & 7 ? '' : $_LANG['library_not_written'];
    make_json_result($library['html'], $message);
}
/*------------------------------------------------------ */
예제 #2
0
    $templates['dir'] = substr($_CFG['template_dir'], 0, -1);
    $templates['info'] = get_templates_info("../templates/" . $templates['dir'] . "/info.txt");
    $smarty->assign('templates', $templates);
    $smarty->assign('navlabel', "list");
    $smarty->display('tpl/admin_templates_list.htm');
} elseif ($act == 'backup') {
    check_token();
    check_permissions($_SESSION['admin_purview'], "tpl_backup");
    require_once ADMIN_ROOT_PATH . 'include/admin_phpzip.php';
    $tpl = trim($_REQUEST['tpl_name']);
    if (dirname($tpl) != '.') {
        adminmsg("操作失败!", 0);
    }
    $filename = '../temp/backup_templates/' . $tpl . '_' . date('Ymd') . '.zip';
    $zip = new PHPZip();
    $done = $zip->zip('../templates/' . $tpl . '/', $filename);
    if ($done) {
        header("Location:" . $filename . "");
    } else {
        adminmsg("操作失败!", 0);
    }
} elseif ($act == 'set') {
    check_token();
    check_permissions($_SESSION['admin_purview'], "tpl_edit");
    $templates_info = get_templates_info("../templates/" . trim($_REQUEST['tpl_dir']) . "/info.txt");
    $tpl_dir = trim($_REQUEST['tpl_dir']) . "/";
    !$db->query("UPDATE " . table('config') . " SET value='{$tpl_dir}' WHERE name='template_dir'") ? adminmsg('设置失败', 1) : "";
    refresh_cache("config");
    $dir = "../temp/templates_c/" . $tpl_dir;
    if (!file_exists($dir)) {
        mkdir($dir);