* (bug 1636) Refs like ţ were misinterpreted as octal in some places
[lhc/web/wiklou.git] / includes / ChangesList.php
index 7e9807b..ccd07c3 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,9 +105,12 @@ class ChangesList {
                $r .= $rcObj->usertalklink ;
 
                # 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 ( $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 .= "<br />\n" ;
@@ -139,7 +155,7 @@ class ChangesList {
                        if ( $count > 1 ) $text .= " ({$count}&times;)" ;
                        array_push ( $users , $text ) ;
                }
-               $users = ' <font size="-1">['.implode('; ',$users).']</font>' ;
+               $users = ' <span class="changedby">['.implode('; ',$users).']</span>';
 
                # Arrow
                $rci = 'RCI'.$this->rcCacheIndex ;
@@ -154,13 +170,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
@@ -172,6 +191,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
@@ -187,6 +210,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
@@ -198,21 +225,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>' ;
@@ -235,10 +262,7 @@ class ChangesList {
                        $r .= $rcObj->lastlink ;
                        $r .= ') . . '.$rcObj->userlink ;
                        $r .= $rcObj->usertalklink ;
-                       if ( $rc_comment != '' ) {
-                               $rc_comment=$this->skin->formatComment($rc_comment, $rcObj->getTitle());
-                               $r .= $wgContLang->emphasize( ' ('.$rc_comment.')' ) ;
-                       }
+                       $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
                        $r .= "<br />\n" ;
                }
                $r .= "</div>\n" ;
@@ -271,7 +295,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 ) ;
@@ -280,11 +304,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 ) ) {
@@ -298,7 +324,7 @@ class ChangesList {
                $curIdEq = 'curid=' . $rc_cur_id;
 
                # Should patrol-related stuff be shown?
-               $unpatrolled = $wgUseRCPatrol && $wgUser->getID() != 0 && 
+               $unpatrolled = $wgUseRCPatrol && $wgUser->isLoggedIn() && 
                  ( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed('patrol') ) && $rc_patrolled == 0;
                
                # Make date header if necessary
@@ -350,9 +376,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
@@ -365,6 +391,11 @@ class ChangesList {
                        if ( $watched ) {
                                $articleLink = '<strong>'.$articleLink.'</strong>';
                        }
+
+                       if ($rc->notificationtimestamp) {
+                               $articleLink .= wfMsg( 'updatedmarker' );
+                       }
+
                        $s .= ' '.$articleLink;
                        wfProfileOut("$fname-page");
                }
@@ -395,7 +426,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 );
@@ -408,10 +439,14 @@ class ChangesList {
                if($userTalkLink) $s.=' ('.$userTalkLink.')';
 
                # Add 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_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
+                       $s .= $this->skin->commentBlock( $rc_comment, $rc->getTitle() );
+               }
+
+               if ($rc->numberofWatchingusers > 0) {
+                       $s .= ' ' . wfMsg('number_of_watching_users_RCview',  $wgContLang->formatNum($rc->numberofWatchingusers));
                }
+
                $s .= "</li>\n";
 
                wfProfileOut( "$fname-rest" );
@@ -420,8 +455,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 ) ) {
@@ -449,7 +484,7 @@ class ChangesList {
                }
                
                # Should patrol-related stuff be shown?
-               if ( $wgUseRCPatrol && $wgUser->getID() != 0 && 
+               if ( $wgUseRCPatrol && $wgUser->isLoggedIn() && 
                  ( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed('patrol') )) {
                        $rc->unpatrolled = !$rc_patrolled;
                } else {
@@ -477,6 +512,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();
@@ -524,7 +561,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 );
@@ -554,6 +591,4 @@ class ChangesList {
        }
 
 }
-
-
-?>
+?>
\ No newline at end of file