getPrefixedDBkey() ); // form header $out = '
' . '' . wfMsgHtml( 'groups-editgroup-name' ) . ' '; $out .= wfMsgHtml( 'specialloguserlabel' ) . ' '; // OK button, end of form. $out .= '
'; // congratulations the form is now build return $out; } function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); $user = $dbr->tableName( 'user' ); $user_groups = $dbr->tableName( 'user_groups' ); // We need to get an 'atomic' list of users, so that we // don't break the list half-way through a user's group set // and so that lists by group will show all group memberships. // // On MySQL 4.1 we could use GROUP_CONCAT to grab group // assignments together with users pretty easily. On other // versions, it's not so easy to do it consistently. // For now we'll just grab the number of memberships, so // we can then do targetted checks on those who are in // non-default groups as we go down the list. $userspace = NS_USER; $sql = "SELECT 'Listusers' as type, $userspace AS namespace, user_name AS title, " . "user_name as value, user_id, COUNT(ug_group) as numgroups " . "FROM $user ". "LEFT JOIN $user_groups ON user_id=ug_user "; if($this->requestedGroup != '') { $sql .= 'WHERE ug_group = ' . $dbr->addQuotes( $this->requestedGroup ) . ' '; if($this->requestedUser != '') { $sql .= "AND user_name = " . $dbr->addQuotes( $this->requestedUser ) . ' '; } } else { if($this->requestedUser !='') { $sql .= "WHERE user_name = " . $dbr->addQuotes( $this->requestedUser ) . ' '; } } $sql .= "GROUP BY user_name"; return $sql; } function sortDescending() { return false; } function formatResult( $skin, $result ) { global $wgContLang; $userPage = Title::makeTitle( $result->namespace, $result->title ); $name = $skin->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) ); if( !isset( $result->numgroups ) || $result->numgroups > 0 ) { $dbr =& wfGetDB( DB_SLAVE ); $result = $dbr->select( 'user_groups', array( 'ug_group' ), array( 'ug_user' => $result->user_id ), 'ListUsersPage::formatResult' ); $groups = array(); while( $row = $dbr->fetchObject( $result ) ) { $groups[] = User::getGroupName( $row->ug_group ); } $dbr->freeResult( $result ); if( count( $groups ) > 0 ) { $name .= ' (' . $skin->makeLink( wfMsgForContent( 'administrators' ), htmlspecialchars( implode( ', ', $groups ) ) ) . ')'; } } return $name; } } /** * constructor */ function wfSpecialListusers() { global $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 ); } ?>