Commit dddc17ec authored by mkanat%kerio.com's avatar mkanat%kerio.com

Bug 303669: Bugzilla mis-uses perl subroutine prototypes

Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=justdave
parent 71a6b9cf
...@@ -339,7 +339,7 @@ sub actual_time { ...@@ -339,7 +339,7 @@ sub actual_time {
return $self->{'actual_time'}; return $self->{'actual_time'};
} }
sub any_flags_requesteeble () { sub any_flags_requesteeble {
my ($self) = @_; my ($self) = @_;
return $self->{'any_flags_requesteeble'} return $self->{'any_flags_requesteeble'}
if exists $self->{'any_flags_requesteeble'}; if exists $self->{'any_flags_requesteeble'};
...@@ -351,7 +351,7 @@ sub any_flags_requesteeble () { ...@@ -351,7 +351,7 @@ sub any_flags_requesteeble () {
return $self->{'any_flags_requesteeble'}; return $self->{'any_flags_requesteeble'};
} }
sub attachments () { sub attachments {
my ($self) = @_; my ($self) = @_;
return $self->{'attachments'} if exists $self->{'attachments'}; return $self->{'attachments'} if exists $self->{'attachments'};
return [] if $self->{'error'}; return [] if $self->{'error'};
...@@ -359,7 +359,7 @@ sub attachments () { ...@@ -359,7 +359,7 @@ sub attachments () {
return $self->{'attachments'}; return $self->{'attachments'};
} }
sub assigned_to () { sub assigned_to {
my ($self) = @_; my ($self) = @_;
return $self->{'assigned_to'} if exists $self->{'assigned_to'}; return $self->{'assigned_to'} if exists $self->{'assigned_to'};
$self->{'assigned_to_id'} = 0 if $self->{'error'}; $self->{'assigned_to_id'} = 0 if $self->{'error'};
...@@ -367,7 +367,7 @@ sub assigned_to () { ...@@ -367,7 +367,7 @@ sub assigned_to () {
return $self->{'assigned_to'}; return $self->{'assigned_to'};
} }
sub blocked () { sub blocked {
my ($self) = @_; my ($self) = @_;
return $self->{'blocked'} if exists $self->{'blocked'}; return $self->{'blocked'} if exists $self->{'blocked'};
return [] if $self->{'error'}; return [] if $self->{'error'};
...@@ -378,7 +378,7 @@ sub blocked () { ...@@ -378,7 +378,7 @@ sub blocked () {
# Even bugs in an error state always have a bug_id. # Even bugs in an error state always have a bug_id.
sub bug_id { $_[0]->{'bug_id'}; } sub bug_id { $_[0]->{'bug_id'}; }
sub cc () { sub cc {
my ($self) = @_; my ($self) = @_;
return $self->{'cc'} if exists $self->{'cc'}; return $self->{'cc'} if exists $self->{'cc'};
return [] if $self->{'error'}; return [] if $self->{'error'};
...@@ -396,7 +396,7 @@ sub cc () { ...@@ -396,7 +396,7 @@ sub cc () {
return $self->{'cc'}; return $self->{'cc'};
} }
sub dependson () { sub dependson {
my ($self) = @_; my ($self) = @_;
return $self->{'dependson'} if exists $self->{'dependson'}; return $self->{'dependson'} if exists $self->{'dependson'};
return [] if $self->{'error'}; return [] if $self->{'error'};
...@@ -405,7 +405,7 @@ sub dependson () { ...@@ -405,7 +405,7 @@ sub dependson () {
return $self->{'dependson'}; return $self->{'dependson'};
} }
sub flag_types () { sub flag_types {
my ($self) = @_; my ($self) = @_;
return $self->{'flag_types'} if exists $self->{'flag_types'}; return $self->{'flag_types'} if exists $self->{'flag_types'};
return [] if $self->{'error'}; return [] if $self->{'error'};
...@@ -430,7 +430,7 @@ sub flag_types () { ...@@ -430,7 +430,7 @@ sub flag_types () {
return $self->{'flag_types'}; return $self->{'flag_types'};
} }
sub keywords () { sub keywords {
my ($self) = @_; my ($self) = @_;
return $self->{'keywords'} if exists $self->{'keywords'}; return $self->{'keywords'} if exists $self->{'keywords'};
return () if $self->{'error'}; return () if $self->{'error'};
...@@ -456,7 +456,7 @@ sub longdescs { ...@@ -456,7 +456,7 @@ sub longdescs {
return $self->{'longdescs'}; return $self->{'longdescs'};
} }
sub milestoneurl () { sub milestoneurl {
my ($self) = @_; my ($self) = @_;
return $self->{'milestoneurl'} if exists $self->{'milestoneurl'}; return $self->{'milestoneurl'} if exists $self->{'milestoneurl'};
return '' if $self->{'error'}; return '' if $self->{'error'};
...@@ -464,7 +464,7 @@ sub milestoneurl () { ...@@ -464,7 +464,7 @@ sub milestoneurl () {
return $self->{'milestoneurl'}; return $self->{'milestoneurl'};
} }
sub qa_contact () { sub qa_contact {
my ($self) = @_; my ($self) = @_;
return $self->{'qa_contact'} if exists $self->{'qa_contact'}; return $self->{'qa_contact'} if exists $self->{'qa_contact'};
return undef if $self->{'error'}; return undef if $self->{'error'};
...@@ -480,7 +480,7 @@ sub qa_contact () { ...@@ -480,7 +480,7 @@ sub qa_contact () {
return $self->{'qa_contact'}; return $self->{'qa_contact'};
} }
sub reporter () { sub reporter {
my ($self) = @_; my ($self) = @_;
return $self->{'reporter'} if exists $self->{'reporter'}; return $self->{'reporter'} if exists $self->{'reporter'};
$self->{'reporter_id'} = 0 if $self->{'error'}; $self->{'reporter_id'} = 0 if $self->{'error'};
...@@ -489,7 +489,7 @@ sub reporter () { ...@@ -489,7 +489,7 @@ sub reporter () {
} }
sub show_attachment_flags () { sub show_attachment_flags {
my ($self) = @_; my ($self) = @_;
return $self->{'show_attachment_flags'} return $self->{'show_attachment_flags'}
if exists $self->{'show_attachment_flags'}; if exists $self->{'show_attachment_flags'};
...@@ -694,7 +694,7 @@ sub choices { ...@@ -694,7 +694,7 @@ sub choices {
# the alias. # the alias.
# Queries the database for the bug with a given alias, and returns # Queries the database for the bug with a given alias, and returns
# the ID of the bug if it exists or the undefined value if it doesn't. # the ID of the bug if it exists or the undefined value if it doesn't.
sub bug_alias_to_id ($) { sub bug_alias_to_id {
my ($alias) = @_; my ($alias) = @_;
return undef unless Param("usebugaliases"); return undef unless Param("usebugaliases");
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
...@@ -707,7 +707,7 @@ sub bug_alias_to_id ($) { ...@@ -707,7 +707,7 @@ sub bug_alias_to_id ($) {
# Subroutines # Subroutines
##################################################################### #####################################################################
sub AppendComment ($$$;$$$) { sub AppendComment {
my ($bugid, $whoid, $comment, $isprivate, $timestamp, $work_time) = @_; my ($bugid, $whoid, $comment, $isprivate, $timestamp, $work_time) = @_;
$work_time ||= 0; $work_time ||= 0;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
...@@ -992,7 +992,7 @@ sub CountOpenDependencies { ...@@ -992,7 +992,7 @@ sub CountOpenDependencies {
return @dependencies; return @dependencies;
} }
sub ValidateComment ($) { sub ValidateComment {
my ($comment) = @_; my ($comment) = @_;
if (defined($comment) && length($comment) > MAX_COMMENT_LENGTH) { if (defined($comment) && length($comment) > MAX_COMMENT_LENGTH) {
...@@ -1242,7 +1242,7 @@ sub ValidateBugAlias { ...@@ -1242,7 +1242,7 @@ sub ValidateBugAlias {
} }
# Validate and return a hash of dependencies # Validate and return a hash of dependencies
sub ValidateDependencies($$$) { sub ValidateDependencies {
my $fields = {}; my $fields = {};
$fields->{'dependson'} = shift; $fields->{'dependson'} = shift;
$fields->{'blocked'} = shift; $fields->{'blocked'} = shift;
......
...@@ -112,7 +112,7 @@ END ...@@ -112,7 +112,7 @@ END
# All the names are email addresses, not userids # All the names are email addresses, not userids
# values are scalars, except for cc, which is a list # values are scalars, except for cc, which is a list
# This hash usually comes from the "mailrecipients" var in a template call. # This hash usually comes from the "mailrecipients" var in a template call.
sub Send($;$) { sub Send {
my ($id, $forced) = (@_); my ($id, $forced) = (@_);
# This only works in a sub. Probably something to do with the # This only works in a sub. Probably something to do with the
...@@ -122,7 +122,7 @@ sub Send($;$) { ...@@ -122,7 +122,7 @@ sub Send($;$) {
return ProcessOneBug($id, $forced); return ProcessOneBug($id, $forced);
} }
sub ProcessOneBug($$) { sub ProcessOneBug {
my ($id, $forced) = (@_); my ($id, $forced) = (@_);
my @headerlist; my @headerlist;
...@@ -474,7 +474,7 @@ sub ProcessOneBug($$) { ...@@ -474,7 +474,7 @@ sub ProcessOneBug($$) {
return {'sent' => \@sent, 'excluded' => \@excluded}; return {'sent' => \@sent, 'excluded' => \@excluded};
} }
sub sendMail($$$$$$$$$$$$) { sub sendMail {
my ($user, $hlRef, $relRef, $valueRef, $dmhRef, $fdRef, my ($user, $hlRef, $relRef, $valueRef, $dmhRef, $fdRef,
$diffRef, $newcomments, $anyprivate, $start, $diffRef, $newcomments, $anyprivate, $start,
$id) = @_; $id) = @_;
...@@ -608,7 +608,7 @@ sub sendMail($$$$$$$$$$$$) { ...@@ -608,7 +608,7 @@ sub sendMail($$$$$$$$$$$$) {
return 1; return 1;
} }
sub MessageToMTA ($) { sub MessageToMTA {
my ($msg) = (@_); my ($msg) = (@_);
return if (Param('mail_delivery_method') eq "none"); return if (Param('mail_delivery_method') eq "none");
...@@ -639,7 +639,7 @@ sub MessageToMTA ($) { ...@@ -639,7 +639,7 @@ sub MessageToMTA ($) {
$mailer->close; $mailer->close;
} }
sub encode_qp_words($) { sub encode_qp_words {
my ($line) = (@_); my ($line) = (@_);
my @encoded; my @encoded;
foreach my $word (split / /, $line) { foreach my $word (split / /, $line) {
...@@ -652,7 +652,7 @@ sub encode_qp_words($) { ...@@ -652,7 +652,7 @@ sub encode_qp_words($) {
return join(' ', @encoded); return join(' ', @encoded);
} }
sub encode_message($$) { sub encode_message {
my ($header, $body) = @_; my ($header, $body) = @_;
# read header into MIME::Entity # read header into MIME::Entity
...@@ -735,14 +735,14 @@ sub encode_message($$) { ...@@ -735,14 +735,14 @@ sub encode_message($$) {
# its value will be placed into the string. If it's not a key in the hash, # its value will be placed into the string. If it's not a key in the hash,
# then the value of the parameter called "some_variable_name" will be placed # then the value of the parameter called "some_variable_name" will be placed
# into the string. # into the string.
sub PerformSubsts ($;$) { sub PerformSubsts {
my ($str, $substs) = (@_); my ($str, $substs) = (@_);
$str =~ s/%([a-z]*)%/(defined $substs->{$1} ? $substs->{$1} : Param($1))/eg; $str =~ s/%([a-z]*)%/(defined $substs->{$1} ? $substs->{$1} : Param($1))/eg;
return $str; return $str;
} }
# Send the login name and password of the newly created account to the user. # Send the login name and password of the newly created account to the user.
sub MailPassword ($$) { sub MailPassword {
my ($login, $password) = (@_); my ($login, $password) = (@_);
my $template = Param("passwordmail"); my $template = Param("passwordmail");
my $msg = PerformSubsts($template, my $msg = PerformSubsts($template,
......
...@@ -105,7 +105,7 @@ sub description { return $_[0]->{'description'}; } ...@@ -105,7 +105,7 @@ sub description { return $_[0]->{'description'}; }
#### Subroutines #### #### Subroutines ####
############################### ###############################
sub get_all_classifications () { sub get_all_classifications {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $ids = $dbh->selectcol_arrayref(q{ my $ids = $dbh->selectcol_arrayref(q{
...@@ -118,7 +118,7 @@ sub get_all_classifications () { ...@@ -118,7 +118,7 @@ sub get_all_classifications () {
return @classifications; return @classifications;
} }
sub check_classification ($) { sub check_classification {
my ($class_name) = @_; my ($class_name) = @_;
unless ($class_name) { unless ($class_name) {
......
...@@ -103,7 +103,7 @@ sub default_qa_contact { return $_[0]->{'initialqacontact'}; } ...@@ -103,7 +103,7 @@ sub default_qa_contact { return $_[0]->{'initialqacontact'}; }
#### Subroutines #### #### Subroutines ####
############################### ###############################
sub get_components_by_product ($) { sub get_components_by_product {
my ($product_id) = @_; my ($product_id) = @_;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
......
...@@ -128,12 +128,12 @@ sub FetchOneColumn { ...@@ -128,12 +128,12 @@ sub FetchOneColumn {
return $row[0]; return $row[0];
} }
sub PushGlobalSQLState() { sub PushGlobalSQLState {
push @SQLStateStack, $_current_sth; push @SQLStateStack, $_current_sth;
push @SQLStateStack, $_fetchahead; push @SQLStateStack, $_fetchahead;
} }
sub PopGlobalSQLState() { sub PopGlobalSQLState {
die ("PopGlobalSQLState: stack underflow") if ( scalar(@SQLStateStack) < 1 ); die ("PopGlobalSQLState: stack underflow") if ( scalar(@SQLStateStack) < 1 );
$_fetchahead = pop @SQLStateStack; $_fetchahead = pop @SQLStateStack;
$_current_sth = pop @SQLStateStack; $_current_sth = pop @SQLStateStack;
...@@ -153,7 +153,7 @@ sub connect_shadow { ...@@ -153,7 +153,7 @@ sub connect_shadow {
Param("shadowdbsock"), $db_user, $db_pass); Param("shadowdbsock"), $db_user, $db_pass);
} }
sub connect_main (;$) { sub connect_main {
my ($no_db_name) = @_; my ($no_db_name) = @_;
my $connect_to_db = $db_name; my $connect_to_db = $db_name;
$connect_to_db = "" if $no_db_name; $connect_to_db = "" if $no_db_name;
......
...@@ -27,7 +27,7 @@ use Bugzilla::Util; ...@@ -27,7 +27,7 @@ use Bugzilla::Util;
use Bugzilla::Error; use Bugzilla::Error;
sub check_form_field ($$;$) { sub check_form_field {
my ($cgi, $fieldname, $legalsRef) = @_; my ($cgi, $fieldname, $legalsRef) = @_;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
...@@ -45,7 +45,7 @@ sub check_form_field ($$;$) { ...@@ -45,7 +45,7 @@ sub check_form_field ($$;$) {
} }
} }
sub check_form_field_defined ($$) { sub check_form_field_defined {
my ($cgi, $fieldname) = @_; my ($cgi, $fieldname) = @_;
if (!defined $cgi->param($fieldname)) { if (!defined $cgi->param($fieldname)) {
......
...@@ -106,7 +106,7 @@ sub is_active { return $_[0]->{'isactive'}; } ...@@ -106,7 +106,7 @@ sub is_active { return $_[0]->{'isactive'}; }
##### Module Subroutines ### ##### Module Subroutines ###
################################ ################################
sub ValidateGroupName ($$) { sub ValidateGroupName {
my ($name, @users) = (@_); my ($name, @users) = (@_);
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $query = "SELECT id FROM groups " . my $query = "SELECT id FROM groups " .
...@@ -125,7 +125,7 @@ sub ValidateGroupName ($$) { ...@@ -125,7 +125,7 @@ sub ValidateGroupName ($$) {
return $ret; return $ret;
} }
sub get_group_controls_by_product ($) { sub get_group_controls_by_product {
my ($product_id) = @_; my ($product_id) = @_;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
......
...@@ -99,7 +99,7 @@ sub sortkey { return $_[0]->{'sortkey'}; } ...@@ -99,7 +99,7 @@ sub sortkey { return $_[0]->{'sortkey'}; }
##### Subroutines ##### ##### Subroutines #####
################################ ################################
sub get_milestones_by_product ($) { sub get_milestones_by_product {
my ($product_id) = @_; my ($product_id) = @_;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
...@@ -125,7 +125,7 @@ sub get_milestones_by_product ($) { ...@@ -125,7 +125,7 @@ sub get_milestones_by_product ($) {
return @milestones; return @milestones;
} }
sub check_milestone ($$) { sub check_milestone {
my ($product, $milestone_name) = @_; my ($product, $milestone_name) = @_;
unless ($milestone_name) { unless ($milestone_name) {
...@@ -142,7 +142,7 @@ sub check_milestone ($$) { ...@@ -142,7 +142,7 @@ sub check_milestone ($$) {
return $milestone; return $milestone;
} }
sub check_sort_key ($$) { sub check_sort_key {
my ($milestone_name, $sortkey) = @_; my ($milestone_name, $sortkey) = @_;
# Keep a copy in case detaint_signed() clears the sortkey # Keep a copy in case detaint_signed() clears the sortkey
my $stored_sortkey = $sortkey; my $stored_sortkey = $sortkey;
......
...@@ -178,7 +178,7 @@ sub classification_id { return $_[0]->{'classification_id'}; } ...@@ -178,7 +178,7 @@ sub classification_id { return $_[0]->{'classification_id'}; }
#### Subroutines ###### #### Subroutines ######
############################### ###############################
sub get_products_by_classification ($) { sub get_products_by_classification {
my ($class_id) = @_; my ($class_id) = @_;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
$class_id ||= DEFAULT_CLASSIFICATION_ID; $class_id ||= DEFAULT_CLASSIFICATION_ID;
...@@ -205,7 +205,7 @@ sub get_products_by_classification ($) { ...@@ -205,7 +205,7 @@ sub get_products_by_classification ($) {
return @products; return @products;
} }
sub get_all_products () { sub get_all_products {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $ids = $dbh->selectcol_arrayref(q{ my $ids = $dbh->selectcol_arrayref(q{
...@@ -218,7 +218,7 @@ sub get_all_products () { ...@@ -218,7 +218,7 @@ sub get_all_products () {
return @products; return @products;
} }
sub check_product ($) { sub check_product {
my ($product_name) = @_; my ($product_name) = @_;
unless ($product_name) { unless ($product_name) {
......
...@@ -97,7 +97,7 @@ sub sortAcceptLanguage { ...@@ -97,7 +97,7 @@ sub sortAcceptLanguage {
# Returns the path to the templates based on the Accept-Language # Returns the path to the templates based on the Accept-Language
# settings of the user and of the available languages # settings of the user and of the available languages
# If no Accept-Language is present it uses the defined default # If no Accept-Language is present it uses the defined default
sub getTemplateIncludePath () { sub getTemplateIncludePath {
# Return cached value if available # Return cached value if available
# XXXX - mod_perl! # XXXX - mod_perl!
......
...@@ -249,7 +249,7 @@ sub HasEmailChangeToken { ...@@ -249,7 +249,7 @@ sub HasEmailChangeToken {
return $token; return $token;
} }
sub GetTokenData($) { sub GetTokenData {
# Returns the userid, issuedate and eventdata for the specified token # Returns the userid, issuedate and eventdata for the specified token
my ($token) = @_; my ($token) = @_;
...@@ -263,7 +263,7 @@ sub GetTokenData($) { ...@@ -263,7 +263,7 @@ sub GetTokenData($) {
WHERE token = ?", undef, $token); WHERE token = ?", undef, $token);
} }
sub DeleteToken($) { sub DeleteToken {
# Deletes specified token # Deletes specified token
my ($token) = @_; my ($token) = @_;
...@@ -280,7 +280,7 @@ sub DeleteToken($) { ...@@ -280,7 +280,7 @@ sub DeleteToken($) {
# Internal Functions # Internal Functions
################################################################################ ################################################################################
sub _create_token($$$) { sub _create_token {
# Generates a unique token and inserts it into the database # Generates a unique token and inserts it into the database
# Returns the token and the token timestamp # Returns the token and the token timestamp
my ($userid, $tokentype, $eventdata) = @_; my ($userid, $tokentype, $eventdata) = @_;
......
...@@ -1156,7 +1156,7 @@ sub get_userlist { ...@@ -1156,7 +1156,7 @@ sub get_userlist {
return $self->{'userlist'}; return $self->{'userlist'};
} }
sub insert_new_user ($$;$$) { sub insert_new_user {
my ($username, $realname, $password, $disabledtext) = (@_); my ($username, $realname, $password, $disabledtext) = (@_);
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
...@@ -1201,7 +1201,7 @@ sub insert_new_user ($$;$$) { ...@@ -1201,7 +1201,7 @@ sub insert_new_user ($$;$$) {
return $password; return $password;
} }
sub is_available_username ($;$) { sub is_available_username {
my ($username, $old_username) = @_; my ($username, $old_username) = @_;
if(login_to_id($username) != 0) { if(login_to_id($username) != 0) {
...@@ -1237,7 +1237,7 @@ sub is_available_username ($;$) { ...@@ -1237,7 +1237,7 @@ sub is_available_username ($;$) {
return 1; return 1;
} }
sub login_to_id ($) { sub login_to_id {
my ($login) = (@_); my ($login) = (@_);
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
# $login will only be used by the following SELECT statement, so it's safe. # $login will only be used by the following SELECT statement, so it's safe.
...@@ -1252,7 +1252,7 @@ sub login_to_id ($) { ...@@ -1252,7 +1252,7 @@ sub login_to_id ($) {
} }
} }
sub UserInGroup ($) { sub UserInGroup {
return defined Bugzilla->user->groups->{$_[0]} ? 1 : 0; return defined Bugzilla->user->groups->{$_[0]} ? 1 : 0;
} }
......
...@@ -138,7 +138,7 @@ sub url_decode { ...@@ -138,7 +138,7 @@ sub url_decode {
return $todecode; return $todecode;
} }
sub i_am_cgi () { sub i_am_cgi {
# I use SERVER_SOFTWARE because it's required to be # I use SERVER_SOFTWARE because it's required to be
# defined for all requests in the CGI spec. # defined for all requests in the CGI spec.
return exists $ENV{'SERVER_SOFTWARE'} ? 1 : 0; return exists $ENV{'SERVER_SOFTWARE'} ? 1 : 0;
...@@ -221,7 +221,7 @@ sub diff_strings { ...@@ -221,7 +221,7 @@ sub diff_strings {
return ($removed, $added); return ($removed, $added);
} }
sub wrap_comment ($) { sub wrap_comment {
my ($comment) = @_; my ($comment) = @_;
my $wrappedcomment = ""; my $wrappedcomment = "";
...@@ -245,7 +245,7 @@ sub wrap_comment ($) { ...@@ -245,7 +245,7 @@ sub wrap_comment ($) {
return $wrappedcomment; return $wrappedcomment;
} }
sub find_wrap_point ($$) { sub find_wrap_point {
my ($string, $maxpos) = @_; my ($string, $maxpos) = @_;
if (!$string) { return 0 } if (!$string) { return 0 }
if (length($string) < $maxpos) { return length($string) } if (length($string) < $maxpos) { return length($string) }
...@@ -264,7 +264,7 @@ sub find_wrap_point ($$) { ...@@ -264,7 +264,7 @@ sub find_wrap_point ($$) {
return $wrappoint; return $wrappoint;
} }
sub format_time ($;$) { sub format_time {
my ($date, $format) = @_; my ($date, $format) = @_;
# If $format is undefined, try to guess the correct date format. # If $format is undefined, try to guess the correct date format.
...@@ -316,7 +316,7 @@ sub format_time_decimal { ...@@ -316,7 +316,7 @@ sub format_time_decimal {
return $newtime; return $newtime;
} }
sub file_mod_time ($) { sub file_mod_time {
my ($filename) = (@_); my ($filename) = (@_);
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) $atime,$mtime,$ctime,$blksize,$blocks)
...@@ -324,7 +324,7 @@ sub file_mod_time ($) { ...@@ -324,7 +324,7 @@ sub file_mod_time ($) {
return $mtime; return $mtime;
} }
sub bz_crypt ($) { sub bz_crypt {
my ($password) = @_; my ($password) = @_;
# The list of characters that can appear in a salt. Salts and hashes # The list of characters that can appear in a salt. Salts and hashes
......
...@@ -97,7 +97,7 @@ sub product_id { return $_[0]->{'product_id'}; } ...@@ -97,7 +97,7 @@ sub product_id { return $_[0]->{'product_id'}; }
##### Subroutines ### ##### Subroutines ###
############################### ###############################
sub get_versions_by_product ($) { sub get_versions_by_product {
my ($product_id) = @_; my ($product_id) = @_;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
...@@ -123,7 +123,7 @@ sub get_versions_by_product ($) { ...@@ -123,7 +123,7 @@ sub get_versions_by_product ($) {
return @versions; return @versions;
} }
sub check_version ($$) { sub check_version {
my ($product, $version_name) = @_; my ($product, $version_name) = @_;
$version_name || ThrowUserError('version_not_specified'); $version_name || ThrowUserError('version_not_specified');
......
...@@ -227,7 +227,7 @@ sub LookupNamedQuery { ...@@ -227,7 +227,7 @@ sub LookupNamedQuery {
# #
# Returns: A boolean true value if the query existed in the database # Returns: A boolean true value if the query existed in the database
# before, and we updated it. A boolean false value otherwise. # before, and we updated it. A boolean false value otherwise.
sub InsertNamedQuery ($$$;$) { sub InsertNamedQuery {
my ($userid, $query_name, $query, $link_in_footer) = @_; my ($userid, $query_name, $query, $link_in_footer) = @_;
$link_in_footer ||= 0; $link_in_footer ||= 0;
$query_name = trim($query_name); $query_name = trim($query_name);
......
...@@ -519,14 +519,14 @@ EOT ...@@ -519,14 +519,14 @@ EOT
die "Syntax error in localconfig"; die "Syntax error in localconfig";
} }
sub LocalVarExists ($) sub LocalVarExists
{ {
my ($name) = @_; my ($name) = @_;
return $main::{$name}; # if localconfig declared it, we're done. return $main::{$name}; # if localconfig declared it, we're done.
} }
my $newstuff = ""; my $newstuff = "";
sub LocalVar ($$) sub LocalVar
{ {
my ($name, $definition) = @_; my ($name, $definition) = @_;
return if LocalVarExists($name); # if localconfig declared it, we're done. return if LocalVarExists($name); # if localconfig declared it, we're done.
...@@ -1616,7 +1616,7 @@ $dbh->bz_setup_database(); ...@@ -1616,7 +1616,7 @@ $dbh->bz_setup_database();
# Populate groups table # Populate groups table
########################################################################### ###########################################################################
sub GroupDoesExist ($) sub GroupDoesExist
{ {
my ($name) = @_; my ($name) = @_;
my $sth = $dbh->prepare("SELECT name FROM groups WHERE name='$name'"); my $sth = $dbh->prepare("SELECT name FROM groups WHERE name='$name'");
...@@ -1657,7 +1657,7 @@ sub AddGroup { ...@@ -1657,7 +1657,7 @@ sub AddGroup {
my $headernum = 1; my $headernum = 1;
sub AddFDef ($$$) { sub AddFDef {
my ($name, $description, $mailhead) = (@_); my ($name, $description, $mailhead) = (@_);
my $sth = $dbh->prepare("SELECT fieldid FROM fielddefs " . my $sth = $dbh->prepare("SELECT fieldid FROM fielddefs " .
...@@ -1751,7 +1751,7 @@ AddFDef("content", "Content", 0); ...@@ -1751,7 +1751,7 @@ AddFDef("content", "Content", 0);
# mkanat@bugzilla.org - bug 17453 # mkanat@bugzilla.org - bug 17453
# Create the values for the tables that hold what used to be enum types. # Create the values for the tables that hold what used to be enum types.
# Don't populate the tables if the table isn't empty. # Don't populate the tables if the table isn't empty.
sub PopulateEnumTable ($@) { sub PopulateEnumTable {
my ($table, @valuelist) = @_; my ($table, @valuelist) = @_;
# If we encounter any of the keys in this hash, they are # If we encounter any of the keys in this hash, they are
......
...@@ -52,7 +52,7 @@ else { ...@@ -52,7 +52,7 @@ else {
# Subs # Subs
############################################################################### ###############################################################################
sub MakeDocs($$) { sub MakeDocs {
my ($name, $cmdline) = @_; my ($name, $cmdline) = @_;
......
...@@ -38,7 +38,7 @@ my $dbh = Bugzilla->dbh; ...@@ -38,7 +38,7 @@ my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template; my $template = Bugzilla->template;
my $vars = {}; my $vars = {};
sub LoadTemplate ($) { sub LoadTemplate {
my $action = shift; my $action = shift;
$action =~ /(\w+)/; $action =~ /(\w+)/;
......
...@@ -49,7 +49,7 @@ my $showbugcounts = (defined $cgi->param('showbugcounts')); ...@@ -49,7 +49,7 @@ my $showbugcounts = (defined $cgi->param('showbugcounts'));
# TestComponent: just returns if the specified product/component combination exists # TestComponent: just returns if the specified product/component combination exists
# CheckComponent: same check, optionally emit an error text # CheckComponent: same check, optionally emit an error text
sub TestProduct ($) sub TestProduct
{ {
my $prod = shift; my $prod = shift;
...@@ -60,7 +60,7 @@ sub TestProduct ($) ...@@ -60,7 +60,7 @@ sub TestProduct ($)
return FetchOneColumn(); return FetchOneColumn();
} }
sub CheckProduct ($) sub CheckProduct
{ {
my $prod = shift; my $prod = shift;
...@@ -75,7 +75,7 @@ sub CheckProduct ($) ...@@ -75,7 +75,7 @@ sub CheckProduct ($)
} }
} }
sub TestComponent ($$) sub TestComponent
{ {
my ($prod, $comp) = @_; my ($prod, $comp) = @_;
...@@ -89,7 +89,7 @@ sub TestComponent ($$) ...@@ -89,7 +89,7 @@ sub TestComponent ($$)
return FetchOneColumn(); return FetchOneColumn();
} }
sub CheckComponent ($$) sub CheckComponent
{ {
my ($prod, $comp) = @_; my ($prod, $comp) = @_;
......
...@@ -567,7 +567,7 @@ sub validateGroups { ...@@ -567,7 +567,7 @@ sub validateGroups {
# added by the user and have passed all validation tests. # added by the user and have passed all validation tests.
# The only way to have invalid product/component combinations is to # The only way to have invalid product/component combinations is to
# hack the URL. So we silently ignore them, if any. # hack the URL. So we silently ignore them, if any.
sub validateAndSubmit ($) { sub validateAndSubmit {
my ($id) = @_; my ($id) = @_;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
......
...@@ -51,7 +51,7 @@ UserInGroup("creategroups") ...@@ -51,7 +51,7 @@ UserInGroup("creategroups")
my $action = trim($cgi->param('action') || ''); my $action = trim($cgi->param('action') || '');
# RederiveRegexp: update user_group_map with regexp-based grants # RederiveRegexp: update user_group_map with regexp-based grants
sub RederiveRegexp ($$) sub RederiveRegexp
{ {
my $regexp = shift; my $regexp = shift;
my $gid = shift; my $gid = shift;
......
...@@ -35,7 +35,7 @@ my $dbh = Bugzilla->dbh; ...@@ -35,7 +35,7 @@ my $dbh = Bugzilla->dbh;
use vars qw($template $vars); use vars qw($template $vars);
sub Validate ($$) { sub Validate {
my ($name, $description) = @_; my ($name, $description) = @_;
if ($name eq "") { if ($name eq "") {
ThrowUserError("keyword_blank_name"); ThrowUserError("keyword_blank_name");
......
...@@ -53,7 +53,7 @@ my %ctl = ( ...@@ -53,7 +53,7 @@ my %ctl = (
# TestProduct: just returns if the specified product does exists # TestProduct: just returns if the specified product does exists
# CheckProduct: same check, optionally emit an error text # CheckProduct: same check, optionally emit an error text
sub TestProduct ($) sub TestProduct
{ {
my $prod = shift; my $prod = shift;
...@@ -64,7 +64,7 @@ sub TestProduct ($) ...@@ -64,7 +64,7 @@ sub TestProduct ($)
return FetchOneColumn(); return FetchOneColumn();
} }
sub CheckProduct ($) sub CheckProduct
{ {
my $prod = shift; my $prod = shift;
...@@ -85,7 +85,7 @@ sub CheckProduct ($) ...@@ -85,7 +85,7 @@ sub CheckProduct ($)
# TestClassification: just returns if the specified classification does exists # TestClassification: just returns if the specified classification does exists
# CheckClassification: same check, optionally emit an error text # CheckClassification: same check, optionally emit an error text
sub TestClassification ($) sub TestClassification
{ {
my $cl = shift; my $cl = shift;
...@@ -96,7 +96,7 @@ sub TestClassification ($) ...@@ -96,7 +96,7 @@ sub TestClassification ($)
return FetchOneColumn(); return FetchOneColumn();
} }
sub CheckClassification ($) sub CheckClassification
{ {
my $cl = shift; my $cl = shift;
...@@ -118,7 +118,7 @@ sub CheckClassification ($) ...@@ -118,7 +118,7 @@ sub CheckClassification ($)
# we need this routine, which does things properly, and will # we need this routine, which does things properly, and will
# eventually be the only version. (The older versions assume a # eventually be the only version. (The older versions assume a
# $template->put_header() call has been made) # $template->put_header() call has been made)
sub CheckClassificationNew ($) sub CheckClassificationNew
{ {
my $cl = shift; my $cl = shift;
...@@ -134,7 +134,7 @@ sub CheckClassificationNew ($) ...@@ -134,7 +134,7 @@ sub CheckClassificationNew ($)
} }
sub CheckClassificationProduct ($$) sub CheckClassificationProduct
{ {
my $cl = shift; my $cl = shift;
my $prod = shift; my $prod = shift;
...@@ -161,7 +161,7 @@ sub CheckClassificationProduct ($$) ...@@ -161,7 +161,7 @@ sub CheckClassificationProduct ($$)
} }
} }
sub CheckClassificationProductNew ($$) sub CheckClassificationProductNew
{ {
my ($cl, $prod) = @_; my ($cl, $prod) = @_;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
...@@ -189,7 +189,7 @@ sub CheckClassificationProductNew ($$) ...@@ -189,7 +189,7 @@ sub CheckClassificationProductNew ($$)
# Displays the form to edit a products parameters # Displays the form to edit a products parameters
# #
sub EmitFormElements ($$$$$$$$$) sub EmitFormElements
{ {
my ($classification, $product, $description, $milestoneurl, $disallownew, my ($classification, $product, $description, $milestoneurl, $disallownew,
$votesperuser, $maxvotesperbug, $votestoconfirm, $defaultmilestone) $votesperuser, $maxvotesperbug, $votestoconfirm, $defaultmilestone)
...@@ -250,7 +250,7 @@ sub EmitFormElements ($$$$$$$$$) ...@@ -250,7 +250,7 @@ sub EmitFormElements ($$$$$$$$$)
# Displays a text like "a.", "a or b.", "a, b or c.", "a, b, c or d." # Displays a text like "a.", "a or b.", "a, b or c.", "a, b, c or d."
# #
sub PutTrailer (@) sub PutTrailer
{ {
my (@links) = ("Back to the <A HREF=\"query.cgi\">query page</A>", @_); my (@links) = ("Back to the <A HREF=\"query.cgi\">query page</A>", @_);
......
...@@ -39,14 +39,14 @@ our @valid_fields = ('op_sys', 'rep_platform', 'priority', 'bug_severity',); ...@@ -39,14 +39,14 @@ our @valid_fields = ('op_sys', 'rep_platform', 'priority', 'bug_severity',);
###################################################################### ######################################################################
# Returns whether or not the specified table exists in the @tables array. # Returns whether or not the specified table exists in the @tables array.
sub FieldExists ($) { sub FieldExists {
my ($field) = @_; my ($field) = @_;
return lsearch(\@valid_fields, $field) >= 0; return lsearch(\@valid_fields, $field) >= 0;
} }
# Same as FieldExists, but emits and error and dies if it fails. # Same as FieldExists, but emits and error and dies if it fails.
sub FieldMustExist ($) { sub FieldMustExist {
my ($field)= @_; my ($field)= @_;
$field || $field ||
...@@ -58,7 +58,7 @@ sub FieldMustExist ($) { ...@@ -58,7 +58,7 @@ sub FieldMustExist ($) {
} }
# Returns if the specified value exists for the field specified. # Returns if the specified value exists for the field specified.
sub ValueExists ($$) { sub ValueExists {
my ($field, $value) = @_; my ($field, $value) = @_;
FieldMustExist($field); FieldMustExist($field);
trick_taint($field); trick_taint($field);
...@@ -75,7 +75,7 @@ sub ValueExists ($$) { ...@@ -75,7 +75,7 @@ sub ValueExists ($$) {
} }
# Same check as ValueExists, emits an error text and dies if it fails. # Same check as ValueExists, emits an error text and dies if it fails.
sub ValueMustExist ($$) { sub ValueMustExist {
my ($field, $value)= @_; my ($field, $value)= @_;
# Values may not be empty (it's very difficult to deal # Values may not be empty (it's very difficult to deal
......
...@@ -210,7 +210,7 @@ check_form_field_defined($cgi, 'component'); ...@@ -210,7 +210,7 @@ check_form_field_defined($cgi, 'component');
# function and tests, if the comment was given. # function and tests, if the comment was given.
# If comments are required for functions is defined by params. # If comments are required for functions is defined by params.
# #
sub CheckonComment( $ ) { sub CheckonComment {
my ($function) = (@_); my ($function) = (@_);
# Param is 1 if comment should be added ! # Param is 1 if comment should be added !
......
...@@ -727,7 +727,7 @@ if (defined $cgi->param('rebuildkeywordcache')) { ...@@ -727,7 +727,7 @@ if (defined $cgi->param('rebuildkeywordcache')) {
# General bug checks # General bug checks
########################################################################### ###########################################################################
sub BugCheck ($$;$$) { sub BugCheck {
my ($middlesql, $errortext, $repairparam, $repairtext) = @_; my ($middlesql, $errortext, $repairparam, $repairtext) = @_;
SendSQL("SELECT DISTINCT bugs.bug_id " . SendSQL("SELECT DISTINCT bugs.bug_id " .
......
...@@ -337,7 +337,7 @@ sub DoPermissions { ...@@ -337,7 +337,7 @@ sub DoPermissions {
# No SavePermissions() because this panel has no changeable fields. # No SavePermissions() because this panel has no changeable fields.
sub DoSavedSearches() { sub DoSavedSearches {
# 2004-12-13 - colin.ogilvie@gmail.com, bug 274397 # 2004-12-13 - colin.ogilvie@gmail.com, bug 274397
# Need to work around the possibly missing query_format=advanced # Need to work around the possibly missing query_format=advanced
$vars->{'user'} = Bugzilla->user; $vars->{'user'} = Bugzilla->user;
...@@ -362,7 +362,7 @@ sub DoSavedSearches() { ...@@ -362,7 +362,7 @@ sub DoSavedSearches() {
$vars->{'queries'} = \@newqueries; $vars->{'queries'} = \@newqueries;
} }
sub SaveSavedSearches() { sub SaveSavedSearches {
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my @queries = @{Bugzilla->user->queries}; my @queries = @{Bugzilla->user->queries};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment