From e51425da1f1fe8ee831bfb8d4c091d9e08ae4dce Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Wed, 4 May 2005 01:44:53 +0000 Subject: Bug 248386: Add support for Alias to post_bug.cgi - Patch by Albert Ting r=LpSolit a=justdave --- process_bug.cgi | 38 ++++---------------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) (limited to 'process_bug.cgi') diff --git a/process_bug.cgi b/process_bug.cgi index b62271e8b..6eb82fc5a 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -768,47 +768,17 @@ if (Param("usebugaliases") && defined $cgi->param('alias')) { # for one bug at a time, so ignore the alias change unless only a single # bug is being changed. if (scalar(@idlist) == 1) { - # Validate the alias if the user entered one. - if ($alias ne "") { - # Make sure the alias isn't too long. - if (length($alias) > 20) { - ThrowUserError("alias_too_long"); - } - - # Make sure the alias is unique. - my $escaped_alias = SqlQuote($alias); - my $vars = { alias => $alias }; - - SendSQL("SELECT bug_id FROM bugs WHERE alias = $escaped_alias " . - "AND bug_id != $idlist[0]"); - my $id = FetchOneColumn(); - - if ($id) { - $vars->{'bug_link'} = GetBugLink($id, "Bug $id"); - ThrowUserError("alias_in_use", $vars); - } - - # Make sure the alias isn't just a number. - if ($alias =~ /^\d+$/) { - ThrowUserError("alias_is_numeric", $vars); - } - - # Make sure the alias has no commas or spaces. - if ($alias =~ /[, ]/) { - ThrowUserError("alias_has_comma_or_space", $vars); - } - } - # Add the alias change to the query. If the field contains the blank # value, make the field be NULL to indicate that the bug has no alias. # Otherwise, if the field contains a value, update the record # with that value. DoComma(); $::query .= "alias = "; - if ($alias eq "") { - $::query .= "NULL"; + if ($alias ne "") { + ValidateBugAlias($alias, $idlist[0]); + $::query .= $dbh->quote($alias); } else { - $::query .= SqlQuote($alias); + $::query .= "NULL"; } } } -- cgit v1.2.3-24-g4f1b