From 9012bb868e0d33bca6ca05a910726ae1abb6b06d Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Fri, 12 Nov 2004 20:41:24 +0000 Subject: [PATCH] Partially implement http://bugzilla.wikipedia.org/show_bug.cgi?id=770 * Group is shown instead of rights. * Filter per group. * Search by exact username match --- includes/SpecialListusers.php | 99 +++++++++++++++++++++++++++++++++-- 1 file changed, 96 insertions(+), 3 deletions(-) diff --git a/includes/SpecialListusers.php b/includes/SpecialListusers.php index f025e1a345..bde94bba73 100644 --- a/includes/SpecialListusers.php +++ b/includes/SpecialListusers.php @@ -1,4 +1,23 @@ getPrefixedDBkey() ); + + // form header + $out = '
' . + '' . + 'Group: '; + + $out .= 'User: '; + + // OK button, end of form. + $out .= '
'; + // congratulations the form is now build + return $out; + } + function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); + /* system showing possible actions for users $user = $dbr->tableName( 'user' ); $user_rights = $dbr->tableName( 'user_rights' ); $userspace = Namespace::getUser(); return "SELECT ur_rights as type, $userspace as namespace, user_name as title, " . "user_name as value FROM $user LEFT JOIN $user_rights ON user_id = ur_user"; + */ + /** Show groups instead */ + $user = $dbr->tableName( 'user' ); + $group = $dbr->tableName( 'group' ); + $user_groups = $dbr->tableName( 'user_groups' ); + + $userspace = Namespace::getUser(); + $sql = "SELECT group_name as type, $userspace AS namespace, user_name AS title, user_name as value " . + "FROM $user LEFT JOIN $user_groups ON user_id =ug_user " . + "LEFT JOIN $group ON ug_group = group_id "; + + if($this->requestedGroup != '') { + $sql .= "WHERE group_id= '$this->requestedGroup' "; + if($this->requestedUser != '') { + $sql .= "AND user_name = '$this->requestedUser' "; + } + } else { + if($this->requestedUser !='') { + $sql .= "WHERE user_name = '$this->requestedUser' "; + } + } + + return $sql; } function sortDescending() { @@ -42,7 +129,7 @@ class ListUsersPage extends QueryPage { $name = $skin->makeLink( $wgContLang->getNsText($result->namespace) . ':' . $result->title, $result->title ); if( '' != $result->type ) { $name .= ' (' . - $skin->makeLink( wfMsgForContent( "administrators" ), $result->type) . + $skin->makeLink( wfMsgForContent( 'administrators' ), $result->type) . ')'; } return $name; @@ -53,11 +140,17 @@ class ListUsersPage extends QueryPage { * constructor */ function wfSpecialListusers() { - global $wgUser, $wgOut, $wgLang; + global $wgUser, $wgOut, $wgLang, $wgRequest; list( $limit, $offset ) = wfCheckLimits(); $slu = new ListUsersPage(); + + /** + * Get some parameters + */ + $slu->requestedGroup = $wgRequest->getVal('group'); + $slu->requestedUser = $wgRequest->getVal('username'); return $slu->doQuery( $offset, $limit ); } -- 2.20.1