Permalink
Browse files

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...!!
  • Loading branch information...
1 parent 2b26825 commit f54d5ea5fb78a9c3ba2361043877c06d09ee6fb1 stronk7 committed Oct 10, 2004
Showing with 9 additions and 19 deletions.
  1. +9 −19 files/index.php
View
@@ -358,26 +358,16 @@ function html_header($course, $wdir, $formfield=""){
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);

0 comments on commit f54d5ea

Please sign in to comment.