+ %html=(B=>1, I=>1, P=>1, A=>1, LI=>1, OL=>1, UL=>1, EM=>1, BR=>1, TT=>1, STRONG=>1,
+ BLOCKQUOTE=>1, DIV=>1, IMG=>1);
+
$message = $form{'message'};
- $message =~ s/\n\r\n/
/g;
+
+ $message =~ s/((\n\r)|(\n))\n/
/g;
$message =~ s/\n/
/g;
+ $message =~ s/\<(\/?\s*(\w+)[^\>\<]*)/
+ {($html{uc($2)}&(length($1)<1000))?"\<$1":"\<$1"}/ge;
+ $message =~ s/(\\s*(\w+)[^\<\>]*)\>/
+ {($html{uc($2)}&(length($1)<1000))?"$1\>":"$1\>"}/ge;
+
+# $message =~ s/</g;
+# $message =~ s/>/>/g;
+
# check if posted anonymously
if($form{'ANONYMOUS'} eq "yes") {
$username = "Anonymous|$username";
@@ -643,6 +674,7 @@ sub CheckAdmin {
last;
}
}
+ if ($debug) { print "Admin Sections: ".$adminsection;}
@adminsections = split(/\,/,$adminsection);
for ($asection=0; $asection <= $#adminsections; $asection++) {
$adminsections[$asection]=&RemZero($adminsections[$asection])
@@ -654,10 +686,12 @@ sub CheckAdmin {
$snum =~ tr/a-z/A-Z/;
LINE: foreach $line(@classl) {
- ($course,$coursenum,$section,$stunum,$a) = split(/\ +/,$line);
+ $section= substr $line, 10, 3;
+ $stunum= substr $line, 14, 9;
$stunum =~ tr/a-z/A-Z/;
if ( $stunum ne $snum ) { next LINE;}
$section = &RemZero($section);
+ if ($debug) {print "
".$stunum."Is in section:".$section."
";}
foreach $asection(@adminsections) {
if($section eq $asection ) {
$validadmin = "yes";
@@ -669,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);
@@ -685,7 +743,7 @@ sub ValidateUser {
if($valid eq "no") { &InvalidVarsHTML; }
# check w/ allcapaid program
- @allcapaid = `allcapaid51 -s $setid -e $setid -stu $snum -c $capadir/$class -i -checkopen`;
+ @allcapaid = `allcapaid -s $setid -e $setid -stu $snum -c $capadir/$class -i -checkopen`;
chop $allcapaid[2];
chop $allcapaid[2];
@@ -790,7 +848,7 @@ sub form_info {
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
-
+ if ($name eq "message") {$allow_html=1;} else {$allow_html=0;}
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
@@ -810,6 +868,8 @@ sub GetDateTime {
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime (time);
$mon++;
+ $year=$year+1900;
+
if ($hour < 12) {
$AMPM = "AM";
}
@@ -847,7 +907,7 @@ sub Log {
&Lock("lock.file");
open(LOG,">>$capadir/$class/discussion/logs/access.log");
- print LOG "$snum|$capaid|$username|$email|$logmsg|$setid|$probnum|$HyphenDate|$Time\n";
+ print LOG "$snum|$capaid|$username|$email|$logmsg|$setid|$probnum|$HyphenDate|$Time|$file\n";
close(LOG);
&Unlock("lock.file");
}