diff options
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-x | buglist.cgi | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/buglist.cgi b/buglist.cgi index e8a21d76e..0ce292337 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -141,22 +141,6 @@ if ($::buffer =~ /&cmd-/) { exit; } -# Generate a reasonable filename for the user agent to suggest to the user -# when the user saves the bug list. Uses the name of the remembered query -# if available. We have to do this now, even though we return HTTP headers -# at the end, because the fact that there is a remembered query gets -# forgotten in the process of retrieving it. -my @time = localtime(time()); -my $date = sprintf "%04d-%02d-%02d", 1900+$time[5],$time[4]+1,$time[3]; -my $filename = "bugs-$date.$format->{extension}"; -$::FORM{'cmdtype'} ||= ""; -if ($::FORM{'cmdtype'} eq 'runnamed') { - $filename = "$::FORM{'namedcmd'}-$date.$format->{extension}"; - # Remove white-space from the filename so the user cannot tamper - # with the HTTP headers. - $filename =~ s/\s//; -} - ################################################################################ # Utilities ################################################################################ @@ -188,6 +172,18 @@ sub LookupNamedQuery { return $result; } +sub LookupSeries { + my ($series_id) = @_; + detaint_natural($series_id) || ThrowCodeError("invalid_series_id"); + + my $dbh = Bugzilla->instance->dbh; + my $result = $dbh->selectrow_array("SELECT query FROM series " . + "WHERE series_id = $series_id"); + $result + || ThrowCodeError("invalid_series_id", {'series_id' => $series_id}); + return $result; +} + sub GetQuip { my $quip; @@ -231,6 +227,9 @@ sub GetGroupsByUserId { # Command Execution ################################################################################ +$::FORM{'cmdtype'} ||= ""; +$::FORM{'remaction'} ||= ""; + # Backwards-compatibility - the old interface had cmdtype="runnamed" to run # a named command, and we can't break this because it's in bookmarks. if ($::FORM{'cmdtype'} eq "runnamed") { @@ -245,6 +244,21 @@ if ($::FORM{'cmdtype'} eq "runnamed") { # This will be modified, so make a copy. $params ||= new Bugzilla::CGI($cgi); +# Generate a reasonable filename for the user agent to suggest to the user +# when the user saves the bug list. Uses the name of the remembered query +# if available. We have to do this now, even though we return HTTP headers +# at the end, because the fact that there is a remembered query gets +# forgotten in the process of retrieving it. +my @time = localtime(time()); +my $date = sprintf "%04d-%02d-%02d", 1900+$time[5],$time[4]+1,$time[3]; +my $filename = "bugs-$date.$format->{extension}"; +if ($::FORM{'cmdtype'} eq "dorem" && $::FORM{'remaction'} =~ /^run/) { + $filename = "$::FORM{'namedcmd'}-$date.$format->{extension}"; + # Remove white-space from the filename so the user cannot tamper + # with the HTTP headers. + $filename =~ s/\s/_/g; +} + # Take appropriate action based on user's request. if ($::FORM{'cmdtype'} eq "dorem") { if ($::FORM{'remaction'} eq "run") { @@ -253,6 +267,12 @@ if ($::FORM{'cmdtype'} eq "dorem") { $params = new Bugzilla::CGI($::buffer); $order = $params->param('order') || $order; } + elsif ($::FORM{'remaction'} eq "runseries") { + $::buffer = LookupSeries($::FORM{"series_id"}); + $vars->{'title'} = "Bug List: $::FORM{'namedcmd'}"; + $params = new Bugzilla::CGI($::buffer); + $order = $params->param('order') || $order; + } elsif ($::FORM{'remaction'} eq "load") { my $url = "query.cgi?" . LookupNamedQuery($::FORM{"namedcmd"}); print "Refresh: 0; URL=$url\n"; |