--- capa/capa51/Discuss/Ver1.3/Attic/capadiscuss 2000/01/31 18:34:12 1.7
+++ capa/capa51/Discuss/Ver1.3/Attic/capadiscuss 2000/03/22 21:08:02 1.8
@@ -51,11 +51,17 @@ $validadmin = "unchecked";
$psetid = $form{'PSETID'};
if ($snum eq "A12345678") {$debug=1;}
if ($snum eq "a12345678") {$debug=1;}
+$debug=0;
if($psetid eq "") { $psetid = $setid; }
if ($debug) {print "GetTeacherInfo
";$BenchmarkTa = new Benchmark;}
&GetTeacherInfo;
if($debug) {$BenchmarkTb = new Benchmark;print "
",timestr(timediff($BenchmarkTb,$BenchmarkTa)),"\n";}
+ # check if student is banned from forum
+if ($debug) {print "BanUser
";$BenchmarkTa = new Benchmark;}
+if (&BanUser) {exit;}
+if($debug) {$BenchmarkTb = new Benchmark;print "
",timestr(timediff($BenchmarkTb,$BenchmarkTa)),"\n";}
+
# check for valid studentnumber/capaid, an exit will occur here if the set wasn't open
if ($debug) {print "ValidateUser
";$BenchmarkTa = new Benchmark;}
&ValidateUser;
@@ -697,6 +703,30 @@ sub CheckAdmin {
if($validadmin eq "no" && $mode eq "kill") { &NotAdminHTML; }
}
+sub BanUser {
+ local (@capaconfig,$line,$command,$value,$ban,@banned,$result);
+ $result = 0;
+ open(CAPACONFIG,"$capadir/$class/capa.config");
+ @capaconfig = ;
+ close(CAPACONFIG);
+ foreach $line(@capaconfig) {
+ chop $line;
+ ($command,$value) = split(/\ =\ /,$line);
+ if($command eq "banned_users") { $ban = $value; last; }
+ }
+
+ if ($debug) { print "Banned Users: ".$ban }
+ @banned = split(/\,/,$ban);
+ $snum =~ tr/a-x/A-Z/;
+ foreach $ban (@banned) {
+ if ($debug) {print $ban . "is Banned
";}
+ $ban =~ tr/a-z/A-Z/;
+ $ban =~ tr/\ //d;
+ if ( $ban eq $snum) { &BannedMessageHTML; $result=1 }
+ }
+ return $result
+}
+
sub ValidateUser {
local(@allcapaid,@classl,$line);