version 1.33, 2015/10/05 02:35:51
|
version 1.34, 2017/01/20 06:23:37
|
Line 26
|
Line 26
|
my $name=$helper->{VARS}{'origname'}; |
my $name=$helper->{VARS}{'origname'}; |
my %slot=&Apache::lonnet::get('slots', [$name], $cdom, $cnum); |
my %slot=&Apache::lonnet::get('slots', [$name], $cdom, $cnum); |
if (!ref($slot{$name})) { return $default; } |
if (!ref($slot{$name})) { return $default; } |
if (!exists($slot{$name}{$which})) { return $default; } |
if (($which eq 'ipdeny') || ($which eq 'ipallow')) { |
return $slot{$name}{$which}; |
if (!exists($slot{$name}{'ip'})) { return $default; } |
|
} else { |
|
if (!exists($slot{$name}{$which})) { return $default; } |
|
} |
|
if (($which eq 'ipdeny') || ($which eq 'ipallow')) { |
|
my @allows; |
|
my @denies; |
|
foreach my $item (split(',',$slot{$name}{'ip'})) { |
|
$item =~ s/^\s*//; |
|
$item =~ s/\s*$//; |
|
if ($item =~ /^\!(.+)$/) { |
|
push(@denies,$1); |
|
} else { |
|
push(@allows,$item); |
|
} |
|
} |
|
if ($which eq 'ipdeny') { |
|
return join(',',@denies); |
|
} |
|
if ($which eq 'ipallow') { |
|
return join(',',@allows); |
|
} |
|
} else { |
|
return $slot{$name}{$which}; |
|
} |
} |
} |
</exec> |
</exec> |
<message> |
<message> |
Line 241
|
Line 265
|
} |
} |
</defaultvalue> |
</defaultvalue> |
</choices> |
</choices> |
|
|
|
<message> |
|
</p><p>IP restrictions -- allow from all except: <br /> |
|
</message> |
|
|
|
<string variable="ipdeny" size="30"> |
|
<validator> |
|
return undef; |
|
</validator> |
|
<defaultvalue> |
|
return &{$helper->{DATA}{origslot}}('ipdeny'); |
|
</defaultvalue> |
|
</string> |
|
|
<message> |
<message> |
</p><p>IP restrictions:<br /> |
</p><p>IP restrictions -- deny from all except: <br /> |
</message> |
</message> |
<string variable="ip" size="30"> |
|
|
<string variable="ipallow" size="30"> |
<validator> |
<validator> |
return undef; |
return undef; |
</validator> |
</validator> |
<defaultvalue> |
<defaultvalue> |
return &{$helper->{DATA}{origslot}}('ip'); |
return &{$helper->{DATA}{origslot}}('ipallow'); |
</defaultvalue> |
</defaultvalue> |
</string> |
</string> |
|
|
Line 378
|
Line 416
|
$slot{$which} = $helper->{'VARS'}{$which}; |
$slot{$which} = $helper->{'VARS'}{$which}; |
} |
} |
|
|
foreach my $which ('ip','description','maxspace','secret') { |
foreach my $which ('description','maxspace','secret') { |
if ( $helper->{'VARS'}{$which} =~/\S/ ) { |
if ( $helper->{'VARS'}{$which} =~/\S/ ) { |
$slot{$which} = $helper->{'VARS'}{$which}; |
$slot{$which} = $helper->{'VARS'}{$which}; |
} |
} |
} |
} |
|
|
|
if ($helper->{'VARS'}{'ipdeny'} =~/\S/ ) { |
|
foreach my $item (split(',',$helper->{'VARS'}{'ipdeny'})) { |
|
$item =~ s/^\s*//; |
|
$item =~ s/\s*$//; |
|
$slot{'ip'} .= '!'.$item.','; |
|
} |
|
} |
|
|
|
if ($helper->{'VARS'}{'ipallow'} =~/\S/ ) { |
|
foreach my $item (split(',',$helper->{'VARS'}{'ipallow'})) { |
|
$item =~ s/^\s*//; |
|
$item =~ s/\s*$//; |
|
$slot{'ip'} .= $item.','; |
|
} |
|
} |
|
|
|
if ($slot{'ip'} ne '') { |
|
$slot{'ip'} =~s /,$//; |
|
} |
|
|
if ($helper->{'VARS'}{'type'} eq 'schedulable_student') { |
if ($helper->{'VARS'}{'type'} eq 'schedulable_student') { |
if (($helper->{'VARS'}{'reservationmsg'} eq 'only_student') || |
if (($helper->{'VARS'}{'reservationmsg'} eq 'only_student') || |
($helper->{'VARS'}{'reservationmsg'} eq 'student_and_user_notes_screen')) { |
($helper->{'VARS'}{'reservationmsg'} eq 'student_and_user_notes_screen')) { |