diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2019-11-30 23:12:11 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2019-12-01 14:53:51 -0800 |
commit | 70780e40e5586c6882e33dd65a3dc3f31031a321 (patch) | |
tree | 51fc3608bd44e7b92d07a976ca3112fd5d87d843 /page.cgi | |
parent | Merge commit '3395d78cc8b0bd660e56f73a2689d495f2a22628' into bugstest (diff) | |
download | bugzilla-70780e40e5586c6882e33dd65a3dc3f31031a321.tar.gz bugzilla-70780e40e5586c6882e33dd65a3dc3f31031a321.tar.bz2 bugzilla-70780e40e5586c6882e33dd65a3dc3f31031a321.zip |
Gentoo-local version of 7f3a749d7bd78a3e4aee163f562d7e95b0954b44 w/ Perl-Tidy-20180220
Reformat all code using Perl-Tidy v20180220 and .perltidyrc from
matching upstream 7f3a749d7bd78a3e4aee163f562d7e95b0954b44 commit.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'page.cgi')
-rwxr-xr-x | page.cgi | 79 |
1 files changed, 41 insertions, 38 deletions
@@ -30,16 +30,17 @@ use Bugzilla::Search::Quicksearch; # For quicksearch.html. sub quicksearch_field_names { - my $fields = Bugzilla::Search::Quicksearch->FIELD_MAP; - my %fields_reverse; - # Put longer names before shorter names. - my @nicknames = sort { length($b) <=> length($a) } (keys %$fields); - foreach my $nickname (@nicknames) { - my $db_field = $fields->{$nickname}; - $fields_reverse{$db_field} ||= []; - push(@{ $fields_reverse{$db_field} }, $nickname); - } - return \%fields_reverse; + my $fields = Bugzilla::Search::Quicksearch->FIELD_MAP; + my %fields_reverse; + + # Put longer names before shorter names. + my @nicknames = sort { length($b) <=> length($a) } (keys %$fields); + foreach my $nickname (@nicknames) { + my $db_field = $fields->{$nickname}; + $fields_reverse{$db_field} ||= []; + push(@{$fields_reverse{$db_field}}, $nickname); + } + return \%fields_reverse; } ############### @@ -48,38 +49,40 @@ sub quicksearch_field_names { Bugzilla->login(); -my $cgi = Bugzilla->cgi; +my $cgi = Bugzilla->cgi; my $template = Bugzilla->template; my $id = $cgi->param('id'); if ($id) { - # Be careful not to allow directory traversal. - if ($id =~ /\.\./) { - # two dots in a row is bad - ThrowUserError("bad_page_cgi_id", { "page_id" => $id }); - } - # Split into name and ctype. - $id =~ /^([\w\-\/\.]+)\.(\w+)$/; - if (!$2) { - # if this regexp fails to match completely, something bad came in - ThrowUserError("bad_page_cgi_id", { "page_id" => $id }); - } - - my %vars = ( - quicksearch_field_names => \&quicksearch_field_names, - ); - Bugzilla::Hook::process('page_before_template', - { page_id => $id, vars => \%vars }); - - my $format = $template->get_format("pages/$1", undef, $2); - - $cgi->param('id', $id); - - print $cgi->header($format->{'ctype'}); - - $template->process("$format->{'template'}", \%vars) - || ThrowTemplateError($template->error()); + + # Be careful not to allow directory traversal. + if ($id =~ /\.\./) { + + # two dots in a row is bad + ThrowUserError("bad_page_cgi_id", {"page_id" => $id}); + } + + # Split into name and ctype. + $id =~ /^([\w\-\/\.]+)\.(\w+)$/; + if (!$2) { + + # if this regexp fails to match completely, something bad came in + ThrowUserError("bad_page_cgi_id", {"page_id" => $id}); + } + + my %vars = (quicksearch_field_names => \&quicksearch_field_names,); + Bugzilla::Hook::process('page_before_template', + {page_id => $id, vars => \%vars}); + + my $format = $template->get_format("pages/$1", undef, $2); + + $cgi->param('id', $id); + + print $cgi->header($format->{'ctype'}); + + $template->process("$format->{'template'}", \%vars) + || ThrowTemplateError($template->error()); } else { - ThrowUserError("no_page_specified"); + ThrowUserError("no_page_specified"); } |