version 1.159.2.3, 2016/08/07 20:49:37
|
version 1.159.2.5.2.3, 2019/02/06 15:14:10
|
Line 159 sub get_posted_cgi {
|
Line 159 sub get_posted_cgi {
|
if (length($value) == 1) { |
if (length($value) == 1) { |
$value=~s/[\r\n]$//; |
$value=~s/[\r\n]$//; |
} |
} |
} elsif ($fname =~ /\.(xls|doc|ppt)x$/i) { |
} elsif ($fname =~ /\.(xls|doc|ppt)(x|m)$/i) { |
$value=~s/[\r\n]$//; |
$value=~s/[\r\n]$//; |
} |
} |
if (ref($fields) eq 'ARRAY') { |
if (ref($fields) eq 'ARRAY') { |
Line 281 sub upload_size_allowed {
|
Line 281 sub upload_size_allowed {
|
sub sso_login { |
sub sso_login { |
my ($r,$handle,$username) = @_; |
my ($r,$handle,$username) = @_; |
|
|
my $lonidsdir=$r->dir_config('lonIDsDir'); |
|
if (($r->user eq '') || ($username ne '') || ($r->user eq 'public:public') || |
if (($r->user eq '') || ($username ne '') || ($r->user eq 'public:public') || |
(defined($env{'user.name'}) && (defined($env{'user.domain'})) |
(defined($env{'user.name'}) && (defined($env{'user.domain'})) |
&& ($handle ne ''))) { |
&& ($handle ne ''))) { |
Line 331 sub sso_login {
|
Line 330 sub sso_login {
|
} |
} |
unless ($hosthere) { |
unless ($hosthere) { |
($is_balancer,$otherserver) = |
($is_balancer,$otherserver) = |
&Apache::lonnet::check_loadbalancing($user,$domain); |
&Apache::lonnet::check_loadbalancing($user,$domain,'login'); |
|
if ($is_balancer) { |
|
if ($otherserver eq '') { |
|
my $lowest_load; |
|
($otherserver,undef,undef,undef,$lowest_load) = &Apache::lonnet::choose_server($domain); |
|
if ($lowest_load > 100) { |
|
$otherserver = &Apache::lonnet::spareserver($lowest_load,$lowest_load,1,$domain); |
|
} |
|
} |
|
if ($otherserver ne '') { |
|
my @hosts = &Apache::lonnet::current_machine_ids(); |
|
if (grep(/^\Q$otherserver\E$/,@hosts)) { |
|
$hosthere = $otherserver; |
|
} |
|
} |
|
} |
} |
} |
|
if (($is_balancer) && (!$hosthere)) { |
if ($is_balancer) { |
|
# login but immediately go to switch server to find us a new |
# login but immediately go to switch server to find us a new |
# machine |
# machine |
&Apache::lonauth::success($r,$user,$domain,$home,'noredirect'); |
&Apache::lonauth::success($r,$user,$domain,$home,'noredirect'); |
|
foreach my $item (keys(%form)) { |
|
$env{'form.'.$item} = $form{$item}; |
|
} |
|
unless ($form{'symb'}) { |
|
unless (($r->uri eq '/adm/roles') || ($r->uri eq '/adm/sso')) { |
|
$env{'form.origurl'} = $r->uri; |
|
} |
|
} |
$env{'request.sso.login'} = 1; |
$env{'request.sso.login'} = 1; |
if (defined($r->dir_config("lonSSOReloginServer"))) { |
if (defined($r->dir_config("lonSSOReloginServer"))) { |
$env{'request.sso.reloginserver'} = |
$env{'request.sso.reloginserver'} = |
Line 352 sub sso_login {
|
Line 373 sub sso_login {
|
} else { |
} else { |
# need to login them in, so generate the need data that |
# need to login them in, so generate the need data that |
# migrate expects to do login |
# migrate expects to do login |
my $ip; |
my $ip = $r->get_remote_host(); |
my $c = $r->connection; |
|
eval { |
|
$ip = $c->remote_ip(); |
|
}; |
|
if ($@) { |
|
$ip = $c->client_ip(); |
|
} |
|
my %info=('ip' => $ip, |
my %info=('ip' => $ip, |
'domain' => $domain, |
'domain' => $domain, |
'username' => $user, |
'username' => $user, |
Line 383 sub sso_login {
|
Line 397 sub sso_login {
|
$info{'sso.reloginserver'} = |
$info{'sso.reloginserver'} = |
$r->dir_config('lonSSOReloginServer'); |
$r->dir_config('lonSSOReloginServer'); |
} |
} |
|
if (($is_balancer) && ($hosthere)) { |
|
$info{'noloadbalance'} = $hosthere; |
|
} |
my $token = |
my $token = |
&Apache::lonnet::tmpput(\%info, |
&Apache::lonnet::tmpput(\%info, |
$r->dir_config('lonHostID')); |
$r->dir_config('lonHostID')); |
Line 507 sub handler {
|
Line 524 sub handler {
|
} |
} |
} elsif ($env{'request.course.id'} && |
} elsif ($env{'request.course.id'} && |
(($requrl =~ m{^/adm/$match_domain/$match_username/aboutme$}) || |
(($requrl =~ m{^/adm/$match_domain/$match_username/aboutme$}) || |
($requrl =~ m{^/public/$cdom/$cnum/syllabus$}))) { |
($requrl =~ m{^/public/$cdom/$cnum/syllabus$}) || |
|
($requrl =~ m{^/adm/$cdom/$cnum/\d+/ext\.tool$}))) { |
my $query = $r->args; |
my $query = $r->args; |
if ($query) { |
if ($query) { |
foreach my $pair (split(/&/,$query)) { |
foreach my $pair (split(/&/,$query)) { |
Line 528 sub handler {
|
Line 546 sub handler {
|
my $lonhost = &Apache::lonnet::host_from_dns($hostname); |
my $lonhost = &Apache::lonnet::host_from_dns($hostname); |
if ($lonhost) { |
if ($lonhost) { |
my $actual = &Apache::lonnet::absolute_url($hostname); |
my $actual = &Apache::lonnet::absolute_url($hostname); |
|
my $exphostname = &Apache::lonnet::hostname($lonhost); |
my $expected = $Apache::lonnet::protocol{$lonhost}.'://'.$hostname; |
my $expected = $Apache::lonnet::protocol{$lonhost}.'://'.$hostname; |
unless ($actual eq $expected) { |
unless ($actual eq $expected) { |
$env{'request.use_absolute'} = $expected; |
$env{'request.use_absolute'} = $expected; |
Line 565 sub handler {
|
Line 584 sub handler {
|
$env{'form.origurl'} = $r->uri; |
$env{'form.origurl'} = $r->uri; |
} |
} |
} |
} |
|
if ($requrl=~m{^/+tiny/+$match_domain/+\w+$}) { |
|
return OK; |
|
} |
|
|
# ---------------------------------------------------------------- Check access |
# ---------------------------------------------------------------- Check access |
my $now = time; |
my $now = time; |
Line 655 sub handler {
|
Line 677 sub handler {
|
($requrl=~m|\.problem/smpedit$|) || |
($requrl=~m|\.problem/smpedit$|) || |
($requrl=~/^\/public\/.*\/syllabus$/) || |
($requrl=~/^\/public\/.*\/syllabus$/) || |
($requrl=~/^\/adm\/(viewclasslist|navmaps)$/) || |
($requrl=~/^\/adm\/(viewclasslist|navmaps)$/) || |
($requrl=~/^\/adm\/.*\/aboutme\/portfolio(\?|$)/)) { |
($requrl=~/^\/adm\/.*\/aboutme\/portfolio(\?|$)/) || |
|
($requrl=~m{^/adm/$cdom/$cnum/\d+/ext\.tool$})) { |
# ------------------------------------- This is serious stuff, get symb and log |
# ------------------------------------- This is serious stuff, get symb and log |
my $symb; |
my $symb; |
if ($query) { |
if ($query) { |