Bug 312307: Misused Throw*Error tags in code and templates - Patch by Dennis Melentyev <dennis.melentyev@infopulse.com.ua> r=LpSolit a=justdave

This commit is contained in:
lpsolit%gmail.com 2005-10-23 21:47:51 +00:00
Родитель 6ec00688d6
Коммит 733a2fdb5a
7 изменённых файлов: 17 добавлений и 56 удалений

Просмотреть файл

@ -334,10 +334,7 @@ GetVersionTable();
my $product_id = get_product_id($product);
if (0 == @{$::components{$product}}) {
ThrowUserError("no_components", {product => $product});
}
elsif (1 == @{$::components{$product}}) {
if (1 == @{$::components{$product}}) {
# Only one component; just pick it.
$cgi->param('component', $::components{$product}->[0]);
}

Просмотреть файл

@ -328,7 +328,7 @@ foreach my $b (grep(/^bit-\d*$/, $cgi->param())) {
if ($cgi->param($b)) {
my $v = substr($b, 4);
detaint_natural($v)
|| ThrowCodeError("group_id_invalid");
|| ThrowUserError("invalid_group_ID");
if (!GroupIsActive($v)) {
# Prevent the user from adding the bug to an inactive group.
# Should only happen if there is a bug in Bugzilla or the user

Просмотреть файл

@ -56,7 +56,7 @@ if ($action eq 'sudo') {
# Do not try to start a new session if one is already in progress!
if (defined(Bugzilla->sudoer)) {
ThrowUserError('sudo-in-progress', { target => $user->login });
ThrowUserError('sudo_in_progress', { target => $user->login });
}
# We may have been given a value to put into the field

Просмотреть файл

@ -290,7 +290,7 @@ elsif ($action eq "plot") {
$vars->{'data'} = \@image_data;
}
else {
ThrowUserError("unknown_action", {action => $cgi->param('action')});
ThrowCodeError("unknown_action", {action => $cgi->param('action')});
}
my $format = $template->get_format("reports/report", $formatparam,

Просмотреть файл

@ -154,11 +154,6 @@
[%+ terms.bug %] [%+ bug_id FILTER html %].
[% END %]
[% ELSIF error == "invalid_isactive_flag" %]
[% title = "Invalid isactive flag" %]
The active flag was improperly set. There may be
a problem with [% terms.Bugzilla %] or [% terms.abug %] in your browser.
[% ELSIF error == "invalid_numeric_argument" %]
[% title = "Invalid number argument" %]
The argument <code>[% argument FILTER html %] = [% value FILTER html %]</code>
@ -245,13 +240,12 @@
[%+ series.subcategory FILTER html %] /
[%+ series.name FILTER html %].
[% ELSIF error == "no_y_axis_defined" %]
No Y axis was defined when creating report. The X axis is optional,
but the Y axis is compulsory.
[% ELSIF error == "need_quipid" %]
A valid quipid is needed.
[% ELSIF error == "unknown_comparison_type" %]
Specified comparison type is not supported.
[% ELSIF error == "request_queue_group_invalid" %]
The group field <em>[% group FILTER html %]</em> is invalid.
@ -298,6 +292,10 @@
I could not figure out what you wanted to do.
[% END %]
[% ELSIF error == "must_be_patch" %]
[% title = "Attachment Must Be Patch" %]
Attachment #[% attach_id FILTER html %] must be a patch.
[% ELSIF error == "nested_transaction" %]
Attempted to start a new transaction without finishing previous one first.

Просмотреть файл

@ -276,15 +276,6 @@
You must reassign those [% terms.bugs %] to another component before you
can delete this one.
[% ELSIF error == "component_must_have_a_name" %]
[% title = "Blank Component Name Not Allowed" %]
You cannot delete the component name for component '[% name FILTER html %]'.
[% ELSIF error == "component_cant_del_description" %]
[% title = "Blank Component Description Not Allowed" %]
You cannot delete the component description for
component '[% name FILTER html %]'.
[% ELSIF error == "component_name_too_long" %]
[% title = "Component Name Is Too Long" %]
The name of a component is limited to 64 characters.
@ -294,10 +285,6 @@
[% title = "Component Requires Default Assignee" %]
You must enter a default assignee for component '[% name FILTER html %]'.
[% ELSIF error == "component_not_specified" %]
[% title = "No Component Specified" %]
No component specified when trying to edit components.
[% ELSIF error == "component_not_valid" %]
[% title = "Specified Component Does Not Exist" %]
The component '[% name FILTER html %]' for product
@ -601,11 +588,6 @@
You are not authorised to edit this series. To do this, you must either
be its creator, or an administrator.
[% ELSIF error == "insufficient_data" %]
[% title = "Insufficient Data" %]
None of the series you selected have any data associated with them, so a
chart cannot be plotted.
[% ELSIF error == "insufficient_data_points" %]
We don't have enough data points to make a graph (yet).
@ -842,10 +824,6 @@
Sorry, [% terms.bug %] moving has been disabled. If you need
to move [% terms.abug %], please contact [% Param("maintainer") %].
[% ELSIF error == "must_be_patch" %]
[% title = "Attachment Must Be Patch" %]
Attachment #[% attach_id FILTER html %] must be a patch.
[% ELSIF error == "missing_subcategory" %]
[% title = "Missing Subcategory" %]
You did not specify a subcategory for this series.
@ -1077,10 +1055,6 @@
To reassign [% terms.abug %], you must provide an address for
the new assignee.
[% ELSIF error == "report_access_denied" %]
[% title = "Access Denied" %]
You do not have the permissions necessary to view reports for this product.
[% ELSIF error == "require_component" %]
[% title = "Component Needed" %]
To file this [% terms.bug %], you must first choose a component.
@ -1199,11 +1173,6 @@
version! You must reassign those [% terms.bugs %] to another version
before you can delete this one.
[% ELSIF error == "version_name_too_long" %]
[% title = "Version Name Is Too Long" %]
The name of a version is limited to 20 characters.
'[% name FILTER html %]' is too long ([% name.length %] characters).
[% ELSIF error == "version_not_specified" %]
[% title = "No Version Specified" %]
No version specified when trying to edit versions.
@ -1239,15 +1208,14 @@
[% title = "Wrong Token" %]
That token cannot be used to change your password.
[% ELSIF error == "extern_id_conflict" %]
[% title = "Extern ID Conflict" %]
Someone with a different external ID has that address.
[% ELSIF error == "wrong_token_for_confirming_email_change" %]
[% title = "Wrong Token" %]
That token cannot be used to change your email address.
[% ELSIF error == "value_out_of_range" %]
[% title = "Value Out Of Range" %]
Value is out of range for field
<em>[% field_descs.$field FILTER html %]</em>.
[% ELSIF error == "zero_length_file" %]
[% title = "File Is Empty" %]
The file you are trying to attach is empty!

Просмотреть файл

@ -67,10 +67,8 @@ if ($cgi->param('t')) {
$::token = $cgi->param('t');
# Make sure the token contains only valid characters in the right amount.
my $validationerror = ValidatePassword($::token);
if ($validationerror) {
ThrowUserError("token_invalid");
}
# Validate password will throw an error if token is invalid
ValidatePassword($::token);
trick_taint($::token); # Only used in placeholders
Bugzilla::Token::CleanTokenTable();