version 1.9, 2002/05/24 05:11:40
|
version 1.10, 2002/05/27 03:18:46
|
Line 63 use Apache::Constants qw(:common :http :
|
Line 63 use Apache::Constants qw(:common :http :
|
use Apache::loncacc; |
use Apache::loncacc; |
use Apache::Log (); |
use Apache::Log (); |
|
|
my $DEBUG=1; |
my $DEBUG=0; |
|
my $r; # Needs to be global for some stuff RF. |
# |
# |
# Debug |
# Debug |
# If debugging is enabled puts out a debuggin message determined by the |
# If debugging is enabled puts out a debuggin message determined by the |
Line 83 sub Debug {
|
Line 83 sub Debug {
|
$log->debug($message); |
$log->debug($message); |
} |
} |
} |
} |
|
# |
|
# URLToPath |
|
# Convert a URL to a file system path. |
|
# |
|
# In order to manipulate the construction space objects, it's necessary |
|
# to access url identified objects a filespace objects. This function |
|
# translates a construction space URL to a file system path. |
|
# Parameters: |
|
# Url - string [in] The url to convert. |
|
# Returns: |
|
# The corresponing file system path. |
|
sub URLToPath |
|
{ |
|
my $Url = shift; |
|
&Debug($r, "UrlToPath got: $Url"); |
|
$Url=~ s/^http\:\/\/[^\/]+\/\~(\w+)/\/home\/$1\/public_html/; |
|
$Url=~ s/^http\:\/\/[^\/]+//; |
|
&Debug($r, "Returning $Url \n"); |
|
return $Url; |
|
} |
sub exists { |
sub exists { |
my ($uname,$udom,$dir,$newfile)=@_; |
my ($uname,$udom,$dir,$newfile)=@_; |
my $published='/home/httpd/html/res/'.$udom.'/'.$uname.'/'.$dir.'/'. |
my $published='/home/httpd/html/res/'.$udom.'/'.$uname.'/'.$dir.'/'. |
Line 265 sub phasetwo {
|
Line 284 sub phasetwo {
|
|
|
sub handler { |
sub handler { |
|
|
my $r=shift; |
$r=shift; |
|
|
|
|
&Debug($r, "loncfile.pm - handler entered"); |
&Debug($r, "loncfile.pm - handler entered"); |
Line 275 sub handler {
|
Line 294 sub handler {
|
if ($ENV{'form.filename'}) { |
if ($ENV{'form.filename'}) { |
$fn=$ENV{'form.filename'}; |
$fn=$ENV{'form.filename'}; |
&Debug($r, "loncfile::handler - raw url: $fn"); |
&Debug($r, "loncfile::handler - raw url: $fn"); |
$fn=~s/^http\:\/\/[^\/]+\/\~(\w+)/\/home\/$1\/public_html/; |
# $fn=~s/^http\:\/\/[^\/]+\/\~(\w+)/\/home\/$1\/public_html/; |
$fn=~s/^http\:\/\/[^\/]+//; |
# $fn=~s/^http\:\/\/[^\/]+//; |
|
$fn=URLToPath($fn); |
&Debug($r, "loncfile::handler - doctored url: $fn"); |
&Debug($r, "loncfile::handler - doctored url: $fn"); |
|
|
} else { |
} else { |