mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 14:03:52 +01:00
iNow 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...!! Merged from MOODLE_14_STABLE
This commit is contained in:
parent
ef1e97c7ec
commit
1a11dfd14a
@ -338,26 +338,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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user