version 1.18, 2005/03/23 20:55:33
|
version 1.19, 2005/04/07 06:56:22
|
Line 95 sub uploadzip {
|
Line 95 sub uploadzip {
|
my ($context,$tempdir,$source) = @_; |
my ($context,$tempdir,$source) = @_; |
my $fname; |
my $fname; |
if ($context eq 'DOCS') { |
if ($context eq 'DOCS') { |
$fname=$ENV{'form.uploadname.filename'}; |
$fname=$env{'form.uploadname.filename'}; |
# Replace Windows backslashes by forward slashes |
# Replace Windows backslashes by forward slashes |
$fname=~s/\\/\//g; |
$fname=~s/\\/\//g; |
# Get rid of everything but the actual filename |
# Get rid of everything but the actual filename |
Line 107 sub uploadzip {
|
Line 107 sub uploadzip {
|
# See if there is anything left |
# See if there is anything left |
unless ($fname) { return 'error: no uploaded file'; } |
unless ($fname) { return 'error: no uploaded file'; } |
# Save the file |
# Save the file |
chomp($ENV{'form.uploadname'}); |
chomp($env{'form.uploadname'}); |
open(my $fh,'>'.$tempdir.'/'.$fname); |
open(my $fh,'>'.$tempdir.'/'.$fname); |
print $fh $ENV{'form.uploadname'}; |
print $fh $env{'form.uploadname'}; |
close($fh); |
close($fh); |
} elsif ($context eq 'CSTR') { |
} elsif ($context eq 'CSTR') { |
if ($source =~ m/\/([^\/]+)$/) { |
if ($source =~ m/\/([^\/]+)$/) { |
Line 128 sub expand_zip {
|
Line 128 sub expand_zip {
|
return 'no zip'; |
return 'no zip'; |
} |
} |
if ($filename =~ m|\.zip$|i) { |
if ($filename =~ m|\.zip$|i) { |
# unzip can cause an sh launch which can pass along all of %ENV |
|
# which can be too large for /bin/sh to handle |
|
my %oldENV=%ENV; |
|
undef(%ENV); |
|
open(OUTPUT, "unzip -o $zipfile -d $tempdir 2> /dev/null |"); |
open(OUTPUT, "unzip -o $zipfile -d $tempdir 2> /dev/null |"); |
close(OUTPUT); |
close(OUTPUT); |
%ENV=%oldENV; |
|
undef(%oldENV); |
|
} else { |
} else { |
return 'nozip'; |
return 'nozip'; |
} |
} |
Line 2290 sub process_assessment {
|
Line 2284 sub process_assessment {
|
my $randompickflag = 0; |
my $randompickflag = 0; |
my ($cid,$cdom,$cnum); |
my ($cid,$cdom,$cnum); |
if ($context eq 'DOCS') { |
if ($context eq 'DOCS') { |
$cid = $ENV{'request.course.id'}; |
$cid = $env{'request.course.id'}; |
($cdom,$cnum) = split/_/,$cid; |
($cdom,$cnum) = split/_/,$cid; |
} |
} |
my $destresdir = $destdir; |
my $destresdir = $destdir; |