From 279e0061c515ee0a03036bef68eea9738273d785 Mon Sep 17 00:00:00 2001 From: Johan Berntsson Date: Tue, 4 Mar 2008 05:31:54 +0000 Subject: Merged 3Di code that provides scene and avatar serialization, and plugin support for region move/split/merge. See ThirdParty/3Di/README.txt. Unless the new modules are used there should be no noticeable changes when running OpenSim. --- .../3Di/RegionMonitor/MonitorGUI/htdocs/MyCGI.pm | 91 ++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/MyCGI.pm (limited to 'ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/MyCGI.pm') diff --git a/ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/MyCGI.pm b/ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/MyCGI.pm new file mode 100644 index 0000000..1f232aa --- /dev/null +++ b/ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/MyCGI.pm @@ -0,0 +1,91 @@ +package MyCGI; + +use strict; +use CGI; + +sub getParam { + my $cgi; + if ($ARGV[0]) { + $cgi = new CGI($ARGV[0]); + } else { + $cgi = new CGI; + } + my @param_names = $cgi->param(); + my %param = (); + foreach (@param_names) { + $param{$_} = $cgi->param($_); + } + return \%param; +} + +sub getCookie { + my $name = shift; + my $cookie_value = &CGI::cookie($name); + return &_parse($cookie_value); +} + +sub outputHtml { + my ($charset, $html) = @_; + print &CGI::header(-charset => $charset); + print $html; +} + +sub outputXml { + my ($charset, $xml) = @_; + print &CGI::header( -type => 'text/xml', -charset => $charset ); + print $xml; +} + +sub makeCookieValue { + my $param = shift; + my @data = (); + foreach(keys %$param) { + push(@data, $_ . "=" . $param->{$_}); + } + return join("&", @data); +} + +sub setCookie { + my $param = shift; + my $cookie = &CGI::cookie( + -name => $param->{name} || return, + -value => $param->{value}, + -domain => $param->{domain}, + -path => $param->{path}, + -expires => $param->{expires}, + ); + return &CGI::header(-cookie => $cookie); +} + +sub redirect { + my $dest = shift; + &CGI::redirect($dest); +} + +sub urlEncode { + my $str = shift; + $str =~ s/([^\w ])/'%'.unpack('H2', $1)/eg; + $str =~ tr/ /+/; + return $str; +} + +sub urlDecode { + my $str = shift; + $str =~ tr/+/ /; + $str =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/pack('H2', $1)/eg; + return $str; +} + +sub _parse { + my $value = shift; + my @pair = split(/&/, $value); + my %data = (); + foreach(@pair) { + my ($name, $value) = split(/=/, $_); + $data{$name} = $value; + } + return \%data; +} + +1; + -- cgit v1.1