version 1.471, 2004/02/04 22:39:06
|
version 1.472, 2004/02/11 00:10:01
|
Line 1232 sub finishuserfileupload {
|
Line 1232 sub finishuserfileupload {
|
# Notify homeserver to grep it |
# Notify homeserver to grep it |
# |
# |
|
|
my $fetchresult= |
my $fetchresult= &reply('fetchuserfile:'.$docudom.'/'.$docuname.'/'.$fname, |
&reply('fetchuserfile:'.$docudom.'/'.$docuname.'/'.$fname,$docuhome); |
$docuhome); |
if ($fetchresult eq 'ok') { |
if ($fetchresult eq 'ok') { |
# |
# |
# Return the URL to it |
# Return the URL to it |
Line 3844 sub metadata {
|
Line 3844 sub metadata {
|
# if it is a non metadata possible uri return quickly |
# if it is a non metadata possible uri return quickly |
if (($uri eq '') || (($uri =~ m|^/*adm/|) && ($uri !~ m|^adm/includes|)) || |
if (($uri eq '') || (($uri =~ m|^/*adm/|) && ($uri !~ m|^adm/includes|)) || |
($uri =~ m|/$|) || ($uri =~ m|/.meta$|) || ($uri =~ /^~/) || |
($uri =~ m|/$|) || ($uri =~ m|/.meta$|) || ($uri =~ /^~/) || |
($uri =~ m|home/[^/]+/public_html/|)) { |
($uri =~ m|home/[^/]+/public_html/|) || ($uri =~ m|^uploaded/|)) { |
return undef; |
return undef; |
} |
} |
my $filename=$uri; |
my $filename=$uri; |
Line 4415 sub receipt {
|
Line 4415 sub receipt {
|
} |
} |
|
|
# ------------------------------------------------------------ Serves up a file |
# ------------------------------------------------------------ Serves up a file |
# returns either the contents of the file or a -1 |
# returns either the contents of the file or |
|
# -1 if the file doesn't exist |
|
# -2 if an error occured when trying to aqcuire the file |
|
|
sub getfile { |
sub getfile { |
my $file=shift; |
my $file=shift; |
if ($file=~/^\/*uploaded\//) { # user file |
if ($file=~/^\/*uploaded\//) { # user file |
my $ua=new LWP::UserAgent; |
my $ua=new LWP::UserAgent; |
my $request=new HTTP::Request('GET',&tokenwrapper($file)); |
my $request=new HTTP::Request('GET',&tokenwrapper($file)); |
my $response=$ua->request($request); |
my $response=$ua->request($request); |
if ($response->is_success()) { |
if ($response->is_success()) { |
return $response->content; |
return $response->content; |
} else { |
} else { |
return -1; |
#&logthis("Return Code is ".$response->code." for $file ". |
} |
# &tokenwrapper($file)); |
} else { # normal file from res space |
# 500 for ISE when tokenwrapper can't figure out what server to |
&repcopy($file); |
# contact |
if (! -e $file ) { return -1; }; |
# 503 when lonuploadacc can't contact the requested server |
my $fh; |
if ($response->code eq 503 || $response->code eq 500) { |
open($fh,"<$file"); |
return -2; |
my $a=''; |
} else { |
while (<$fh>) { $a .=$_; } |
return -1; |
return $a; |
} |
} |
} |
|
} else { # normal file from res space |
|
&repcopy($file); |
|
if (! -e $file ) { return -1; }; |
|
my $fh; |
|
open($fh,"<$file"); |
|
my $a=''; |
|
while (<$fh>) { $a .=$_; } |
|
return $a; |
|
} |
} |
} |
|
|
sub filelocation { |
sub filelocation { |