diff options
author | David Lawrence <dlawrence@mozilla.com> | 2011-08-22 19:21:08 +0200 |
---|---|---|
committer | David Lawrence <dlawrence@mozilla.com> | 2011-08-22 19:21:08 +0200 |
commit | 9344a458c830ba066b9004c301d0fc6cabc8f229 (patch) | |
tree | ff06e420d70da1459af478c2619fb18900591d5c | |
parent | f30b939630917a63bc733e3963869643eeccdc90 (diff) | |
parent | dd7eacbef2571efe55e5b18d80e93837dc6619d1 (diff) | |
download | bugzilla-9344a458c830ba066b9004c301d0fc6cabc8f229.tar.gz bugzilla-9344a458c830ba066b9004c301d0fc6cabc8f229.tar.xz |
merged with bugzilla/4.2
-rw-r--r-- | Bugzilla/Bug.pm | 6 | ||||
-rw-r--r-- | Bugzilla/DB/Oracle.pm | 27 | ||||
-rw-r--r-- | Bugzilla/Install/Localconfig.pm | 5 | ||||
-rw-r--r-- | Bugzilla/Install/Requirements.pm | 5 | ||||
-rw-r--r-- | Bugzilla/Token.pm | 10 | ||||
-rwxr-xr-x | buglist.cgi | 2 | ||||
-rwxr-xr-x | editparams.cgi | 5 | ||||
-rwxr-xr-x | post_bug.cgi | 9 | ||||
-rwxr-xr-x | process_bug.cgi | 2 | ||||
-rw-r--r-- | template/en/default/attachment/createformcontents.html.tmpl | 5 | ||||
-rw-r--r-- | template/en/default/bug/create/create.html.tmpl | 1 | ||||
-rw-r--r-- | template/en/default/global/user-error.html.tmpl | 6 | ||||
-rw-r--r-- | template/en/default/reports/menu.html.tmpl | 4 | ||||
-rwxr-xr-x | userprefs.cgi | 7 |
14 files changed, 53 insertions, 41 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 40bf3af2e..6fdab3645 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -554,8 +554,8 @@ sub possible_duplicates { FROM bugs INNER JOIN bugs_fulltext ON bugs.bug_id = bugs_fulltext.bug_id WHERE ($where_sql) $product_sql - ORDER BY relevance DESC, bug_id DESC - LIMIT $sql_limit", {Slice=>{}}); + ORDER BY relevance DESC, bug_id DESC " . + $dbh->sql_limit($sql_limit), {Slice=>{}}); my @actual_dupe_ids; # Resolve duplicates into their ultimate target duplicates. @@ -1217,6 +1217,8 @@ sub send_changes { sub _send_bugmail { my ($params, $vars) = @_; + require Bugzilla::BugMail; + my $results = Bugzilla::BugMail::Send($params->{'id'}, $params->{'forced'}, $params); diff --git a/Bugzilla/DB/Oracle.pm b/Bugzilla/DB/Oracle.pm index 9fdacf24c..d91eb428e 100644 --- a/Bugzilla/DB/Oracle.pm +++ b/Bugzilla/DB/Oracle.pm @@ -177,7 +177,7 @@ sub sql_fulltext_search { my ($self, $column, $text, $label) = @_; $text = $self->quote($text); trick_taint($text); - return "CONTAINS($column,$text,$label)", "SCORE($label)"; + return "CONTAINS($column,$text,$label) > 0", "SCORE($label)"; } sub sql_date_format { @@ -379,20 +379,17 @@ sub adjust_statement { if ($new_sql !~ /\bWHERE\b/) { $new_sql = $new_sql." WHERE 1=1"; } - my ($before_where, $after_where) = split /\bWHERE\b/i,$new_sql; - if (defined($offset)) { - if ($new_sql =~ /(.*\s+)FROM(\s+.*)/i) { - my ($before_from,$after_from) = ($1,$2); - $before_where = "$before_from FROM ($before_from," - . " ROW_NUMBER() OVER (ORDER BY 1) R " - . " FROM $after_from ) "; - $after_where = " R BETWEEN $offset+1 AND $limit+$offset"; - } - } else { - $after_where = " rownum <=$limit AND ".$after_where; - } - - $new_sql = $before_where." WHERE ".$after_where; + my ($before_where, $after_where) = split(/\bWHERE\b/i, $new_sql, 2); + if (defined($offset)) { + my ($before_from, $after_from) = split(/\bFROM\b/i, $new_sql, 2); + $before_where = "$before_from FROM ($before_from," + . " ROW_NUMBER() OVER (ORDER BY 1) R " + . " FROM $after_from ) "; + $after_where = " R BETWEEN $offset+1 AND $limit+$offset"; + } else { + $after_where = " rownum <=$limit AND ".$after_where; + } + $new_sql = $before_where." WHERE ".$after_where; } return $new_sql; } diff --git a/Bugzilla/Install/Localconfig.pm b/Bugzilla/Install/Localconfig.pm index 3ce12207e..1ee7aca67 100644 --- a/Bugzilla/Install/Localconfig.pm +++ b/Bugzilla/Install/Localconfig.pm @@ -245,7 +245,8 @@ sub update_localconfig { # Move any custom or old variables into a separate file. if (scalar @old_vars) { my $filename_old = "$filename.old"; - open(my $old_file, ">>$filename_old") || die "$filename_old: $!"; + open(my $old_file, ">>:utf8", $filename_old) + or die "$filename_old: $!"; local $Data::Dumper::Purity = 1; foreach my $var (@old_vars) { print $old_file Data::Dumper->Dump([$localconfig->{$var}], @@ -259,7 +260,7 @@ sub update_localconfig { } # Re-write localconfig - open(my $fh, ">$filename") || die "$filename: $!"; + open(my $fh, ">:utf8", $filename) or die "$filename: $!"; foreach my $var (LOCALCONFIG_VARS) { my $name = $var->{name}; my $desc = install_string("localconfig_$name", { root => ROOT_USER }); diff --git a/Bugzilla/Install/Requirements.pm b/Bugzilla/Install/Requirements.pm index 8825eb3a7..ef4bf3d22 100644 --- a/Bugzilla/Install/Requirements.pm +++ b/Bugzilla/Install/Requirements.pm @@ -717,8 +717,9 @@ sub _checking_for { # show "ok" or "not found". if (exists $params->{found}) { my $found_string; - # We do a string compare in case it's non-numeric. - if ($found and $found eq "-1") { + # We do a string compare in case it's non-numeric. We make sure + # it's not a version object as negative versions are forbidden. + if ($found && !ref($found) && $found eq '-1') { $found_string = install_string('module_not_found'); } elsif ($found) { diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm index 69751e905..86220aa29 100644 --- a/Bugzilla/Token.pm +++ b/Bugzilla/Token.pm @@ -92,8 +92,9 @@ sub issue_new_user_account_token { } sub IssueEmailChangeToken { - my ($user, $old_email, $new_email) = @_; + my ($user, $new_email) = @_; my $email_suffix = Bugzilla->params->{'emailsuffix'}; + my $old_email = $user->login; my ($token, $token_ts) = _create_token($user->id, 'emailold', $old_email . ":" . $new_email); @@ -245,7 +246,7 @@ sub GenerateUniqueToken { $column ||= "token"; my $dbh = Bugzilla->dbh; - my $sth = $dbh->prepare("SELECT userid FROM $table WHERE $column = ?"); + my $sth = $dbh->prepare("SELECT 1 FROM $table WHERE $column = ?"); while ($duplicate) { ++$tries; @@ -447,7 +448,7 @@ Bugzilla::Token - Provides different routines to manage tokens. use Bugzilla::Token; Bugzilla::Token::issue_new_user_account_token($login_name); - Bugzilla::Token::IssueEmailChangeToken($user, $old_email, $new_email); + Bugzilla::Token::IssueEmailChangeToken($user, $new_email); Bugzilla::Token::IssuePasswordToken($user); Bugzilla::Token::DeletePasswordTokens($user_id, $reason); Bugzilla::Token::Cancel($token, $cancelaction, $vars); @@ -478,7 +479,7 @@ Bugzilla::Token - Provides different routines to manage tokens. Returns: Nothing. It throws an error if the same user made the same request in the last few minutes. -=item C<sub IssueEmailChangeToken($user, $old_email, $new_email)> +=item C<sub IssueEmailChangeToken($user, $new_email)> Description: Sends two distinct tokens per email to the old and new email addresses to confirm the email address change for the given @@ -486,7 +487,6 @@ Bugzilla::Token - Provides different routines to manage tokens. Params: $user - User object of the user requesting a new email address. - $old_email - The current (old) email address of the user. $new_email - The new email address of the user. Returns: Nothing. diff --git a/buglist.cgi b/buglist.cgi index 7549063a4..bf8b443e6 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -766,7 +766,7 @@ if ($fulltext and grep { /^relevance/ } @orderstrings) { # In the HTML interface, by default, we limit the returned results, # which speeds up quite a few searches where people are really only looking # for the top results. -if ($format->{'extension'} eq 'html' && !defined $cgi->param('limit')) { +if ($format->{'extension'} eq 'html' && !defined $params->param('limit')) { $params->param('limit', Bugzilla->params->{'default_search_limit'}); $vars->{'default_limited'} = 1; } diff --git a/editparams.cgi b/editparams.cgi index 6affd324c..28aac9602 100755 --- a/editparams.cgi +++ b/editparams.cgi @@ -100,6 +100,11 @@ if ($action eq 'save' && $current_module) { # assume single linefeed is an empty string $value =~ s/^\n$//; } + # Stop complaining if the URL has no trailing slash. + # XXX - This hack can go away once bug 303662 is implemented. + if ($name =~ /(?<!webdot)base$/) { + $value = "$value/" if ($value && $value !~ m#/$#); + } } my $changed; diff --git a/post_bug.cgi b/post_bug.cgi index 6d6ed746c..6ca46fb3c 100755 --- a/post_bug.cgi +++ b/post_bug.cgi @@ -153,14 +153,17 @@ my %bug_params; foreach my $field (@bug_fields) { $bug_params{$field} = $cgi->param($field); } -$bug_params{'cc'} = [$cgi->param('cc')]; -$bug_params{'groups'} = [$cgi->param('groups')]; -$bug_params{'comment'} = $comment; +foreach my $field (qw(cc groups)) { + next if !$cgi->should_set($field); + $bug_params{$field} = [$cgi->param($field)]; +} +$bug_params{'comment'} = $comment; my @multi_selects = grep {$_->type == FIELD_TYPE_MULTI_SELECT && $_->enter_bug} Bugzilla->active_custom_fields; foreach my $field (@multi_selects) { + next if !$cgi->should_set($field->name); $bug_params{$field->name} = [$cgi->param($field->name)]; } diff --git a/process_bug.cgi b/process_bug.cgi index acb359f63..382ee8b59 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -48,8 +48,6 @@ use lib qw(. lib); use Bugzilla; use Bugzilla::Constants; use Bugzilla::Bug; -use Bugzilla::BugMail; -use Bugzilla::Mailer; use Bugzilla::User; use Bugzilla::Util; use Bugzilla::Error; diff --git a/template/en/default/attachment/createformcontents.html.tmpl b/template/en/default/attachment/createformcontents.html.tmpl index f7b86f884..5b04382b6 100644 --- a/template/en/default/attachment/createformcontents.html.tmpl +++ b/template/en/default/attachment/createformcontents.html.tmpl @@ -43,10 +43,11 @@ </td> </tr> <tr> - <th><label for="description">Description</label>:</th> + <th class="required"><label for="description">Description</label>:</th> <td> <em>Describe the attachment briefly.</em><br> - <input type="text" id="description" name="description" size="60" maxlength="200"> + <input type="text" id="description" name="description" class="required" + size="60" maxlength="200"> </td> </tr> <tr[% ' class="expert_fields"' UNLESS bug.id %]> diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl index 8604f0839..ee19ab5d6 100644 --- a/template/en/default/bug/create/create.html.tmpl +++ b/template/en/default/bug/create/create.html.tmpl @@ -665,6 +665,7 @@ TUI_hide_default('attachment_text_field'); <br> <!-- Checkboxes --> + <input type="hidden" name="defined_groups" value="1"> [% FOREACH group = product.groups_available %] <input type="checkbox" id="group_[% group.id FILTER html %]" name="groups" value="[% group.name FILTER html %]" diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 5af39dc80..35640b220 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -1790,6 +1790,10 @@ attachment [% ELSIF class == "Bugzilla::User" %] user + [% ELSIF class == "Bugzilla::Classification" %] + classification + [% ELSIF class == "Bugzilla::Product" %] + product [% ELSIF class == "Bugzilla::Component" %] component [% ELSIF class == "Bugzilla::Version" %] @@ -1808,8 +1812,6 @@ group [% ELSIF class == "Bugzilla::Keyword" %] keyword - [% ELSIF class == "Bugzilla::Product" %] - product [% ELSIF class == "Bugzilla::Search::Recent" %] recent search [% ELSIF class == "Bugzilla::Search::Saved" %] diff --git a/template/en/default/reports/menu.html.tmpl b/template/en/default/reports/menu.html.tmpl index 5f26ac335..5e19b1209 100644 --- a/template/en/default/reports/menu.html.tmpl +++ b/template/en/default/reports/menu.html.tmpl @@ -57,6 +57,10 @@ line graphs, bar and pie charts. </li> [% END %] + <li id="report_duplicates"> + <strong><a href="duplicates.cgi">Duplicates</a></strong> - + list of most frequently reported [% terms.bugs %]. + </li> [% Hook.process('current_state') %] </ul> diff --git a/userprefs.cgi b/userprefs.cgi index f411326a2..94fe1def2 100755 --- a/userprefs.cgi +++ b/userprefs.cgi @@ -84,8 +84,6 @@ sub SaveAccount { my $oldpassword = $cgi->param('old_password'); my $pwd1 = $cgi->param('new_password1'); my $pwd2 = $cgi->param('new_password2'); - - my $old_login_name = $user->login; my $new_login_name = trim($cgi->param('new_login_name')); if ($user->authorizer->can_change_password @@ -119,7 +117,7 @@ sub SaveAccount { && Bugzilla->params->{"allowemailchange"} && $new_login_name) { - if ($old_login_name ne $new_login_name) { + if ($user->login ne $new_login_name) { $oldpassword || ThrowUserError("old_password_required"); # Block multiple email changes for the same user. @@ -133,8 +131,7 @@ sub SaveAccount { is_available_username($new_login_name) || ThrowUserError("account_exists", {email => $new_login_name}); - Bugzilla::Token::IssueEmailChangeToken($user, $old_login_name, - $new_login_name); + Bugzilla::Token::IssueEmailChangeToken($user, $new_login_name); $vars->{'email_changes_saved'} = 1; } |