Remove most named character references from output
[lhc/web/wiklou.git] / includes / specials / SpecialContributions.php
1 <?php
2 /**
3 * Special:Contributions, show user contributions in a paged list
4 * @file
5 * @ingroup SpecialPage
6 */
7
8 class SpecialContributions extends SpecialPage {
9
10 public function __construct() {
11 parent::__construct( 'Contributions' );
12 }
13
14 public function execute( $par ) {
15 global $wgUser, $wgOut, $wgLang, $wgRequest;
16
17 $this->setHeaders();
18 $this->outputHeader();
19
20 $this->opts = array();
21
22 if( $par == 'newbies' ) {
23 $target = 'newbies';
24 $this->opts['contribs'] = 'newbie';
25 } elseif( isset( $par ) ) {
26 $target = $par;
27 } else {
28 $target = $wgRequest->getVal( 'target' );
29 }
30
31 // check for radiobox
32 if( $wgRequest->getVal( 'contribs' ) == 'newbie' ) {
33 $target = 'newbies';
34 $this->opts['contribs'] = 'newbie';
35 }
36
37 $this->opts['deletedOnly'] = $wgRequest->getCheck( 'deletedOnly' );
38
39 if( !strlen( $target ) ) {
40 $wgOut->addHTML( $this->getForm() );
41 return;
42 }
43
44 $this->opts['limit'] = $wgRequest->getInt( 'limit', $wgUser->getOption('rclimit') );
45 $this->opts['target'] = $target;
46
47 $nt = Title::makeTitleSafe( NS_USER, $target );
48 if( !$nt ) {
49 $wgOut->addHTML( $this->getForm() );
50 return;
51 }
52 $id = User::idFromName( $nt->getText() );
53
54 if( $target != 'newbies' ) {
55 $target = $nt->getText();
56 $wgOut->setSubtitle( $this->contributionsSub( $nt, $id ) );
57 $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsgExt( 'contributions-title', array( 'parsemag' ),$target ) ) );
58 } else {
59 $wgOut->setSubtitle( wfMsgHtml( 'sp-contributions-newbies-sub') );
60 $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsg( 'sp-contributions-newbies-title' ) ) );
61 }
62
63 if( ( $ns = $wgRequest->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
64 $this->opts['namespace'] = intval( $ns );
65 } else {
66 $this->opts['namespace'] = '';
67 }
68
69 $this->opts['tagfilter'] = (string) $wgRequest->getVal( 'tagfilter' );
70
71 // Allows reverts to have the bot flag in recent changes. It is just here to
72 // be passed in the form at the top of the page
73 if( $wgUser->isAllowed( 'markbotedits' ) && $wgRequest->getBool( 'bot' ) ) {
74 $this->opts['bot'] = '1';
75 }
76
77 $skip = $wgRequest->getText( 'offset' ) || $wgRequest->getText( 'dir' ) == 'prev';
78 # Offset overrides year/month selection
79 if( $skip ) {
80 $this->opts['year'] = '';
81 $this->opts['month'] = '';
82 } else {
83 $this->opts['year'] = $wgRequest->getIntOrNull( 'year' );
84 $this->opts['month'] = $wgRequest->getIntOrNull( 'month' );
85 }
86
87 // Add RSS/atom links
88 $this->setSyndicated();
89 $feedType = $wgRequest->getVal( 'feed' );
90 if( $feedType ) {
91 return $this->feed( $feedType );
92 }
93
94 if ( wfRunHooks( 'SpecialContributionsBeforeMainOutput', array( $id ) ) ) {
95
96 $wgOut->addHTML( $this->getForm() );
97
98 $pager = new ContribsPager( $target, $this->opts['namespace'], $this->opts['year'],
99 $this->opts['month'], false, $this->opts['deletedOnly'] );
100 if( !$pager->getNumRows() ) {
101 $wgOut->addWikiMsg( 'nocontribs', $target );
102 } else {
103 # Show a message about slave lag, if applicable
104 if( ( $lag = $pager->getDatabase()->getLag() ) > 0 )
105 $wgOut->showLagWarning( $lag );
106
107 $wgOut->addHTML(
108 '<p>' . $pager->getNavigationBar() . '</p>' .
109 $pager->getBody() .
110 '<p>' . $pager->getNavigationBar() . '</p>'
111 );
112 }
113
114
115 # Show the appropriate "footer" message - WHOIS tools, etc.
116 if( $target != 'newbies' ) {
117 $message = 'sp-contributions-footer';
118 if ( IP::isIPAddress( $target ) ) {
119 $message = 'sp-contributions-footer-anon';
120 } else {
121 $user = User::newFromName( $target );
122 if ( !$user || $user->isAnon() ) {
123 // No message for non-existing users
124 return;
125 }
126 }
127
128 $text = wfMsgNoTrans( $message, $target );
129 if( !wfEmptyMsg( $message, $text ) && $text != '-' ) {
130 $wgOut->wrapWikiMsg(
131 "<div class='mw-contributions-footer'>\n$1\n</div>",
132 array( $message, $target ) );
133 }
134 }
135 }
136 }
137
138 protected function setSyndicated() {
139 global $wgOut;
140 $wgOut->setSyndicated( true );
141 $wgOut->setFeedAppendQuery( wfArrayToCGI( $this->opts ) );
142 }
143
144 /**
145 * Generates the subheading with links
146 * @param $nt Title object for the target
147 * @param $id Integer: User ID for the target
148 * @return String: appropriately-escaped HTML to be output literally
149 * @todo Fixme: almost the same as getSubTitle in SpecialDeletedContributions.php. Could be combined.
150 */
151 protected function contributionsSub( $nt, $id ) {
152 global $wgSysopUserBans, $wgLang, $wgUser, $wgOut;
153
154 $sk = $wgUser->getSkin();
155
156 if ( $id === null ) {
157 $user = htmlspecialchars( $nt->getText() );
158 } else {
159 $user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) );
160 }
161 $userObj = User::newFromName( $nt->getText(), /* check for username validity not needed */ false );
162 $talk = $nt->getTalkPage();
163 if( $talk ) {
164 # Talk page link
165 $tools[] = $sk->link( $talk, wfMsgHtml( 'sp-contributions-talk' ) );
166 if( ( $id !== null && $wgSysopUserBans ) || ( $id === null && IP::isIPAddress( $nt->getText() ) ) ) {
167 if( $wgUser->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
168 if ( $userObj->isBlocked() ) {
169 $tools[] = $sk->linkKnown( # Change block link
170 SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ),
171 wfMsgHtml( 'change-blocklink' )
172 );
173 $tools[] = $sk->linkKnown( # Unblock link
174 SpecialPage::getTitleFor( 'Ipblocklist' ),
175 wfMsgHtml( 'unblocklink' ),
176 array(),
177 array(
178 'action' => 'unblock',
179 'ip' => $nt->getDBkey()
180 )
181 );
182 }
183 else { # User is not blocked
184 $tools[] = $sk->linkKnown( # Block link
185 SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ),
186 wfMsgHtml( 'blocklink' )
187 );
188 }
189 }
190 # Block log link
191 $tools[] = $sk->linkKnown(
192 SpecialPage::getTitleFor( 'Log' ),
193 wfMsgHtml( 'sp-contributions-blocklog' ),
194 array(),
195 array(
196 'type' => 'block',
197 'page' => $nt->getPrefixedText()
198 )
199 );
200 }
201 # Other logs link
202 $tools[] = $sk->linkKnown(
203 SpecialPage::getTitleFor( 'Log' ),
204 wfMsgHtml( 'sp-contributions-logs' ),
205 array(),
206 array( 'user' => $nt->getText() )
207 );
208
209 # Add link to deleted user contributions for priviledged users
210 if( $wgUser->isAllowed( 'deletedhistory' ) ) {
211 $tools[] = $sk->linkKnown(
212 SpecialPage::getTitleFor( 'DeletedContributions', $nt->getDBkey() ),
213 wfMsgHtml( 'sp-contributions-deleted' )
214 );
215 }
216
217 # Add a link to change user rights for privileged users
218 $userrightsPage = new UserrightsPage();
219 if( $id !== null && $userrightsPage->userCanChangeRights( User::newFromId( $id ) ) ) {
220 $tools[] = $sk->linkKnown(
221 SpecialPage::getTitleFor( 'Userrights', $nt->getDBkey() ),
222 wfMsgHtml( 'sp-contributions-userrights' )
223 );
224 }
225
226 wfRunHooks( 'ContributionsToolLinks', array( $id, $nt, &$tools ) );
227
228 $links = $wgLang->pipeList( $tools );
229
230 // Show a note if the user is blocked and display the last block log entry.
231 if ( $userObj->isBlocked() ) {
232 LogEventsList::showLogExtract(
233 $wgOut,
234 'block',
235 $nt->getPrefixedText(),
236 '',
237 array(
238 'lim' => 1,
239 'showIfEmpty' => false,
240 'msgKey' => array(
241 $userObj->isAnon() ?
242 'sp-contributions-blocked-notice-anon' :
243 'sp-contributions-blocked-notice',
244 $nt->getText() # Support GENDER in 'sp-contributions-blocked-notice'
245 ),
246 'offset' => '' # don't use $wgRequest parameter offset
247 )
248 );
249 }
250 }
251
252 // Old message 'contribsub' had one parameter, but that doesn't work for
253 // languages that want to put the "for" bit right after $user but before
254 // $links. If 'contribsub' is around, use it for reverse compatibility,
255 // otherwise use 'contribsub2'.
256 if( wfEmptyMsg( 'contribsub', wfMsg( 'contribsub' ) ) ) {
257 return wfMsgHtml( 'contribsub2', $user, $links );
258 } else {
259 return wfMsgHtml( 'contribsub', "$user ($links)" );
260 }
261 }
262
263 /**
264 * Generates the namespace selector form with hidden attributes.
265 * @return String: HTML fragment
266 */
267 protected function getForm() {
268 global $wgScript;
269
270 $this->opts['title'] = $this->getTitle()->getPrefixedText();
271 if( !isset( $this->opts['target'] ) ) {
272 $this->opts['target'] = '';
273 } else {
274 $this->opts['target'] = str_replace( '_' , ' ' , $this->opts['target'] );
275 }
276
277 if( !isset( $this->opts['namespace'] ) ) {
278 $this->opts['namespace'] = '';
279 }
280
281 if( !isset( $this->opts['contribs'] ) ) {
282 $this->opts['contribs'] = 'user';
283 }
284
285 if( !isset( $this->opts['year'] ) ) {
286 $this->opts['year'] = '';
287 }
288
289 if( !isset( $this->opts['month'] ) ) {
290 $this->opts['month'] = '';
291 }
292
293 if( $this->opts['contribs'] == 'newbie' ) {
294 $this->opts['target'] = '';
295 }
296
297 if( !isset( $this->opts['tagfilter'] ) ) {
298 $this->opts['tagfilter'] = '';
299 }
300
301 $f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
302
303 # Add hidden params for tracking except for parameters in $skipParameters
304 $skipParameters = array( 'namespace', 'deletedOnly', 'target', 'contribs', 'year', 'month' );
305 foreach ( $this->opts as $name => $value ) {
306 if( in_array( $name, $skipParameters ) ) {
307 continue;
308 }
309 $f .= "\t" . Xml::hidden( $name, $value ) . "\n";
310 }
311
312 $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagfilter'] );
313
314 $f .= '<fieldset>' .
315 Xml::element( 'legend', array(), wfMsg( 'sp-contributions-search' ) ) .
316 Xml::radioLabel( wfMsgExt( 'sp-contributions-newbies', array( 'parsemag' ) ),
317 'contribs', 'newbie' , 'newbie', $this->opts['contribs'] == 'newbie' ? true : false ) . '<br />' .
318 Xml::radioLabel( wfMsgExt( 'sp-contributions-username', array( 'parsemag' ) ),
319 'contribs' , 'user', 'user', $this->opts['contribs'] == 'user' ? true : false ) . ' ' .
320 Html::input( 'target', $this->opts['target'], 'text', array(
321 'size' => '20',
322 'required' => ''
323 ) + ( $this->opts['target'] ? array() : array( 'autofocus' ) ) ) . ' '.
324 '<span style="white-space: nowrap">' .
325 Xml::label( wfMsg( 'namespace' ), 'namespace' ) . ' ' .
326 Xml::namespaceSelector( $this->opts['namespace'], '' ) .
327 '</span>' .
328 Xml::checkLabel( wfMsg( 'history-show-deleted' ),
329 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'] ) .
330 ( $tagFilter ? Xml::tags( 'p', null, implode( '&#160;', $tagFilter ) ) : '' ) .
331 Xml::openElement( 'p' ) .
332 '<span style="white-space: nowrap">' .
333 Xml::dateMenu( $this->opts['year'], $this->opts['month'] ) .
334 '</span>' . ' ' .
335 Xml::submitButton( wfMsg( 'sp-contributions-submit' ) ) .
336 Xml::closeElement( 'p' );
337
338 $explain = wfMsgExt( 'sp-contributions-explain', 'parseinline' );
339 if( !wfEmptyMsg( 'sp-contributions-explain', $explain ) )
340 $f .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
341
342 $f .= '</fieldset>' .
343 Xml::closeElement( 'form' );
344 return $f;
345 }
346
347 /**
348 * Output a subscription feed listing recent edits to this page.
349 * @param $type String
350 */
351 protected function feed( $type ) {
352 global $wgRequest, $wgFeed, $wgFeedClasses, $wgFeedLimit;
353
354 if( !$wgFeed ) {
355 global $wgOut;
356 $wgOut->addWikiMsg( 'feed-unavailable' );
357 return;
358 }
359
360 if( !isset( $wgFeedClasses[$type] ) ) {
361 global $wgOut;
362 $wgOut->addWikiMsg( 'feed-invalid' );
363 return;
364 }
365
366 $feed = new $wgFeedClasses[$type](
367 $this->feedTitle(),
368 wfMsgExt( 'tagline', 'parsemag' ),
369 $this->getTitle()->getFullUrl() . "/" . urlencode($this->opts['target'])
370 );
371
372 // Already valid title
373 $nt = Title::makeTitleSafe( NS_USER, $this->opts['target'] );
374 $target = $this->opts['target'] == 'newbies' ? 'newbies' : $nt->getText();
375
376 $pager = new ContribsPager( $target, $this->opts['namespace'],
377 $this->opts['year'], $this->opts['month'], $this->opts['tagfilter'], $this->opts['deletedOnly'] );
378
379 $pager->mLimit = min( $this->opts['limit'], $wgFeedLimit );
380
381 $feed->outHeader();
382 if( $pager->getNumRows() > 0 ) {
383 while( $row = $pager->mResult->fetchObject() ) {
384 $feed->outItem( $this->feedItem( $row ) );
385 }
386 }
387 $feed->outFooter();
388 }
389
390 protected function feedTitle() {
391 global $wgContLanguageCode, $wgSitename;
392 $page = SpecialPage::getPage( 'Contributions' );
393 $desc = $page->getDescription();
394 return "$wgSitename - $desc [$wgContLanguageCode]";
395 }
396
397 protected function feedItem( $row ) {
398 $title = Title::MakeTitle( intval( $row->page_namespace ), $row->page_title );
399 if( $title ) {
400 $date = $row->rev_timestamp;
401 $comments = $title->getTalkPage()->getFullURL();
402 $revision = Revision::newFromTitle( $title, $row->rev_id );
403
404 return new FeedItem(
405 $title->getPrefixedText(),
406 $this->feedItemDesc( $revision ),
407 $title->getFullURL(),
408 $date,
409 $this->feedItemAuthor( $revision ),
410 $comments
411 );
412 } else {
413 return null;
414 }
415 }
416
417 protected function feedItemAuthor( $revision ) {
418 return $revision->getUserText();
419 }
420
421 protected function feedItemDesc( $revision ) {
422 if( $revision ) {
423 return '<p>' . htmlspecialchars( $revision->getUserText() ) . wfMsgForContent( 'colon-separator' ) .
424 htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) .
425 "</p>\n<hr />\n<div>" .
426 nl2br( htmlspecialchars( $revision->getText() ) ) . "</div>";
427 }
428 return '';
429 }
430 }
431
432 /**
433 * Pager for Special:Contributions
434 * @ingroup SpecialPage Pager
435 */
436 class ContribsPager extends ReverseChronologicalPager {
437 public $mDefaultDirection = true;
438 var $messages, $target;
439 var $namespace = '', $mDb;
440
441 function __construct( $target, $namespace = false, $year = false, $month = false, $tagFilter = false, $deletedOnly = false ) {
442 parent::__construct();
443
444 $msgs = array( 'uctop', 'diff', 'newarticle', 'rollbacklink', 'diff', 'hist', 'rev-delundel', 'pipe-separator' );
445
446 foreach( $msgs as $msg ) {
447 $this->messages[$msg] = wfMsgExt( $msg, array( 'escapenoentities' ) );
448 }
449
450 $this->target = $target;
451 $this->namespace = $namespace;
452 $this->tagFilter = $tagFilter;
453 $this->deletedOnly = $deletedOnly;
454
455 $this->getDateCond( $year, $month );
456
457 $this->mDb = wfGetDB( DB_SLAVE, 'contributions' );
458 }
459
460 function getDefaultQuery() {
461 $query = parent::getDefaultQuery();
462 $query['target'] = $this->target;
463 return $query;
464 }
465
466 function getQueryInfo() {
467 global $wgUser;
468 list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond();
469
470 $conds = array_merge( $userCond, $this->getNamespaceCond() );
471 // Paranoia: avoid brute force searches (bug 17342)
472 if( !$wgUser->isAllowed( 'deletedhistory' ) ) {
473 $conds[] = $this->mDb->bitAnd('rev_deleted',Revision::DELETED_USER) . ' = 0';
474 } else if( !$wgUser->isAllowed( 'suppressrevision' ) ) {
475 $conds[] = $this->mDb->bitAnd('rev_deleted',Revision::SUPPRESSED_USER) .
476 ' != ' . Revision::SUPPRESSED_USER;
477 }
478 $join_cond['page'] = array( 'INNER JOIN', 'page_id=rev_page' );
479
480 $queryInfo = array(
481 'tables' => $tables,
482 'fields' => array(
483 'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'page_is_redirect',
484 'page_len','rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment',
485 'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted'
486 ),
487 'conds' => $conds,
488 'options' => array( 'USE INDEX' => array('revision' => $index) ),
489 'join_conds' => $join_cond
490 );
491
492 ChangeTags::modifyDisplayQuery(
493 $queryInfo['tables'],
494 $queryInfo['fields'],
495 $queryInfo['conds'],
496 $queryInfo['join_conds'],
497 $queryInfo['options'],
498 $this->tagFilter
499 );
500
501 wfRunHooks( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) );
502 return $queryInfo;
503 }
504
505 function getUserCond() {
506 $condition = array();
507 $join_conds = array();
508 if( $this->target == 'newbies' ) {
509 $tables = array( 'user_groups', 'page', 'revision' );
510 $max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ );
511 $condition[] = 'rev_user >' . (int)($max - $max / 100);
512 $condition[] = 'ug_group IS NULL';
513 $index = 'user_timestamp';
514 # FIXME: other groups may have 'bot' rights
515 $join_conds['user_groups'] = array( 'LEFT JOIN', "ug_user = rev_user AND ug_group = 'bot'" );
516 } else {
517 $tables = array( 'page', 'revision' );
518 $condition['rev_user_text'] = $this->target;
519 $index = 'usertext_timestamp';
520 }
521 if ( $this->deletedOnly ) {
522 $condition[] = "rev_deleted != '0'";
523 }
524 return array( $tables, $index, $condition, $join_conds );
525 }
526
527 function getNamespaceCond() {
528 if( $this->namespace !== '' ) {
529 return array( 'page_namespace' => (int)$this->namespace );
530 } else {
531 return array();
532 }
533 }
534
535 function getIndexField() {
536 return 'rev_timestamp';
537 }
538
539 function getStartBody() {
540 return "<ul>\n";
541 }
542
543 function getEndBody() {
544 return "</ul>\n";
545 }
546
547 /**
548 * Generates each row in the contributions list.
549 *
550 * Contributions which are marked "top" are currently on top of the history.
551 * For these contributions, a [rollback] link is shown for users with roll-
552 * back privileges. The rollback link restores the most recent version that
553 * was not written by the target user.
554 *
555 * @todo This would probably look a lot nicer in a table.
556 */
557 function formatRow( $row ) {
558 global $wgUser, $wgLang, $wgContLang;
559 wfProfileIn( __METHOD__ );
560
561 $sk = $this->getSkin();
562 $rev = new Revision( $row );
563 $classes = array();
564
565 $page = Title::newFromRow( $row );
566 $page->resetArticleId( $row->rev_page ); // use process cache
567 $link = $sk->link(
568 $page,
569 htmlspecialchars( $page->getPrefixedText() ),
570 array(),
571 $page->isRedirect() ? array( 'redirect' => 'no' ) : array()
572 );
573 # Mark current revisions
574 $difftext = $topmarktext = '';
575 if( $row->rev_id == $row->page_latest ) {
576 $topmarktext .= '<span class="mw-uctop">' . $this->messages['uctop'] . '</span>';
577 # Add rollback link
578 if( !$row->page_is_new && $page->quickUserCan( 'rollback' )
579 && $page->quickUserCan( 'edit' ) )
580 {
581 $topmarktext .= ' '.$sk->generateRollback( $rev );
582 }
583 }
584 # Is there a visible previous revision?
585 if( $rev->userCan( Revision::DELETED_TEXT ) && $rev->getParentId() !== 0 ) {
586 $difftext = $sk->linkKnown(
587 $page,
588 $this->messages['diff'],
589 array(),
590 array(
591 'diff' => 'prev',
592 'oldid' => $row->rev_id
593 )
594 );
595 } else {
596 $difftext = $this->messages['diff'];
597 }
598 $histlink = $sk->linkKnown(
599 $page,
600 $this->messages['hist'],
601 array(),
602 array( 'action' => 'history' )
603 );
604
605 $comment = $wgContLang->getDirMark() . $sk->revComment( $rev, false, true );
606 $date = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->rev_timestamp ), true );
607 if( $rev->userCan( Revision::DELETED_TEXT ) ) {
608 $d = $sk->linkKnown(
609 $page,
610 htmlspecialchars($date),
611 array(),
612 array( 'oldid' => intval( $row->rev_id ) )
613 );
614 } else {
615 $d = $date;
616 }
617 if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
618 $d = '<span class="history-deleted">' . $d . '</span>';
619 }
620
621 if( $this->target == 'newbies' ) {
622 $userlink = ' . . ' . $sk->userLink( $row->rev_user, $row->rev_user_text );
623 $userlink .= ' ' . wfMsg( 'parentheses', $sk->userTalkLink( $row->rev_user, $row->rev_user_text ) ) . ' ';
624 } else {
625 $userlink = '';
626 }
627
628 if( $rev->getParentId() === 0 ) {
629 $nflag = ChangesList::flag( 'newpage' );
630 } else {
631 $nflag = '';
632 }
633
634 if( $rev->isMinor() ) {
635 $mflag = ChangesList::flag( 'minor' );
636 } else {
637 $mflag = '';
638 }
639
640 // Don't show useless link to people who cannot hide revisions
641 $canHide = $wgUser->isAllowed( 'deleterevision' );
642 if( $canHide || ($rev->getVisibility() && $wgUser->isAllowed('deletedhistory')) ) {
643 if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
644 $del = $this->mSkin->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
645 } else {
646 $query = array(
647 'type' => 'revision',
648 'target' => $page->getPrefixedDbkey(),
649 'ids' => $rev->getId()
650 );
651 $del = $this->mSkin->revDeleteLink( $query,
652 $rev->isDeleted( Revision::DELETED_RESTRICTED ), $canHide );
653 }
654 $del .= ' ';
655 } else {
656 $del = '';
657 }
658
659 $diffHistLinks = '(' . $difftext . $this->messages['pipe-separator'] . $histlink . ')';
660 $ret = "{$del}{$d} {$diffHistLinks} {$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
661
662 # Denote if username is redacted for this edit
663 if( $rev->isDeleted( Revision::DELETED_USER ) ) {
664 $ret .= " <strong>" . wfMsgHtml('rev-deleted-user-contribs') . "</strong>";
665 }
666
667 # Tags, if any.
668 list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $row->ts_tags, 'contributions' );
669 $classes = array_merge( $classes, $newClasses );
670 $ret .= " $tagSummary";
671
672 // Let extensions add data
673 wfRunHooks( 'ContributionsLineEnding', array( &$this, &$ret, $row ) );
674
675 $classes = implode( ' ', $classes );
676 $ret = "<li class=\"$classes\">$ret</li>\n";
677 wfProfileOut( __METHOD__ );
678 return $ret;
679 }
680
681 /**
682 * Get the Database object in use
683 *
684 * @return Database
685 */
686 public function getDatabase() {
687 return $this->mDb;
688 }
689
690 /**
691 * Overwrite Pager function and return a helpful comment
692 */
693 function getSqlComment() {
694 if ( $this->namespace || $this->deletedOnly ) {
695 return 'contributions page filtered for namespace or RevisionDeleted edits'; // potentially slow, see CR r58153
696 } else {
697 return 'contributions page unfiltered';
698 }
699 }
700
701 }