diff options
author | Christian Ruppert <idl0r@gentoo.org> | 2011-03-12 22:26:37 +0100 |
---|---|---|
committer | Christian Ruppert <idl0r@gentoo.org> | 2011-03-12 22:26:37 +0100 |
commit | 012daefaf1d94c23f6eb6d3e4b9bfd1def4fe3af (patch) | |
tree | c64d1c7c31661186c811ab79c3d09bffda950c46 | |
parent | Fix typo in 5829fcba9a6eb8a896fce7c5611bad9f24d98a41 (diff) | |
download | bugzilla-012daefaf1d94c23f6eb6d3e4b9bfd1def4fe3af.tar.gz bugzilla-012daefaf1d94c23f6eb6d3e4b9bfd1def4fe3af.tar.bz2 bugzilla-012daefaf1d94c23f6eb6d3e4b9bfd1def4fe3af.zip |
Improve custom_userhistory.cgi
-rwxr-xr-x | custom_userhistory.cgi | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/custom_userhistory.cgi b/custom_userhistory.cgi index 6a4557c17..6bf8ec3ca 100755 --- a/custom_userhistory.cgi +++ b/custom_userhistory.cgi @@ -7,6 +7,7 @@ use Data::Dumper; use Bugzilla; use Bugzilla::Constants; use Bugzilla::Util; +use Bugzilla::User; my $cgi = Bugzilla->cgi; my $vars = {}; @@ -28,28 +29,14 @@ trick_taint($matchstr) if defined($matchstr); trick_taint($userid) if defined($userid); trick_taint($limit); -if($matchstr) { - $query = 'SELECT DISTINCT userid, login_name '. - 'FROM profiles '. - 'WHERE profiles.login_name = ?'; -} -else { - $query = 'SELECT DISTINCT userid, login_name '. - 'FROM profiles '. - 'WHERE profiles.userid = ?'; -} +$userid = $matchstr ? login_to_id($matchstr) : $userid; +my $login_name = $matchstr ? $matchstr : user_id_to_login($userid); -push(@bindValues, $matchstr ? $matchstr : $userid); -$vars->{'users'} = $dbh->selectall_arrayref($query, {'Slice' => {}}, @bindValues); - -if(!defined($vars->{'users'}[0])) { +if(!$userid || !$login_name) { print "Bad user!<br>"; - exit 0; + exit(0); } -$userid = $vars->{'users'}[0]->{'userid'} ? $vars->{'users'}[0]->{'userid'} : $userid; -my $login_name = $vars->{'users'}[0]->{'login_name'}; - my @bindValues2; $query = sprintf '(SELECT bug_id,bug_when,fielddefs.name AS field '. |