Skip to content

Commit

Permalink
Now we are using the new, central, unzip_file() function here...
Browse files Browse the repository at this point in the history
Please TEST, TEST, TEST!!
  • Loading branch information
stronk7 committed Oct 10, 2004
1 parent ed12408 commit a748a0f
Showing 1 changed file with 2 additions and 36 deletions.
38 changes: 2 additions & 36 deletions files/index.php
Expand Up @@ -419,42 +419,8 @@ function html_header($course, $wdir, $formfield=""){

$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 "<table cellpadding=\"4\" cellspacing=\"2\" border=\"0\" width=640>";
echo "<tr><th align=left>$strname</th>";
echo "<th align=right>$strsize</th>";
echo "<th align=right>$strmodified</th>";
echo "<th align=right>$strstatus</th></tr>";
foreach ($list as $item) {
echo "<tr>";
$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 "<td>&nbsp;</td>";
}
$filedate = userdate($item['mtime'], get_string("strftimedatetime"));
print_cell("right", $filedate);
print_cell("right", $item['status']);
echo "</tr>";
}
echo "</table>";
}

} else { // Use external unzip program
print_simple_box_start("center");
echo "<PRE>";
$command = "cd $basedir/$wdir ; $CFG->unzip -o $file 2>&1";
passthru($command);
echo "</PRE>";
print_simple_box_end();
if (!unzip_file("$basedir/$wdir/$file")) {
error(get_string("unzipfileserror","error"));
}

echo "<CENTER><FORM ACTION=index.php METHOD=get>";
Expand Down

0 comments on commit a748a0f

Please sign in to comment.