Now FileManager is using the new, central zip_files() function.

Only tested under MacOS X. It should support all the new
features of that function (Win32 external zip, imporved security...).

TODO: Create the unzip_file() function and use it here too!!
      Apply this changes to the rest of filemanagers (coursefiles.php...)
      TEST, TEST, TEST...!!
This commit is contained in:
stronk7
2004-10-10 01:17:20 +00:00
parent 2b26825cb2
commit f54d5ea5fb
+9 -19
View File
@@ -358,26 +358,16 @@
if (!empty($name)) {
html_header($course, $wdir);
$name = clean_filename($name);
if (empty($CFG->zip)) { // Use built-in php-based zip function
$files = array();
foreach ($USER->filelist as $file) {
$files[] = cleardoubleslashes("$basedir/$file"); // no doubleslashes!
}
include_once("$CFG->libdir/pclzip/pclzip.lib.php");
$archive = new PclZip(cleardoubleslashes("$basedir/$wdir/$name"));
if (($list = $archive->create($files, PCLZIP_OPT_REMOVE_PATH,
rtrim(cleardoubleslashes("$basedir/$wdir"), "/"))) == 0) { // no double slashes and trailing slash!
error($archive->errorInfo(true));
}
} else { // Use external zip program
$files = "";
foreach ($USER->filelist as $file) {
$files .= basename($file);
$files .= " ";
}
$command = "cd $basedir/$wdir ; $CFG->zip -r $name $files";
Exec($command);
$files = array();
foreach ($USER->filelist as $file) {
$files[] = "$basedir/$file";
}
if (!zip_files($files,"$basedir/$wdir/$name")) {
error(get_string("zipfileserror","error"));
}
clearfilelist();
displaydir($wdir);