version 1.977, 2008/12/09 11:32:03
|
version 1.979, 2008/12/19 17:04:57
|
Line 4406 sub is_portfolio_file {
|
Line 4406 sub is_portfolio_file {
|
} |
} |
|
|
sub usertools_access { |
sub usertools_access { |
my ($uname,$udom,$tool) = @_; |
my ($uname,$udom,$tool,$action) = @_; |
my $access; |
my $access; |
my %tools = ( |
my %tools = ( |
aboutme => 1, |
aboutme => 1, |
Line 4420 sub usertools_access {
|
Line 4420 sub usertools_access {
|
$uname = $env{'user.name'}; |
$uname = $env{'user.name'}; |
} |
} |
|
|
my $hashid=$uname.':'.$udom; |
if (($udom eq $env{'user.domain'}) && ($uname eq $env{'user.name'})) { |
my ($result,$cached) = &is_cached_new('usertools.'.$tool,$hashid); |
if ($action ne 'reload') { |
if (defined($cached)) { |
return $env{'environment.availabletools.'.$tool}; |
return $result; |
} |
} |
} |
|
|
my ($toolstatus,$inststatus); |
my ($toolstatus,$inststatus); |
Line 4443 sub usertools_access {
|
Line 4443 sub usertools_access {
|
} else { |
} else { |
$access = 0; |
$access = 0; |
} |
} |
&do_cache_new('usertools.'.$tool,$hashid,$access,600); |
|
return $access; |
return $access; |
} |
} |
|
|
Line 4457 sub usertools_access {
|
Line 4456 sub usertools_access {
|
} else { |
} else { |
$access = 0; |
$access = 0; |
} |
} |
&do_cache_new('usertools.'.$tool,$hashid,$access,600); |
|
return $access; |
return $access; |
} |
} |
} |
} |
Line 4478 sub usertools_access {
|
Line 4476 sub usertools_access {
|
} elsif ($hasnoaccess) { |
} elsif ($hasnoaccess) { |
$access = 0; |
$access = 0; |
} |
} |
&do_cache_new('usertools.'.$tool,$hashid,$access,600); |
|
return $access; |
return $access; |
} |
} |
} else { |
} else { |
Line 4488 sub usertools_access {
|
Line 4485 sub usertools_access {
|
} elsif ($domdef{$tool}{'default'} == 0) { |
} elsif ($domdef{$tool}{'default'} == 0) { |
$access = 0; |
$access = 0; |
} |
} |
&do_cache_new('usertools.'.$tool,$hashid,$access,600); |
|
return $access; |
return $access; |
} |
} |
} |
} |
} else { |
} else { |
$access = 1; |
$access = 1; |
&do_cache_new('usertools.'.$tool,$hashid,$access,600); |
|
return $access; |
return $access; |
} |
} |
} |
} |
Line 8653 sub get_dns {
|
Line 8648 sub get_dns {
|
open(my $config,"<$perlvar{'lonTabDir'}/hosts.tab"); |
open(my $config,"<$perlvar{'lonTabDir'}/hosts.tab"); |
foreach my $dns (<$config>) { |
foreach my $dns (<$config>) { |
next if ($dns !~ /^\^(\S*)/x); |
next if ($dns !~ /^\^(\S*)/x); |
$alldns{$1} = 1; |
my $line = $1; |
|
my ($host,$protocol) = split(/:/,$line); |
|
if ($protocol ne 'https') { |
|
$protocol = 'http'; |
|
} |
|
$alldns{$host} = $protocol; |
} |
} |
while (%alldns) { |
while (%alldns) { |
my ($dns) = keys(%alldns); |
my ($dns) = keys(%alldns); |
delete($alldns{$dns}); |
|
my $ua=new LWP::UserAgent; |
my $ua=new LWP::UserAgent; |
my $request=new HTTP::Request('GET',"http://$dns$url"); |
my $request=new HTTP::Request('GET',"$alldns{$dns}://$dns$url"); |
my $response=$ua->request($request); |
my $response=$ua->request($request); |
|
delete($alldns{$dns}); |
next if ($response->is_error()); |
next if ($response->is_error()); |
my @content = split("\n",$response->content); |
my @content = split("\n",$response->content); |
&Apache::lonnet::do_cache_new('dns',$url,\@content,30*24*60*60); |
&Apache::lonnet::do_cache_new('dns',$url,\@content,30*24*60*60); |