version 1.4, 2001/05/25 17:03:58
|
version 1.5, 2001/06/23 18:26:40
|
Line 15
|
Line 15
|
# |
# |
# 03/31,04/03 Gerd Kortemeyer) |
# 03/31,04/03 Gerd Kortemeyer) |
# |
# |
# 04/05,04/09,05/25 Gerd Kortemeyer |
# 04/05,04/09,05/25,06/23 Gerd Kortemeyer |
|
|
package Apache::lonupload; |
package Apache::lonupload; |
|
|
Line 45 sub upfile_store {
|
Line 45 sub upfile_store {
|
|
|
|
|
sub phaseone { |
sub phaseone { |
my ($r,$fn,$uname,$udom)=@_; |
my ($r,$fn,$uname,$udom)=@_; |
|
if ($ENV{'form.upfile.filename'}) { |
$fn=~s/\/[^\/]+$//; |
$fn=~s/\/[^\/]+$//; |
$fn=~s/([^\/])$/$1\//; |
$fn=~s/([^\/])$/$1\//; |
$fn.=$ENV{'form.upfile.filename'}; |
$fn.=$ENV{'form.upfile.filename'}; |
$fn=~s/^\///; |
$fn=~s/^\///; |
$fn=~s/(\/)+/\//g; |
$fn=~s/(\/)+/\//g; |
|
|
if (($fn) && ($fn!~/\/$/)) { |
if (($fn) && ($fn!~/\/$/)) { |
$r->print( |
$r->print( |
'<form action=/adm/upload method=post>'. |
'<form action=/adm/upload method=post>'. |
Line 64 sub phaseone {
|
Line 64 sub phaseone {
|
} else { |
} else { |
$r->print('<font color=red>Illegal filename.</font>'); |
$r->print('<font color=red>Illegal filename.</font>'); |
} |
} |
|
} else { |
|
$r->print('<font color=red>No upload file specified.</font>'); |
|
} |
} |
} |
|
|
sub phasetwo { |
sub phasetwo { |
Line 112 sub handler {
|
Line 115 sub handler {
|
my $uname; |
my $uname; |
my $udom; |
my $udom; |
|
|
unless (($uname,$udom)= |
($uname,$udom)= |
&Apache::loncacc::constructaccess( |
&Apache::loncacc::constructaccess( |
$ENV{'form.filename'},$r->dir_config('lonDefDomain'))) { |
$ENV{'form.filename'},$r->dir_config('lonDefDomain')); |
|
unless (($uname) && ($udom)) { |
$r->log_reason($uname.' at '.$udom. |
$r->log_reason($uname.' at '.$udom. |
' trying to publish file '.$ENV{'form.filename'}. |
' trying to publish file '.$ENV{'form.filename'}. |
' - not authorized', |
' - not authorized', |