From: Antoine Musso Date: Sat, 12 Jun 2004 20:14:55 +0000 (+0000) Subject: Migrated as a QueryPage extension X-Git-Tag: 1.5.0alpha1~2877 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=2b42d219a9f3d61e1a9e6738ba4b93a95f6c44f2;p=lhc%2Fweb%2Fwiklou.git Migrated as a QueryPage extension * isExpensive : false --- diff --git a/includes/SpecialListusers.php b/includes/SpecialListusers.php index 756e92e61f..ad11a78170 100644 --- a/includes/SpecialListusers.php +++ b/includes/SpecialListusers.php @@ -1,39 +1,48 @@ addHTML( "

{$top}\n" ); +require_once("QueryPage.php"); - $sl = wfViewPrevNext( $offset, $limit, - $wgLang->specialPage( "Listusers" ) ); - $wgOut->addHTML( "
{$sl}

\n
    " ); +class ListUsersPage extends QueryPage { - $usertable=$wgIsPg?'"user"':'user'; - $sql = "SELECT user_name,user_rights FROM $usertable ORDER BY user_name" . - wfLimitResult($limit,$offset); - $res = wfQuery( $sql, DB_READ, "wfSpecialListusers" ); + function getName() { + return "Listusers"; + } - $sk = $wgUser->getSkin(); - while ( $s = wfFetchObject( $res ) ) { - $n = $s->user_name; - $r = $s->user_rights; + function isExpensive() { + return false; + } - $l = $sk->makeLink( $wgLang->getNsText( - Namespace::getUser() ) . ":{$n}", $n ); + function getSQL() { + global $wgIsPg; + $usertable = $wgIsPg?'"user"':'user'; + $userspace = Namespace::getUser(); + return "SELECT user_rights as type, $userspace as namespace, user_name as title, user_name as value FROM $usertable"; + } + + function sortDescending() { + return false; + } - if ( "" != $r ) { - $link = $sk->makeKnownLink( wfMsg( "administrators" ), $r ); - $l .= " ({$link})"; + function formatResult( $skin, $result ) { + global $wgLang; + $name = $skin->makeKnownLink( $wgLang->getNsText($result->namespace) . ':' . $result->title, $result->title ); + if( '' != $result->type ) { + $name .= ' (' . + $skin->makeKnownLink( wfMsg( "administrators" ), $result->type) . + ')'; } - $wgOut->addHTML( "
  1. {$l}
  2. \n" ); + return $name; } - wfFreeResult( $res ); - $wgOut->addHTML( "
\n

{$sl}

\n" ); +} + +function wfSpecialListusers() { + global $wgUser, $wgOut, $wgLang, $wgIsPg; + + list( $limit, $offset ) = wfCheckLimits(); + + $slu = new ListUsersPage(); + + return $slu->doQuery( $offset, $limit ); } ?>