From bea873a66d06670af744b29d9e8d357ae3b5ceed Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Tue, 25 Jul 2006 04:43:35 +0000 Subject: Bug 344527: Old Charts are broken using mod_perl Patch By Max Kanat-Alexander r=LpSolit, a=justdave --- Bugzilla/Util.pm | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index c5cfc0444..24debb1d6 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -34,7 +34,7 @@ use base qw(Exporter); detaint_signed html_quote url_quote value_quote xml_quote css_class_quote - i_am_cgi get_netaddr + i_am_cgi get_netaddr correct_urlbase lsearch diff_arrays diff_strings trim wrap_comment find_wrap_point @@ -146,6 +146,22 @@ sub i_am_cgi { return exists $ENV{'SERVER_SOFTWARE'} ? 1 : 0; } +sub correct_urlbase { + my $ssl = Bugzilla->params->{'ssl'}; + return Bugzilla->params->{'urlbase'} if $ssl eq 'never'; + + my $sslbase = Bugzilla->params->{'sslbase'}; + if ($sslbase) { + return $sslbase if $ssl eq 'always'; + # Authenticated Sessions + return $sslbase if Bugzilla->user->id; + } + + # Set to "authenticated sessions" but nobody's logged in, or + # sslbase isn't set. + return Bugzilla->params->{'urlbase'}; +} + sub lsearch { my ($list,$item) = (@_); my $count = 0; @@ -429,8 +445,9 @@ Bugzilla::Util - Generic utility functions for bugzilla $rv = url_decode($var); # Functions that tell you about your environment - my $is_cgi = i_am_cgi(); - $net_addr = get_netaddr($ip_addr); + my $is_cgi = i_am_cgi(); + my $net_addr = get_netaddr($ip_addr); + my $urlbase = correct_urlbase(); # Functions for searching $loc = lsearch(\@arr, $val); @@ -565,6 +582,11 @@ Cparams->{'loginnetmask'}> as the netmask. This can be used to obtain data in order to restrict weak authentication methods (such as cookies) to only some addresses. +=item C + +Returns either the C or C parameter, depending on the +current setting for the C parameter. + =back =head2 Searching -- cgit v1.2.3-24-g4f1b