Example #1
0
function zip_items($dir, $name)
{
    $cnt = count($GLOBALS['__POST']["selitems"]);
    $abs_dir = get_abs_dir($dir);
    $zipfile = new ZipFile();
    for ($i = 0; $i < $cnt; ++$i) {
        $selitem = stripslashes($GLOBALS['__POST']["selitems"][$i]);
        if (!$zipfile->add($abs_dir, $selitem)) {
            show_error($selitem . ": Failed adding item.");
        }
    }
    if (!$zipfile->save(get_abs_item($dir, $name))) {
        show_error($name . ": Failed saving zipfile.");
    }
    header("Location: " . make_link("list", $dir, NULL));
}