* Wont work
[lhc/web/wiklou.git] / includes / ChangesList.php
index 7f9c9f4..8d0f950 100644 (file)
@@ -1,31 +1,52 @@
 <?php
+
 /**
- * @package MediaWiki
- * Contain class to show various lists of change:
- * - what's link here
- * - related changes
- * - recent changes
+ * @todo document
  */
+class RCCacheEntry extends RecentChange
+{
+       var $secureName, $link;
+       var $curlink , $difflink, $lastlink , $usertalklink , $versionlink ;
+       var $userlink, $timestamp, $watched;
+
+       static function newFromParent( $rc ) {
+               $rc2 = new RCCacheEntry;
+               $rc2->mAttribs = $rc->mAttribs;
+               $rc2->mExtra = $rc->mExtra;
+               return $rc2;
+       }
+} ;
 
 /**
- * @package MediaWiki
+ * Class to show various lists of changes:
+ * - what links here
+ * - related changes
+ * - recent changes
  */
 class ChangesList {
        # Called by history lists and recent changes
        #
 
        /** @todo document */
-       function ChangesList( &$skin ) {
+       function __construct( &$skin ) {
                $this->skin =& $skin;
                $this->preCacheMessages();
        }
-       
-       function newFromUser( &$user ) {
-               $sk =& $user->getSkin();
-               if( $user->getOption('usenewrc') ) {
-                       return new EnhancedChangesList( $sk );
+
+       /**
+        * Fetch an appropriate changes list class for the specified user
+        * Some users might want to use an enhanced list format, for instance
+        *
+        * @param $user User to fetch the list class for
+        * @return ChangesList derivative
+        */
+       public static function newFromUser( &$user ) {
+               $sk = $user->getSkin();
+               $list = NULL;
+               if( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) {
+                       return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk );
                } else {
-                       return new OldChangesList( $sk );
+                       return $list;
                }
        }
 
@@ -36,21 +57,23 @@ class ChangesList {
        function preCacheMessages() {
                // Precache various messages
                if( !isset( $this->message ) ) {
-                       foreach( explode(' ', 'cur diff hist minoreditletter newpageletter last blocklink' ) as $msg ) {
-                               $this->message[$msg] = wfMsg( $msg );
+                       foreach( explode(' ', 'cur diff hist minoreditletter newpageletter last '.
+                               'blocklink history boteditletter' ) as $msg ) {
+                               $this->message[$msg] = wfMsgExt( $msg, array( 'escape') );
                        }
                }
        }
 
 
        /**
-        * Returns the appropiate flags for new page, minor change and patrolling
+        * Returns the appropriate flags for new page, minor change and patrolling
         */
-       function recentChangesFlags( $new, $minor, $patrolled, $nothing = '&nbsp;' ) {
-               $f = $new ? '<span class="newpage">' . wfMsgHtml( 'newpageletter' ) . '</span>'
+       function recentChangesFlags( $new, $minor, $patrolled, $nothing = '&nbsp;', $bot = false ) {
+               $f = $new ? '<span class="newpage">' . $this->message['newpageletter'] . '</span>'
                                : $nothing;
-               $f .= $minor ? '<span class="minor">' . wfMsgHtml( 'minoreditletter' ) . '</span>'
+               $f .= $minor ? '<span class="minor">' . $this->message['minoreditletter'] . '</span>'
                                : $nothing;
+               $f .= $bot ? '<span class="bot">' . $this->message['boteditletter'] . '</span>' : $nothing;
                $f .= $patrolled ? '<span class="unpatrolled">!</span>' : $nothing;
                return $f;
        }
@@ -148,21 +171,24 @@ class ChangesList {
                        ? 'rcid='.$rc->mAttribs['rc_id']
                        : '';
                $articlelink = ' '. $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
-               if($watched) $articlelink = '<strong>'.$articlelink.'</strong>';
+               if( $watched )
+                       $articlelink = "<strong class=\"mw-watched\">{$articlelink}</strong>";
+               global $wgContLang;
+               $articlelink .= $wgContLang->getDirMark();
 
                $s .= ' '.$articlelink;
        }
 
-       function insertTimestamp(&$s, &$rc) {
+       function insertTimestamp(&$s, $rc) {
                global $wgLang;
-        # Timestamp
-        $s .= '; ' . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
+               # Timestamp
+               $s .= '; ' . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
        }
 
        /** Insert links to user page, user talk page and eventually a blocking link */
        function insertUserRelatedLinks(&$s, &$rc) {
-               $s .= $this->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
-               $s .= $this->userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
+               $s .= $this->skin->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
+               $s .= $this->skin->userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
        }
 
        /** insert a formatted comment */
@@ -172,90 +198,32 @@ class ChangesList {
                        $s .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
                }
        }
-       
+
        /**
-        * Check whether to enable RC-Patrol features
+        * Check whether to enable recent changes patrol features
         * @return bool
         */
        function usePatrol() {
-               global $wgUseRCPatrol, $wgOnlySysopsCanPatrol, $wgUser;
-               return $wgUseRCPatrol && $wgUser->isLoggedIn() &&
-                 ( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed( 'patrol' ) );
-       }
-       
-       /**
-        * Make user link (or user contributions for unregistered users)
-        * @param int $userId
-        * @param string $userText
-        * @return string HTML fragment
-        * @access private
-        */
-       function userLink( $userId, $userText ) {
-               $encName = htmlspecialchars( $userText );
-               if( $userId == 0 ) {
-                       $contribsPage = Title::makeTitle( NS_SPECIAL, 'Contributions' );
-                       return $this->skin->makeKnownLinkObj( $contribsPage,
-                               $encName, 'target=' . urlencode( $userText ) );
-               } else {
-                       $userPage = Title::makeTitle( NS_USER, $userText );
-                       return $this->skin->makeLinkObj( $userPage, $encName );
-               }
+               global $wgUseRCPatrol, $wgUser;
+               return( $wgUseRCPatrol && ($wgUser->isAllowed('patrol') || $wgUser->isAllowed('patrolmarks')) );
        }
-       
+
        /**
-        * @param int $userId
-        * @param string $userText
-        * @return string HTML fragment with talk and/or block links
-        * @access private
+        * Returns the string which indicates the number of watching users
         */
-       function userToolLinks( $userId, $userText ) {
-               global $wgUser, $wgDisableAnonTalk, $wgSysopUserBans;
-               $talkable = !( $wgDisableAnonTalk && 0 == $userId );
-               $blockable = ( $wgSysopUserBans || 0 == $userId );
-               
-               $items = array();
-               if( $talkable ) {
-                       $items[] = $this->userTalkLink( $userId, $userText );
-               }
-               if( $blockable && $wgUser->isAllowed( 'block' ) ) {
-                       $items[] = $this->blockLink( $userId, $userText );
-               }
-               
-               if( $items ) {
-                       return ' (' . implode( ' | ', $items ) . ')';
+       function numberofWatchingusers( $count ) {
+               global $wgLang;
+               static $cache = array();
+               if ( $count > 0 ) {
+                       if ( !isset( $cache[$count] ) ) {
+                               $cache[$count] = wfMsgExt('number_of_watching_users_RCview',
+                                       array('parsemag', 'escape'), $wgLang->formatNum($count));
+                       }
+                       return $cache[$count];
                } else {
                        return '';
                }
        }
-       
-       /**
-        * @param int $userId
-        * @param string $userText
-        * @return string HTML fragment with user talk link
-        * @access private
-        */
-       function userTalkLink( $userId, $userText ) {
-               global $wgContLang;
-               $talkname = $wgContLang->getNsText( NS_TALK ); # use the shorter name
-               
-               $userTalkPage = Title::makeTitle( NS_USER_TALK, $userText );
-               $userTalkLink = $this->skin->makeLinkObj( $userTalkPage, $talkname );
-               return $userTalkLink;
-       }
-       
-       /**
-        * @param int $userId
-        * @param string $userText
-        * @return string HTML fragment with block link
-        * @access private
-        */
-       function blockLink( $userId, $userText ) {
-               $blockPage = Title::makeTitle( NS_SPECIAL, 'Blockip' );
-               $blockLink = $this->skin->makeKnownLinkObj( $blockPage,
-                       $this->message['blocklink'], 'ip=' . urlencode( $userText ) );
-               return $blockLink;
-       }
-
 }
 
 
@@ -267,15 +235,14 @@ class OldChangesList extends ChangesList {
         * Format a line using the old system (aka without any javascript).
         */
        function recentChangesLine( &$rc, $watched = false ) {
-               global $wgLang, $wgContLang, $wgUser, $wgSysopUserBans;
+               global $wgContLang, $wgRCShowChangedSize;
 
                $fname = 'ChangesList::recentChangesLineOld';
                wfProfileIn( $fname );
 
-
                # Extract DB fields into local scope
+               // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
                extract( $rc->mAttribs );
-               $curIdEq = 'curid=' . $rc_cur_id;
 
                # Should patrol-related stuff be shown?
                $unpatrolled = $this->usePatrol() && $rc_patrolled == 0;
@@ -288,16 +255,21 @@ class OldChangesList extends ChangesList {
                if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
                        $this->insertMove( $s, $rc );
                // log entries
-               } elseif( $rc_namespace == NS_SPECIAL && preg_match( '!^Log/(.*)$!', $rc_title, $matches ) ) {
-                       $this->insertLog($s, $rc->getTitle(), $matches[1]);
+               } elseif ( $rc_namespace == NS_SPECIAL ) {
+                       list( $specialName, $specialSubpage ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
+                       if ( $specialName == 'Log' ) {
+                               $this->insertLog( $s, $rc->getTitle(), $specialSubpage );
+                       } else {
+                               wfDebug( "Unexpected special page in recentchanges\n" );
+                       }
                // all other stuff
                } else {
                        wfProfileIn($fname.'-page');
 
                        $this->insertDiffHist($s, $rc, $unpatrolled);
 
-                       # M, N and ! (minor, new and unpatrolled)
-                       $s .= ' ' . $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '' );
+                       # M, N, b and ! (minor, new, bot and unpatrolled)
+                       $s .= ' ' . $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '', $rc_bot );
                        $this->insertArticleLink($s, $rc, $unpatrolled, $watched);
 
                        wfProfileOut($fname.'-page');
@@ -306,12 +278,15 @@ class OldChangesList extends ChangesList {
                wfProfileIn( $fname.'-rest' );
 
                $this->insertTimestamp($s,$rc);
+
+               if( $wgRCShowChangedSize ) {
+                       $s .= ( $rc->getCharacterDifference() == '' ? '' : $rc->getCharacterDifference() . ' . . ' );
+               }
+
                $this->insertUserRelatedLinks($s,$rc);
                $this->insertComment($s, $rc);
 
-               if($rc->numberofWatchingusers > 0) {
-                       $s .= ' ' . wfMsg('number_of_watching_users_RCview',  $wgContLang->formatNum($rc->numberofWatchingusers));
-               }
+               $s .=  rtrim(' ' . $this->numberofWatchingusers($rc->numberofWatchingusers));
 
                $s .= "</li>\n";
 
@@ -331,12 +306,13 @@ class EnhancedChangesList extends ChangesList {
         * Format a line for enhanced recentchange (aka with javascript and block of lines).
         */
        function recentChangesLine( &$baseRC, $watched = false ) {
-               global $wgLang, $wgContLang, $wgUser, $wgSysopUserBans;
+               global $wgLang, $wgContLang;
 
                # Create a specialised object
                $rc = RCCacheEntry::newFromParent( $baseRC );
 
                # Extract fields from DB into the function scope (rc_xxxx variables)
+               // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
                extract( $rc->mAttribs );
                $curIdEq = 'curid=' . $rc_cur_id;
 
@@ -363,11 +339,16 @@ class EnhancedChangesList extends ChangesList {
                        $msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
                        $clink = wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
                          $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
-               } elseif( $rc_namespace == NS_SPECIAL && preg_match( '!^Log/(.*)$!', $rc_title, $matches ) ) {
-                       # Log updates, etc
-                       $logtype = $matches[1];
-                       $logname = LogPage::logName( $logtype );
-                       $clink = '(' . $this->skin->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
+               } elseif( $rc_namespace == NS_SPECIAL ) {
+                       list( $specialName, $logtype ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
+                       if ( $specialName == 'Log' ) {
+                               # Log updates, etc
+                               $logname = LogPage::logName( $logtype );
+                               $clink = '(' . $this->skin->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
+                       } else {
+                               wfDebug( "Unexpected special page in recentchanges\n" );
+                               $clink = '';
+                       }
                } elseif( $rc->unpatrolled && $rc_type == RC_NEW ) {
                        # Unpatrolled new page, give rc_id in query
                        $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
@@ -382,7 +363,6 @@ class EnhancedChangesList extends ChangesList {
                $rc->numberofWatchingusers = $baseRC->numberofWatchingusers;
 
                # Make "cur" and "diff" links
-               $titleObj = $rc->getTitle();
                if( $rc->unpatrolled ) {
                        $rcIdQuery = "&rcid={$rc_id}";
                } else {
@@ -409,13 +389,13 @@ class EnhancedChangesList extends ChangesList {
                          $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
                }
 
-               $rc->userlink = $this->userLink( $rc_user, $rc_user_text );
-               
+               $rc->userlink = $this->skin->userLink( $rc_user, $rc_user_text );
+
                $rc->lastlink = $lastLink;
                $rc->curlink  = $curLink;
                $rc->difflink = $diffLink;
 
-               $rc->usertalklink = $this->userToolLinks( $rc_user, $rc_user_text );
+               $rc->usertalklink = $this->skin->userToolLinks( $rc_user, $rc_user_text );
 
                # Put accumulated information into the cache, for later display
                # Page moves go on their own line
@@ -432,11 +412,12 @@ class EnhancedChangesList extends ChangesList {
                }
                return $ret;
        }
-       
+
        /**
         * Enhanced RC group
         */
        function recentChangesBlockGroup( $block ) {
+               global $wgLang, $wgContLang, $wgRCShowChangedSize;
                $r = '';
 
                # Collate list of users
@@ -445,7 +426,6 @@ class EnhancedChangesList extends ChangesList {
                $userlinks = array();
                foreach( $block as $rcObj ) {
                        $oldid = $rcObj->mAttribs['rc_last_oldid'];
-                       $newid = $rcObj->mAttribs['rc_this_oldid'];
                        if( $rcObj->mAttribs['rc_new'] ) {
                                $isnew = true;
                        }
@@ -456,6 +436,7 @@ class EnhancedChangesList extends ChangesList {
                        if( $rcObj->unpatrolled ) {
                                $unpatrolled = true;
                        }
+                       $bot = $rcObj->mAttribs['rc_bot'];
                        $userlinks[$u]++;
                }
 
@@ -465,6 +446,7 @@ class EnhancedChangesList extends ChangesList {
                $users = array();
                foreach( $userlinks as $userlink => $count) {
                        $text = $userlink;
+                       $text .= $wgContLang->getDirMark();
                        if( $count > 1 ) {
                                $text .= ' ('.$count.'&times;)';
                        }
@@ -484,49 +466,70 @@ class EnhancedChangesList extends ChangesList {
 
                # Main line
                $r .= '<tt>';
-               $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled );
+               $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, '&nbsp;', $bot );
 
                # Timestamp
-               $r .= ' '.$block[0]->timestamp.' ';
-               $r .= '</tt>';
+               $r .= ' '.$block[0]->timestamp.' </tt>';
 
                # Article link
                $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
+               $r .= $wgContLang->getDirMark();
 
                $curIdEq = 'curid=' . $block[0]->mAttribs['rc_cur_id'];
                $currentRevision = $block[0]->mAttribs['rc_this_oldid'];
                if( $block[0]->mAttribs['rc_type'] != RC_LOG ) {
                        # Changes
-                       $r .= ' ('.count($block).' ';
+
+                       $n = count($block);
+                       static $nchanges = array();
+                       if ( !isset( $nchanges[$n] ) ) {
+                               $nchanges[$n] = wfMsgExt( 'nchanges', array( 'parsemag', 'escape'),
+                                       $wgLang->formatNum( $n ) );
+                       }
+
+                       $r .= ' (';
+
                        if( $isnew ) {
-                               $r .= wfMsg('changes');
+                               $r .= $nchanges[$n];
                        } else {
-                               $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(), wfMsg('changes'),
-                                       $curIdEq."&diff=$currentRevision&oldid=$oldid" );
+                               $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
+                                       $nchanges[$n], $curIdEq."&diff=$currentRevision&oldid=$oldid" );
                        }
-                       $r .= '; ';
+
+                       $r .= ') . . ';
+
+                       if( $wgRCShowChangedSize ) {
+                               # Character difference
+                               $chardiff = $rcObj->getCharacterDifference( $block[ count( $block ) - 1 ]->mAttribs['rc_old_len'],
+                                               $block[0]->mAttribs['rc_new_len'] );
+                               if( $chardiff == '' ) {
+                                       $r .= ' (';
+                               } else {
+                                       $r .= ' ' . $chardiff. ' . . ';
+                               }
+                       }       
 
                        # History
-                       $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(), wfMsg( 'history' ), $curIdEq.'&action=history' );
+                       $r .= '(' . $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
+                               $this->message['history'], $curIdEq.'&action=history' );
                        $r .= ')';
                }
 
                $r .= $users;
 
-               if($block[0]->numberofWatchingusers > 0) {
-                       $r .= wfMsg('number_of_watching_users_RCview',  $wgContLang->formatNum($block[0]->numberofWatchingusers));
-               }
+               $r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers);
                $r .= "<br />\n";
 
                # Sub-entries
                $r .= '<div id="'.$rci.'" style="display:none">';
                foreach( $block as $rcObj ) {
                        # Get rc_xxxx variables
+                       // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
                        extract( $rcObj->mAttribs );
 
                        $r .= $this->spacerArrow();
                        $r .= '<tt>&nbsp; &nbsp; &nbsp; &nbsp;';
-                       $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled );
+                       $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
                        $r .= '&nbsp;</tt>';
 
                        $o = '';
@@ -545,7 +548,14 @@ class EnhancedChangesList extends ChangesList {
                        $r .= $rcObj->curlink;
                        $r .= '; ';
                        $r .= $rcObj->lastlink;
-                       $r .= ') . . '.$rcObj->userlink;
+                       $r .= ') . . ';
+
+                       # Character diff
+                       if( $wgRCShowChangedSize ) {
+                               $r .= ( $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ' ) ;
+                       }
+
+                       $r .= $rcObj->userlink;
                        $r .= $rcObj->usertalklink;
                        $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
                        $r .= "<br />\n";
@@ -555,16 +565,16 @@ class EnhancedChangesList extends ChangesList {
                $this->rcCacheIndex++;
                return $r;
        }
-       
+
        function maybeWatchedLink( $link, $watched=false ) {
                if( $watched ) {
                        // FIXME: css style might be more appropriate
-                       return '<strong>' . $link . '</strong>';
+                       return '<strong class="mw-watched">' . $link . '</strong>';
                } else {
                        return $link;
                }
        }
-       
+
        /**
         * Generate HTML for an arrow or placeholder graphic
         * @param string $dir one of '', 'd', 'l', 'r'
@@ -578,7 +588,7 @@ class EnhancedChangesList extends ChangesList {
                $encAlt = htmlspecialchars( $alt );
                return "<img src=\"$encUrl\" width=\"12\" height=\"12\" alt=\"$encAlt\" />";
        }
-       
+
        /**
         * Generate HTML for a right- or left-facing arrow,
         * depending on language direction.
@@ -590,7 +600,7 @@ class EnhancedChangesList extends ChangesList {
                $dir = $wgContLang->isRTL() ? 'l' : 'r';
                return $this->arrow( $dir, '+' );
        }
-       
+
        /**
         * Generate HTML for a down-facing arrow
         * depending on language direction.
@@ -600,7 +610,7 @@ class EnhancedChangesList extends ChangesList {
        function downArrow() {
                return $this->arrow( 'd', '-' );
        }
-       
+
        /**
         * Generate HTML for a spacer image
         * @return string HTML <img> tag
@@ -615,9 +625,10 @@ class EnhancedChangesList extends ChangesList {
         * @return string a HTML formated line (generated using $r)
         */
        function recentChangesBlockLine( $rcObj ) {
-               global $wgContLang;
+               global $wgContLang, $wgRCShowChangedSize;
 
                # Get rc_xxxx variables
+               // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
                extract( $rcObj->mAttribs );
                $curIdEq = 'curid='.$rc_cur_id;
 
@@ -632,7 +643,7 @@ class EnhancedChangesList extends ChangesList {
                if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
                        $r .= '&nbsp;&nbsp;&nbsp;';
                } else {
-                       $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled );
+                       $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
                }
                $r .= ' '.$rcObj->timestamp.' </tt>';
 
@@ -643,19 +654,22 @@ class EnhancedChangesList extends ChangesList {
                $r .= ' ('. $rcObj->difflink .'; ';
 
                # Hist
-               $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' );
+               $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ') . . ';
+
+               # Character diff
+               if( $wgRCShowChangedSize ) {
+                       $r .= ( $rcObj->getCharacterDifference() == '' ? '' : '&nbsp;' . $rcObj->getCharacterDifference() . ' . . ' ) ;
+               }
 
                # User/talk
-               $r .= ') . . '.$rcObj->userlink . $rcObj->usertalklink;
+               $r .= $rcObj->userlink . $rcObj->usertalklink;
 
                # Comment
                if( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
                        $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
                }
 
-               if( $rcObj->numberofWatchingusers > 0 ) {
-                       $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rcObj->numberofWatchingusers));
-               }
+               $r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
 
                $r .= "<br />\n";
                return $r;
@@ -670,7 +684,7 @@ class EnhancedChangesList extends ChangesList {
                        return '';
                }
                $blockOut = '';
-               foreach( $this->rc_cache as $secureName => $block ) {
+               foreach( $this->rc_cache as $block ) {
                        if( count( $block ) < 2 ) {
                                $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
                        } else {
@@ -690,4 +704,4 @@ class EnhancedChangesList extends ChangesList {
        }
 
 }
-?>
+