version 1.37, 2005/05/21 00:40:01
|
version 1.38, 2005/05/21 15:35:07
|
Line 237 END
|
Line 237 END
|
my $choice=<>; |
my $choice=<>; |
chomp($choice); |
chomp($choice); |
my $bad_domain_flag=0; |
my $bad_domain_flag=0; |
my @bad_domain_names=('raw','userfiles','priv','adm','uploaded'); |
my @bad_domain_names=('res','raw','userfiles','priv','adm','uploaded'); |
foreach my $bad (@bad_domain_names) { |
foreach my $bad (@bad_domain_names) { |
$bad_domain_flag=1 if $choice eq $bad; |
$bad_domain_flag=1 if $choice eq $bad; |
} |
} |
Line 255 END
|
Line 255 END
|
print "Name too long\n"; |
print "Name too long\n"; |
} elsif (length($choice)<2) { |
} elsif (length($choice)<2) { |
print "Name too short\n"; |
print "Name too short\n"; |
|
} elsif ($bad_domain_flag) { |
|
print "Invalid input ('$choice' conflicts with LON-CAPA namespace).\n"; |
|
print "Please try something different than '$choice'\n"; |
} elsif ($choice!~/\_/ and $choice=~/^\w+$/) { |
} elsif ($choice!~/\_/ and $choice=~/^\w+$/) { |
open(OUT,'>>/tmp/loncapa_updatequery.out'); |
open(OUT,'>>/tmp/loncapa_updatequery.out'); |
print(OUT 'lonDefDomain'."\t".$choice."\n"); |
print(OUT 'lonDefDomain'."\t".$choice."\n"); |
Line 262 END
|
Line 265 END
|
$lonDefDomain=$choice; |
$lonDefDomain=$choice; |
$r='l'; |
$r='l'; |
$flag=1; |
$flag=1; |
} elsif ($bad_domain_flag) { |
|
print "Invalid input ('$choice' conflicts with LON-CAPA namespace).\n"; |
|
print "Please try something different than '$choice'\n"; |
|
} else { |
} else { |
print "Invalid input (only alphanumeric characters supported).\n"; |
print "Invalid input (only alphanumeric characters supported).\n"; |
} |
} |
Line 586 This is now the current configuration of
|
Line 586 This is now the current configuration of
|
10) Allow only secure connections: $securestatus |
10) Allow only secure connections: $securestatus |
11) Everything is correct up above |
11) Everything is correct up above |
END |
END |
my $hbug=-1; |
|
my $dbug=-1; |
|
{ |
|
my $v=$perlvar{'lonHostID'}; |
|
$hbug=0; |
|
$hbug=1 if $v=~/\W/; |
|
$hbug=1 if $v=~/\_/; |
|
} |
|
{ |
|
my $v=$1; |
|
$dbug=0; |
|
$dbug=1 if $v=~/\W/; |
|
$dbug=1 if $v=~/\_/; |
|
} |
|
|
|
if ($hbug) { |
|
print "**** ERROR **** ". |
|
"Invalid lonHostID (should only be letters and/or digits)\n"; |
|
} |
|
if ($dbug) { |
|
print "**** ERROR **** ". |
|
"Invalid lonDefDomain (should only be letters and/or digits)\n"; |
|
} |
|
|
|
|
my $error=''; |
|
foreach my $v ($perlvar{'lonDefDomain'},$perlvar{'lonHostID'}) { |
|
if (length($v)>16) { $error.="\nName $v too long"; } |
|
if (length($v)<2) { $error.="\nName $v too short"; } |
|
if ($v=~/capa/i) { $error.="\nName $v contains 'capa'"; } |
|
foreach my $bad ('res','raw','userfiles','priv','adm','uploaded') { |
|
$error.="\nName $v reserved." if $v eq $bad; |
|
} |
|
if ($v=~/\W/) { $error.="\nName $v contains special characters"; } |
|
} |
|
if ($domainDescription!~/^[\w\s]+$/) { |
|
$error.="\nDomain Description contains special characters"; |
|
} |
|
foreach my $v ($perlvar{'lonExpire'},$perlvar{'lonLoadLim'}) { |
|
unless ($v=~/^[\d+\.]+$/) { $error.="\nNumber expected instead of $v"; } |
|
} |
|
unless (($perlvar{'lonRole'} eq 'library') || ($perlvar{'lonRole'} eq 'access')) { |
|
$error.="\nInvalid Role"; |
|
} |
|
if ($error) { print "\n*** ERRORS: $error\n"; } |
print(<<END); |
print(<<END); |
ENTER A CHOICE OF 1-10 TO CHANGE, otherwise ENTER 11: |
ENTER A CHOICE OF 1-10 TO CHANGE, otherwise ENTER 11: |
END |
END |
Line 734 END
|
Line 731 END
|
} |
} |
($securestatus,$securenum)=&securesetting(%perlvar); |
($securestatus,$securenum)=&securesetting(%perlvar); |
} |
} |
elsif ($choice==11) { |
elsif (($choice==11) && (!$error)) { |
$flag=1; |
$flag=1; |
} |
} |
else { |
else { |
|
print "Invalid input.\n"; |
} |
} |
} |
} |
open(OUT,">$confdir$filename") or |
open(OUT,">$confdir$filename") or |