Split user table into two parts: user and user_rights, for single login. BUG#57
[lhc/web/wiklou.git] / includes / SpecialListusers.php
1 <?php
2 #
3 # This class is used to get a list of user. The ones with specials
4 # rights (sysop, bureaucrat, developer) will have them displayed
5 # next to their names.
6
7 require_once("QueryPage.php");
8
9 class ListUsersPage extends QueryPage {
10
11 function getName() {
12 return "Listusers";
13 }
14
15 function getSQL() {
16 $dbr =& wfGetDB( DB_SLAVE );
17 $user = $dbr->tableName( 'user' );
18 $user_rights = $dbr->tableName( 'user_rights' );
19 $userspace = Namespace::getUser();
20 return "SELECT r.user_rights as type, $userspace as namespace, u.user_name as title, " .
21 "u.user_name as value FROM $user u LEFT JOIN $user_rights r ON u.user_id = r.user_id";
22 }
23
24 function sortDescending() {
25 return false;
26 }
27
28 function formatResult( $skin, $result ) {
29 global $wgLang;
30 $name = $skin->makeLink( $wgLang->getNsText($result->namespace) . ':' . $result->title, $result->title );
31 if( '' != $result->type ) {
32 $name .= ' (' .
33 $skin->makeLink( wfMsg( "administrators" ), $result->type) .
34 ')';
35 }
36 return $name;
37 }
38 }
39
40 function wfSpecialListusers() {
41 global $wgUser, $wgOut, $wgLang;
42
43 list( $limit, $offset ) = wfCheckLimits();
44
45 $slu = new ListUsersPage();
46
47 return $slu->doQuery( $offset, $limit );
48 }
49
50 ?>