add($abs_dir,$selitem)) {
show_error($selitem.": Failed adding item.");
}
}
if(!$zipfile->save( $archive_name )) {
show_error($name.": Failed saving zipfile.");
}
else {
if( $download=="y" ) {
require _QUIXPLORER_PATH . "/_include/fun_down.php";
download_item( $dir, basename($archive_name), true );
}
}
return;
}
//------------------------------------------------------------------------------
function tgz_items($dir,$name) {
require_once(_QUIXPLORER_PATH . "/_lib/Tar.php");
$cnt=count($GLOBALS['__POST']["selitems"]);
$abs_dir=get_abs_dir($dir);
$download = mosGetParam( $_REQUEST, 'download', "n" );
$type = ($GLOBALS['__POST']["type"] == "tgz") ? "gz" : "bz2";
$archive_name = get_abs_item($dir,$name);
if( !strstr( $archive_name, "." )) {
$archive_name .= ".tar.$type";
}
$tgz_file = new Archive_Tar($archive_name, $type);
for($i=0;$i<$cnt;++$i) {
$selitem=stripslashes($GLOBALS['__POST']["selitems"][$i]);
$v_list[] = $abs_dir ."/". $selitem;
}
if(!$tgz_file->createModify($v_list, '', realpath($GLOBALS['home_dir']))) {
show_error($name.": Failed saving Archive File.");
}
else {
if( $download=="y" ) {
require _QUIXPLORER_PATH . "/_include/fun_down.php";
download_item( dirname($archive_name), basename($archive_name), true );
}
}
return;
}
//------------------------------------------------------------------------------
function archive_items($dir) {
if(($GLOBALS["permissions"]&01)!=01) show_error($GLOBALS["error_msg"]["accessfunc"]);
if(!$GLOBALS["zip"]) show_error($GLOBALS["error_msg"]["miscnofunc"]);
if(isset($GLOBALS['__POST']["name"])) {
$name=basename(stripslashes($GLOBALS['__POST']["name"]));
if($name=="") show_error($GLOBALS["error_msg"]["miscnoname"]);
switch($GLOBALS['__POST']["type"]) {
case "zip": zip_items($dir,$name); break;
default: tgz_items($dir,$name);
}
header("Location: ".make_link("list",$dir,NULL));
}
show_menu();
show_header($GLOBALS["messages"]["actarchive"]);
echo "