$text = wfMsgNoTrans( $message, $target );
if( !wfEmptyMsg( $message, $text ) && $text != '-' ) {
$wgOut->wrapWikiMsg(
- "<div class='mw-contributions-footer'>\n$1\n</div>", $message );
+ "<div class='mw-contributions-footer'>\n$1\n</div>",
+ array( $message, $target ) );
}
}
}
protected function setSyndicated() {
global $wgOut;
- $queryParams = array(
- 'namespace' => $this->opts['namespace'],
- 'target' => $this->opts['target']
- );
$wgOut->setSyndicated( true );
- $wgOut->setFeedAppendQuery( wfArrayToCGI( $queryParams ) );
+ $wgOut->setFeedAppendQuery( wfArrayToCGI( $this->opts ) );
}
/**
- * Generates the subheading with links
- * @param Title $nt Title object for the target
- * @param integer $id User ID for the target
- * @return String: appropriately-escaped HTML to be output literally
- */
+ * Generates the subheading with links
+ * @param Title $nt @see Title object for the target
+ * @param integer $id User ID for the target
+ * @return String: appropriately-escaped HTML to be output literally
+ * @todo Fixme: almost the same as getSubTitle in SpecialDeletedContributions.php. Could be combined.
+ */
protected function contributionsSub( $nt, $id ) {
- global $wgSysopUserBans, $wgLang, $wgUser;
+ global $wgSysopUserBans, $wgLang, $wgUser, $wgOut;
$sk = $wgUser->getSkin();
- if( 0 == $id ) {
+ if ( 0 == $id ) {
$user = htmlspecialchars( $nt->getText() );
} else {
$user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) );
}
+ $userObj = User::newFromName( $nt->getText(), /* check for username validity not needed */ false );
$talk = $nt->getTalkPage();
if( $talk ) {
# Talk page link
$tools[] = $sk->link( $talk, wfMsgHtml( 'sp-contributions-talk' ) );
if( ( $id != 0 && $wgSysopUserBans ) || ( $id == 0 && IP::isIPAddress( $nt->getText() ) ) ) {
if( $wgUser->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
- if ( User::newFromId( $id )->isBlocked() ) {
+ if ( $userObj->isBlocked() ) {
$tools[] = $sk->linkKnown( # Change block link
SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ),
wfMsgHtml( 'change-blocklink' )
}
wfRunHooks( 'ContributionsToolLinks', array( $id, $nt, &$tools ) );
-
+
$links = $wgLang->pipeList( $tools );
- $this->showBlock( $nt, $id );
+
+ // Show a note if the user is blocked and display the last block log entry.
+ if ( $userObj->isBlocked() ) {
+ LogEventsList::showLogExtract(
+ $wgOut,
+ 'block',
+ $nt->getPrefixedText(),
+ '',
+ array(
+ 'lim' => 1,
+ 'showIfEmpty' => false,
+ 'msgKey' => array(
+ 'sp-contributions-blocked-notice',
+ $nt->getText() # Support GENDER in 'sp-contributions-blocked-notice'
+ ),
+ 'offset' => '' # don't use $wgRequest parameter offset
+ )
+ );
+ }
}
-
+
// Old message 'contribsub' had one parameter, but that doesn't work for
// languages that want to put the "for" bit right after $user but before
// $links. If 'contribsub' is around, use it for reverse compatibility,
}
}
- /**
- * Show a note if the user is blocked and display the last block log entry.
- * @param Title $nt Title object for the target
- */
- protected function showBlock( $nt, $id ) {
- global $wgUser, $wgOut;
- if ( !User::newFromID( $id )->isBlocked() )
- return; # User is not blocked, nothing to do here
- $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut );
- $pager = new LogPager( $loglist, 'block', false, $nt->getPrefixedText() );
- // Check if there is something in the block log.
- // If this is not the case, either the user is not blocked,
- // or the account has been hidden via hideuser.
- if( $pager->getNumRows() > 0 ) {
- $pager->mLimit = 1; # Show only latest log entry.
- $wgOut->addHTML( '<div class="mw-warning-with-logexcerpt">' );
- $wgOut->addWikiMsg( 'sp-contributions-blocked-notice' );
- $wgOut->addHTML(
- $loglist->beginLogEventsList() .
- $pager->getBody() .
- $loglist->endLogEventsList()
- );
- if( $pager->getNumRows() > $pager->mLimit ) {
- $wgOut->addHTML( $wgUser->getSkin()->link(
- SpecialPage::getTitleFor( 'Log', 'block' ),
- wfMsgHtml( 'log-fulllog' ),
- array(),
- array( 'page' => $nt->getPrefixedText() )
- ) );
- }
- $wgOut->addHTML( '</div>' );
- }
- }
/**
* Generates the namespace selector form with hidden attributes.
* @param $this->opts Array: the options to be included.
$explain = wfMsgExt( 'sp-contributions-explain', 'parseinline' );
if( !wfEmptyMsg( 'sp-contributions-explain', $explain ) )
- $f .= "<p>{$explain}</p>";
+ $f .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
$f .= '</fieldset>' .
Xml::closeElement( 'form' );
$comments
);
} else {
- return NULL;
+ return null;
}
}
function __construct( $target, $namespace = false, $year = false, $month = false, $tagFilter = false ) {
parent::__construct();
- foreach( explode( ' ', 'uctop diff newarticle rollbacklink diff hist' ) as $msg ) {
- $this->messages[$msg] = wfMsgExt( $msg, array( 'escape') );
+
+ $msgs = array( 'uctop', 'diff', 'newarticle', 'rollbacklink', 'diff', 'hist', 'rev-delundel', 'pipe-separator' );
+
+ foreach( $msgs as $msg ) {
+ $this->messages[$msg] = wfMsgExt( $msg, array( 'escape' ) );
}
+
$this->target = $target;
$this->namespace = $namespace;
$this->tagFilter = $tagFilter;
$conds = array_merge( $userCond, $this->getNamespaceCond() );
// Paranoia: avoid brute force searches (bug 17342)
- if( !$wgUser->isAllowed( 'deleterevision' ) ) {
+ if( !$wgUser->isAllowed( 'deletedhistory' ) ) {
$conds[] = $this->mDb->bitAnd('rev_deleted',Revision::DELETED_USER) . ' = 0';
} else if( !$wgUser->isAllowed( 'suppressrevision' ) ) {
$conds[] = $this->mDb->bitAnd('rev_deleted',Revision::SUPPRESSED_USER) .
'options' => array( 'USE INDEX' => array('revision' => $index) ),
'join_conds' => $join_cond
);
-
- ChangeTags::modifyDisplayQuery( $queryInfo['tables'],
- $queryInfo['fields'],
- $queryInfo['conds'],
- $queryInfo['join_conds'],
- $queryInfo['options'],
- $this->tagFilter );
-
+
+ ChangeTags::modifyDisplayQuery(
+ $queryInfo['tables'],
+ $queryInfo['fields'],
+ $queryInfo['conds'],
+ $queryInfo['join_conds'],
+ $queryInfo['options'],
+ $this->tagFilter
+ );
+
wfRunHooks( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) );
return $queryInfo;
}
$difftext = $topmarktext = '';
if( $row->rev_id == $row->page_latest ) {
$topmarktext .= '<span class="mw-uctop">' . $this->messages['uctop'] . '</span>';
- if( !$row->page_is_new ) {
- $difftext .= '(' . $sk->linkKnown(
- $page,
- $this->messages['diff'],
- array(),
- array( 'diff' => 0 )
- ) . ')';
- # Add rollback link
- if( $page->quickUserCan( 'rollback') && $page->quickUserCan( 'edit' ) ) {
- $topmarktext .= ' '.$sk->generateRollback( $rev );
- }
- } else {
- $difftext .= $this->messages['newarticle'];
+ # Add rollback link
+ if( !$row->page_is_new && $page->quickUserCan( 'rollback' ) && $page->quickUserCan( 'edit' ) ) {
+ $topmarktext .= ' '.$sk->generateRollback( $rev );
}
}
# Is there a visible previous revision?
- if( !$rev->isDeleted(Revision::DELETED_TEXT) ) {
- $difftext = '(' . $sk->linkKnown(
+ if( !$rev->isDeleted( Revision::DELETED_TEXT ) && $rev->getParentId() !== 0 ) {
+ $difftext = $this->messages['pipe-separator'] . $sk->linkKnown(
$page,
$this->messages['diff'],
array(),
)
) . ')';
} else {
- $difftext = '(' . $this->messages['diff'] . ')';
+ $difftext = $this->messages['pipe-separator'] . $this->messages['diff'] . ')';
}
$histlink = '('.$sk->linkKnown(
$page,
$this->messages['hist'],
array(),
array( 'action' => 'history' )
- ) . ')';
+ );
$comment = $wgContLang->getDirMark() . $sk->revComment( $rev, false, true );
$date = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->rev_timestamp ), true );
if( $this->target == 'newbies' ) {
$userlink = ' . . ' . $sk->userLink( $row->rev_user, $row->rev_user_text );
- $userlink .= ' (' . $sk->userTalkLink( $row->rev_user, $row->rev_user_text ) . ') ';
+ $userlink .= ' ' . wfMsg( 'parentheses', $sk->userTalkLink( $row->rev_user, $row->rev_user_text ) ) . ' ';
} else {
$userlink = '';
}
} else {
$mflag = '';
}
-
- if( $wgUser->isAllowed( 'deleterevision' ) ) {
- // If revision was hidden from sysops
+
+ // Don't show useless link to people who cannot hide revisions
+ $canHide = $wgUser->isAllowed( 'deleterevision' );
+ if( $canHide || ($rev->getVisibility() && $wgUser->isAllowed('deletedhistory')) ) {
if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
- $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ),
- '(' . $this->message['rev-delundel'] . ')' ) . ' ';
- // Otherwise, show the link...
+ $del = $this->mSkin->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
} else {
$query = array(
- 'type' => 'revision',
+ 'type' => 'revision',
'target' => $page->getPrefixedDbkey(),
- 'ids' => $rev->getId() );
+ 'ids' => $rev->getId()
+ );
$del = $this->mSkin->revDeleteLink( $query,
- $rev->isDeleted( Revision::DELETED_RESTRICTED ) ) . ' ';
+ $rev->isDeleted( Revision::DELETED_RESTRICTED ), $canHide );
}
+ $del .= ' ';
} else {
$del = '';
}
- $ret = "{$del}{$d} {$histlink} {$difftext} {$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
+ $ret = "{$del}{$d} {$histlink}{$difftext} {$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
+
+ # Denote if username is redacted for this edit
+ if( $rev->isDeleted( Revision::DELETED_USER ) ) {
+ $ret .= " <strong>" . wfMsgHtml('rev-deleted-user-contribs') . "</strong>";
+ }
# Tags, if any.
list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $row->ts_tags, 'contributions' );