# Domas Mituzas, Ashar Voultoiz, Jens Frank, Zhengzhu.
#
# http://www.mediawiki.org/
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
class ListUsersPage extends QueryPage {
var $requestedGroup = '';
var $requestedUser = '';
-
+
function getName() {
return 'Listusers';
}
* Fetch user page links and cache their existence
*/
function preprocessResults( &$db, &$res ) {
- global $wgLinkCache;
-
$batch = new LinkBatch;
while ( $row = $db->fetchObject( $res ) ) {
$batch->addObj( Title::makeTitleSafe( $row->namespace, $row->title ) );
}
- $batch->execute( $wgLinkCache );
+ $batch->execute();
// Back to start for display
if( $db->numRows( $res ) > 0 ) {
*/
function getPageHeader( ) {
global $wgScript;
-
+
// Various variables used for the form
$action = htmlspecialchars( $wgScript );
$title = Title::makeTitle( NS_SPECIAL, 'Listusers' );
'<input type="hidden" name="title" value="'.$special.'" />' .
wfMsgHtml( 'groups-editgroup-name' ) . '<select name="group">';
- // get all group names and IDs
+ // get group names
$groups = User::getAllGroups();
-
+
// we want a default empty group
$out.= '<option value=""></option>';
-
+
// build the dropdown list menu using datas from the database
foreach ( $groups as $group ) {
$selected = ($group == $this->requestedGroup);
// OK button, end of form.
$out .= '<input type="submit" value="' . wfMsgHtml( 'allpagessubmit' ) . '" /></form>';
// congratulations the form is now build
- return $out;
+ 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.
// 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 " .
"LEFT JOIN $user_groups ON user_id=ug_user " .
$this->userQueryWhere( $dbr ) .
" GROUP BY user_name";
-
+
return $sql;
}
-
+
function userQueryWhere( &$dbr ) {
$conds = $this->userQueryConditions();
return empty( $conds )
? ""
: "WHERE " . $dbr->makeList( $conds, LIST_AND );
}
-
+
function userQueryConditions() {
$conds = array();
if( $this->requestedGroup != '' ) {
}
return $conds;
}
-
+
function linkParameters() {
$conds = array();
if( $this->requestedGroup != '' ) {
}
return $conds;
}
-
+
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',
$groups[] = User::getGroupName( $row->ug_group );
}
$dbr->freeResult( $result );
-
+
if( count( $groups ) > 0 ) {
$name .= ' (' .
$skin->makeLink( wfMsgForContent( 'administrators' ),
}
return $name;
- }
+ }
}
/**
$slu = new ListUsersPage();
-
+
/**
* Get some parameters
*/