Fixing bug in HTML diff when the word '0' is encountered. Thanks siebrand for reporting
[lhc/web/wiklou.git] / includes / ChangesList.php
index ba94b4b..bad9445 100644 (file)
@@ -62,7 +62,7 @@ class ChangesList {
                if( !isset( $this->message ) ) {
                        foreach( explode(' ', 'cur diff hist minoreditletter newpageletter last '.
                                'blocklink history boteditletter semicolon-separator' ) as $msg ) {
-                               $this->message[$msg] = wfMsgExt( $msg, array( 'escape') );
+                               $this->message[$msg] = wfMsgExt( $msg, array( 'escapenoentities' ) );
                        }
                }
        }
@@ -201,7 +201,7 @@ class ChangesList {
        protected function insertTimestamp(&$s, $rc) {
                global $wgLang;
                # Timestamp
-               $s .= $this->message['semicolon-separator'] . ' ' . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
+               $s .= $this->message['semicolon-separator'] . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
        }
 
        /** Insert links to user page, user talk page and eventually a blocking link */
@@ -288,7 +288,7 @@ class ChangesList {
                if( ( $rc->mAttribs['rc_deleted'] & $field ) == $field ) {
                        global $wgUser;
                        $permission = ( $rc->mAttribs['rc_deleted'] & Revision::DELETED_RESTRICTED ) == Revision::DELETED_RESTRICTED
-                               ? 'hiderevision'
+                               ? 'suppressrevision'
                                : 'deleterevision';
                        wfDebug( "Checking for $permission due to $field match on $rc->mAttribs['rc_deleted']\n" );
                        return $wgUser->isAllowed( $permission );
@@ -441,7 +441,13 @@ class EnhancedChangesList extends ChangesList {
                        $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
                // Log entries
                } else if( $rc_type == RC_LOG ) {
-                       $clink = $this->skin->makeLinkObj( $rc->getTitle(), '' );
+                       if( $rc_log_type ) {
+                               $logtitle = SpecialPage::getTitleFor( 'Log', $rc_log_type );
+                               $clink = '(' . $this->skin->makeKnownLinkObj( $logtitle, LogPage::logName($rc_log_type) ) . ')';
+                       } else {
+                               $clink = $this->skin->makeLinkObj( $rc->getTitle(), '' );
+                       }
+                       $watched = false;
                // Edits
                } else {
                        $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '' );
@@ -512,9 +518,8 @@ class EnhancedChangesList extends ChangesList {
                        # Use an @ character to prevent collision with page names
                        $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array($rc);
                } else {
-                       global $wgRCTypeGroupedLogs;
-                       # Some logs are best grouped by type (block,rights)
-                       if( $rc_type == RC_LOG && in_array($rc_log_type,$wgRCTypeGroupedLogs) ){
+                       # Logs are grouped by type
+                       if( $rc_type == RC_LOG ){
                                $secureName = SpecialPage::getTitleFor( 'Log', $rc_log_type )->getPrefixedDBkey();
                        }
                        if( !isset( $this->rc_cache[$secureName] ) ) {
@@ -582,12 +587,12 @@ class EnhancedChangesList extends ChangesList {
                        $text = $userlink;
                        $text .= $wgContLang->getDirMark();
                        if( $count > 1 ) {
-                               $text .= ' ('.$count.'×)';
+                               $text .= ' (' . $wgLang->formatNum( $count ) . '×)';
                        }
                        array_push( $users, $text );
                }
 
-               $users = ' <span class="changedby">[' . implode( $this->message['semicolon-separator'] . ' ', $users ) . ']</span>';
+               $users = ' <span class="changedby">[' . implode( $this->message['semicolon-separator'], $users ) . ']</span>';
 
                # Arrow
                $rci = 'RCI'.$this->rcCacheIndex;
@@ -658,7 +663,9 @@ class EnhancedChangesList extends ChangesList {
                }
 
                # History
-               if( $namehidden || $alllogs ) {
+               if( $alllogs ) {
+                       // don't show history link for logs
+               } else if( $namehidden || !$block[0]->getTitle()->exists() ) {
                        $r .= '(' . $this->message['history'] . ')';
                } else {
                        $r .= '(' . $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
@@ -666,7 +673,7 @@ class EnhancedChangesList extends ChangesList {
                }
 
                $r .= $users;
-               $r .=$this->numberofWatchingusers($block[0]->numberofWatchingusers);
+               $r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers);
 
                $r .= "</td></tr></table>\n";
 
@@ -687,13 +694,16 @@ class EnhancedChangesList extends ChangesList {
                        if( $rc_this_oldid != 0 ) {
                                $o = 'oldid='.$rc_this_oldid;
                        }
-                       # Revision link
+                       # Log timestamp
                        if( $rc_type == RC_LOG ) {
                                $link = '<tt>'.$rcObj->timestamp.'</tt> ';
+                       # Revision link
                        } else if( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) {
                                $link = '<span class="history-deleted"><tt>'.$rcObj->timestamp.'</tt></span> ';
                        } else {
-                               $link = '<tt>'.$this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o ).'</tt>';
+                               $rcIdEq = ($rcObj->unpatrolled && $rc_type == RC_NEW) ? '&rcid='.$rcObj->mAttribs['rc_id'] : '';
+                               
+                               $link = '<tt>'.$this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o.$rcIdEq ).'</tt>';
                                if( $this->isDeleted($rcObj,Revision::DELETED_TEXT) )
                                        $link = '<span class="history-deleted">'.$link.'</span> ';
                        }
@@ -702,7 +712,7 @@ class EnhancedChangesList extends ChangesList {
                        if ( !$rc_type == RC_LOG || $rc_type == RC_NEW ) {
                                $r .= ' (';
                                $r .= $rcObj->curlink;
-                               $r .= $this->message['semicolon-separator'] . ' ';
+                               $r .= $this->message['semicolon-separator'];
                                $r .= $rcObj->lastlink;
                                $r .= ')';
                        }
@@ -827,7 +837,7 @@ class EnhancedChangesList extends ChangesList {
 
                # Diff and hist links
                if ( $rc_type != RC_LOG ) {
-                  $r .= ' ('. $rcObj->difflink . $this->message['semicolon-separator'] . ' ';
+                  $r .= ' ('. $rcObj->difflink . $this->message['semicolon-separator'];
                   $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ')';
                }
                $r .= ' . . ';
@@ -845,7 +855,8 @@ class EnhancedChangesList extends ChangesList {
                        if( $this->isDeleted($rcObj,LogPage::DELETED_ACTION) ) {
                                $r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
                        } else {
-                               $r .= ' ' . LogPage::actionText( $rc_log_type, $rc_log_action, $rcObj->getTitle(), $this->skin, LogPage::extractParams($rc_params), true, true );
+                               $r .= ' ' . LogPage::actionText( $rc_log_type, $rc_log_action, $rcObj->getTitle(), 
+                                       $this->skin, LogPage::extractParams($rc_params), true, true );
                        }
                }