getText( 'username' ); $this->requestedUser = ''; if ( $un != '' ) { $username = Title::makeTitleSafe( NS_USER, $un ); if( !is_null( $username ) ) { $this->requestedUser = $username->getText(); } } parent::__construct(); } function getIndexField() { return 'rc_user_text'; } function getQueryInfo() { $dbr = wfGetDB( DB_SLAVE ); $conds = array( 'rc_user > 0' ); // Users - no anons $conds[] = 'ipb_deleted IS NULL'; // don't show hidden names $conds[] = 'rc_log_type IS NULL OR rc_log_type != "newusers"'; if( $this->requestedUser != '' ) { $conds[] = 'rc_user_text >= ' . $dbr->addQuotes( $this->requestedUser ); } $query = array( 'tables' => array( 'recentchanges', 'user', 'ipblocks' ), 'fields' => array( 'rc_user_text AS user_name', // inheritance 'rc_user_text', // for Pager 'user_id', 'COUNT(*) AS recentedits', 'MAX(ipb_user) AS blocked' ), 'options' => array( 'GROUP BY' => 'rc_user_text', 'USE INDEX' => array( 'recentchanges' => 'rc_user_text' ) ), 'join_conds' => array( 'user' => array( 'INNER JOIN', 'rc_user_text=user_name' ), 'ipblocks' => array( 'LEFT JOIN', 'user_id=ipb_user AND ipb_auto=0 AND ipb_deleted=1' ), ), 'conds' => $conds ); return $query; } function formatRow( $row ) { $userName = $row->user_name; $userPage = Title::makeTitle( NS_USER, $userName ); $name = $this->getSkin()->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) ); $list = array(); foreach( self::getGroups( $row->user_id ) as $group ) $list[] = self::buildGroupLink( $group ); $groups = implode( ', ', $list ); $item = wfSpecialList( $name, $groups ); $count = wfMsgExt( 'activeusers-count', array( 'parsemag' ), $row->recentedits, $userName ); $blocked = $row->blocked ? ' ' . wfMsgExt( 'listusers-blocked', array( 'parsemag' ), $userName ) : ''; return "
  • {$item} [{$count}]{$blocked}
  • "; } function getPageHeader() { global $wgScript, $wgRequest; $self = $this->getTitle(); # Form tag $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) . '
    ' . Xml::element( 'legend', array(), wfMsg( 'activeusers' ) ); $out .= Xml::hidden( 'title', $self->getPrefixedDBkey() ); # Username field $out .= Xml::label( wfMsg( 'activeusers-from' ), 'offset' ) . ' ' . Xml::input( 'username', 20, $this->requestedUser, array( 'id' => 'offset' ) ) . ' '; # Submit button and form bottom if( $this->mLimit ) $out .= Xml::hidden( 'limit', $this->mLimit ); $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ); $out .= '
    ' . Xml::closeElement( 'form' ); return $out; } } /** * @ingroup SpecialPage */ class SpecialActiveUsers extends SpecialPage { /** * Constructor */ public function __construct() { parent::__construct( 'Activeusers' ); } /** * Show the special page * * @param $par Mixed: parameter passed to the page or null */ public function execute( $par ) { global $wgOut; $this->setHeaders(); $up = new ActiveUsersPager(); # getBody() first to check, if empty $usersbody = $up->getBody(); $s = $up->getPageHeader(); if( $usersbody ) { $s .= $up->getNavigationBar(); $s .= ''; $s .= $up->getNavigationBar(); } else { $s .= '

    ' . wfMsgHtml( 'activeusers-noresult' ) . '

    '; } $wgOut->addHTML( $s ); } }