Browse files

New CFG->zip and CFG->unzip valiables which specify programs to use

when zipping and unzipping files.  Unix only at this stage. (Zip interfaces
for Windows are much less standardised)
  • Loading branch information...
1 parent 0a260c5 commit 8ce53f0f85dc8da2a740af7e774410d35c9bbb87 martin committed Aug 18, 2002
Showing with 21 additions and 4 deletions.
  1. +7 −0 config-dist.php
  2. +14 −4 files/index.php
View
7 config-dist.php
@@ -93,6 +93,13 @@
$CFG->longtimenosee = 100;
+// These programs are used by the file management code to zip and unzip
+// uploaded files. This only works on Unix systems right now.
+
+$CFG->zip = "/usr/bin/zip";
+$CFG->unzip = "/usr/bin/unzip";
+
+
// You should not need to change anything else. To continue setting up
// Moodle, use your web browser to go to the moodle/admin web page.
///////////////////////////////////////////////////////////////////////////
View
18 files/index.php
@@ -21,6 +21,14 @@
error("Only teachers can edit files");
}
+ if (!$CFG->zip) {
+ $CFG->zip = "/usr/bin/zip";
+ }
+
+ if (!$CFG->unzip) {
+ $CFG->unzip = "/usr/bin/unzip";
+ }
+
function html_footer() {
global $course;
echo "</td></tr></table></body></html>";
@@ -29,9 +37,11 @@ function html_footer() {
function html_header($formfield=""){
global $course;
+
+ $strfiles = get_string("files");
- print_header("$course->shortname: Files", "$course->shortname: Files",
- "<A HREF=\"../course/view.php?id=$course->id\">$course->shortname</A> -> Files", $formfield);
+ print_header("$course->shortname: $strfiles", "$course->fullname",
+ "<A HREF=\"../course/view.php?id=$course->id\">$course->shortname</A> -> $strfiles", $formfield);
echo "<table border=0 align=center cellspacing=3 cellpadding=3 width=640>";
echo "<tr>";
echo "<td colspan=\"2\">";
@@ -293,7 +303,7 @@ function html_header($formfield=""){
$files .= basename($file);
$files .= " ";
}
- $command = "cd $basedir/$wdir ; /usr/bin/zip -r $name $files";
+ $command = "cd $basedir/$wdir ; $CFG->zip -r $name $files";
Exec($command);
clearfilelist();
displaydir($wdir);
@@ -338,7 +348,7 @@ function html_header($formfield=""){
print_simple_box_start("center");
echo "<PRE>";
$file = basename($file);
- $command = "cd $basedir/$wdir ; /usr/bin/unzip -o $file 2>&1";
+ $command = "cd $basedir/$wdir ; $CFG->unzip -o $file 2>&1";
passthru($command);
echo "</PRE>";
print_simple_box_end();

0 comments on commit 8ce53f0

Please sign in to comment.