--- loncom/cgi/userstatus.pl 2004/09/22 15:00:04 1.11 +++ loncom/cgi/userstatus.pl 2006/06/02 21:39:02 1.12.2.1 @@ -1,7 +1,7 @@ #!/usr/bin/perl $|=1; # User Status -# $Id: userstatus.pl,v 1.11 2004/09/22 15:00:04 albertel Exp $ +# $Id: userstatus.pl,v 1.12.2.1 2006/06/02 21:39:02 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -80,6 +80,7 @@ sub main { my @allfiles=(sort(readdir(DIR))); foreach my $filename (@allfiles) { if ($filename=~/^\./) { next; } + if ($filename=~/^publicuser_/) { next; } my ($dev,$ino,$mode,$nlink, $uid,$gid,$rdev,$size, $atime,$mtime,$ctime, @@ -100,6 +101,8 @@ sub main { while (my $line=<$fh>) { chomp($line); my ($name,$value)=split(/\=/,$line); + $name = &unescape($name); + $value = &unescape($value); $userinfo{$name}=$value; } $fh->close(); @@ -208,3 +211,18 @@ sub showact { print("\n"); } +# -------------------------------------------------------- Escape Special Chars + +sub escape { + my $str=shift; + $str =~ s/(\W)/"%".unpack('H2',$1)/eg; + return $str; +} + +# ----------------------------------------------------- Un-Escape Special Chars + +sub unescape { + my $str=shift; + $str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; + return $str; +}