remove unused variable
[lhc/web/wiklou.git] / includes / ChangesList.php
index 45fef5f..887e6e1 100644 (file)
@@ -1,14 +1,23 @@
 <?php
+/**
+ * @package MediaWiki
+ */
 
+/**
+ * @package MediaWiki
+ */
 class ChangesList {
        # Called by history lists and recent changes
        #
 
+       /** @todo document */
        function ChangesList( &$skin ) {
                $this->skin =& $skin;
        }
        
-       # Returns text for the start of the tabular part of RC
+       /** 
+        * Returns text for the start of the tabular part of RC
+        */
        function beginRecentChangesList() {
                $this->rc_cache = array() ;
                $this->rcMoveIndex = 0;
@@ -47,24 +56,24 @@ class ChangesList {
                $r .= '<tt>' ;
 
                if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
-                       $r .= '&nbsp;&nbsp;';
+                       $r .= '&nbsp;&nbsp;&nbsp;';
                } else {
                        # M, N and !
                        $M = wfMsg( 'minoreditletter' );
                        $N = wfMsg( 'newpageletter' );
 
                        if ( $rc_type == RC_NEW ) {
-                               $r .= $N ;
+                               $r .= '<span class="newpage">' . htmlspecialchars( $N ) . '</span>';
                        } else {
                                $r .= '&nbsp;' ;
                        }
                        if ( $rc_minor ) {
-                               $r .= $M ;
+                               $r .= '<span class="minor">' . htmlspecialchars( $M ) . '</span>';
                        } else {
                                $r .= '&nbsp;' ;
                        }
                        if ( $rcObj->unpatrolled ) {
-                               $r .= '!';
+                               $r .= '<span class="unpatrolled">!</span>';
                        } else {
                                $r .= '&nbsp;';
                        }
@@ -79,6 +88,10 @@ class ChangesList {
                if ( $rcObj->watched ) $link = '<strong>'.$link.'</strong>' ;
                $r .= $link ;
 
+               if ($rcObj->notificationtimestamp) {
+                       $r .= wfMsg( 'updatedmarker' );
+               }
+
                # Diff
                $r .= ' (' ;
                $r .= $rcObj->difflink ;
@@ -92,20 +105,13 @@ class ChangesList {
                $r .= $rcObj->usertalklink ;
 
                # Comment
-               if ( ($rc_comment != '' || $rc_type == RC_EDIT_COMMENT) && 
-                        $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
-               
-                       $rc_comment = $this->skin->formatComment($rc_comment, $rcObj->getTitle()); 
-               
-                       # If a summary comment change, we want to form the message "was ($rc_moved_to_title)
-                       # now ($rc_comment)".
-                       if ( $rc_type == RC_EDIT_COMMENT ) {
-                               $rc_comment = $wgContLang->emphasize( '(' . $rc_comment . ')' );
-                               $rc_moved_to_title = $this->skin->formatComment( $rc_moved_to_title, $rcObj->getTitle() );
-                               $rc_moved_to_title = $wgContLang->emphasize( '(' . $rc_moved_to_title . ')' );
-                               $r .= ' ' . wfMsg( 'ecrccommentformat', $rc_moved_to_title, $rc_comment );
-                       } else
-                               $r .= $wgContLang->emphasize( ' ('.$rc_comment.')' );
+                if ( $rc_comment != '' && $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
+                       $rc_comment=$this->skin->formatComment($rc_comment, $rcObj->getTitle());
+                       $r .= $wgContLang->emphasize( ' ('.$rc_comment.')' );
+               }
+
+               if ($rcObj->numberofWatchingusers > 0) {
+                       $r .= wfMsg('number_of_watching_users_RCview',  $wgContLang->formatNum($rcObj->numberofWatchingusers));
                }
 
                $r .= "<br />\n" ;
@@ -165,13 +171,16 @@ class ChangesList {
                # Main line
                # M/N
                $r .= '<tt>' ;
-               if ( $isnew ) $r .= $N ;
-               else $r .= '&nbsp;' ;
-               $r .= '&nbsp;' ; # Minor
+               if ( $isnew ) {
+                       $r .= '<span class="newpage">' . htmlspecialchars( $N ) . '</span>';
+               } else {
+                       $r .= '&nbsp;';
+               }
+               $r .= '&nbsp;'; # Minor
                if ( $unpatrolled ) {
-                       $r .= "!";
+                       $r .= '<span class="unpatrolled">!</span>';
                } else {
-                       $r .= "&nbsp;";
+                       $r .= '&nbsp;';
                }
 
                # Timestamp
@@ -183,6 +192,10 @@ class ChangesList {
                if ( $block[0]->watched ) $link = '<strong>'.$link.'</strong>' ;
                $r .= $link ;
 
+               if ($block[0]->notificationtimestamp) {
+                       $r .= wfMsg( 'updatedmarker' );
+               }
+
                $curIdEq = 'curid=' . $block[0]->mAttribs['rc_cur_id'];
                if ( $block[0]->mAttribs['rc_type'] != RC_LOG ) {
                        # Changes
@@ -198,6 +211,10 @@ class ChangesList {
                }
 
                $r .= $users ;
+
+               if ($block[0]->numberofWatchingusers > 0) {
+                       $r .= wfMsg('number_of_watching_users_RCview',  $wgContLang->formatNum($block[0]->numberofWatchingusers));
+               }
                $r .= "<br />\n" ;
 
                # Sub-entries
@@ -209,21 +226,21 @@ class ChangesList {
                        $r .= '<img src="'.$wgStylePath.'/common/images/Arr_.png" width="12" height="12" />';
                        $r .= '<tt>&nbsp; &nbsp; &nbsp; &nbsp;' ;
                        if ( $rc_new ) {
-                               $r .= $N ;
+                               $r .= '<span class="newpage">' . htmlspecialchars( $N ) . '</span>';
                        } else {
                                $r .= '&nbsp;' ;
                        }
 
                        if ( $rc_minor ) {
-                               $r .= $M ;
+                               $r .= '<span class="minoredit">' . htmlspecialchars( $M ) . '</span>';
                        } else {
                                $r .= '&nbsp;' ;
                        }
 
                        if ( $rcObj->unpatrolled ) {
-                               $r .= "!";
+                               $r .= '<span class="unpatrolled">!</span>';
                        } else {
-                               $r .= "&nbsp;";
+                               $r .= '&nbsp;';
                        }
 
                        $r .= '&nbsp;</tt>' ;
@@ -282,7 +299,7 @@ class ChangesList {
         * Either returns the line, or caches it for later use
         */
        function recentChangesLine( &$rc, $watched = false ) {
-               global $wgUser ;
+               global $wgUser;
                $usenew = $wgUser->getOption( 'usenewrc' );
                if ( $usenew )
                        $line = $this->recentChangesLineNew ( $rc, $watched ) ;
@@ -291,11 +308,13 @@ class ChangesList {
                return $line ;
        }
 
+
        function recentChangesLineOld( &$rc, $watched = false ) {
+               global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgRCSeconds, $wgUseRCPatrol,
+                       $wgOnlySysopsCanPatrol, $wgSysopUserBans;
+
                $fname = 'Skin::recentChangesLineOld';
                wfProfileIn( $fname );
-               
-               global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgRCSeconds, $wgUseRCPatrol, $wgOnlySysopsCanPatrol;
 
                static $message;
                if( !isset( $message ) ) {
@@ -335,20 +354,6 @@ class ChangesList {
                        $msg = ( $rc_type == RC_MOVE ) ? '1movedto2' : '1movedto2_redir';
                        $s .= wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
                                $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
-               } else if ( $rc_type == RC_EDIT_COMMENT ) { 
-                       # Diff
-                       $s .= '(' . wfMsg( 'diff' ) . ') (';
-                       # History link
-                       $s .= $this->skin->makeKnownLinkObj( $rc->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' );
-                       $s .= ') . . ';
-
-                       # M and ! (minor and unpatrolled)
-                       if ( $rc_minor ) { $s .= '<span class="minor">'.$message["minoreditletter"].'</span> '; }
-                       if ( !$rc_patrolled ) { $s .= '<span class="unpatrolled">!</span> '; }
-                       
-                       # Put a link to the revision the comment is for, in a message.
-                       $s .= wfMsg( "eccommentchanged" , 
-                                               $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no&oldid=' . $rc_this_oldid ) );
                } elseif( $rc_namespace == NS_SPECIAL && preg_match( '!^Log/(.*)$!', $rc_title, $matches ) ) {
                        # Log updates, etc
                        $logtype = $matches[1];
@@ -375,9 +380,9 @@ class ChangesList {
                        $s .= ') . . ';
 
                        # M, N and ! (minor, new and unpatrolled)
-                       if ( $rc_minor ) { $s .= ' <span class="minor">'.$message["minoreditletter"].'</span>'; }
-                       if ( $rc_type == RC_NEW ) { $s .= '<span class="newpage">'.$message["newpageletter"].'</span>'; }
-                       if ( !$rc_patrolled ) { $s .= ' <span class="unpatrolled">!</span>'; }
+                       if ( $rc_minor ) { $s .= ' <span class="minor">'.htmlspecialchars( $message["minoreditletter"] ).'</span>'; }
+                       if ( $rc_type == RC_NEW ) { $s .= '<span class="newpage">'.htmlspecialchars( $message["newpageletter"] ).'</span>'; }
+                       if ( $unpatrolled ) { $s .= ' <span class="unpatrolled">!</span>'; }
 
                        # Article link
                        # If it's a new article, there is no diff link, but if it hasn't been
@@ -390,6 +395,11 @@ class ChangesList {
                        if ( $watched ) {
                                $articleLink = '<strong>'.$articleLink.'</strong>';
                        }
+
+                       if ($rc->notificationtimestamp) {
+                               $articleLink .= wfMsg( 'updatedmarker' );
+                       }
+
                        $s .= ' '.$articleLink;
                        wfProfileOut("$fname-page");
                }
@@ -420,7 +430,7 @@ class ChangesList {
                }
                # Block link
                $blockLink='';
-               if ( ( 0 == $rc_user ) && $wgUser->isAllowed('block') ) {
+               if ( ( $wgSysopUserBans || 0 == $rc_user ) && $wgUser->isAllowed('block') ) {
                        $blockLinkPage = Title::makeTitle( NS_SPECIAL, 'Blockip' );
                        $blockLink = $this->skin->makeKnownLinkObj( $blockLinkPage,
                                $message['blocklink'], 'ip='.$rc_user_text );
@@ -433,21 +443,15 @@ class ChangesList {
                if($userTalkLink) $s.=' ('.$userTalkLink.')';
 
                # Add comment
-               if ( (('' != $rc_comment && '*' != $rc_comment) || $rc_type == RC_EDIT_COMMENT) && 
-                    $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
-                       
-                       $rc_comment = $this->skin->formatComment( $rc_comment, $rc->getTitle() );
-                       
-                       # If a summary comment change, we want to form the message "was ($rc_moved_to_title)
-                       # now ($rc_comment)".
-                       if ( $rc_type == RC_EDIT_COMMENT ) {
-                               $rc_comment = $wgContLang->emphasize( '(' . $rc_comment . ')' );
-                               $rc_moved_to_title = $this->skin->formatComment( $rc_moved_to_title, $rc->getTitle() );
-                               $rc_moved_to_title = $wgContLang->emphasize( '(' . $rc_moved_to_title . ')' );
-                               $s .= ' ' . wfMsg( 'ecrccommentformat', $rc_moved_to_title, $rc_comment );
-                       } else
-                               $s .= $wgContLang->emphasize(' (' . $rc_comment . ')');
+               if ( '' != $rc_comment && '*' != $rc_comment && $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
+                       $rc_comment = $this->skin->formatComment($rc_comment,$rc->getTitle());
+                       $s .= $wgContLang->emphasize(' (' . $rc_comment . ')');
+               }
+
+               if ($rc->numberofWatchingusers > 0) {
+                       $s .= ' ' . wfMsg('number_of_watching_users_RCview',  $wgContLang->formatNum($rc->numberofWatchingusers));
                }
+
                $s .= "</li>\n";
 
                wfProfileOut( "$fname-rest" );
@@ -456,8 +460,8 @@ class ChangesList {
        }
 
        function recentChangesLineNew( &$baseRC, $watched = false ) {
-               global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgRCSeconds;
-               global $wgUseRCPatrol, $wgOnlySysopsCanPatrol;
+               global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgRCSeconds,
+                       $wgUseRCPatrol, $wgOnlySysopsCanPatrol, $wgSysopUserBans;
                
                static $message;
                if( !isset( $message ) ) {
@@ -497,10 +501,6 @@ class ChangesList {
                        $msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
                        $clink = wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
                          $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
-               } else if ( $rc_type == RC_EDIT_COMMENT ) { 
-                       # Put a link to the revision the comment is for, in a message.
-                       $clink = wfMsg( "eccommentchanged" , 
-                                                       $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no&oldid=' . $rc_this_oldid ) );
                } elseif( $rc_namespace == NS_SPECIAL && preg_match( '!^Log/(.*)$!', $rc_title, $matches ) ) {
                        # Log updates, etc
                        $logtype = $matches[1];
@@ -517,6 +517,8 @@ class ChangesList {
                $rc->watched = $watched ;
                $rc->link = $clink ;
                $rc->timestamp = $time;
+               $rc->notificationtimestamp = $baseRC->notificationtimestamp;
+               $rc->numberofWatchingusers = $baseRC->numberofWatchingusers;
 
                # Make "cur" and "diff" links
                $titleObj = $rc->getTitle();
@@ -525,9 +527,7 @@ class ChangesList {
                } else {
                        $rcIdQuery = '';
                }
-               if ( ( $rc_type == RC_NEW && $rc_this_oldid == 0 ) || $rc_type == RC_LOG || 
-                          $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT || 
-                          $rc_type == RC_EDIT_COMMENT) {
+               if ( ( $rc_type == RC_NEW && $rc_this_oldid == 0 ) || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
                        $curLink = $message['cur'];
                        $diffLink = $message['diff'];
                } else {
@@ -566,7 +566,7 @@ class ChangesList {
                $userTalkLink = $this->skin->makeLinkObj( $userTalkPage, $talkname );
 
                global $wgDisableAnonTalk;
-               if ( ( 0 == $rc_user ) && $wgUser->isAllowed('block') ) {
+               if ( ( $wgSysopUserBans || 0 == $rc_user ) && $wgUser->isAllowed('block') ) {
                        $blockPage =& Title::makeTitle( NS_SPECIAL, 'Blockip' );
                        $blockLink = $this->skin->makeKnownLinkObj( $blockPage,
                                $message['blocklink'], 'ip='.$rc_user_text );
@@ -585,7 +585,7 @@ class ChangesList {
                # Page moves go on their own line
                $title = $rc->getTitle();
                $secureName = $title->getPrefixedDBkey();
-               if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT || $rc_type == RC_EDIT_COMMENT ) {
+               if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
                        # Use an @ character to prevent collision with page names
                        $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array($rc);
                } else {
@@ -596,6 +596,4 @@ class ChangesList {
        }
 
 }
-
-
-?>
+?>
\ No newline at end of file