aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Ruppert <idl0r@gentoo.org>2011-03-12 22:26:37 +0100
committerChristian Ruppert <idl0r@gentoo.org>2011-03-12 22:26:37 +0100
commit012daefaf1d94c23f6eb6d3e4b9bfd1def4fe3af (patch)
treec64d1c7c31661186c811ab79c3d09bffda950c46 /custom_userhistory.cgi
parentFix typo in 5829fcba9a6eb8a896fce7c5611bad9f24d98a41 (diff)
downloadbugzilla-012daefaf1d94c23f6eb6d3e4b9bfd1def4fe3af.tar.gz
bugzilla-012daefaf1d94c23f6eb6d3e4b9bfd1def4fe3af.tar.bz2
bugzilla-012daefaf1d94c23f6eb6d3e4b9bfd1def4fe3af.zip
Improve custom_userhistory.cgi
Diffstat (limited to 'custom_userhistory.cgi')
-rwxr-xr-xcustom_userhistory.cgi23
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 '.