added enabled field so you can disable the cache thing if you need to before its...
[lhc/web/wiklou.git] / includes / specials / SpecialListusers.php
index 8a60c38..0b8959e 100644 (file)
@@ -40,7 +40,8 @@ class UsersPager extends AlphabeticPager {
                }
 
                $request = $this->getRequest();
-               $parms = explode( '/', ($par = ( $par !== null ) ? $par : '' ) );
+               $par = ( $par !== null ) ? $par : '';
+               $parms = explode( '/', $par );
                $symsForAll = array( '*', 'user' );
                if ( $parms[0] != '' && ( in_array( $par, User::getAllGroups() ) || in_array( $par, $symsForAll ) ) ) {
                        $this->requestedGroup = $par;
@@ -131,7 +132,7 @@ class UsersPager extends AlphabeticPager {
                $userPage = Title::makeTitle( NS_USER, $row->user_name );
                $name = Linker::link( $userPage, htmlspecialchars( $userPage->getText() ) );
 
-               $lang = $this->getLang();
+               $lang = $this->getLanguage();
 
                $groups_list = self::getGroups( $row->user_id );
                if( count( $groups_list ) > 0 ) {
@@ -150,23 +151,27 @@ class UsersPager extends AlphabeticPager {
 
                global $wgEdititis;
                if ( $wgEdititis ) {
-                       $editCount = $lang->formatNum( $row->edits );
-                       $edits = ' [' . wfMsgExt( 'usereditcount', array( 'parsemag', 'escape' ), $editCount ) . ']';
+                       $edits = ' [' . $this->msg( 'usereditcount' )->numParams( $row->edits )->escaped() . ']';
                } else {
                        $edits = '';
                }
 
+               $userTalkPage = $userPage->getTalkPage();
+               $talk = Linker::link( $userTalkPage, $this->msg( 'talkpagelinktext' )->escaped() );
+               $talk = ' ' . $this->msg( 'parentheses' )->rawParams( $talk )->escaped();
+
                $created = '';
                # Some rows may be NULL
                if( $row->creation ) {
-                       $d = $lang->date( wfTimestamp( TS_MW, $row->creation ), true );
-                       $t = $lang->time( wfTimestamp( TS_MW, $row->creation ), true );
-                       $created = ' (' . wfMsg( 'usercreated', $d, $t ) . ')';
-                       $created = htmlspecialchars( $created );
+                       $user = $this->getUser();
+                       $d = $lang->userDate( $row->creation, $user );
+                       $t = $lang->userTime( $row->creation, $user );
+                       $created = $this->msg( 'usercreated', $d, $t, $row->user_name )->escaped();
+                       $created = ' ' . $this->msg( 'parentheses' )->rawParams( $created )->escaped();
                }
 
                wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) );
-               return "<li>{$item}{$edits}{$created}</li>";
+               return "<li>{$item}{$edits}{$talk}{$created}</li>";
        }
 
        function getBody() {
@@ -185,34 +190,35 @@ class UsersPager extends AlphabeticPager {
 
        function getPageHeader( ) {
                global $wgScript;
-               $self = $this->getTitle();
+               // @todo Add a PrefixedBaseDBKey
+               list( $self ) = explode( '/', $this->getTitle()->getPrefixedDBkey() );
 
                # Form tag
                $out  = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listusers-form' ) ) .
-                       Xml::fieldset( wfMsg( 'listusers' ) ) .
-                       Html::hidden( 'title', $self->getPrefixedDbKey() );
+                       Xml::fieldset( $this->msg( 'listusers' )->text() ) .
+                       Html::hidden( 'title', $self );
 
                # Username field
-               $out .= Xml::label( wfMsg( 'listusersfrom' ), 'offset' ) . ' ' .
+               $out .= Xml::label( $this->msg( 'listusersfrom' )->text(), 'offset' ) . ' ' .
                        Xml::input( 'username', 20, $this->requestedUser, array( 'id' => 'offset' ) ) . ' ';
 
                # Group drop-down list
-               $out .= Xml::label( wfMsg( 'group' ), 'group' ) . ' ' .
+               $out .= Xml::label( $this->msg( 'group' )->text(), 'group' ) . ' ' .
                        Xml::openElement('select',  array( 'name' => 'group', 'id' => 'group' ) ) .
-                       Xml::option( wfMsg( 'group-all' ), '' );
+                       Xml::option( $this->msg( 'group-all' )->text(), '' );
                foreach( $this->getAllGroups() as $group => $groupText )
                        $out .= Xml::option( $groupText, $group, $group == $this->requestedGroup );
                $out .= Xml::closeElement( 'select' ) . '<br />';
-               $out .= Xml::checkLabel( wfMsg('listusers-editsonly'), 'editsOnly', 'editsOnly', $this->editsOnly );
+               $out .= Xml::checkLabel( $this->msg( 'listusers-editsonly' )->text(), 'editsOnly', 'editsOnly', $this->editsOnly );
                $out .= '&#160;';
-               $out .= Xml::checkLabel( wfMsg('listusers-creationsort'), 'creationSort', 'creationSort', $this->creationSort );
+               $out .= Xml::checkLabel( $this->msg( 'listusers-creationsort' )->text(), 'creationSort', 'creationSort', $this->creationSort );
                $out .= '<br />';
 
                wfRunHooks( 'SpecialListusersHeaderForm', array( $this, &$out ) );
 
                # Submit button and form bottom
                $out .= Html::hidden( 'limit', $this->mLimit );
-               $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) );
+               $out .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text() );
                wfRunHooks( 'SpecialListusersHeader', array( $this, &$out ) );
                $out .= Xml::closeElement( 'fieldset' ) .
                        Xml::closeElement( 'form' );
@@ -263,6 +269,7 @@ class UsersPager extends AlphabeticPager {
         * Format a link to a group description page
         *
         * @param $group String: group name
+        * @param $username String Username
         * @return string
         */
        protected static function buildGroupLink( $group, $username ) {
@@ -302,7 +309,7 @@ class SpecialListUsers extends SpecialPage {
                        $s .= Html::rawElement( 'ul', array(), $usersbody );
                        $s .= $up->getNavigationBar();
                } else {
-                       $s .= wfMessage( 'listusers-noresult' )->parseAsBlock();
+                       $s .= $this->msg( 'listusers-noresult' )->parseAsBlock();
                }
 
                $this->getOutput()->addHTML( $s );