summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcreateaccount.cgi6
-rwxr-xr-xenter_bug.cgi27
-rwxr-xr-xpost_bug.cgi16
-rwxr-xr-xprocess_bug.cgi22
-rwxr-xr-xquips.cgi20
-rw-r--r--template/en/default/global/code-error.html.tmpl5
-rw-r--r--template/en/default/global/user-error.html.tmpl50
7 files changed, 75 insertions, 71 deletions
diff --git a/createaccount.cgi b/createaccount.cgi
index 13256f47b..37776a780 100755
--- a/createaccount.cgi
+++ b/createaccount.cgi
@@ -44,11 +44,7 @@ if(Param('useLDAP')) {
# Just in case someone already has an account, let them get the correct
# footer on the error message
quietly_check_login();
- DisplayError("This site is using LDAP for authentication. Please contact
- an LDAP administrator to get a new account created.",
- "Can't create LDAP accounts");
- PutFooter();
- exit;
+ ThrowUserError("ldap_cant_create_account");
}
# Clear out the login cookies. Make people log in again if they create an
diff --git a/enter_bug.cgi b/enter_bug.cgi
index f53c63dd6..ab3e1512d 100755
--- a/enter_bug.cgi
+++ b/enter_bug.cgi
@@ -79,9 +79,7 @@ if (!defined $::FORM{'product'}) {
my $prodsize = scalar(keys %products);
if ($prodsize == 0) {
- DisplayError("Either no products have been defined to enter bugs ".
- "against or you have not been given access to any.\n");
- exit;
+ ThrowUserError("no_products");
}
elsif ($prodsize > 1) {
$vars->{'proddesc'} = \%products;
@@ -225,34 +223,19 @@ if(Param("usebuggroupsentry")
&& GroupExists($product)
&& !UserInGroup($product))
{
- DisplayError("Sorry; you do not have the permissions necessary to " .
- "enter a bug against this product.\n");
- exit;
+ ThrowUserError("entry_access_denied", { product => $product});
}
GetVersionTable();
if (lsearch(\@::enterable_products, $product) == -1) {
- DisplayError("'" . html_quote($product) . "' is not a valid product.");
- exit;
+ ThrowUserError("invalid_product_name", { product => $product});
}
my $product_id = get_product_id($product);
-if (0 == @{$::components{$product}}) {
- my $error = "Sorry; there needs to be at least one component for this " .
- "product in order to create a new bug. ";
- if (UserInGroup('editcomponents')) {
- $error .= "<a href=\"editcomponents.cgi\">" .
- "Create a new component</a>\n";
- }
- else {
- $error .= "Please contact " . Param("maintainer") . ", detailing " .
- "the product in which you tried to create a new bug.\n";
- }
-
- DisplayError($error);
- exit;
+if (0 == @{$::components{$product}}) {
+ ThrowUserError("no_components");
}
elsif (1 == @{$::components{$product}}) {
# Only one component; just pick it.
diff --git a/post_bug.cgi b/post_bug.cgi
index 206c75c57..c07d07d99 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -94,23 +94,15 @@ umask 0;
# Some sanity checking
if(Param("usebuggroupsentry") && GroupExists($product)) {
- if(!UserInGroup($product)) {
- DisplayError("Sorry; you do not have the permissions necessary to enter
- a bug against this product.", "Permission Denied");
- exit;
- }
+ UserInGroup($product) ||
+ ThrowUserError("entry_access_denied", {product => $product});
}
my $component_id = get_component_id($product_id, $::FORM{component});
-if (!$component_id) {
- DisplayError("You must choose a component that corresponds to this bug.
- If necessary, just guess.");
- exit;
-}
+$component_id || ThrowUserError("require_component");
if (!defined $::FORM{'short_desc'} || trim($::FORM{'short_desc'}) eq "") {
- DisplayError("You must enter a summary for this bug.");
- exit;
+ ThrowUserError("require_summary");
}
# If bug_file_loc is "http://", the default, strip it out and use an empty
diff --git a/process_bug.cgi b/process_bug.cgi
index 4fb42d8b0..1e4fd28b7 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -84,9 +84,7 @@ if (defined $::FORM{'id'}) {
}
# Make sure there are bugs to process.
-scalar(@idlist)
- || DisplayError("You did not select any bugs to modify.")
- && exit;
+scalar(@idlist) || ThrowUserError("no_bugs_chosen");
# If we are duping bugs, let's also make sure that we can change
# the original. This takes care of issue A on bug 96085.
@@ -616,11 +614,9 @@ foreach my $field ("rep_platform", "priority", "bug_severity",
my $prod_id; # Remember, can't use this for mass changes
if ($::FORM{'product'} ne $::dontchange) {
$prod_id = get_product_id($::FORM{'product'});
- if (! $prod_id) {
- DisplayError("The <tt>" . html_quote($::FORM{'product'}) .
- "</tt> product doesn't exist.");
- exit;
- }
+ $prod_id ||
+ ThrowUserError("invalid_product_name", {product => $::FORM{'product'});
+
DoComma();
$::query .= "product_id = $prod_id";
} else {
@@ -637,12 +633,10 @@ if ($::FORM{'component'} ne $::dontchange) {
}
$comp_id = get_component_id($prod_id,
$::FORM{'component'});
- if (! $comp_id) {
- DisplayError("The <tt>" . html_quote($::FORM{'component'}) .
- "</tt> component doesn't exist in the <tt>" .
- html_quote($::FORM{'product'}) . "</tt> product");
- exit;
- }
+ $comp_id || ThrowCodeError("invalid_component",
+ {component => $::FORM{'component'},
+ product => $::FORM{'product'}});
+
DoComma();
$::query .= "component_id = $comp_id";
}
diff --git a/quips.cgi b/quips.cgi
index f120e5a24..c36a09b6c 100755
--- a/quips.cgi
+++ b/quips.cgi
@@ -55,24 +55,12 @@ if ($action eq "show") {
}
if ($action eq "add") {
+ (Param('enablequips') eq "on") || ThrowUserError("no_new_quips");
+
# Add the quip
my $comment = $::FORM{"quip"};
- if (!$comment) {
- DisplayError("Please enter a quip in the text field.");
- exit();
- }
-
- if (Param('enablequips') ne "on") {
- ThrowUserError("no_new_quips");
- exit();
- }
-
-
- if ($comment =~ m/</) {
- DisplayError("Sorry - for security reasons, support for HTML tags has
- been turned off in quips.");
- exit();
- }
+ $comment || ThrowUserError("need_quip");
+ $comment !~ m/</ || ThrowUserError("no_html_in_quips");
SendSQL("INSERT INTO quips (userid, quip) VALUES (". $userid . ", " . SqlQuote($comment) . ")");
diff --git a/template/en/default/global/code-error.html.tmpl b/template/en/default/global/code-error.html.tmpl
index 0f767ded8..ecc222484 100644
--- a/template/en/default/global/code-error.html.tmpl
+++ b/template/en/default/global/code-error.html.tmpl
@@ -84,6 +84,11 @@
The custom sort order specified in your form submission contains an
invalid column name <em>[% fragment FILTER html %]</em>.
+ [% ELSIF error == "invalid_component" %]
+ [% title = "Invalid Component" %]
+ The [% component FILTER html %] component doesn't exist in the
+ [% product FILTER html %] product.
+
[% ELSIF error == "mismatched_bug_ids_on_obsolete" %]
Attachment [% attach_id FILTER html %] ([% description FILTER html %])
is attached to bug [% attach_bug_id FILTER html %], but you tried to
diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl
index 10c50cc9e..fd9ffe09b 100644
--- a/template/en/default/global/user-error.html.tmpl
+++ b/template/en/default/global/user-error.html.tmpl
@@ -147,6 +147,11 @@
[% title = "Email Address Email Address Confirmation Failed" %]
Email address confirmation failed.
+ [% ELSIF error == "entry_access_denied" %]
+ [% title = "Permission Denied" %]
+ Sorry; you do not have the permissions necessary to enter a bug against
+ the [% product FILTER html %] product.
+
[% ELSIF error == "file_not_specified" %]
[% title = "No File Specified" %]
You did not specify a file to attach.
@@ -272,6 +277,11 @@
[% title = "Invalid Username Or Password" %]
The username or password you entered is not valid.
+ [% ELSIF error == "ldap_cant_create_account" %]
+ [% title = "Can't create LDAP accounts" %]
+ This site is using LDAP for authentication. Please contact
+ an LDAP administrator to get a new account created.
+
[% ELSIF error == "login_needed_for_password_change" %]
[% title = "Login Name Required" %]
You must enter a login name when requesting to change your password.
@@ -316,10 +326,16 @@
[% ELSIF error == "need_component" %]
[% title = "Component Required" %]
- You must specify a component to help determine the new owner of these bugs.
+ You must specify a component to help determine the new owner of these bugs.
+
[% ELSIF error == "need_product" %]
[% title = "Product Required" %]
- You must specify a product to help determine the new owner of these bugs.
+ You must specify a product to help determine the new owner of these bugs.
+
+ [% ELSIF error == "need_quip" %]
+ [% title = "Quip Required" %]
+ Please enter a quip in the text field.
+
[% ELSIF error == "no_bugs_chosen" %]
[% title = "No Bugs Chosen" %]
You apparently didn't choose any bugs to modify.
@@ -329,6 +345,17 @@
You cannot change the component for a list of bugs covering more than
one product.
+ [% ELSIF error == "no_components" %]
+ [% title = "No Components" %]
+ Sorry; there needs to be at least one component for this product in order
+ to create a new bug.
+ [% IF UserInGroup("editcomponents") %]
+ <a href="editcomponents.cgi">Create a new component</a>.
+ [% ELSE %]
+ Please contact [% Param("maintainer") %], giving the name of
+ the product in which you tried to create a new bug.
+ [% END %]
+
[% ELSIF error == "no_dupe_stats" %]
[% title = "Cannot Find Duplicate Statistics" %]
There are no duplicate statistics for today ([% today %]) or yesterday.
@@ -347,6 +374,11 @@
There are no duplicate statistics for today ([% today %]), and an error
occurred opening yesterday's dupes file: [% error_msg FILTER html %].
+ [% ELSIF error == "no_html_in_quips" %]
+ [% title = "No HTML In Quips" %]
+ Sorry - for security reasons, support for HTML tags has been turned off
+ in quips.
+
[% ELSIF error == "no_new_quips" %]
[% title = "No New Quips" %]
This site does not permit the addition of new quips.
@@ -355,6 +387,11 @@
[% title = "No Page Specified" %]
You did not specify the id of a page to display.
+ [% ELSIF error == "no_products" %]
+ [% title = "No Products" %]
+ Either no products have been defined to enter bugs against or you have not
+ been given access to any.
+
[% ELSIF error == "patch_too_large" %]
[% title = "File Too Large" %]
The file you are trying to attach is [% filesize %] kilobytes (KB) in size.
@@ -383,10 +420,19 @@
100 users. Enter more of the name to bring the number of matches
down to a reasonable amount.
+ [% ELSIF error == "require_component" %]
+ [% title = "Component Needed" %]
+ You must choose a component to file this bug in. If necessary,
+ just guess.
+
[% ELSIF error == "require_new_password" %]
[% title = "New Password Needed" %]
You cannot change your password without submitting a new one.
+ [% ELSIF error == "require_summary" %]
+ [% title = "Summary Needed" %]
+ You must enter a summary for this bug.
+
[% ELSIF error == "token_inexistent" %]
[% title = "Token Does Not Exist" %]
The token you submitted does not exist, has expired, or has