From b1f4cf8bdc4b49c02ebebbee2553202bc46ab720 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Tue, 4 Jul 2006 04:26:20 +0000 Subject: Bug 342869: Use Bugzilla->params everywhere except templates Patch By Max Kanat-Alexander r=LpSolit, a=justdave --- Bugzilla/Attachment.pm | 7 ++--- Bugzilla/Auth.pm | 4 +-- Bugzilla/Auth/Login/CGI.pm | 6 +++-- Bugzilla/Auth/Login/Env.pm | 6 ++--- Bugzilla/Auth/Persist/Cookie.pm | 6 ++--- Bugzilla/Auth/Verify/LDAP.pm | 18 +++++++------ Bugzilla/Bug.pm | 33 +++++++++++++----------- Bugzilla/BugMail.pm | 35 ++++++++++++------------- Bugzilla/Config.pm | 4 +-- Bugzilla/DB.pm | 12 +++++---- Bugzilla/Flag.pm | 8 +++--- Bugzilla/FlagType.pm | 4 +-- Bugzilla/Mailer.pm | 23 ++++++++++------- Bugzilla/Search.pm | 28 +++++++++++++------- Bugzilla/Search/Quicksearch.pm | 13 +++++----- Bugzilla/Template.pm | 10 +++++--- Bugzilla/Template/Plugin/Hook.pm | 2 +- Bugzilla/Token.pm | 15 ++++++----- Bugzilla/User.pm | 51 +++++++++++++++++++++---------------- attachment.cgi | 33 ++++++++++++++---------- buglist.cgi | 10 ++++---- chart.cgi | 4 +-- checksetup.pl | 22 ++++++++-------- colchange.cgi | 16 ++++++------ config.cgi | 2 +- contrib/bug_email.pl | 8 +++--- contrib/sendbugmail.pl | 4 +-- contrib/syncLDAP.pl | 14 +++++----- createaccount.cgi | 2 +- duplicates.cgi | 2 +- editclassifications.cgi | 3 ++- editcomponents.cgi | 6 ++--- editgroups.cgi | 8 +++--- editparams.cgi | 4 +-- editproducts.cgi | 25 +++++++++--------- editusers.cgi | 7 ++--- editvalues.cgi | 6 ++--- editwhines.cgi | 2 +- enter_bug.cgi | 20 +++++++-------- importxml.pl | 55 ++++++++++++++++++++-------------------- index.cgi | 6 ++--- post_bug.cgi | 24 ++++++++++-------- process_bug.cgi | 54 +++++++++++++++++++++------------------ query.cgi | 8 +++--- quips.cgi | 6 ++--- request.cgi | 6 +++-- show_bug.cgi | 2 +- showdependencygraph.cgi | 4 +-- summarize_time.cgi | 2 +- userprefs.cgi | 10 +++++--- votes.cgi | 4 +-- whine.pl | 4 +-- whineatnews.pl | 4 +-- 53 files changed, 365 insertions(+), 307 deletions(-) diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm index 78d326049..0ed77974f 100644 --- a/Bugzilla/Attachment.pm +++ b/Bugzilla/Attachment.pm @@ -413,7 +413,8 @@ sub _validate_filename { sub _validate_data { my ($throw_error, $hr_vars) = @_; my $cgi = Bugzilla->cgi; - my $maxsize = $cgi->param('ispatch') ? Param('maxpatchsize') : Param('maxattachmentsize'); + my $maxsize = $cgi->param('ispatch') ? Bugzilla->params->{'maxpatchsize'} + : Bugzilla->params->{'maxattachmentsize'}; $maxsize *= 1024; # Convert from K my $fh; # Skip uploading into a local variable if the user wants to upload huge @@ -439,7 +440,7 @@ sub _validate_data { # makes for a quick way to eat up disk space. Let's compress them. # We do this before we check the size since the uncompressed version # could easily be greater than maxattachmentsize. - if (Param('convert_uncompressed_images') + if (Bugzilla->params->{'convert_uncompressed_images'} && $cgi->param('contenttype') eq 'image/bmp') { require Image::Magick; my $img = Image::Magick->new(magick=>'bmp'); @@ -710,7 +711,7 @@ sub insert_attachment_for_bug { open(AH, ">$attachdir/$hash/attachment.$attachid"); binmode AH; my $sizecount = 0; - my $limit = (Param("maxlocalattachment") * 1048576); + my $limit = (Bugzilla->params->{"maxlocalattachment"} * 1048576); while (<$fh>) { print AH $_; $sizecount += length($_); diff --git a/Bugzilla/Auth.pm b/Bugzilla/Auth.pm index daacc677a..b6d378a43 100644 --- a/Bugzilla/Auth.pm +++ b/Bugzilla/Auth.pm @@ -44,8 +44,8 @@ sub new { my $self = fields::new($class); $params ||= {}; - $params->{Login} ||= Param('user_info_class') . ',Cookie'; - $params->{Verify} ||= Param('user_verify_class'); + $params->{Login} ||= Bugzilla->params->{'user_info_class'} . ',Cookie'; + $params->{Verify} ||= Bugzilla->params->{'user_verify_class'}; $self->{_info_getter} = new Bugzilla::Auth::Login::Stack($params->{Login}); $self->{_verifier} = new Bugzilla::Auth::Verify::Stack($params->{Verify}); diff --git a/Bugzilla/Auth/Login/CGI.pm b/Bugzilla/Auth/Login/CGI.pm index e6fa7d590..d0c29d8aa 100644 --- a/Bugzilla/Auth/Login/CGI.pm +++ b/Bugzilla/Auth/Login/CGI.pm @@ -60,8 +60,10 @@ sub fail_nodata { my $template = Bugzilla->template; # Redirect to SSL if required - if (Param('sslbase') ne '' and Param('ssl') ne 'never') { - $cgi->require_https(Param('sslbase')); + if (Bugzilla->params->{'sslbase'} ne '' + and Bugzilla->params->{'ssl'} ne 'never') + { + $cgi->require_https(Bugzilla->params->{'sslbase'}); } print $cgi->header(); $template->process("account/auth/login.html.tmpl", diff --git a/Bugzilla/Auth/Login/Env.pm b/Bugzilla/Auth/Login/Env.pm index ade192ea0..f9837b3e6 100644 --- a/Bugzilla/Auth/Login/Env.pm +++ b/Bugzilla/Auth/Login/Env.pm @@ -36,9 +36,9 @@ sub get_login_info { my ($self) = @_; my $dbh = Bugzilla->dbh; - my $env_id = $ENV{Param("auth_env_id")} || ''; - my $env_email = $ENV{Param("auth_env_email")} || ''; - my $env_realname = $ENV{Param("auth_env_realname")} || ''; + my $env_id = $ENV{Bugzilla->params->{"auth_env_id"}} || ''; + my $env_email = $ENV{Bugzilla->params->{"auth_env_email"}} || ''; + my $env_realname = $ENV{Bugzilla->params->{"auth_env_realname"}} || ''; return { failure => AUTH_NODATA } if !$env_email; diff --git a/Bugzilla/Auth/Persist/Cookie.pm b/Bugzilla/Auth/Persist/Cookie.pm index 7d1209a0e..3d8599c18 100644 --- a/Bugzilla/Auth/Persist/Cookie.pm +++ b/Bugzilla/Auth/Persist/Cookie.pm @@ -52,7 +52,7 @@ sub persist_login { my $ip_addr = $cgi->remote_addr; unless ($cgi->param('Bugzilla_restrictlogin') || - Param('loginnetmask') == 32) + Bugzilla->params->{'loginnetmask'} == 32) { $ip_addr = get_netaddr($ip_addr); } @@ -70,8 +70,8 @@ sub persist_login { # Remember cookie only if admin has told so # or admin didn't forbid it and user told to remember. - if ( Param('rememberlogin') eq 'on' || - (Param('rememberlogin') ne 'off' && + if ( Bugzilla->params->{'rememberlogin'} eq 'on' || + (Bugzilla->params->{'rememberlogin'} ne 'off' && $cgi->param('Bugzilla_remember') && $cgi->param('Bugzilla_remember') eq 'on') ) { diff --git a/Bugzilla/Auth/Verify/LDAP.pm b/Bugzilla/Auth/Verify/LDAP.pm index 2ee5247ec..713619589 100644 --- a/Bugzilla/Auth/Verify/LDAP.pm +++ b/Bugzilla/Auth/Verify/LDAP.pm @@ -85,7 +85,7 @@ sub check_credentials { my $user_entry = $detail_result->shift_entry; - my $mail_attr = Param("LDAPmailattribute"); + my $mail_attr = Bugzilla->params->{"LDAPmailattribute"}; if ($mail_attr) { if (!$user_entry->exists($mail_attr)) { return { failure => AUTH_ERROR, @@ -106,17 +106,19 @@ sub check_credentials { sub _bz_search_params { my ($username) = @_; - return (base => Param("LDAPBaseDN"), + return (base => Bugzilla->params->{"LDAPBaseDN"}, scope => "sub", - filter => '(&(' . Param("LDAPuidattribute") . "=$username)" - . Param("LDAPfilter") . ')'); + filter => '(&(' . Bugzilla->params->{"LDAPuidattribute"} + . "=$username)" + . Bugzilla->params->{"LDAPfilter"} . ')'); } sub _bind_ldap_anonymously { my ($self) = @_; my $bind_result; - if (Param("LDAPbinddn")) { - my ($LDAPbinddn,$LDAPbindpass) = split(":",Param("LDAPbinddn")); + if (Bugzilla->params->{"LDAPbinddn"}) { + my ($LDAPbinddn,$LDAPbindpass) = + split(":",Bugzilla->params->{"LDAPbinddn"}); $bind_result = $self->ldap->bind($LDAPbinddn, password => $LDAPbindpass); } @@ -136,7 +138,7 @@ sub ldap { my ($self) = @_; return $self->{ldap} if $self->{ldap}; - my $server = Param("LDAPserver"); + my $server = Bugzilla->params->{"LDAPserver"}; ThrowCodeError("ldap_server_not_defined") unless $server; my $port = DEFAULT_PORT; @@ -166,7 +168,7 @@ sub ldap { || ThrowCodeError("ldap_connect_failed", { server => $conn_string }); # try to start TLS if needed - if (Param("LDAPstarttls")) { + if (Bugzilla->params->{"LDAPstarttls"}) { my $mesg = $self->{ldap}->start_tls(); ThrowCodeError("ldap_start_tls_failed", { error => $mesg->error() }) if $mesg->code(); diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index f7e89c33d..72ca27093 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -298,10 +298,9 @@ sub fields { reporter assigned_to cc), # Conditional Fields - Param('useqacontact') ? "qa_contact" : (), - Param('timetrackinggroup') ? qw(estimated_time remaining_time - actual_time deadline) - : (), + Bugzilla->params->{'useqacontact'} ? "qa_contact" : (), + Bugzilla->params->{'timetrackinggroup'} ? + qw(estimated_time remaining_time actual_time deadline) : (), # Custom Fields Bugzilla->custom_field_names @@ -346,7 +345,7 @@ sub actual_time { return $self->{'actual_time'} if exists $self->{'actual_time'}; if ( $self->{'error'} || - !Bugzilla->user->in_group(Param("timetrackinggroup")) ) { + !Bugzilla->user->in_group(Bugzilla->params->{"timetrackinggroup"}) ) { $self->{'actual_time'} = undef; return $self->{'actual_time'}; } @@ -492,7 +491,7 @@ sub qa_contact { return $self->{'qa_contact'} if exists $self->{'qa_contact'}; return undef if $self->{'error'}; - if (Param('useqacontact') && $self->{'qa_contact_id'}) { + if (Bugzilla->params->{'useqacontact'} && $self->{'qa_contact_id'}) { $self->{'qa_contact'} = new Bugzilla::User($self->{'qa_contact_id'}); } else { # XXX - This is somewhat inconsistent with the assignee/reporter @@ -542,7 +541,8 @@ sub use_votes { $self->{'prod_obj'} ||= new Bugzilla::Product({name => $self->{'product'}}); - return Param('usevotes') && $self->{'prod_obj'}->votes_per_user > 0; + return Bugzilla->params->{'usevotes'} + && $self->{'prod_obj'}->votes_per_user > 0; } sub groups { @@ -617,7 +617,7 @@ sub user { return {} if $self->{'error'}; my $user = Bugzilla->user; - my $canmove = Param('move-enabled') && $user->is_mover; + my $canmove = Bugzilla->params->{'move-enabled'} && $user->is_mover; # In the below, if the person hasn't logged in, then we treat them # as if they can do anything. That's because we don't know why they @@ -629,7 +629,7 @@ sub user { || $user->in_group("editbugs"); my $canedit = $unknown_privileges || $user->id == $self->{assigned_to_id} - || (Param('useqacontact') + || (Bugzilla->params->{'useqacontact'} && $self->{'qa_contact_id'} && $user->id == $self->{qa_contact_id}); my $canconfirm = $unknown_privileges @@ -703,7 +703,7 @@ sub settable_resolutions { # the ID of the bug if it exists or the undefined value if it doesn't. sub bug_alias_to_id { my ($alias) = @_; - return undef unless Param("usebugaliases"); + return undef unless Bugzilla->params->{"usebugaliases"}; my $dbh = Bugzilla->dbh; trick_taint($alias); return $dbh->selectrow_array( @@ -823,7 +823,7 @@ sub GetComments { while (my $comment_ref = $sth->fetchrow_hashref()) { my %comment = %$comment_ref; - $comment{'email'} .= Param('emailsuffix'); + $comment{'email'} .= Bugzilla->params->{'emailsuffix'}; $comment{'name'} = $comment{'name'} || $comment{'email'}; push (@comments, \%comment); @@ -856,7 +856,9 @@ sub GetBugActivity { # Only includes attachments the user is allowed to see. my $suppjoins = ""; my $suppwhere = ""; - if (Param("insidergroup") && !UserInGroup(Param('insidergroup'))) { + if (Bugzilla->params->{"insidergroup"} + && !UserInGroup(Bugzilla->params->{'insidergroup'})) + { $suppjoins = "LEFT JOIN attachments ON attachments.attach_id = bugs_activity.attach_id"; $suppwhere = "AND COALESCE(attachments.isprivate, 0) = 0"; @@ -901,7 +903,8 @@ sub GetBugActivity { || $fieldname eq 'work_time' || $fieldname eq 'deadline') { - $activity_visible = UserInGroup(Param('timetrackinggroup')) ? 1 : 0; + $activity_visible = + UserInGroup(Bugzilla->params->{'timetrackinggroup'}) ? 1 : 0; } else { $activity_visible = 1; } @@ -1090,7 +1093,7 @@ sub RemoveVotes { # been reduced or removed. my $vars = { - 'to' => $name . Param('emailsuffix'), + 'to' => $name . Bugzilla->params->{'emailsuffix'}, 'bugid' => $id, 'reason' => $reason, @@ -1281,7 +1284,7 @@ sub check_can_change_field { } # - change the priority (unless he could have set it originally) if ($field eq 'priority' - && !Param('letsubmitterchoosepriority')) + && !Bugzilla->params->{'letsubmitterchoosepriority'}) { $PrivilegesRequired = 2; return 0; diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index 7c8aee1ba..dc6efc735 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -239,7 +239,8 @@ sub ProcessOneBug { my $diffpart = {}; if ($who ne $lastwho) { $lastwho = $who; - $diffheader = "\n$whoname <$who" . Param('emailsuffix') . "> changed:\n\n"; + $diffheader = "\n$whoname <$who" . Bugzilla->params->{'emailsuffix'} + . "> changed:\n\n"; $diffheader .= FormatTriple("What ", "Removed", "Added"); $diffheader .= ('-' x 76) . "\n"; } @@ -293,7 +294,7 @@ sub ProcessOneBug { $deptext .= $thisdiff; } $lastbug = $depbug; - my $urlbase = Param("urlbase"); + my $urlbase = Bugzilla->params->{"urlbase"}; $thisdiff = "\nBug $id depends on bug $depbug, which changed state.\n\n" . "Bug $depbug Summary: $summary\n" . @@ -352,7 +353,7 @@ sub ProcessOneBug { $recipients{$reporter}->{+REL_REPORTER} = BIT_DIRECT; # QA Contact - if (Param('useqacontact')) { + if (Bugzilla->params->{'useqacontact'}) { foreach (@qa_contacts) { # QA Contact can be blank; ignore it if so. $recipients{$_}->{+REL_QA} = BIT_DIRECT if $_; @@ -387,7 +388,7 @@ sub ProcessOneBug { } } - if (Param("supportwatchers")) { + if (Bugzilla->params->{"supportwatchers"}) { # Find all those user-watching anyone on the current list, who is not # on it already themselves. my $involved = join(",", keys %recipients); @@ -444,9 +445,9 @@ sub ProcessOneBug { # If we are using insiders, and the comment is private, only send # to insiders my $insider_ok = 1; - $insider_ok = 0 if (Param("insidergroup") && + $insider_ok = 0 if (Bugzilla->params->{"insidergroup"} && ($anyprivate != 0) && - (!$user->groups->{Param("insidergroup")})); + (!$user->groups->{Bugzilla->params->{"insidergroup"}})); # We shouldn't send mail if this is a dependency mail (i.e. there # is something in @depbugs), and any of the depending bugs are not @@ -518,7 +519,7 @@ sub sendMail { } # Only send estimated_time if it is enabled and the user is in the group if (($f ne 'estimated_time' && $f ne 'deadline') || - $user->groups->{Param('timetrackinggroup')}) { + $user->groups->{Bugzilla->params->{'timetrackinggroup'}}) { my $desc = $fielddescription{$f}; $head .= FormatDouble($desc, $value); @@ -539,12 +540,12 @@ sub sendMail { $diff->{'fieldname'} eq 'remaining_time' || $diff->{'fieldname'} eq 'work_time' || $diff->{'fieldname'} eq 'deadline')){ - if ($user->groups->{Param("timetrackinggroup")}) { + if ($user->groups->{Bugzilla->params->{"timetrackinggroup"}}) { $add_diff = 1; } } elsif (($diff->{'isprivate'}) - && Param('insidergroup') - && !($user->groups->{Param('insidergroup')}) + && Bugzilla->params->{'insidergroup'} + && !($user->groups->{Bugzilla->params->{'insidergroup'}}) ) { $add_diff = 0; } else { @@ -599,7 +600,7 @@ sub sendMail { if ( $newcomments =~ /Created an attachment \(/ ) { my $showattachurlbase = - Param('urlbase') . "attachment.cgi?id="; + Bugzilla->params->{'urlbase'} . "attachment.cgi?id="; $newcomments =~ s/(Created an attachment \(id=([0-9]+)\))/$1\n --> \(${showattachurlbase}$2\)/g; } @@ -639,7 +640,7 @@ sub sendMail { $substs{"changer"} = $values{'changer'}; $substs{"changername"} = $values{'changername'}; - my $sitespec = '@' . Param('urlbase'); + my $sitespec = '@' . Bugzilla->params->{'urlbase'}; $sitespec =~ s/:\/\//\./; # Make the protocol look like part of the domain $sitespec =~ s/^([^:\/]+):(\d+)/$1/; # Remove a port number, to relocate if ($2) { @@ -653,7 +654,7 @@ sub sendMail { $user->id . "$sitespec>"; } - my $template = Param("newchangedmail"); + my $template = Bugzilla->params->{"newchangedmail"}; my $msg = perform_substs($template, \%substs); @@ -667,7 +668,7 @@ sub MailPassword { my ($login, $password) = (@_); my $template = Bugzilla->template; my $vars = { - mailaddress => $login . Param('emailsuffix'), + mailaddress => $login . Bugzilla->params->{'emailsuffix'}, login => $login, password => $password }; my $msg; @@ -716,10 +717,10 @@ sub get_comments_by_bug { my ($who, $whoname, $when, $text, $isprivate, $already_wrapped) = @$_; if ($count) { $result .= "\n\n--- Comment #$count from $whoname <$who" . - Param('emailsuffix'). "> " . format_time($when) . - " ---\n"; + Bugzilla->params->{'emailsuffix'}. "> " + . format_time($when) . " ---\n"; } - if ($isprivate > 0 && Param('insidergroup')) { + if ($isprivate > 0 && Bugzilla->params->{'insidergroup'}) { $anyprivate = 1; } $result .= ($already_wrapped ? $text : wrap_comment($text)); diff --git a/Bugzilla/Config.pm b/Bugzilla/Config.pm index 53e8b1b77..c4a23f9cb 100644 --- a/Bugzilla/Config.pm +++ b/Bugzilla/Config.pm @@ -280,7 +280,7 @@ Bugzilla::Config - Configuration parameters for Bugzilla # Getting parameters use Bugzilla::Config; - my $fooSetting = Param('foo'); + my $fooSetting = Bugzilla->params->{'foo'}; # Administration functions use Bugzilla::Config qw(:admin); @@ -305,7 +305,7 @@ Parameters can be set, retrieved, and updated. =over 4 -=item C +=item Cparams->{$name}> Returns the Param with the specified name. Either a string, or, in the case of multiple-choice parameters, an array reference. diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm index 87e0bc4b2..3d30dd778 100644 --- a/Bugzilla/DB.pm +++ b/Bugzilla/DB.pm @@ -52,11 +52,13 @@ use constant BLOB_TYPE => DBI::SQL_BLOB; ##################################################################### sub connect_shadow { - die "Tried to connect to non-existent shadowdb" unless Param('shadowdb'); + my $params = Bugzilla->params; + die "Tried to connect to non-existent shadowdb" + unless $params->{'shadowdb'}; - return _connect($db_driver, Param("shadowdbhost"), - Param('shadowdb'), Param("shadowdbport"), - Param("shadowdbsock"), $db_user, $db_pass); + return _connect($db_driver, $params->{"shadowdbhost"}, + $params->{'shadowdb'}, $params->{"shadowdbport"}, + $params->{"shadowdbsock"}, $db_user, $db_pass); } sub connect_main { @@ -205,7 +207,7 @@ sub bz_get_field_defs { my ($self) = @_; my $extra = ""; - if (!Bugzilla->user->in_group(Param('timetrackinggroup'))) { + if (!Bugzilla->user->in_group(Bugzilla->params->{'timetrackinggroup'})) { $extra = "AND name NOT IN ('estimated_time', 'remaining_time', " . "'work_time', 'percentage_complete', 'deadline')"; } diff --git a/Bugzilla/Flag.pm b/Bugzilla/Flag.pm index bcea5b043..8646e72ac 100644 --- a/Bugzilla/Flag.pm +++ b/Bugzilla/Flag.pm @@ -305,8 +305,8 @@ sub validate { # the requestee isn't in the group of insiders who can see it. if ($attach_id && $cgi->param('isprivate') - && Param("insidergroup") - && !$requestee->in_group(Param("insidergroup"))) + && Bugzilla->params->{"insidergroup"} + && !$requestee->in_group(Bugzilla->params->{"insidergroup"})) { ThrowUserError("flag_requestee_unauthorized_attachment", { flag_type => $flag->{'type'}, @@ -798,8 +798,8 @@ sub notify { next if ($bug->groups && !$ccuser->can_see_bug($bug->bug_id)); next if $attachment_is_private - && Param("insidergroup") - && !$ccuser->in_group(Param("insidergroup")); + && Bugzilla->params->{"insidergroup"} + && !$ccuser->in_group(Bugzilla->params->{"insidergroup"}); push(@new_cc_list, $cc); } $flag->{'type'}->{'cc_list'} = join(", ", @new_cc_list); diff --git a/Bugzilla/FlagType.pm b/Bugzilla/FlagType.pm index 572c4fad7..078f6de71 100644 --- a/Bugzilla/FlagType.pm +++ b/Bugzilla/FlagType.pm @@ -398,9 +398,9 @@ sub validate { # Throw an error if the target is a private attachment and # the requestee isn't in the group of insiders who can see it. if ($attach_id - && Param("insidergroup") + && Bugzilla->params->{"insidergroup"} && $cgi->param('isprivate') - && !$requestee->in_group(Param("insidergroup"))) + && !$requestee->in_group(Bugzilla->params->{"insidergroup"})) { ThrowUserError("flag_requestee_unauthorized_attachment", { flag_type => $flag_type, diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm index ce3565368..9f51c71e0 100644 --- a/Bugzilla/Mailer.pm +++ b/Bugzilla/Mailer.pm @@ -50,12 +50,15 @@ use MIME::Base64; sub MessageToMTA { my ($msg) = (@_); - return if (Param('mail_delivery_method') eq "none"); + my $params = Bugzilla->params; + return if ($params->{'mail_delivery_method'} eq "none"); my ($header, $body) = $msg =~ /(.*?\n)\n(.*)/s ? ($1, $2) : ('', $msg); my $headers; - if (Param('utf8') and (!is_7bit_clean($header) or !is_7bit_clean($body))) { + if ($params->{'utf8'} + and (!is_7bit_clean($header) or !is_7bit_clean($body))) + { ($headers, $body) = encode_message($msg); } else { my @header_lines = split(/\n/, $header); @@ -65,7 +68,7 @@ sub MessageToMTA { # Use trim to remove any whitespace (incl. newlines) my $from = trim($headers->get('from')); - if (Param("mail_delivery_method") eq "sendmail" && $^O =~ /MSWin32/i) { + if ($params->{"mail_delivery_method"} eq "sendmail" && $^O =~ /MSWin32/i) { my $cmd = '|' . SENDMAIL_EXE . ' -t -i'; if ($from) { # We're on Windows, thus no danger of command injection @@ -82,23 +85,25 @@ sub MessageToMTA { } my @args; - if (Param("mail_delivery_method") eq "sendmail") { + if ($params->{"mail_delivery_method"} eq "sendmail") { push @args, "-i"; if ($from) { push(@args, "-f$from"); } } - if (Param("mail_delivery_method") eq "sendmail" && !Param("sendmailnow")) { + if ($params->{"mail_delivery_method"} eq "sendmail" + && !$params->{"sendmailnow"}) + { push @args, "-ODeliveryMode=deferred"; } - if (Param("mail_delivery_method") eq "smtp") { - push @args, Server => Param("smtpserver"); + if ($params->{"mail_delivery_method"} eq "smtp") { + push @args, Server => $params->{"smtpserver"}; if ($from) { $ENV{'MAILADDRESS'} = $from; } } - my $mailer = new Mail::Mailer Param("mail_delivery_method"), @args; - if (Param("mail_delivery_method") eq "testfile") { + my $mailer = new Mail::Mailer($params->{"mail_delivery_method"}, @args); + if ($params->{"mail_delivery_method"} eq "testfile") { $Mail::Mailer::testfile::config{outfile} = bz_locations()->{'datadir'} . '/mailer.testfile'; } diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 9f3d0213d..f9bf55388 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -346,7 +346,7 @@ sub init { my $sql_deadlinefrom; my $sql_deadlineto; - if (Bugzilla->user->in_group(Param('timetrackinggroup'))){ + if (Bugzilla->user->in_group(Bugzilla->params->{'timetrackinggroup'})){ my $deadlinefrom; my $deadlineto; @@ -579,8 +579,8 @@ sub init { # Add the longdescs table to the query so we can search comments. my $table = "longdescs_$chartid"; my $extra = ""; - if (Param("insidergroup") - && !UserInGroup(Param("insidergroup"))) + if (Bugzilla->params->{"insidergroup"} + && !UserInGroup(Bugzilla->params->{"insidergroup"})) { $extra = "AND $table.isprivate < 1"; } @@ -644,7 +644,9 @@ sub init { } my $table = "longdescs_$chartseq"; my $extra = ""; - if (Param("insidergroup") && !UserInGroup(Param("insidergroup"))) { + if (Bugzilla->params->{"insidergroup"} + && !UserInGroup(Bugzilla->params->{"insidergroup"})) + { $extra = "AND $table.isprivate < 1"; } push(@supptables, "LEFT JOIN longdescs AS $table " . @@ -662,7 +664,9 @@ sub init { } my $table = "longdescs_$chartseq"; my $extra = ""; - if (Param("insidergroup") && !UserInGroup(Param("insidergroup"))) { + if (Bugzilla->params->{"insidergroup"} + && !UserInGroup(Bugzilla->params->{"insidergroup"})) + { $extra = "AND $table.isprivate < 1"; } if ($list) { @@ -683,7 +687,9 @@ sub init { "^long_?desc," => sub { my $table = "longdescs_$chartid"; my $extra = ""; - if (Param("insidergroup") && !UserInGroup(Param("insidergroup"))) { + if (Bugzilla->params->{"insidergroup"} + && !UserInGroup(Bugzilla->params->{"insidergroup"})) + { $extra = "AND $table.isprivate < 1"; } push(@supptables, "INNER JOIN longdescs AS $table " . @@ -790,7 +796,9 @@ sub init { my $atable = "attachments_$chartid"; my $dtable = "attachdata_$chartid"; my $extra = ""; - if (Param("insidergroup") && !UserInGroup(Param("insidergroup"))) { + if (Bugzilla->params->{"insidergroup"} + && !UserInGroup(Bugzilla->params->{"insidergroup"})) + { $extra = "AND $atable.isprivate = 0"; } push(@supptables, "INNER JOIN attachments AS $atable " . @@ -802,7 +810,9 @@ sub init { "^attachments\..*," => sub { my $table = "attachments_$chartid"; my $extra = ""; - if (Param("insidergroup") && !UserInGroup(Param("insidergroup"))) { + if (Bugzilla->params->{"insidergroup"} + && !UserInGroup(Bugzilla->params->{"insidergroup"})) + { $extra = "AND $table.isprivate = 0"; } push(@supptables, "INNER JOIN attachments AS $table " . @@ -1422,7 +1432,7 @@ sub init { $query .= " OR (bugs.reporter_accessible = 1 AND bugs.reporter = $userid) " . " OR (bugs.cclist_accessible = 1 AND cc.who IS NOT NULL) " . " OR (bugs.assigned_to = $userid) "; - if (Param('useqacontact')) { + if (Bugzilla->params->{'useqacontact'}) { $query .= "OR (bugs.qa_contact = $userid) "; } } diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm index 19bc6738c..48b825318 100644 --- a/Bugzilla/Search/Quicksearch.pm +++ b/Bugzilla/Search/Quicksearch.pm @@ -118,7 +118,7 @@ sub quicksearch { if (index($searchstring, ',') < $[) { # Single bug number; shortcut to show_bug.cgi. - print $cgi->redirect(-uri => Param('urlbase') . + print $cgi->redirect(-uri => Bugzilla->params->{'urlbase'} . "show_bug.cgi?id=$searchstring"); exit; } @@ -138,7 +138,7 @@ sub quicksearch { WHERE alias = ?}, undef, $1)) { - print $cgi->redirect(-uri => Param('urlbase') . + print $cgi->redirect(-uri => Bugzilla->params->{'urlbase'} . "show_bug.cgi?id=$1"); exit; } @@ -154,7 +154,8 @@ sub quicksearch { $searchstring =~ s/\s+NOT\s+/ -/g; my @words = splitString($searchstring); - my $searchComments = $#words < Param('quicksearch_comment_cutoff'); + my $searchComments = + $#words < Bugzilla->params->{'quicksearch_comment_cutoff'}; my @openStates = BUG_STATE_OPEN; my @closedStates; my (%states, %resolutions); @@ -381,9 +382,9 @@ sub quicksearch { if ($cgi->param('load')) { # Param 'load' asks us to display the query in the advanced search form. - print $cgi->redirect(-uri => Param('urlbase') . "query.cgi?" . - "format=advanced&" . - $modified_query_string); + print $cgi->redirect(-uri => Bugzilla->params->{'urlbase'} + . "query.cgi?format=advanced&" + . $modified_query_string); } # Otherwise, pass the modified query string to the caller. diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 2a6cb901d..65d937510 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -113,7 +113,7 @@ sub getTemplateIncludePath { my $templatedir = bz_locations()->{'templatedir'}; my $project = bz_locations()->{'project'}; - my $languages = trim(Param('languages')); + my $languages = trim(Bugzilla->params->{'languages'}); if (not ($languages =~ /,/)) { if ($project) { $template_include_path = [ @@ -141,7 +141,7 @@ sub getTemplateIncludePath { push (@usedlanguages, @found); } } - push(@usedlanguages, Param('defaultlanguage')); + push(@usedlanguages, Bugzilla->params->{'defaultlanguage'}); if ($project) { $template_include_path = [ map(( @@ -277,7 +277,9 @@ sub quoteUrls { my $tmp; # Provide tooltips for full bug links (Bug 74355) - my $urlbase_re = '(' . join('|', map { qr/$_/ } grep($_, Param('urlbase'), Param('sslbase'))) . ')'; + my $urlbase_re = '(' . join('|', + map { qr/$_/ } grep($_, Bugzilla->params->{'urlbase'}, + Bugzilla->params->{'sslbase'})) . ')'; $text =~ s~\b(${urlbase_re}\Qshow_bug.cgi?id=\E([0-9]+))\b ~($things[$count++] = get_bug_link($3, $1)) && ("\0\0" . ($count-1) . "\0\0") @@ -697,7 +699,7 @@ sub create { my ($var) = Template::Filters::html_filter(@_); # Obscure '@'. $var =~ s/\@/\@/g; - if (Param('utf8')) { + if (Bugzilla->params->{'utf8'}) { # Remove the following characters because they're # influencing BiDi: # -------------------------------------------------------- diff --git a/Bugzilla/Template/Plugin/Hook.pm b/Bugzilla/Template/Plugin/Hook.pm index c2e1626ef..6f744a8aa 100644 --- a/Bugzilla/Template/Plugin/Hook.pm +++ b/Bugzilla/Template/Plugin/Hook.pm @@ -107,7 +107,7 @@ sub process { # get a list of languages we accept so we can find the hook # that corresponds to our desired languages: sub getLanguages() { - my $languages = trim(Param('languages')); + my $languages = trim(Bugzilla->params->{'languages'}); if (not ($languages =~ /,/)) { # only one language return $languages; } diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm index 40eef4f1b..c2e11f5a3 100644 --- a/Bugzilla/Token.pm +++ b/Bugzilla/Token.pm @@ -50,6 +50,7 @@ my $maxtokenage = 3; sub IssueEmailChangeToken { my ($userid, $old_email, $new_email) = @_; + my $email_suffix = Bugzilla->params->{'emailsuffix'}; my ($token, $token_ts) = _create_token($userid, 'emailold', $old_email . ":" . $new_email); @@ -60,14 +61,14 @@ sub IssueEmailChangeToken { my $template = Bugzilla->template; my $vars = {}; - $vars->{'oldemailaddress'} = $old_email . Param('emailsuffix'); - $vars->{'newemailaddress'} = $new_email . Param('emailsuffix'); + $vars->{'oldemailaddress'} = $old_email . $email_suffix; + $vars->{'newemailaddress'} = $new_email . $email_suffix; $vars->{'max_token_age'} = $maxtokenage; $vars->{'token_ts'} = $token_ts; $vars->{'token'} = $token; - $vars->{'emailaddress'} = $old_email . Param('emailsuffix'); + $vars->{'emailaddress'} = $old_email . $email_suffix; my $message; $template->process("account/email/change-old.txt.tmpl", $vars, \$message) @@ -76,7 +77,7 @@ sub IssueEmailChangeToken { MessageToMTA($message); $vars->{'token'} = $newtoken; - $vars->{'emailaddress'} = $new_email . Param('emailsuffix'); + $vars->{'emailaddress'} = $new_email . $email_suffix; $message = ""; $template->process("account/email/change-new.txt.tmpl", $vars, \$message) @@ -112,7 +113,7 @@ sub IssuePasswordToken { # Mail the user the token along with instructions for using it. $vars->{'token'} = $token; - $vars->{'emailaddress'} = $loginname . Param('emailsuffix'); + $vars->{'emailaddress'} = $loginname . Bugzilla->params->{'emailsuffix'}; $vars->{'max_token_age'} = $maxtokenage; $vars->{'token_ts'} = $token_ts; @@ -191,11 +192,11 @@ sub Cancel { undef, $token); # Get the email address of the Bugzilla maintainer. - my $maintainer = Param('maintainer'); + my $maintainer = Bugzilla->params->{'maintainer'}; my $template = Bugzilla->template; - $vars->{'emailaddress'} = $loginname . Param('emailsuffix'); + $vars->{'emailaddress'} = $loginname . Bugzilla->params->{'emailsuffix'}; $vars->{'maintainer'} = $maintainer; $vars->{'remoteaddress'} = $::ENV{'REMOTE_ADDR'}; $vars->{'token'} = $token; diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 7ad1593ce..1c30ce024 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -152,7 +152,7 @@ sub _create { # Accessors for user attributes sub id { $_[0]->{id}; } sub login { $_[0]->{login}; } -sub email { $_[0]->{login} . Param('emailsuffix'); } +sub email { $_[0]->{login} . Bugzilla->params->{'emailsuffix'}; } sub name { $_[0]->{name}; } sub disabledtext { $_[0]->{'disabledtext'}; } sub is_disabled { $_[0]->disabledtext ? 1 : 0; } @@ -365,7 +365,9 @@ sub bless_groups { } # If visibilitygroups are used, restrict the set of groups. - if ((!$self->in_group('editusers')) && Param('usevisibilitygroups')) { + if (!$self->in_group('editusers') + && Bugzilla->params->{'usevisibilitygroups'}) + { # Users need to see a group in order to bless it. my $visibleGroups = join(', ', @{$self->visible_groups_direct()}) || return $self->{'bless_groups'} = []; @@ -393,7 +395,7 @@ sub can_see_user { my ($self, $otherUser) = @_; my $query; - if (Param('usevisibilitygroups')) { + if (Bugzilla->params->{'usevisibilitygroups'}) { # If the user can see no groups, then no users are visible either. my $visibleGroups = $self->visible_groups_as_string() || return 0; $query = qq{SELECT COUNT(DISTINCT userid) @@ -466,7 +468,8 @@ sub can_see_bug { $self->{sthCanSeeBug} = $sth; return ($ready && ((($reporter == $userid) && $reporter_access) - || (Param('useqacontact') && $qacontact && ($qacontact == $userid)) + || (Bugzilla->params->{'useqacontact'} + && $qacontact && ($qacontact == $userid)) || ($owner == $userid) || ($isoncclist && $cclist_access) || (!$missinggroup))); @@ -493,7 +496,7 @@ sub get_selectable_products { "FROM products " . "LEFT JOIN group_control_map " . "ON group_control_map.product_id = products.id "; - if (Param('useentrygroupdefault')) { + if (Bugzilla->params->{'useentrygroupdefault'}) { $query .= "AND group_control_map.entry != 0 "; } else { $query .= "AND group_control_map.membercontrol = " . @@ -503,7 +506,7 @@ sub get_selectable_products { $self->groups_as_string . ") " . "WHERE group_id IS NULL "; - if (Param('useclassification') && $classification_id) { + if (Bugzilla->params->{'useclassification'} && $classification_id) { $query .= "AND classification_id = ? "; detaint_natural($classification_id); push(@params, $classification_id); @@ -783,20 +786,22 @@ sub match { # first try wildcards my $wildstr = $str; - if ($wildstr =~ s/\*/\%/g && # don't do wildcards if no '*' in the string - Param('usermatchmode') ne 'off') { # or if we only want exact matches + if ($wildstr =~ s/\*/\%/g # don't do wildcards if no '*' in the string + # or if we only want exact matches + && Bugzilla->params->{'usermatchmode'} ne 'off') + { # Build the query. trick_taint($wildstr); my $query = "SELECT DISTINCT login_name FROM profiles "; - if (Param('usevisibilitygroups')) { + if (Bugzilla->params->{'usevisibilitygroups'}) { $query .= "INNER JOIN user_group_map ON user_group_map.user_id = profiles.userid "; } $query .= "WHERE (" . $dbh->sql_istrcmp('login_name', '?', "LIKE") . " OR " . $dbh->sql_istrcmp('realname', '?', "LIKE") . ") "; - if (Param('usevisibilitygroups')) { + if (Bugzilla->params->{'usevisibilitygroups'}) { $query .= "AND isbless = 0 " . "AND group_id IN(" . join(', ', (-1, @{$user->visible_groups_inherited})) . ") "; @@ -824,21 +829,21 @@ sub match { # then try substring search if ((scalar(@users) == 0) - && (Param('usermatchmode') eq 'search') + && (Bugzilla->params->{'usermatchmode'} eq 'search') && (length($str) >= 3)) { $str = lc($str); trick_taint($str); my $query = "SELECT DISTINCT login_name FROM profiles "; - if (Param('usevisibilitygroups')) { + if (Bugzilla->params->{'usevisibilitygroups'}) { $query .= "INNER JOIN user_group_map ON user_group_map.user_id = profiles.userid "; } $query .= " WHERE (" . $dbh->sql_position('?', 'LOWER(login_name)') . " > 0" . " OR " . $dbh->sql_position('?', 'LOWER(realname)') . " > 0) "; - if (Param('usevisibilitygroups')) { + if (Bugzilla->params->{'usevisibilitygroups'}) { $query .= " AND isbless = 0" . " AND group_id IN(" . join(', ', (-1, @{$user->visible_groups_inherited})) . ") "; @@ -907,6 +912,8 @@ sub match_field { my $need_confirm = 0; # whether to display confirmation screen my $match_multiple = 0; # whether we ever matched more than one user + my $params = Bugzilla->params; + # prepare default form values # What does a "--do_not_change--" field look like (if any)? @@ -1007,8 +1014,8 @@ sub match_field { } my $limit = 0; - if (Param('maxusermatches')) { - $limit = Param('maxusermatches') + 1; + if ($params->{'maxusermatches'}) { + $limit = $params->{'maxusermatches'} + 1; } for my $query (@queries) { @@ -1039,16 +1046,16 @@ sub match_field { $cgi->append(-name=>$field, -values=>[@{$users}[0]->{'login'}]); - $need_confirm = 1 if Param('confirmuniqueusermatch'); + $need_confirm = 1 if $params->{'confirmuniqueusermatch'}; } elsif ((scalar(@{$users}) > 1) - && (Param('maxusermatches') != 1)) { + && ($params->{'maxusermatches'} != 1)) { $need_confirm = 1; $match_multiple = 1; - if ((Param('maxusermatches')) - && (scalar(@{$users}) > Param('maxusermatches'))) + if (($params->{'maxusermatches'}) + && (scalar(@{$users}) > $params->{'maxusermatches'})) { $matches->{$field}->{$query}->{'status'} = 'trunc'; pop @{$users}; # take the last one out @@ -1251,7 +1258,7 @@ sub is_mover { my $self = shift; if (!defined $self->{'is_mover'}) { - my @movers = map { trim($_) } split(',', Param('movers')); + my @movers = map { trim($_) } split(',', Bugzilla->params->{'movers'}); $self->{'is_mover'} = ($self->id && lsearch(\@movers, $self->login) != -1); } @@ -1265,13 +1272,13 @@ sub get_userlist { my $dbh = Bugzilla->dbh; my $query = "SELECT DISTINCT login_name, realname,"; - if (Param('usevisibilitygroups')) { + if (Bugzilla->params->{'usevisibilitygroups'}) { $query .= " COUNT(group_id) "; } else { $query .= " 1 "; } $query .= "FROM profiles "; - if (Param('usevisibilitygroups')) { + if (Bugzilla->params->{'usevisibilitygroups'}) { $query .= "LEFT JOIN user_group_map " . "ON user_group_map.user_id = userid AND isbless = 0 " . "AND group_id IN(" . diff --git a/attachment.cgi b/attachment.cgi index 7acc6e326..3ed2984c4 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -165,8 +165,8 @@ sub validateID # Make sure the user is authorized to access this attachment's bug. ValidateBugID($bugid); - if ($isprivate && Param("insidergroup")) { - UserInGroup(Param("insidergroup")) + if ($isprivate && Bugzilla->params->{"insidergroup"}) { + UserInGroup(Bugzilla->params->{"insidergroup"}) || ThrowUserError("auth_failure", {action => "access", object => "attachment"}); } @@ -487,8 +487,9 @@ sub get_unified_diff my $last_reader = $reader; # fixes patch root (makes canonical if possible) - if (Param('cvsroot')) { - my $fix_patch_root = new PatchReader::FixPatchRoot(Param('cvsroot')); + if (Bugzilla->params->{'cvsroot'}) { + my $fix_patch_root = + new PatchReader::FixPatchRoot(Bugzilla->params->{'cvsroot'}); $last_reader->sends_data_to($fix_patch_root); $last_reader = $fix_patch_root; } @@ -548,20 +549,21 @@ sub setup_patch_readers { my $reader = new PatchReader::Raw; my $last_reader = $reader; # Fix the patch root if we have a cvs root - if (Param('cvsroot')) + if (Bugzilla->params->{'cvsroot'}) { require PatchReader::FixPatchRoot; - $last_reader->sends_data_to(new PatchReader::FixPatchRoot(Param('cvsroot'))); + $last_reader->sends_data_to( + new PatchReader::FixPatchRoot(Bugzilla->params->{'cvsroot'})); $last_reader->sends_data_to->diff_root($diff_root) if defined($diff_root); $last_reader = $last_reader->sends_data_to; } # Add in cvs context if we have the necessary info to do it - if ($context ne "patch" && $cvsbin && Param('cvsroot_get')) + if ($context ne "patch" && $cvsbin && Bugzilla->params->{'cvsroot_get'}) { require PatchReader::AddCVSContext; $last_reader->sends_data_to( new PatchReader::AddCVSContext($context, - Param('cvsroot_get'))); + Bugzilla->params->{'cvsroot_get'})); $last_reader = $last_reader->sends_data_to; } return ($reader, $last_reader); @@ -581,7 +583,8 @@ sub setup_template_patch_reader } $vars->{collapsed} = $cgi->param('collapsed'); $vars->{context} = $context; - $vars->{do_context} = $cvsbin && Param('cvsroot_get') && !$vars->{'newid'}; + $vars->{do_context} = $cvsbin && Bugzilla->params->{'cvsroot_get'} + && !$vars->{'newid'}; # Print everything out print $cgi->header(-type => 'text/html', @@ -591,9 +594,9 @@ sub setup_template_patch_reader "attachment/diff-file.$format.tmpl", "attachment/diff-footer.$format.tmpl", { %{$vars}, - bonsai_url => Param('bonsai_url'), - lxr_url => Param('lxr_url'), - lxr_root => Param('lxr_root'), + bonsai_url => Bugzilla->params->{'bonsai_url'}, + lxr_url => Bugzilla->params->{'lxr_url'}, + lxr_root => Bugzilla->params->{'lxr_root'}, })); } @@ -677,7 +680,9 @@ sub viewall my $privacy = ""; my $dbh = Bugzilla->dbh; - if (Param("insidergroup") && !(UserInGroup(Param("insidergroup")))) { + if ( Bugzilla->params->{"insidergroup"} + && !UserInGroup(Bugzilla->params->{"insidergroup"}) ) + { $privacy = "AND isprivate < 1 "; } my $attachments = $dbh->selectall_arrayref( @@ -1099,7 +1104,7 @@ sub delete_attachment { action => 'delete', object => 'attachment'}); - Param('allow_attachment_deletion') + Bugzilla->params->{'allow_attachment_deletion'} || ThrowUserError('attachment_deletion_disabled'); # Make sure the administrator is allowed to edit this attachment. diff --git a/buglist.cgi b/buglist.cgi index cb9dba663..0fcf13b88 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -632,7 +632,7 @@ if (trim($votes) && !grep($_ eq 'votes', @displaycolumns)) { # Remove the timetracking columns if they are not a part of the group # (happens if a user had access to time tracking and it was revoked/disabled) -if (!UserInGroup(Param("timetrackinggroup"))) { +if (!UserInGroup(Bugzilla->params->{"timetrackinggroup"})) { @displaycolumns = grep($_ ne 'estimated_time', @displaycolumns); @displaycolumns = grep($_ ne 'remaining_time', @displaycolumns); @displaycolumns = grep($_ ne 'actual_time', @displaycolumns); @@ -659,7 +659,7 @@ my @selectcolumns = ("bug_id", "bug_severity", "priority", "bug_status", "resolution"); # if using classification, we also need to look in product.classification_id -if (Param("useclassification")) { +if (Bugzilla->params->{"useclassification"}) { push (@selectcolumns,"product"); } @@ -1020,7 +1020,7 @@ $vars->{'caneditbugs'} = UserInGroup('editbugs'); my @bugowners = keys %$bugowners; if (scalar(@bugowners) > 1 && UserInGroup('editbugs')) { - my $suffix = Param('emailsuffix'); + my $suffix = Bugzilla->params->{'emailsuffix'}; map(s/$/$suffix/, @bugowners) if $suffix; my $bugowners = join(",", @bugowners); $vars->{'bugowners'} = $bugowners; @@ -1063,7 +1063,7 @@ if ($dotweak) { $vars->{'versions'} = [map($_->name ,@{$product->versions})]; $vars->{'components'} = [map($_->name, @{$product->components})]; $vars->{'targetmilestones'} = [map($_->name, @{$product->milestones})] - if Param('usetargetmilestone'); + if Bugzilla->params->{'usetargetmilestone'}; } } @@ -1118,7 +1118,7 @@ if ($serverpush) { # close the "please wait" page, then open the buglist page print $cgi->multipart_end(); my @extra; - push @extra, (-charset => "utf8") if Param("utf8"); + push @extra, (-charset => "utf8") if Bugzilla->params->{"utf8"}; print $cgi->multipart_start(-type => $contenttype, -content_disposition => $disposition, @extra); diff --git a/chart.cgi b/chart.cgi index 4bd83cc50..b40a8113e 100755 --- a/chart.cgi +++ b/chart.cgi @@ -90,8 +90,8 @@ if ($action eq "search") { my $user = Bugzilla->login(LOGIN_REQUIRED); -UserInGroup(Param("chartgroup")) - || ThrowUserError("auth_failure", {group => Param("chartgroup"), +UserInGroup(Bugzilla->params->{"chartgroup"}) + || ThrowUserError("auth_failure", {group => Bugzilla->params->{"chartgroup"}, action => "use", object => "charts"}); diff --git a/checksetup.pl b/checksetup.pl index cde371641..ba4efd0e4 100755 --- a/checksetup.pl +++ b/checksetup.pl @@ -1389,7 +1389,7 @@ if (@oldparams) { # if running on Windows and no third party sendmail wrapper # is available if ($^O =~ /MSWin32/i - && Param('mail_delivery_method') eq 'sendmail' + && Bugzilla->params->{'mail_delivery_method'} eq 'sendmail' && !-e SENDMAIL_EXE) { print "\nBugzilla requires an SMTP server to function on Windows.\n" . @@ -1670,7 +1670,7 @@ import Bugzilla::Bug qw(is_open_state); # Check for LDAP ########################################################################### -for my $verifymethod (split /,\s*/, Param('user_verify_class')) { +for my $verifymethod (split /,\s*/, Bugzilla->params->{'user_verify_class'}) { if ($verifymethod eq 'LDAP') { my $netLDAP = have_vers("Net::LDAP", 0); if (!$netLDAP && !$silent) { @@ -1688,12 +1688,12 @@ for my $verifymethod (split /,\s*/, Param('user_verify_class')) { # and that the generated images are accessible. # -if( Param('webdotbase') && Param('webdotbase') !~ /^https?:/ ) { +if( Bugzilla->params->{'webdotbase'} && Bugzilla->params->{'webdotbase'} !~ /^https?:/ ) { printf("Checking for %15s %-9s ", "GraphViz", "(any)") unless $silent; - if(-x Param('webdotbase')) { + if(-x Bugzilla->params->{'webdotbase'}) { print "ok: found\n" unless $silent; } else { - print "not a valid executable: " . Param('webdotbase') . "\n"; + print "not a valid executable: " . Bugzilla->params->{'webdotbase'} . "\n"; } # Check .htaccess allows access to generated images @@ -3413,7 +3413,7 @@ if ($dbh->bz_table_info("flagtypes")) { # # If group_control_map is empty, backward-compatibility # usebuggroups-equivalent records should be created. -my $entry = Param('useentrygroupdefault'); +my $entry = Bugzilla->params->{'useentrygroupdefault'}; $sth = $dbh->prepare("SELECT COUNT(*) FROM group_control_map"); $sth->execute(); my ($mapcnt) = $sth->fetchrow_array(); @@ -4088,7 +4088,7 @@ if (!exists $dbh->bz_column_info('whine_queries', 'title')->{DEFAULT}) { undef, "Other", "other"); $dbh->do('UPDATE bugs SET op_sys = ? WHERE op_sys = ?', undef, "Other", "other"); - if (Param('defaultopsys') eq 'other') { + if (Bugzilla->params->{'defaultopsys'} eq 'other') { # We can't actually fix the param here, because WriteParams() will # make $datadir/params unwriteable to the webservergroup. # It's too much of an ugly hack to copy the permission-fixing code @@ -4608,9 +4608,9 @@ if ($sth->rows == 0) { if (-e "$datadir/params") { require "$datadir/params"; # if they have a params file, use that } - if (Param('emailregexp')) { - $mailcheckexp = Param('emailregexp'); - $mailcheck = Param('emailregexpdesc'); + if (Bugzilla->params->{'emailregexp'}) { + $mailcheckexp = Bugzilla->params->{'emailregexp'}; + $mailcheck = Bugzilla->params->{'emailregexpdesc'}; } else { $mailcheckexp = '^[\\w\\.\\+\\-=]+@[\\w\\.\\-]+\\.[\\w\\-]+$'; $mailcheck = 'A legal address must contain exactly one \'@\', @@ -4805,7 +4805,7 @@ foreach my $item (@params) { last; } -if (Param('urlbase') eq $urlbase_default) { +if (Bugzilla->params->{'urlbase'} eq $urlbase_default) { print "Now that you have installed Bugzilla, you should visit the \n" . "'Parameters' page (linked in the footer of the Administrator \n" . "account) to ensure it is set up as you wish - this includes \n" . diff --git a/colchange.cgi b/colchange.cgi index 857b85063..6d737d5c7 100755 --- a/colchange.cgi +++ b/colchange.cgi @@ -45,33 +45,33 @@ my @masterlist = ("opendate", "changeddate", "bug_severity", "priority", "reporter", "reporter_realname", "bug_status", "resolution"); -if (Param("useclassification")) { +if (Bugzilla->params->{"useclassification"}) { push(@masterlist, "classification"); } push(@masterlist, ("product", "component", "version", "op_sys")); -if (Param("usevotes")) { +if (Bugzilla->params->{"usevotes"}) { push (@masterlist, "votes"); } -if (Param("usebugaliases")) { +if (Bugzilla->params->{"usebugaliases"}) { unshift(@masterlist, "alias"); } -if (Param("usetargetmilestone")) { +if (Bugzilla->params->{"usetargetmilestone"}) { push(@masterlist, "target_milestone"); } -if (Param("useqacontact")) { +if (Bugzilla->params->{"useqacontact"}) { push(@masterlist, "qa_contact"); push(@masterlist, "qa_contact_realname"); } -if (Param("usestatuswhiteboard")) { +if (Bugzilla->params->{"usestatuswhiteboard"}) { push(@masterlist, "status_whiteboard"); } if (Bugzilla::Keyword::keyword_count()) { push(@masterlist, "keywords"); } -if (UserInGroup(Param("timetrackinggroup"))) { +if (UserInGroup(Bugzilla->params->{"timetrackinggroup"})) { push(@masterlist, ("estimated_time", "remaining_time", "actual_time", "percentage_complete", "deadline")); } @@ -96,7 +96,7 @@ if (defined $cgi->param('rememberedquery')) { } } my $list = join(" ", @collist); - my $urlbase = Param("urlbase"); + my $urlbase = Bugzilla->params->{"urlbase"}; if ($list) { $cgi->send_cookie(-name => 'COLUMNLIST', diff --git a/config.cgi b/config.cgi index a50f3aaf6..3675a342f 100755 --- a/config.cgi +++ b/config.cgi @@ -42,7 +42,7 @@ my $user = Bugzilla->login(LOGIN_OPTIONAL); # If the 'requirelogin' parameter is on and the user is not # authenticated, return empty fields. -if (Param('requirelogin') && !$user->id) { +if (Bugzilla->params->{'requirelogin'} && !$user->id) { display_data(); } diff --git a/contrib/bug_email.pl b/contrib/bug_email.pl index 5f95e9272..3cb796b7e 100755 --- a/contrib/bug_email.pl +++ b/contrib/bug_email.pl @@ -38,7 +38,7 @@ # # You need to work with bug_email.pl the MIME::Parser installed. # -# $Id: bug_email.pl,v 1.42 2006/06/21 00:44:48 lpsolit%gmail.com Exp $ +# $Id: bug_email.pl,v 1.43 2006/07/03 21:26:22 mkanat%bugzilla.org Exp $ ############################################################### # 02/12/2000 (SML) @@ -274,12 +274,12 @@ sub CheckPriority my $Text = "You sent wrong priority-setting, valid values are:" . join( "\n\t", @$all_prios ) . "\n\n"; $Text .= "* The priority is set to the default value ". - Param('defaultpriority') . "\n"; + Bugzilla->params->{'defaultpriority'} . "\n"; BugMailError( 0, $Text ); # set default value from param-file - $Control{'priority'} = Param( 'defaultpriority' ); + $Control{'priority'} = Bugzilla->params->{ 'defaultpriority' }; } else { # Nothing to do } @@ -767,7 +767,7 @@ if (! CheckPermissions("CreateBugs", $SenderShort ) ) { } # Set QA -if (Param("useqacontact")) { +if (Bugzilla->params->{"useqacontact"}) { if (defined($Control{'qa_contact'}) && $Control{'qa_contact'} !~ /^\s*$/ ) { $Control{'qa_contact'} = DBname_to_id($Control{'qa_contact'}); diff --git a/contrib/sendbugmail.pl b/contrib/sendbugmail.pl index bcc01666c..8537f66ce 100644 --- a/contrib/sendbugmail.pl +++ b/contrib/sendbugmail.pl @@ -4,7 +4,7 @@ # # Nick Barnes, Ravenbrook Limited, 2004-04-01. # -# $Id: sendbugmail.pl,v 1.5 2006/06/21 00:44:48 lpsolit%gmail.com Exp $ +# $Id: sendbugmail.pl,v 1.6 2006/07/03 21:26:22 mkanat%bugzilla.org Exp $ # # Bugzilla email script for Bugzilla 2.17.4 and later. Invoke this to send # bugmail for a bug which has been changed directly in the database. @@ -54,7 +54,7 @@ if (!$id) { } # Validate the changer address. -my $match = Param('emailregexp'); +my $match = Bugzilla->params->{'emailregexp'}; if ($changer !~ /$match/) { print STDERR "Changer \"$changer\" doesn't match email regular expression.\n"; usage(); diff --git a/contrib/syncLDAP.pl b/contrib/syncLDAP.pl index b3ca80705..4ddabacea 100755 --- a/contrib/syncLDAP.pl +++ b/contrib/syncLDAP.pl @@ -92,7 +92,7 @@ foreach my $login_name (keys %$bugzilla_users) { ### # Get current LDAP users ### -my $LDAPserver = Param("LDAPserver"); +my $LDAPserver = Bugzilla->params->{"LDAPserver"}; if ($LDAPserver eq "") { print "No LDAP server defined in bugzilla preferences.\n"; exit; @@ -108,8 +108,8 @@ if(!$LDAPconn) { exit; } my $mesg; -if (Param("LDAPbinddn")) { - my ($LDAPbinddn,$LDAPbindpass) = split(":",Param("LDAPbinddn")); +if (Bugzilla->params->{"LDAPbinddn"}) { + my ($LDAPbinddn,$LDAPbindpass) = split(":",Bugzilla->params->{"LDAPbinddn"}); $mesg = $LDAPconn->bind($LDAPbinddn, password => $LDAPbindpass); } else { @@ -121,9 +121,9 @@ if($mesg->code) { } # We've got our anonymous bind; let's look up the users. -$mesg = $LDAPconn->search( base => Param("LDAPBaseDN"), +$mesg = $LDAPconn->search( base => Bugzilla->params->{"LDAPBaseDN"}, scope => "sub", - filter => '(&(' . Param("LDAPuidattribute") . "=*)" . Param("LDAPfilter") . ')', + filter => '(&(' . Bugzilla->params->{"LDAPuidattribute"} . "=*)" . Bugzilla->params->{"LDAPfilter"} . ')', ); @@ -136,7 +136,7 @@ my $val = $mesg->as_struct; while( my ($key, $value) = each(%$val) ) { - my $login_name = @$value{Param("LDAPmailattribute")}; + my $login_name = @$value{Bugzilla->params->{"LDAPmailattribute"}}; my $realname = @$value{"cn"}; # no mail entered? go to next @@ -147,7 +147,7 @@ while( my ($key, $value) = each(%$val) ) { # no cn entered? use uid instead if(! defined $realname) { - $realname = @$value{Param("LDAPuidattribute")}; + $realname = @$value{Bugzilla->params->{"LDAPuidattribute"}}; } my $login = shift @$login_name; diff --git a/createaccount.cgi b/createaccount.cgi index 980b5986a..a0f1ed2c3 100755 --- a/createaccount.cgi +++ b/createaccount.cgi @@ -53,7 +53,7 @@ unless (Bugzilla->user->authorizer->user_can_create_account) { ThrowUserError("auth_cant_create_account"); } -my $createexp = Param('createemailregexp'); +my $createexp = Bugzilla->params->{'createemailregexp'}; unless ($createexp) { ThrowUserError("account_creation_disabled"); } diff --git a/duplicates.cgi b/duplicates.cgi index 6b839165b..1de3fe15c 100755 --- a/duplicates.cgi +++ b/duplicates.cgi @@ -132,7 +132,7 @@ if (!tie(%dbmcount, 'AnyDBM_File', "$datadir/duplicates/dupes$today", # Remove all those dupes under the threshold parameter. # We do this, before the sorting, for performance reasons. -my $threshold = Param("mostfreqthreshold"); +my $threshold = Bugzilla->params->{"mostfreqthreshold"}; while (my ($key, $value) = each %count) { delete $count{$key} if ($value < $threshold); diff --git a/editclassifications.cgi b/editclassifications.cgi index e23f32b7e..23ac30d37 100755 --- a/editclassifications.cgi +++ b/editclassifications.cgi @@ -59,7 +59,8 @@ exists Bugzilla->user->groups->{'editclassifications'} action => "edit", object => "classifications"}); -ThrowUserError("auth_classification_not_enabled") unless Param("useclassification"); +ThrowUserError("auth_classification_not_enabled") + unless Bugzilla->params->{"useclassification"}; # # often used variables diff --git a/editcomponents.cgi b/editcomponents.cgi index 225e7ae91..244e83e55 100755 --- a/editcomponents.cgi +++ b/editcomponents.cgi @@ -159,7 +159,7 @@ if ($action eq 'new') { {name => $comp_name}); my $default_assignee_id = login_to_id($default_assignee); - my $default_qa_contact_id = Param('useqacontact') ? + my $default_qa_contact_id = Bugzilla->params->{'useqacontact'} ? (login_to_id($default_qa_contact) || undef) : undef; trick_taint($comp_name); @@ -251,7 +251,7 @@ if ($action eq 'delete') { Bugzilla::Component::check_component($product, $comp_name); if ($component->bug_count) { - if (Param("allowbugdeletion")) { + if (Bugzilla->params->{"allowbugdeletion"}) { foreach my $bug_id (@{$component->bug_ids}) { my $bug = new Bugzilla::Bug($bug_id, $whoid); $bug->remove_from_db(); @@ -380,7 +380,7 @@ if ($action eq 'update') { $vars->{'updated_initialowner'} = 1; } - if (Param('useqacontact') + if (Bugzilla->params->{'useqacontact'} && $default_qa_contact ne $component_old->default_qa_contact->login) { $dbh->do("UPDATE components SET initialqacontact = ? WHERE id = ?", undef, diff --git a/editgroups.cgi b/editgroups.cgi index 7bc712b68..f511a68a6 100755 --- a/editgroups.cgi +++ b/editgroups.cgi @@ -342,7 +342,7 @@ if ($action eq 'del') { # Groups having a special role cannot be deleted. my @special_groups; foreach my $special_group ('chartgroup', 'insidergroup', 'timetrackinggroup') { - if ($name eq Param($special_group)) { + if ($name eq Bugzilla->params->{$special_group}) { push(@special_groups, $special_group); } } @@ -406,7 +406,7 @@ if ($action eq 'delete') { # Groups having a special role cannot be deleted. my @special_groups; foreach my $special_group ('chartgroup', 'insidergroup', 'timetrackinggroup') { - if ($name eq Param($special_group)) { + if ($name eq Bugzilla->params->{$special_group}) { push(@special_groups, $special_group); } } @@ -625,7 +625,7 @@ sub doGroupChanges { # these parameters too. my $update_params = 0; foreach my $group ('chartgroup', 'insidergroup', 'timetrackinggroup') { - if ($cgi->param('oldname') eq Param($group)) { + if ($cgi->param('oldname') eq Bugzilla->params->{$group}) { SetParam($group, $name); $update_params = 1; } @@ -690,7 +690,7 @@ sub doGroupChanges { } my $cansee = $cgi->param("cansee-$v") || 0; - if (Param("usevisibilitygroups") + if (Bugzilla->params->{"usevisibilitygroups"} && ($cgi->param("oldcansee-$v") != $cansee)) { $chgs = 1; if ($cansee != 0) { diff --git a/editparams.cgi b/editparams.cgi index f8c12f581..27db4654f 100755 --- a/editparams.cgi +++ b/editparams.cgi @@ -89,7 +89,7 @@ if ($action eq 'save' && $current_module) { my $changed; if ($i->{'type'} eq 'm') { - my @old = sort @{Param($name)}; + my @old = sort @{Bugzilla->params->{$name}}; my @new = sort @$value; if (scalar(@old) != scalar(@new)) { $changed = 1; @@ -104,7 +104,7 @@ if ($action eq 'save' && $current_module) { } } } else { - $changed = ($value eq Param($name))? 0 : 1; + $changed = ($value eq Bugzilla->params->{$name})? 0 : 1; } if ($changed) { diff --git a/editproducts.cgi b/editproducts.cgi index a3c5221b5..8a0dd5fe8 100755 --- a/editproducts.cgi +++ b/editproducts.cgi @@ -81,7 +81,7 @@ my $showbugcounts = (defined $cgi->param('showbugcounts')); # classifications enabled) # -if (Param('useclassification') +if (Bugzilla->params->{'useclassification'} && !$classification_name && !$product_name) { @@ -101,7 +101,7 @@ if (Param('useclassification') if (!$action && !$product_name) { my $products; - if (Param('useclassification')) { + if (Bugzilla->params->{'useclassification'}) { my $classification = Bugzilla::Classification::check_classification($classification_name); @@ -130,7 +130,7 @@ if (!$action && !$product_name) { if ($action eq 'add') { - if (Param('useclassification')) { + if (Bugzilla->params->{'useclassification'}) { my $classification = Bugzilla::Classification::check_classification($classification_name); $vars->{'classification'} = $classification; @@ -151,7 +151,7 @@ if ($action eq 'new') { # Cleanups and validity checks my $classification_id = 1; - if (Param('useclassification')) { + if (Bugzilla->params->{'useclassification'}) { my $classification = Bugzilla::Classification::check_classification($classification_name); $classification_id = $classification->id; @@ -232,7 +232,7 @@ if ($action eq 'new') { # If we're using bug groups, then we need to create a group for this # product as well. -JMR, 2/16/00 - if (Param("makeproductgroups")) { + if (Bugzilla->params->{"makeproductgroups"}) { # Next we insert into the groups table my $productgroup = $product->name; while (new Bugzilla::Group({name => $productgroup})) { @@ -265,7 +265,8 @@ if ($action eq 'new') { (group_id, product_id, entry, membercontrol, othercontrol, canedit) VALUES (?, ?, ?, ?, ?, ?)', - undef, ($gid, $product->id, Param('useentrygroupdefault'), + undef, ($gid, $product->id, + Bugzilla->params->{'useentrygroupdefault'}, CONTROLMAPDEFAULT, CONTROLMAPNA, 0)); } @@ -328,7 +329,7 @@ if ($action eq 'del') { $user->can_see_product($product->name) || ThrowUserError('product_access_denied', {product => $product->name}); - if (Param('useclassification')) { + if (Bugzilla->params->{'useclassification'}) { my $classification = Bugzilla::Classification::check_classification($classification_name); if ($classification->id != $product->classification_id) { @@ -360,7 +361,7 @@ if ($action eq 'delete') { $vars->{'product'} = $product; - if (Param('useclassification')) { + if (Bugzilla->params->{'useclassification'}) { my $classification = Bugzilla::Classification::check_classification($classification_name); if ($classification->id != $product->classification_id) { @@ -372,7 +373,7 @@ if ($action eq 'delete') { } if ($product->bug_count) { - if (Param("allowbugdeletion")) { + if (Bugzilla->params->{"allowbugdeletion"}) { foreach my $bug_id (@{$product->bug_ids}) { my $bug = new Bugzilla::Bug($bug_id, $whoid); $bug->remove_from_db(); @@ -432,7 +433,7 @@ if ($action eq 'edit' || (!$action && $product_name)) { $user->can_see_product($product->name) || ThrowUserError('product_access_denied', {product => $product->name}); - if (Param('useclassification')) { + if (Bugzilla->params->{'useclassification'}) { my $classification; if (!$classification_name) { $classification = @@ -755,7 +756,7 @@ if ($action eq 'update') { $user->can_see_product($product_old->name) || ThrowUserError('product_access_denied', {product => $product_old->name}); - if (Param('useclassification')) { + if (Bugzilla->params->{'useclassification'}) { my $classification; if (!$classification_name) { $classification = @@ -811,7 +812,7 @@ if ($action eq 'update') { } # Only update milestone related stuff if 'usetargetmilestone' is on. - if (Param('usetargetmilestone')) { + if (Bugzilla->params->{'usetargetmilestone'}) { my $milestone = new Bugzilla::Milestone($product_old->id, $defaultmilestone); diff --git a/editusers.cgi b/editusers.cgi index 6912032f6..42a7d6e3a 100755 --- a/editusers.cgi +++ b/editusers.cgi @@ -88,7 +88,7 @@ if ($action eq 'search') { $group || ThrowUserError('invalid_group_ID'); } - if (!$editusers && Param('usevisibilitygroups')) { + if (!$editusers && Bugzilla->params->{'usevisibilitygroups'}) { # Show only users in visible groups. $visibleGroups = $user->visible_groups_as_string(); @@ -426,7 +426,8 @@ if ($action eq 'search') { my $otherUser = check_user($otherUserID, $otherUserLogin); $otherUserID = $otherUser->id; - Param('allowuserdeletion') || ThrowUserError('users_deletion_disabled'); + Bugzilla->params->{'allowuserdeletion'} + || ThrowUserError('users_deletion_disabled'); $editusers || ThrowUserError('auth_failure', {group => "editusers", action => "delete", object => "users"}); @@ -534,7 +535,7 @@ if ($action eq 'search') { 'whine_queries WRITE', 'whine_events WRITE'); - Param('allowuserdeletion') + Bugzilla->params->{'allowuserdeletion'} || ThrowUserError('users_deletion_disabled'); $editusers || ThrowUserError('auth_failure', {group => "editusers", diff --git a/editvalues.cgi b/editvalues.cgi index 68cd6917a..c812c6c87 100755 --- a/editvalues.cgi +++ b/editvalues.cgi @@ -156,7 +156,7 @@ unless ($action) { {Slice =>{}}); $vars->{'field'} = $field; $vars->{'values'} = $fieldvalues; - $vars->{'default'} = Param($defaults{$field}); + $vars->{'default'} = Bugzilla->params->{$defaults{$field}}; $template->process("admin/fieldvalues/list.html.tmpl", $vars) || ThrowTemplateError($template->error()); @@ -258,7 +258,7 @@ if ($action eq 'del') { # if ($action eq 'delete') { ValueMustExist($field, $value); - if ($value eq Param($defaults{$field})) { + if ($value eq Bugzilla->params->{$defaults{$field}}) { ThrowUserError('fieldvalue_is_default', {field => $field, value => $value, param_name => $defaults{$field}}) @@ -381,7 +381,7 @@ if ($action eq 'update') { # This update is done while tables are unlocked due to the # annoying calls in Bugzilla/Config/Common.pm. if ($value ne $valueold - && $valueold eq Param($defaults{$field})) + && $valueold eq Bugzilla->params->{$defaults{$field}}) { SetParam($defaults{$field}, $value); WriteParams(); diff --git a/editwhines.cgi b/editwhines.cgi index c4a1cae51..282b66ddb 100755 --- a/editwhines.cgi +++ b/editwhines.cgi @@ -237,7 +237,7 @@ if ($cgi->param('update')) { if ($can_mail_others && $mailto) { if ($mailto_type == MAILTO_USER) { # detaint - my $emailregexp = Param('emailregexp'); + my $emailregexp = Bugzilla->params->{'emailregexp'}; if ($mailto =~ /($emailregexp)/) { $mailto_id = login_to_id($1); } diff --git a/enter_bug.cgi b/enter_bug.cgi index 43b413431..929e690c8 100755 --- a/enter_bug.cgi +++ b/enter_bug.cgi @@ -70,7 +70,7 @@ if ($product_name eq '') { my @enterable_products = @{$user->get_enterable_products}; ThrowUserError('no_products') unless scalar(@enterable_products); - my $classification = Param('useclassification') ? + my $classification = Bugzilla->params->{'useclassification'} ? scalar($cgi->param('classification')) : '__all'; unless ($classification) { @@ -170,8 +170,8 @@ sub pickplatform { my @platform; - if (Param('defaultplatform')) { - @platform = Param('defaultplatform'); + if (Bugzilla->params->{'defaultplatform'}) { + @platform = Bugzilla->params->{'defaultplatform'}; } else { # If @platform is a list, this function will return the first # item in the list that is a valid platform choice. If @@ -228,8 +228,8 @@ sub pickos { my @os; - if (Param('defaultopsys')) { - @os = Param('defaultopsys'); + if (Bugzilla->params->{'defaultopsys'}) { + @os = Bugzilla->params->{'defaultopsys'}; } else { # This function will return the first # item in @os that is a valid platform choice. If @@ -367,8 +367,8 @@ if ($cloned_bug_id) { $vars->{'commentprivacy'} = 0; if ( !($isprivate) || - ( ( Param("insidergroup") ) && - ( UserInGroup(Param("insidergroup")) ) ) + ( ( Bugzilla->params->{"insidergroup"} ) && + ( UserInGroup(Bugzilla->params->{"insidergroup"}) ) ) ) { $vars->{'comment'} = $cloned_bug->{'longdescs'}->[0]->{'body'}; $vars->{'commentprivacy'} = $isprivate; @@ -382,8 +382,8 @@ if ($cloned_bug_id) { else { $default{'component_'} = formvalue('component'); - $default{'priority'} = formvalue('priority', Param('defaultpriority')); - $default{'bug_severity'} = formvalue('bug_severity', Param('defaultseverity')); + $default{'priority'} = formvalue('priority', Bugzilla->params->{'defaultpriority'}); + $default{'bug_severity'} = formvalue('bug_severity', Bugzilla->params->{'defaultseverity'}); $default{'rep_platform'} = pickplatform(); $default{'op_sys'} = pickos(); @@ -430,7 +430,7 @@ if ( ($cloned_bug_id) && } # Get list of milestones. -if ( Param('usetargetmilestone') ) { +if ( Bugzilla->params->{'usetargetmilestone'} ) { $vars->{'target_milestone'} = [map($_->name, @{$product->milestones})]; if (formvalue('target_milestone')) { $default{'target_milestone'} = formvalue('target_milestone'); diff --git a/importxml.pl b/importxml.pl index 059adb437..263508b37 100755 --- a/importxml.pl +++ b/importxml.pl @@ -120,6 +120,7 @@ our @attachments; our $bugtotal; my $xml; my $dbh = Bugzilla->dbh; +my $params = Bugzilla->params; my ($timestamp) = $dbh->selectrow_array("SELECT NOW()"); ############################################################################### @@ -131,7 +132,7 @@ sub MailMessage { my $subject = shift; my $message = shift; my @recipients = @_; - my $from = Param("moved-from-address"); + my $from = $params->{"moved-from-address"}; $from =~ s/@/\@/g; foreach my $to (@recipients){ @@ -158,8 +159,8 @@ sub Error { my $subject = "Bug import error: $reason"; my $message = "Cannot import these bugs because $reason "; $message .= "\n\nPlease re-open the original bug.\n" if ($errtype); - $message .= "For more info, contact " . Param("maintainer") . ".\n"; - my @to = ( Param("maintainer"), $exporter); + $message .= "For more info, contact " . $params->{"maintainer"} . ".\n"; + my @to = ( $params->{"maintainer"}, $exporter); Debug( $message, ERR_LEVEL ); MailMessage( $subject, $message, @to ); exit; @@ -315,23 +316,23 @@ sub init() { } Error( "no maintainer", "REOPEN", $exporter ) unless ($maintainer); Error( "no exporter", "REOPEN", $exporter ) unless ($exporter); - Error( "bug importing is disabled here", undef, $exporter ) unless ( Param("move-enabled") ); + Error( "bug importing is disabled here", undef, $exporter ) unless ( $params->{"move-enabled"} ); Error( "invalid exporter: $exporter", "REOPEN", $exporter ) if ( !login_to_id($exporter) ); Error( "no urlbase set", "REOPEN", $exporter ) unless ($urlbase); my $def_product = - new Bugzilla::Product( { name => Param("moved-default-product") } ) + new Bugzilla::Product( { name => $params->{"moved-default-product"} } ) || Error("Cannot import these bugs because an invalid default product was defined for the target db." - . Param("maintainer") . " needs to fix the definitions of + . $params->{"maintainer"} . " needs to fix the definitions of moved-default-product. \n", "REOPEN", $exporter); my $def_component = new Bugzilla::Component( { product_id => $def_product->id, - name => Param("moved-default-component") + name => $params->{"moved-default-component"} }) || Error("Cannot import these bugs because an invalid default component was defined for the target db." - . Param("maintainer") . " needs to fix the definitions of + . $params->{"maintainer"} . " needs to fix the definitions of moved-default-component.\n", "REOPEN", $exporter); } @@ -487,7 +488,7 @@ sub process_bug { $long_desc{'isprivate'} = $comment->{'att'}->{'isprivate'} || 0; # if one of the comments is private we need to set this flag - if ( $long_desc{'isprivate'} && $exporter->in_group(Param('insidergroup'))) { + if ( $long_desc{'isprivate'} && $exporter->in_group($params->{'insidergroup'})) { $private = 1; } my $data = $comment->field('thetext'); @@ -545,7 +546,7 @@ sub process_bug { $comments .= "\n\n--- Bug imported by $exporter_login "; $comments .= time2str( "%Y-%m-%d %H:%M", time ) . " "; - $comments .= Param('timezone'); + $comments .= $params->{'timezone'}; $comments .= " ---\n\n"; $comments .= "This bug was previously known as _bug_ $bug_fields{'bug_id'} at "; $comments .= $urlbase . "show_bug.cgi?id=" . $bug_fields{'bug_id'} . "\n"; @@ -609,11 +610,11 @@ sub process_bug { # Product and Component if there is no valid default product and # component defined in the parameters, we wouldn't be here my $def_product = - new Bugzilla::Product( { name => Param("moved-default-product") } ); + new Bugzilla::Product( { name => $params->{"moved-default-product"} } ); my $def_component = new Bugzilla::Component( { product_id => $def_product->id, - name => Param("moved-default-component") + name => $params->{"moved-default-component"} } ); my $product; @@ -681,7 +682,7 @@ sub process_bug { } # Milestone - if ( Param("usetargetmilestone") ) { + if ( $params->{"usetargetmilestone"} ) { my $milestone = new Bugzilla::Milestone( $product->id, $bug_fields{'target_milestone'} ); @@ -710,13 +711,13 @@ sub process_bug { push( @values, $bug_fields{'bug_severity'} ); } else { - push( @values, Param('defaultseverity') ); + push( @values, $params->{'defaultseverity'} ); $err .= "Unknown severity "; $err .= ( defined $bug_fields{'bug_severity'} ) ? $bug_fields{'bug_severity'} : "unknown"; $err .= ". Setting to default severity \""; - $err .= Param('defaultseverity') . "\".\n"; + $err .= $params->{'defaultseverity'} . "\".\n"; } push( @query, "bug_severity" ); @@ -727,13 +728,13 @@ sub process_bug { push( @values, $bug_fields{'priority'} ); } else { - push( @values, Param('defaultpriority') ); + push( @values, $params->{'defaultpriority'} ); $err .= "Unknown priority "; $err .= ( defined $bug_fields{'priority'} ) ? $bug_fields{'priority'} : "unknown"; $err .= ". Setting to default priority \""; - $err .= Param('defaultpriority') . "\".\n"; + $err .= $params->{'defaultpriority'} . "\".\n"; } push( @query, "priority" ); @@ -744,13 +745,13 @@ sub process_bug { push( @values, $bug_fields{'rep_platform'} ); } else { - push( @values, Param('defaultplatform') ); + push( @values, $params->{'defaultplatform'} ); $err .= "Unknown platform "; $err .= ( defined $bug_fields{'rep_platform'} ) ? $bug_fields{'rep_platform'} : "unknown"; $err .=". Setting to default platform \""; - $err .= Param('defaultplatform') . "\".\n"; + $err .= $params->{'defaultplatform'} . "\".\n"; } push( @query, "rep_platform" ); @@ -761,17 +762,17 @@ sub process_bug { push( @values, $bug_fields{'op_sys'} ); } else { - push( @values, Param('defaultopsys') ); + push( @values, $params->{'defaultopsys'} ); $err .= "Unknown operating system "; $err .= ( defined $bug_fields{'op_sys'} ) ? $bug_fields{'op_sys'} : "unknown"; - $err .= ". Setting to default OS \"" . Param('defaultopsys') . "\".\n"; + $err .= ". Setting to default OS \"" . $params->{'defaultopsys'} . "\".\n"; } push( @query, "op_sys" ); # Process time fields - if ( Param("timetrackinggroup") ) { + if ( $params->{"timetrackinggroup"} ) { my $date = format_time( $bug_fields{'deadline'}, "%Y-%m-%d" ) || undef; push( @values, $date ); @@ -841,7 +842,7 @@ sub process_bug { } } - if ( Param("useqacontact") ) { + if ( $params->{"useqacontact"} ) { my $qa_contact; push( @query, "qa_contact" ); if ( ( defined $bug_fields{'qa_contact'}) @@ -1079,7 +1080,7 @@ sub process_bug { $err .= "No attachment ID specified, dropping attachment\n"; next; } - if (!$exporter->in_group(Param('insidergroup')) && $att->{'isprivate'}){ + if (!$exporter->in_group($params->{'insidergroup'}) && $att->{'isprivate'}){ $err .= "Exporter not in insidergroup and attachment marked private.\n"; $err .= " Marking attachment public\n"; $att->{'isprivate'} = 0; @@ -1118,7 +1119,7 @@ sub process_bug { # Insert longdesc and append any errors my $worktime = $bug_fields{'actual_time'} || 0.0; - $worktime = 0.0 if (!$exporter->in_group(Param('timetrackinggroup'))); + $worktime = 0.0 if (!$exporter->in_group($params->{'timetrackinggroup'})); $long_description .= "\n" . $comments; if ($err) { $long_description .= "\n$err\n"; @@ -1142,7 +1143,7 @@ sub process_bug { $log .= "Bug ${urlbase}show_bug.cgi?id=$bug_fields{'bug_id'} "; $log .= "imported as bug $id.\n"; - $log .= Param("urlbase") . "show_bug.cgi?id=$id\n\n"; + $log .= $params->{"urlbase"} . "show_bug.cgi?id=$id\n\n"; if ($err) { $log .= "The following problems were encountered while creating bug $id.\n"; $log .= $err; @@ -1193,7 +1194,7 @@ my $urlbase = $root->{'att'}->{'urlbase'}; my $log = join("\n\n", @logs); $log .= "\n\nImported $bugtotal bug(s) from $urlbase,\n sent by $exporter.\n"; my $subject = "$bugtotal Bug(s) successfully moved from $urlbase to " - . Param("urlbase"); + . $params->{"urlbase"}; my @to = ($exporter, $maintainer); MailMessage( $subject, $log, @to ); diff --git a/index.cgi b/index.cgi index 42dfb8dde..3a591a32c 100755 --- a/index.cgi +++ b/index.cgi @@ -45,10 +45,10 @@ my $user = Bugzilla->login(LOGIN_OPTIONAL); ############################################################################### my $cgi = Bugzilla->cgi; -# Force to use HTTPS unless Param('ssl') equals 'never'. +# Force to use HTTPS unless Bugzilla->params->{'ssl'} equals 'never'. # This is required because the user may want to log in from here. -if (Param('sslbase') ne '' and Param('ssl') ne 'never') { - $cgi->require_https(Param('sslbase')); +if (Bugzilla->params->{'sslbase'} ne '' and Bugzilla->params->{'ssl'} ne 'never') { + $cgi->require_https(Bugzilla->params->{'sslbase'}); } my $template = Bugzilla->template; diff --git a/post_bug.cgi b/post_bug.cgi index cf92216be..702ff96a4 100755 --- a/post_bug.cgi +++ b/post_bug.cgi @@ -156,7 +156,7 @@ if (!defined $cgi->param('short_desc') # Check that if required a description has been provided # This has to go somewhere after 'maketemplate' # or it breaks bookmarks with no comments. -if (Param("commentoncreate") && !trim($cgi->param('comment'))) { +if (Bugzilla->params->{"commentoncreate"} && !trim($cgi->param('comment'))) { ThrowUserError("description_required"); } @@ -181,7 +181,7 @@ my @bug_fields = ("version", "rep_platform", "bug_status", "everconfirmed", "bug_file_loc", "short_desc", "target_milestone", "status_whiteboard"); -if (Param("usebugaliases")) { +if (Bugzilla->params->{"usebugaliases"}) { my $alias = trim($cgi->param('alias') || ""); if ($alias ne "") { ValidateBugAlias($alias); @@ -191,7 +191,7 @@ if (Param("usebugaliases")) { } # Retrieve the default QA contact if the field is empty -if (Param("useqacontact")) { +if (Bugzilla->params->{"useqacontact"}) { my $qa_contact; if (!UserInGroup("editbugs") || !defined $cgi->param('qa_contact') || trim($cgi->param('qa_contact')) eq "") { @@ -235,8 +235,8 @@ if (!defined $cgi->param('target_milestone')) { $cgi->param(-name => 'target_milestone', -value => $defaultmilestone); } -if (!Param('letsubmitterchoosepriority')) { - $cgi->param(-name => 'priority', -value => Param('defaultpriority')); +if (!Bugzilla->params->{'letsubmitterchoosepriority'}) { + $cgi->param(-name => 'priority', -value => Bugzilla->params->{'defaultpriority'}); } # Some more sanity checking @@ -305,11 +305,11 @@ if ($cgi->param('keywords') && UserInGroup("editbugs")) { } } -if (Param("strict_isolation")) { +if (Bugzilla->params->{"strict_isolation"}) { my @blocked_users = (); my %related_users = %ccids; $related_users{$cgi->param('assigned_to')} = 1; - if (Param('useqacontact') && $cgi->param('qa_contact')) { + if (Bugzilla->params->{'useqacontact'} && $cgi->param('qa_contact')) { $related_users{$cgi->param('qa_contact')} = 1; } foreach my $pid (keys %related_users) { @@ -382,7 +382,7 @@ my $est_time = 0; my $deadline; # Time Tracking -if (UserInGroup(Param("timetrackinggroup")) && +if (UserInGroup(Bugzilla->params->{"timetrackinggroup"}) && defined $cgi->param('estimated_time')) { $est_time = $cgi->param('estimated_time'); @@ -393,7 +393,9 @@ if (UserInGroup(Param("timetrackinggroup")) && push (@fields_values, $est_time, $est_time); -if ((UserInGroup(Param("timetrackinggroup"))) && ($cgi->param('deadline'))) { +if ( UserInGroup(Bugzilla->params->{"timetrackinggroup"}) + && $cgi->param('deadline') ) +{ validate_date($cgi->param('deadline')) || ThrowUserError('illegal_date', {date => $cgi->param('deadline'), format => 'YYYY-MM-DD'}); @@ -481,7 +483,9 @@ foreach my $grouptoadd (@groupstoadd) { # Add the initial comment, allowing for the fact that it may be private my $privacy = 0; -if (Param("insidergroup") && UserInGroup(Param("insidergroup"))) { +if (Bugzilla->params->{"insidergroup"} + && UserInGroup(Bugzilla->params->{"insidergroup"})) +{ $privacy = $cgi->param('commentprivacy') ? 1 : 0; } diff --git a/process_bug.cgi b/process_bug.cgi index 37eb085f6..ec2e8f5fd 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -160,7 +160,7 @@ foreach my $field ("estimated_time", "work_time", "remaining_time") { } } -if (UserInGroup(Param('timetrackinggroup'))) { +if (UserInGroup(Bugzilla->params->{'timetrackinggroup'})) { my $wk_time = $cgi->param('work_time'); if ($cgi->param('comment') =~ /^\s*$/ && $wk_time && $wk_time != 0) { ThrowUserError('comment_required'); @@ -190,7 +190,7 @@ foreach my $field ("dependson", "blocked") { # ValidateBugID is called without $field here so that it will # throw an error if any of the changed bugs are not visible. ValidateBugID($id); - if (Param("strict_isolation")) { + if (Bugzilla->params->{"strict_isolation"}) { my $deltabug = new Bugzilla::Bug($id, $user->id); if (!$user->can_edit_product($deltabug->{'product_id'})) { $vars->{'field'} = $field; @@ -272,7 +272,7 @@ sub CheckonComment { my ($function) = (@_); # Param is 1 if comment should be added ! - my $ret = Param( "commenton" . $function ); + my $ret = Bugzilla->params->{ "commenton" . $function }; # Allow without comment in case of undefined Params. $ret = 0 unless ( defined( $ret )); @@ -354,7 +354,7 @@ if (((defined $cgi->param('id') && $cgi->param('product') ne $oldproduct) my $mok = 1; # so it won't affect the 'if' statement if milestones aren't used my @milestone_names = (); - if ( Param("usetargetmilestone") ) { + if ( Bugzilla->params->{"usetargetmilestone"} ) { defined($cgi->param('target_milestone')) || ThrowCodeError('undefined_field', { field => 'target_milestone' }); @@ -382,7 +382,7 @@ if (((defined $cgi->param('id') && $cgi->param('product') ne $oldproduct) if ($cok) { $defaults{'component'} = $cgi->param('component'); } - if (Param("usetargetmilestone")) { + if (Bugzilla->params->{"usetargetmilestone"}) { $vars->{'use_target_milestone'} = 1; $vars->{'milestones'} = \@milestone_names; if ($mok) { @@ -464,7 +464,7 @@ if (defined $cgi->param('id')) { [map($_->name, @{$prod_obj->components})]); check_field('version', scalar $cgi->param('version'), [map($_->name, @{$prod_obj->versions})]); - if ( Param("usetargetmilestone") ) { + if ( Bugzilla->params->{"usetargetmilestone"} ) { check_field('target_milestone', scalar $cgi->param('target_milestone'), [map($_->name, @{$prod_obj->milestones})]); } @@ -487,8 +487,8 @@ if (defined $cgi->param('id')) { my $action = trim($cgi->param('action') || ''); -if ($action eq Param('move-button-text')) { - Param('move-enabled') || ThrowUserError("move_bugs_disabled"); +if ($action eq Bugzilla->params->{'move-button-text'}) { + Bugzilla->params->{'move-enabled'} || ThrowUserError("move_bugs_disabled"); $user->is_mover || ThrowUserError("auth_failure", {action => 'move', object => 'bugs'}); @@ -506,7 +506,7 @@ if ($action eq Param('move-button-text')) { if (defined $cgi->param('comment') && $cgi->param('comment') !~ /^\s*$/) { $comment = $cgi->param('comment') . "\n\n"; } - $comment .= "Bug moved to " . Param('move-to-url') . ".\n\n"; + $comment .= "Bug moved to " . Bugzilla->params->{'move-to-url'} . ".\n\n"; $comment .= "If the move succeeded, " . $user->login . " will receive a mail\n"; $comment .= "containing the number of the new bug in the other database.\n"; $comment .= "If all went well, please mark this bug verified, and paste\n"; @@ -553,9 +553,9 @@ if ($action eq Param('move-button-text')) { $vars->{'header_done'} = 1; } # Prepare and send all data about these bugs to the new database - my $to = Param('move-to-address'); + my $to = Bugzilla->params->{'move-to-address'}; $to =~ s/@/\@/; - my $from = Param('moved-from-address'); + my $from = Bugzilla->params->{'moved-from-address'}; $from =~ s/@/\@/; my $msg = "To: $to\n"; $msg .= "From: Bugzilla <" . $from . ">\n"; @@ -591,7 +591,7 @@ my @values; umask(0); sub _remove_remaining_time { - if (UserInGroup(Param('timetrackinggroup'))) { + if (UserInGroup(Bugzilla->params->{'timetrackinggroup'})) { if ( defined $cgi->param('remaining_time') && $cgi->param('remaining_time') > 0 ) { @@ -817,7 +817,7 @@ if ($cgi->param('component') ne $cgi->param('dontchange')) { # If this installation uses bug aliases, and the user is changing the alias, # add this change to the query. -if (Param("usebugaliases") && defined $cgi->param('alias')) { +if (Bugzilla->params->{"usebugaliases"} && defined $cgi->param('alias')) { my $alias = trim($cgi->param('alias')); # Since aliases are unique (like bug numbers), they can only be changed @@ -863,8 +863,10 @@ if (defined $cgi->param('id')) { } } -if (defined $cgi->param('id') && - (Param("insidergroup") && UserInGroup(Param("insidergroup")))) { +if ( defined $cgi->param('id') && + (Bugzilla->params->{"insidergroup"} + && UserInGroup(Bugzilla->params->{"insidergroup"})) ) +{ my $sth = $dbh->prepare('UPDATE longdescs SET isprivate = ? WHERE bug_id = ? AND bug_when = ?'); @@ -953,7 +955,7 @@ if (defined $cgi->param('qa_contact') # The QA contact cannot be deleted from show_bug.cgi for a single bug! if ($name ne $cgi->param('dontchange')) { $qacontact = login_to_id($name, THROW_ERROR) if ($name ne ""); - if ($qacontact && Param("strict_isolation")) { + if ($qacontact && Bugzilla->params->{"strict_isolation"}) { $usercache{$qacontact} ||= Bugzilla::User->new($qacontact); my $qa_user = $usercache{$qacontact}; foreach my $product_id (@newprod_ids) { @@ -992,7 +994,9 @@ SWITCH: for ($cgi->param('knob')) { /^accept$/ && CheckonComment( "accept" ) && do { DoConfirm(); ChangeStatus('ASSIGNED'); - if (Param("usetargetmilestone") && Param("musthavemilestoneonaccept")) { + if (Bugzilla->params->{"usetargetmilestone"} + && Bugzilla->params->{"musthavemilestoneonaccept"}) + { $requiremilestone = 1; } last SWITCH; @@ -1007,7 +1011,7 @@ SWITCH: for ($cgi->param('knob')) { Bugzilla::Bug->settable_resolutions); # don't resolve as fixed while still unresolved blocking bugs - if (Param("noresolveonopenblockers") + if (Bugzilla->params->{"noresolveonopenblockers"} && $cgi->param('resolution') eq 'FIXED') { my @dependencies = Bugzilla::Bug::CountOpenDependencies(@idlist); @@ -1038,7 +1042,7 @@ SWITCH: for ($cgi->param('knob')) { if (defined $cgi->param('assigned_to') && trim($cgi->param('assigned_to')) ne "") { $assignee = login_to_id(trim($cgi->param('assigned_to')), THROW_ERROR); - if (Param("strict_isolation")) { + if (Bugzilla->params->{"strict_isolation"}) { $usercache{$assignee} ||= Bugzilla::User->new($assignee); my $assign_user = $usercache{$assignee}; foreach my $product_id (@newprod_ids) { @@ -1177,7 +1181,7 @@ if ($::comma eq "" } # Process data for Time Tracking fields -if (UserInGroup(Param('timetrackinggroup'))) { +if (UserInGroup(Bugzilla->params->{'timetrackinggroup'})) { foreach my $field ("estimated_time", "remaining_time") { if (defined $cgi->param($field)) { my $er_time = trim($cgi->param($field)); @@ -1249,7 +1253,7 @@ sub LogDependencyActivity { return 0; } -if (Param("strict_isolation")) { +if (Bugzilla->params->{"strict_isolation"}) { my @blocked_cc = (); foreach my $pid (keys %cc_add) { $usercache{$pid} ||= Bugzilla::User->new($pid); @@ -1268,7 +1272,7 @@ if (Param("strict_isolation")) { } } -if ($prod_changed && Param("strict_isolation")) { +if ($prod_changed && Bugzilla->params->{"strict_isolation"}) { my $sth_cc = $dbh->prepare("SELECT who FROM cc WHERE bug_id = ?"); @@ -1339,7 +1343,7 @@ foreach my $id (@idlist) { undef, $new_comp_id); $query .= ", assigned_to = ?"; push(@bug_values, $assignee); - if (Param("useqacontact")) { + if (Bugzilla->params->{"useqacontact"}) { $qacontact = $dbh->selectrow_array('SELECT initialqacontact FROM components WHERE components.id = ?', @@ -1396,7 +1400,7 @@ foreach my $id (@idlist) { # email addresses into their corresponding IDs; # - update $newhash{'bug_status'} to its real state if the bug # is in the unconfirmed state. - $formhash{'qa_contact'} = $qacontact if Param('useqacontact'); + $formhash{'qa_contact'} = $qacontact if Bugzilla->params->{'useqacontact'}; if ($cgi->param('knob') eq 'reassignbycomponent' || $cgi->param('knob') eq 'reassign') { $formhash{'assigned_to'} = $assignee; @@ -1519,7 +1523,7 @@ foreach my $id (@idlist) { $timestamp = $dbh->selectrow_array(q{SELECT NOW()}); my $work_time; - if (UserInGroup(Param('timetrackinggroup'))) { + if (UserInGroup(Bugzilla->params->{'timetrackinggroup'})) { $work_time = $cgi->param('work_time'); if ($work_time) { # AppendComment (called below) can in theory raise an error, diff --git a/query.cgi b/query.cgi index f7964f3b5..382fa37c4 100755 --- a/query.cgi +++ b/query.cgi @@ -187,7 +187,7 @@ if (!PrefillForm($buffer)) { if ($userdefaultquery) { PrefillForm($userdefaultquery); } else { - PrefillForm(Param("defaultquery")); + PrefillForm(Bugzilla->params->{"defaultquery"}); } } @@ -218,7 +218,7 @@ my @milestones = sort(keys %milestones); $vars->{'product'} = \@selectable_products; # Create data structures representing each classification -if (Param('useclassification')) { +if (Bugzilla->params->{'useclassification'}) { $vars->{'classification'} = $user->get_selectable_classifications; } @@ -227,7 +227,7 @@ $vars->{'component_'} = \@components; $vars->{'version'} = \@versions; -if (Param('usetargetmilestone')) { +if (Bugzilla->params->{'usetargetmilestone'}) { $vars->{'target_milestone'} = \@milestones; } @@ -255,7 +255,7 @@ foreach my $val (editable_bug_fields()) { push @chfields, $val; } -if (UserInGroup(Param('timetrackinggroup'))) { +if (UserInGroup(Bugzilla->params->{'timetrackinggroup'})) { push @chfields, "work_time"; } else { @chfields = grep($_ ne "estimated_time", @chfields); diff --git a/quips.cgi b/quips.cgi index b50a922e4..c405e089c 100755 --- a/quips.cgi +++ b/quips.cgi @@ -72,12 +72,12 @@ if ($action eq "show") { } if ($action eq "add") { - (Param('quip_list_entry_control') eq "closed") && + (Bugzilla->params->{'quip_list_entry_control'} eq "closed") && ThrowUserError("no_new_quips"); # Add the quip - my $approved = - (Param('quip_list_entry_control') eq "open") || (UserInGroup('admin')) || 0; + my $approved = (Bugzilla->params->{'quip_list_entry_control'} eq "open") + || UserInGroup('admin') || 0; my $comment = $cgi->param("quip"); $comment || ThrowUserError("need_quip"); trick_taint($comment); # Used in a placeholder below diff --git a/request.cgi b/request.cgi index c0fb950c9..9383c2108 100755 --- a/request.cgi +++ b/request.cgi @@ -80,7 +80,9 @@ sub queue { my $form_group = validateGroup($cgi->param('group')); my $attach_join_clause = "flags.attach_id = attachments.attach_id"; - if (Param("insidergroup") && !UserInGroup(Param("insidergroup"))) { + if (Bugzilla->params->{"insidergroup"} + && !UserInGroup(Bugzilla->params->{"insidergroup"})) + { $attach_join_clause .= " AND attachments.isprivate < 1"; } @@ -131,7 +133,7 @@ sub queue { (ccmap.who IS NOT NULL AND cclist_accessible = 1) OR (bugs.reporter = $userid AND bugs.reporter_accessible = 1) OR (bugs.assigned_to = $userid) " . - (Param('useqacontact') ? "OR + (Bugzilla->params->{'useqacontact'} ? "OR (bugs.qa_contact = $userid))" : ")"); # Limit query to pending requests. diff --git a/show_bug.cgi b/show_bug.cgi index 2787c5252..9e322a75f 100755 --- a/show_bug.cgi +++ b/show_bug.cgi @@ -114,7 +114,7 @@ if ($cgi->param("field")) { @fieldlist = $cgi->param("field"); } -unless (UserInGroup(Param("timetrackinggroup"))) { +unless (UserInGroup(Bugzilla->params->{"timetrackinggroup"})) { @fieldlist = grep($_ !~ /_time$/, @fieldlist); } diff --git a/showdependencygraph.cgi b/showdependencygraph.cgi index e11c73ba3..5b6c3195a 100755 --- a/showdependencygraph.cgi +++ b/showdependencygraph.cgi @@ -110,7 +110,7 @@ if (!defined $cgi->param('id') && !defined $cgi->param('doall')) { my ($fh, $filename) = File::Temp::tempfile("XXXXXXXXXX", SUFFIX => '.dot', DIR => $webdotdir); -my $urlbase = Param('urlbase'); +my $urlbase = Bugzilla->params->{'urlbase'}; print $fh "digraph G {"; print $fh qq{ @@ -218,7 +218,7 @@ close $fh; chmod 0777, $filename; -my $webdotbase = Param('webdotbase'); +my $webdotbase = Bugzilla->params->{'webdotbase'}; if ($webdotbase =~ /^https?:/) { # Remote dot server diff --git a/summarize_time.cgi b/summarize_time.cgi index d2b939c82..371e43f81 100755 --- a/summarize_time.cgi +++ b/summarize_time.cgi @@ -405,7 +405,7 @@ my $cgi = Bugzilla->cgi; Bugzilla->switch_to_shadow_db(); -UserInGroup(Param("timetrackinggroup")) +UserInGroup(Bugzilla->params->{"timetrackinggroup"}) || ThrowUserError("auth_failure", {group => "time-tracking", action => "access", object => "timetracking_summaries"}); diff --git a/userprefs.cgi b/userprefs.cgi index 3288efe65..a07cff135 100755 --- a/userprefs.cgi +++ b/userprefs.cgi @@ -50,7 +50,7 @@ sub DoAccount { ($vars->{'realname'}) = $dbh->selectrow_array( "SELECT realname FROM profiles WHERE userid = ?", undef, $user->id); - if(Param('allowemailchange') + if(Bugzilla->params->{'allowemailchange'} && Bugzilla->user->authorizer->can_change_email) { my @token = $dbh->selectrow_array( "SELECT tokentype, issuedate + " . @@ -113,7 +113,7 @@ sub SaveAccount { } } - if(Param("allowemailchange") && $cgi->param('new_login_name')) { + if(Bugzilla->params->{"allowemailchange"} && $cgi->param('new_login_name')) { my $old_login_name = $cgi->param('Bugzilla_login'); my $new_login_name = trim($cgi->param('new_login_name')); @@ -200,7 +200,7 @@ sub DoEmail { ########################################################################### # User watching ########################################################################### - if (Param("supportwatchers")) { + if (Bugzilla->params->{"supportwatchers"}) { my $watched_ref = $dbh->selectcol_arrayref( "SELECT profiles.login_name FROM watch INNER JOIN profiles" . " ON watch.watched = profiles.userid" . @@ -298,7 +298,9 @@ sub SaveEmail { ########################################################################### # User watching ########################################################################### - if (Param("supportwatchers") && defined $cgi->param('watchedusers')) { + if (Bugzilla->params->{"supportwatchers"} + && defined $cgi->param('watchedusers')) + { # Just in case. Note that this much locking is actually overkill: # we don't really care if anyone reads the watch table. So # some small amount of contention could be gotten rid of by diff --git a/votes.cgi b/votes.cgi index bb2948b37..bbae0b7cb 100755 --- a/votes.cgi +++ b/votes.cgi @@ -82,7 +82,7 @@ elsif ($action eq "show_user") { show_user(); } elsif ($action eq "vote") { - record_votes() if Param('usevotes'); + record_votes() if Bugzilla->params->{'usevotes'}; show_user(); } else { @@ -126,7 +126,7 @@ sub show_user { my $who = login_to_id($name, THROW_ERROR); my $userid = $user->id; - my $canedit = (Param('usevotes') && $userid == $who) ? 1 : 0; + my $canedit = (Bugzilla->params->{'usevotes'} && $userid == $who) ? 1 : 0; $dbh->bz_lock_tables('bugs READ', 'products READ', 'votes WRITE', 'cc READ', 'bug_group_map READ', 'user_group_map READ', diff --git a/whine.pl b/whine.pl index 727e66af4..093b6e5e6 100755 --- a/whine.pl +++ b/whine.pl @@ -96,9 +96,9 @@ my $sth_schedules_by_event = $dbh->prepare( # Send whines from the address in the 'maintainer' Parameter so that all # Bugzilla-originated mail appears to come from a single address. -my $fromaddress = Param('maintainer'); +my $fromaddress = Bugzilla->params->{'maintainer'}; -if ($fromaddress !~ Param('emailregexp')) { +if ($fromaddress !~ Bugzilla->params->{'emailregexp'}) { die "Cannot run. " . "The maintainer email address has not been properly set!\n"; } diff --git a/whineatnews.pl b/whineatnews.pl index 1fcd67911..3276858e7 100755 --- a/whineatnews.pl +++ b/whineatnews.pl @@ -36,7 +36,7 @@ use Bugzilla::Mailer; use Bugzilla::Util; # Whining is disabled if whinedays is zero -exit unless Param('whinedays') >= 1; +exit unless Bugzilla->params->{'whinedays'} >= 1; my $dbh = Bugzilla->dbh; my $query = q{SELECT bug_id, short_desc, login_name @@ -46,7 +46,7 @@ my $query = q{SELECT bug_id, short_desc, login_name WHERE (bug_status = ? OR bug_status = ?) AND } . $dbh->sql_to_days('NOW()') . " - " . $dbh->sql_to_days('delta_ts') . " > " . - Param('whinedays') . + Bugzilla->params->{'whinedays'} . " ORDER BY bug_id"; my %bugs; -- cgit v1.2.3-24-g4f1b