# Called by history lists and recent changes
#
- /**
+ /**
* Changeslist contructor
* @param Skin $skin
*/
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' ) );
}
}
}
wfRunHooks('ChangesListInsertArticleLink',
array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched));
-
+
$s .= ' '.$articlelink;
}
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 */
protected function insertUserRelatedLinks(&$s, &$rc) {
if ( $this->isDeleted($rc,Revision::DELETED_USER) ) {
- $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-user') . '</span>';
+ $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-user') . '</span>';
} else {
$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'] );
if ( $this->isDeleted($rc,LogPage::DELETED_ACTION) ) {
$s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
} else {
- $s .= ' ' . LogPage::actionText( $rc->mAttribs['rc_log_type'], $rc->mAttribs['rc_log_action'],
+ $s .= ' ' . LogPage::actionText( $rc->mAttribs['rc_log_type'], $rc->mAttribs['rc_log_action'],
$rc->getTitle(), $this->skin, LogPage::extractParams($rc->mAttribs['rc_params']), true, true );
}
}
* @return bool
*/
public static function usePatrol() {
- global $wgUseRCPatrol, $wgUser;
- return( $wgUseRCPatrol && ($wgUser->isAllowed('patrol') || $wgUser->isAllowed('patrolmarks')) );
+ global $wgUser;
+ return $wgUser->useRCPatrol();
}
/**
return '';
}
}
-
+
/**
* Determine if said field of a revision is hidden
* @param RCCacheEntry $rc
public static function isDeleted( $rc, $field ) {
return ($rc->mAttribs['rc_deleted'] & $field) == $field;
}
-
+
/**
* Determine if the current user is allowed to view a particular
* field of this revision, if it's marked as deleted.
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 );
* Format a line using the old system (aka without any javascript).
*/
public function recentChangesLine( &$rc, $watched = false ) {
- global $wgContLang, $wgRCShowChangedSize;
+ global $wgContLang, $wgRCShowChangedSize, $wgUser;
$fname = 'ChangesList::recentChangesLineOld';
wfProfileIn( $fname );
extract( $rc->mAttribs );
# Should patrol-related stuff be shown?
- $unpatrolled = $this->usePatrol() && $rc_patrolled == 0;
+ $unpatrolled = $wgUser->useRCPatrol() && $rc_patrolled == 0;
$this->insertDateHeader($s,$rc_timestamp);
$this->insertAction($s, $rc);
# Edit or log comment
$this->insertComment($s, $rc);
-
+
# Mark revision as deleted if so
if ( !$rc_log_type && $this->isDeleted($rc,Revision::DELETED_TEXT) )
$s .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
* Format a line for enhanced recentchange (aka with javascript and block of lines).
*/
public function recentChangesLine( &$baseRC, $watched = false ) {
- global $wgLang, $wgContLang;
+ global $wgLang, $wgContLang, $wgUser;
# Create a specialised object
$rc = RCCacheEntry::newFromParent( $baseRC );
}
# Should patrol-related stuff be shown?
- if( $this->usePatrol() ) {
+ if( $wgUser->useRCPatrol() ) {
$rc->unpatrolled = !$rc_patrolled;
} else {
$rc->unpatrolled = false;
$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(), '' );
}
-
+
# Don't show unusable diff links
if ( !ChangesList::userCan($rc,Revision::DELETED_TEXT) ) {
$showdifflinks = false;
$querydiff = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid$rcIdQuery";
$aprops = ' tabindex="'.$baseRC->counter.'"';
$curLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['cur'], $querycur, '' ,'', $aprops );
-
+
# Make "diff" an "cur" links
if( !$showdifflinks ) {
$curLink = $this->message['cur'];
} else {
$diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'], $querydiff, '' ,'', $aprops );
}
-
+
# Make "last" link
if( !$showdifflinks ) {
$lastLink = $this->message['last'];
$lastLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['last'],
$curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
}
-
+
# Make user links
if( $this->isDeleted($rc,Revision::DELETED_USER) ) {
$rc->userlink = ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-user') . '</span>';
# 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] ) ) {
if( !$currentRevision && $rcObj->mAttribs['rc_this_oldid'] ) {
$currentRevision = $rcObj->mAttribs['rc_this_oldid'];
}
-
+
$bot = $rcObj->mAttribs['rc_bot'];
$userlinks[$u]++;
}
$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;
}
$r .= ') . . ';
}
-
+
# Character difference (does not apply if only log items)
if( $wgRCShowChangedSize && !$alllogs ) {
$last = 0;
# Get net change
$chardiff = $rcObj->getCharacterDifference( $block[$first]->mAttribs['rc_old_len'],
$block[$last]->mAttribs['rc_new_len'] );
-
+
if( $chardiff == '' ) {
$r .= ' ';
} else {
}
# 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(),
$this->message['history'], $curIdEq.'&action=history' ) . ')';
}
-
+
$r .= $users;
- $r .=$this->numberofWatchingusers($block[0]->numberofWatchingusers);
-
+ $r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers);
+
$r .= "</td></tr></table>\n";
# Sub-entries
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> ';
}
$r .= $link;
-
+
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 .= ')';
}
protected function spacerArrow() {
return $this->arrow( '', ' ' );
}
-
+
/**
* Add a set of spaces
* @return string HTML <td> tag
- */
+ */
protected function spacerIndent() {
return ' ';
}
$r = '<table cellspacing="0" cellpadding="0" border="0" style="background: none"><tr>';
$r .= '<td valign="top" style="white-space: nowrap"><tt>' . $this->spacerArrow() . ' ';
-
+
# Flag and Timestamp
if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$r .= ' '; // 4 flags -> 4 spaces
$r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot );
}
$r .= ' '.$rcObj->timestamp.' </tt></td><td>';
-
+
# Article or log link
if( $rc_log_type ) {
$logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL );
} else {
$r .= $this->maybeWatchedLink( $rcObj->link, $rcObj->watched );
}
-
+
# 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 .= ' . . ';
-
+
# Character diff
if( $wgRCShowChangedSize ) {
$r .= ( $rcObj->getCharacterDifference() == '' ? '' : ' ' . $rcObj->getCharacterDifference() . ' . . ' ) ;
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 );
+ }
}
# Edit or log comment