From 343fc727856a4c9d08391e415fe5a856fc848f7d Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sun, 10 Oct 2004 21:58:43 +0000 Subject: [PATCH] Now this script is using the new, central unzip_file() function. TEST, TEST!!! Merged from MOODLE_14_STABLE --- files/index.php | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/files/index.php b/files/index.php index 20ea0f2f04..45409b4384 100644 --- a/files/index.php +++ b/files/index.php @@ -399,42 +399,8 @@ $file = basename($file); - if (empty($CFG->unzip)) { // Use built-in php-based unzip function - include_once("$CFG->libdir/pclzip/pclzip.lib.php"); - $archive = new PclZip(cleardoubleslashes("$basedir/$wdir/$file")); - if (!$list = $archive->extract(PCLZIP_OPT_PATH, cleardoubleslashes("$basedir/$wdir"), - PCLZIP_CB_PRE_EXTRACT, 'approvefile')) { - error($archive->errorInfo(true)); - } else { // print some output - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - foreach ($list as $item) { - echo ""; - $item['filename'] = str_replace(cleardoubleslashes("$basedir/$wdir/"), "", $item['filename']); - print_cell("left", $item['filename']); - if (! $item['folder']) { - print_cell("right", display_size($item['size'])); - } else { - echo ""; - } - $filedate = userdate($item['mtime'], get_string("strftimedatetime")); - print_cell("right", $filedate); - print_cell("right", $item['status']); - echo ""; - } - echo "
$strname$strsize$strmodified$strstatus
 
"; - } - - } else { // Use external unzip program - print_simple_box_start("center"); - echo "
";
-                    $command = "cd $basedir/$wdir ; $CFG->unzip -o $file 2>&1";
-                    passthru($command);
-                    echo "
"; - print_simple_box_end(); + if (!unzip_file("$basedir/$wdir/$file")) { + error(get_string("unzipfileserror","error")); } echo "
"; -- 2.39.5