[LON-CAPA-cvs] cvs: loncom(version_2_1_X) /cgi userstatus.pl
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 02 Jun 2006 21:39:02 -0000
albertel Fri Jun 2 17:39:02 2006 EDT
Modified files: (Branch: version_2_1_X)
/loncom/cgi userstatus.pl
Log:
- 'backport' 1.13
Index: loncom/cgi/userstatus.pl
diff -u loncom/cgi/userstatus.pl:1.12 loncom/cgi/userstatus.pl:1.12.2.1
--- loncom/cgi/userstatus.pl:1.12 Thu Aug 25 15:43:40 2005
+++ loncom/cgi/userstatus.pl Fri Jun 2 17:39:02 2006
@@ -1,7 +1,7 @@
#!/usr/bin/perl
$|=1;
# User Status
-# $Id: userstatus.pl,v 1.12 2005/08/25 19:43:40 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
#
@@ -101,6 +101,8 @@
while (my $line=<$fh>) {
chomp($line);
my ($name,$value)=split(/\=/,$line);
+ $name = &unescape($name);
+ $value = &unescape($value);
$userinfo{$name}=$value;
}
$fh->close();
@@ -209,3 +211,18 @@
print("</tr></table>\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;
+}