Exemplo n.º 1
0
// Pack files
if (isset($_POST['group']) && isset($_POST['zip']) && !READONLY) {
    $path = ROOT_PATH;
    if ($p != '') {
        $path .= '/' . $p;
    }
    if (!class_exists('ZipArchive')) {
        set_message(__('Operations with archives are not available'), 'error');
        redirect(FM_URL . '?p=' . urlencode($p));
    }
    $files = $_POST['file'];
    if (!empty($files)) {
        chdir($path);
        $zipname = 'archive_' . date('ymd_His') . '.zip';
        $zipper = new Zipper();
        $res = $zipper->create($zipname, $files);
        if ($res) {
            set_message(sprintf(__('Archive <b>%s</b> created'), $zipname));
        } else {
            set_message(__('Archive not created'), 'error');
        }
    } else {
        set_message(__('Nothing selected'), 'alert');
    }
    redirect(FM_URL . '?p=' . urlencode($p));
}
// Unpack
if (isset($_GET['unzip']) && !READONLY) {
    $unzip = $_GET['unzip'];
    $unzip = clean_path($unzip);
    $unzip = str_replace('/', '', $unzip);