RSS

(root)/bmo/4.2 : 7897.1.149 : report.cgi

To get this branch, use:
bzr branch /bmo/4.2

« back to all changes in this revision

Viewing changes to report.cgi

Frédéric Buclin
2012-03-06 13:11:17
This revision was merged to the branch mainline in revision 8085.
Revision ID: lpsolit@gmail.com-20120306211117-69cg27bybglx8oyr
Bug 545610: Correctly parse CGI parameters, especially when using mod_perl
r=gerv a=LpSolit

Show diffs side-by-side

added added

removed removed

36
36
my $cgi = Bugzilla->cgi;
37
37
my $template = Bugzilla->template;
38
38
my $vars = {};
39
 
my $buffer = $cgi->query_string();
40
39
 
41
40
# Go straight back to query.cgi if we are adding a boolean chart.
42
41
if (grep(/^cmd-/, $cgi->param())) {
49
48
}
50
49
 
51
50
Bugzilla->login();
52
 
 
53
 
my $dbh = Bugzilla->switch_to_shadow_db();
54
 
 
55
51
my $action = $cgi->param('action') || 'menu';
56
52
 
57
53
if ($action eq "menu") {
62
58
    exit;
63
59
}
64
60
 
 
61
# Sanitize the URL, to make URLs shorter.
 
62
$cgi->clean_search_url;
 
63
 
65
64
my $col_field = $cgi->param('x_axis_field') || '';
66
65
my $row_field = $cgi->param('y_axis_field') || '';
67
66
my $tbl_field = $cgi->param('z_axis_field') || '';
135
134
$::SIG{TERM} = 'DEFAULT';
136
135
$::SIG{PIPE} = 'DEFAULT';
137
136
 
 
137
my $dbh = Bugzilla->switch_to_shadow_db();
138
138
my $results = $dbh->selectall_arrayref($query);
139
139
 
140
140
# We have a hash of hashes for the data itself, and a hash to hold the 
243
243
    # We need to keep track of the defined restrictions on each of the 
244
244
    # axes, because buglistbase, below, throws them away. Without this, we
245
245
    # get buglistlinks wrong if there is a restriction on an axis field.
246
 
    $vars->{'col_vals'} = join("&", $buffer =~ /[&?]($col_field=[^&]+)/g);
247
 
    $vars->{'row_vals'} = join("&", $buffer =~ /[&?]($row_field=[^&]+)/g);
248
 
    $vars->{'tbl_vals'} = join("&", $buffer =~ /[&?]($tbl_field=[^&]+)/g);
249
 
    
 
246
    $vars->{'col_vals'} = get_field_restrictions($col_field);
 
247
    $vars->{'row_vals'} = get_field_restrictions($row_field);
 
248
    $vars->{'tbl_vals'} = get_field_restrictions($tbl_field);
 
249
 
250
250
    # We need a number of different variants of the base URL for different
251
251
    # URLs in the HTML.
252
252
    $vars->{'buglistbase'} = $cgi->canonicalise_query(
346
346
    }
347
347
    return $value;
348
348
}
 
349
 
 
350
sub get_field_restrictions {
 
351
    my $field = shift;
 
352
    my $cgi = Bugzilla->cgi;
 
353
 
 
354
    return join('&', map {"$field=$_"} $cgi->param($field));
 
355
}

Loggerhead 1.18.1 is a web-based interface for Bazaar branches