From f1ddf54f4cfc06d99ded78e496c45b324fc0815d Mon Sep 17 00:00:00 2001 From: "gerv%gerv.net" <> Date: Tue, 8 Oct 2002 13:41:17 +0000 Subject: Bug 171437 - Enhancements to generic reporting. Reporting menu, 3D tables, rearranged UI, better API for new report types. Patch by gerv; r=joel. --- CGI.pl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'CGI.pl') diff --git a/CGI.pl b/CGI.pl index 3d6752a57..20f257d60 100644 --- a/CGI.pl +++ b/CGI.pl @@ -199,6 +199,35 @@ sub ProcessMultipartFormFields { } } +sub CanonicaliseParams { + my ($buffer, $exclude) = (@_); + my %pieces; + + # Split the buffer up into key/value pairs, and store the non-empty ones + my @args = split('&', $buffer); + + foreach my $arg (@args) { + my ($name, $value) = split('=', $arg, 2); + + if ($value) { + push(@{$pieces{$name}}, $value); + } + } + + # Reconstruct the URL by concatenating the sorted param=value pairs + my @parameters; + foreach my $key (sort keys %pieces) { + # Leave this key out if it's in the exclude list + next if lsearch($exclude, $key) != -1; + + foreach my $value (@{$pieces{$key}}) { + push(@parameters, "$key=$value"); + } + } + + return join("&", @parameters); +} + # check and see if a given field exists, is non-empty, and is set to a # legal value. assume a browser bug and abort appropriately if not. # if $legalsRef is not passed, just check to make sure the value exists and -- cgit v1.2.3-24-g4f1b