* bug 21267 change "show/hide" to "show", if user cannot submit Special:Revisiondelete
[lhc/web/wiklou.git] / includes / HistoryPage.php
1 <?php
2 /**
3 * Page history
4 *
5 * Split off from Article.php and Skin.php, 2003-12-22
6 * @file
7 */
8
9 /**
10 * This class handles printing the history page for an article. In order to
11 * be efficient, it uses timestamps rather than offsets for paging, to avoid
12 * costly LIMIT,offset queries.
13 *
14 * Construct it by passing in an Article, and call $h->history() to print the
15 * history.
16 *
17 */
18 class HistoryPage {
19 const DIR_PREV = 0;
20 const DIR_NEXT = 1;
21
22 var $article, $title, $skin;
23
24 /**
25 * Construct a new HistoryPage.
26 *
27 * @param Article $article
28 * @returns nothing
29 */
30 function __construct( $article ) {
31 global $wgUser;
32 $this->article = $article;
33 $this->title = $article->getTitle();
34 $this->skin = $wgUser->getSkin();
35 $this->preCacheMessages();
36 }
37
38 function getArticle() {
39 return $this->article;
40 }
41
42 function getTitle() {
43 return $this->title;
44 }
45
46 /**
47 * As we use the same small set of messages in various methods and that
48 * they are called often, we call them once and save them in $this->message
49 */
50 function preCacheMessages() {
51 // Precache various messages
52 if( !isset( $this->message ) ) {
53 $msgs = array( 'cur', 'last', 'pipe-separator' );
54 foreach( $msgs as $msg ) {
55 $this->message[$msg] = wfMsgExt( $msg, array( 'escapenoentities') );
56 }
57 }
58 }
59
60 /**
61 * Print the history page for an article.
62 *
63 * @returns nothing
64 */
65 function history() {
66 global $wgOut, $wgRequest, $wgScript;
67
68 /*
69 * Allow client caching.
70 */
71 if( $wgOut->checkLastModified( $this->article->getTouched() ) )
72 return; // Client cache fresh and headers sent, nothing more to do.
73
74 wfProfileIn( __METHOD__ );
75
76 /*
77 * Setup page variables.
78 */
79 $wgOut->setPageTitle( wfMsg( 'history-title', $this->title->getPrefixedText() ) );
80 $wgOut->setPageTitleActionText( wfMsg( 'history_short' ) );
81 $wgOut->setArticleFlag( false );
82 $wgOut->setArticleRelated( true );
83 $wgOut->setRobotPolicy( 'noindex,nofollow' );
84 $wgOut->setSyndicated( true );
85 $wgOut->setFeedAppendQuery( 'action=history' );
86 $wgOut->addScriptFile( 'history.js' );
87
88 $logPage = SpecialPage::getTitleFor( 'Log' );
89 $logLink = $this->skin->link(
90 $logPage,
91 wfMsgHtml( 'viewpagelogs' ),
92 array(),
93 array( 'page' => $this->title->getPrefixedText() ),
94 array( 'known', 'noclasses' )
95 );
96 $wgOut->setSubtitle( $logLink );
97
98 $feedType = $wgRequest->getVal( 'feed' );
99 if( $feedType ) {
100 wfProfileOut( __METHOD__ );
101 return $this->feed( $feedType );
102 }
103
104 /*
105 * Fail if article doesn't exist.
106 */
107 if( !$this->title->exists() ) {
108 $wgOut->addWikiMsg( 'nohistory' );
109 # show deletion/move log if there is an entry
110 LogEventsList::showLogExtract(
111 $wgOut,
112 array( 'delete', 'move' ),
113 $this->title->getPrefixedText(),
114 '',
115 array( 'lim' => 10,
116 'conds' => array( "log_action != 'revision'" ),
117 'showIfEmpty' => false,
118 'msgKey' => array( 'moveddeleted-notice' )
119 )
120 );
121 wfProfileOut( __METHOD__ );
122 return;
123 }
124
125 /**
126 * Add date selector to quickly get to a certain time
127 */
128 $year = $wgRequest->getInt( 'year' );
129 $month = $wgRequest->getInt( 'month' );
130 $tagFilter = $wgRequest->getVal( 'tagfilter' );
131 $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter );
132 /**
133 * Option to show only revisions that have been (partially) hidden via RevisionDelete
134 * Note that this can run a *long* time if there are many revisions to look at.
135 * We use "isBigDeletion" to determine if the history is too big to go through.
136 * Additionally, only users with 'deleterevision' right can filter for deleted edits.
137 */
138 if ( $this->title->userCan( 'deleterevision' ) && ( !$this->article->isBigDeletion() || $this->title->userCan( 'bigdelete' ) ) ) {
139 $conds = ( $wgRequest->getBool( 'deleted' ) ) ? array("rev_deleted != '0'") : array();
140 $checkDeleted = Xml::checkLabel( wfMsg( 'history-show-deleted' ), 'deleted', '', $wgRequest->getBool( 'deleted' ) ) . "\n";
141 }
142 else { # Don't filter and don't add the checkbox for filtering
143 $conds = array();
144 $checkDeleted = '';
145 }
146
147 $action = htmlspecialchars( $wgScript );
148 $wgOut->addHTML(
149 "<form action=\"$action\" method=\"get\" id=\"mw-history-searchform\">" .
150 Xml::fieldset(
151 wfMsg( 'history-fieldset-title' ),
152 false,
153 array( 'id' => 'mw-history-search' )
154 ) .
155 Xml::hidden( 'title', $this->title->getPrefixedDBKey() ) . "\n" .
156 Xml::hidden( 'action', 'history' ) . "\n" .
157 Xml::dateMenu( $year, $month ) . '&nbsp;' .
158 ( $tagSelector ? ( implode( '&nbsp;', $tagSelector ) . '&nbsp;' ) : '' ) .
159 $checkDeleted .
160 Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .
161 '</fieldset></form>'
162 );
163
164 wfRunHooks( 'PageHistoryBeforeList', array( &$this->article ) );
165
166 /**
167 * Do the list
168 */
169 $pager = new HistoryPager( $this, $year, $month, $tagFilter, $conds );
170 $wgOut->addHTML(
171 $pager->getNavigationBar() .
172 $pager->getBody() .
173 $pager->getNavigationBar()
174 );
175
176 wfProfileOut( __METHOD__ );
177 }
178
179 /**
180 * Fetch an array of revisions, specified by a given limit, offset and
181 * direction. This is now only used by the feeds. It was previously
182 * used by the main UI but that's now handled by the pager.
183 */
184 function fetchRevisions($limit, $offset, $direction) {
185 $dbr = wfGetDB( DB_SLAVE );
186
187 if( $direction == HistoryPage::DIR_PREV )
188 list($dirs, $oper) = array("ASC", ">=");
189 else /* $direction == HistoryPage::DIR_NEXT */
190 list($dirs, $oper) = array("DESC", "<=");
191
192 if( $offset )
193 $offsets = array("rev_timestamp $oper '$offset'");
194 else
195 $offsets = array();
196
197 $page_id = $this->title->getArticleID();
198
199 return $dbr->select( 'revision',
200 Revision::selectFields(),
201 array_merge(array("rev_page=$page_id"), $offsets),
202 __METHOD__,
203 array( 'ORDER BY' => "rev_timestamp $dirs",
204 'USE INDEX' => 'page_timestamp', 'LIMIT' => $limit)
205 );
206 }
207
208 /**
209 * Output a subscription feed listing recent edits to this page.
210 * @param string $type
211 */
212 function feed( $type ) {
213 global $wgFeedClasses, $wgRequest, $wgFeedLimit;
214 if( !FeedUtils::checkFeedOutput($type) ) {
215 return;
216 }
217
218 $feed = new $wgFeedClasses[$type](
219 $this->title->getPrefixedText() . ' - ' .
220 wfMsgForContent( 'history-feed-title' ),
221 wfMsgForContent( 'history-feed-description' ),
222 $this->title->getFullUrl( 'action=history' )
223 );
224
225 // Get a limit on number of feed entries. Provide a sane default
226 // of 10 if none is defined (but limit to $wgFeedLimit max)
227 $limit = $wgRequest->getInt( 'limit', 10 );
228 if( $limit > $wgFeedLimit || $limit < 1 ) {
229 $limit = 10;
230 }
231 $items = $this->fetchRevisions($limit, 0, HistoryPage::DIR_NEXT);
232
233 $feed->outHeader();
234 if( $items ) {
235 foreach( $items as $row ) {
236 $feed->outItem( $this->feedItem( $row ) );
237 }
238 } else {
239 $feed->outItem( $this->feedEmpty() );
240 }
241 $feed->outFooter();
242 }
243
244 function feedEmpty() {
245 global $wgOut;
246 return new FeedItem(
247 wfMsgForContent( 'nohistory' ),
248 $wgOut->parse( wfMsgForContent( 'history-feed-empty' ) ),
249 $this->title->getFullUrl(),
250 wfTimestamp( TS_MW ),
251 '',
252 $this->title->getTalkPage()->getFullUrl()
253 );
254 }
255
256 /**
257 * Generate a FeedItem object from a given revision table row
258 * Borrows Recent Changes' feed generation functions for formatting;
259 * includes a diff to the previous revision (if any).
260 *
261 * @param $row
262 * @return FeedItem
263 */
264 function feedItem( $row ) {
265 $rev = new Revision( $row );
266 $rev->setTitle( $this->title );
267 $text = FeedUtils::formatDiffRow(
268 $this->title,
269 $this->title->getPreviousRevisionID( $rev->getId() ),
270 $rev->getId(),
271 $rev->getTimestamp(),
272 $rev->getComment()
273 );
274 if( $rev->getComment() == '' ) {
275 global $wgContLang;
276 $title = wfMsgForContent( 'history-feed-item-nocomment',
277 $rev->getUserText(),
278 $wgContLang->timeanddate( $rev->getTimestamp() ),
279 $wgContLang->date( $rev->getTimestamp() ),
280 $wgContLang->time( $rev->getTimestamp() )
281 );
282 } else {
283 $title = $rev->getUserText() .
284 wfMsgForContent( 'colon-separator' ) .
285 FeedItem::stripComment( $rev->getComment() );
286 }
287 return new FeedItem(
288 $title,
289 $text,
290 $this->title->getFullUrl( 'diff=' . $rev->getId() . '&oldid=prev' ),
291 $rev->getTimestamp(),
292 $rev->getUserText(),
293 $this->title->getTalkPage()->getFullUrl()
294 );
295 }
296 }
297
298 /**
299 * @ingroup Pager
300 */
301 class HistoryPager extends ReverseChronologicalPager {
302 public $lastRow = false, $counter, $historyPage, $title, $buttons, $conds;
303 protected $oldIdChecked;
304
305 function __construct( $historyPage, $year='', $month='', $tagFilter = '', $conds = array() ) {
306 parent::__construct();
307 $this->historyPage = $historyPage;
308 $this->title = $this->historyPage->title;
309 $this->tagFilter = $tagFilter;
310 $this->getDateCond( $year, $month );
311 $this->conds = $conds;
312 }
313
314 // For hook compatibility...
315 function getArticle() {
316 return $this->historyPage->getArticle();
317 }
318
319 function getQueryInfo() {
320 $queryInfo = array(
321 'tables' => array('revision'),
322 'fields' => array_merge( Revision::selectFields()),
323 'conds' => array_merge( array('rev_page' => $this->historyPage->title->getArticleID() ), $this->conds ),
324 'options' => array( 'USE INDEX' => array('revision' => 'page_timestamp') ),
325 'join_conds' => array( 'tag_summary' => array( 'LEFT JOIN', 'ts_rev_id=rev_id' ) ),
326 );
327 ChangeTags::modifyDisplayQuery(
328 $queryInfo['tables'],
329 $queryInfo['fields'],
330 $queryInfo['conds'],
331 $queryInfo['join_conds'],
332 $queryInfo['options'],
333 $this->tagFilter
334 );
335 wfRunHooks( 'PageHistoryPager::getQueryInfo', array( &$this, &$queryInfo ) );
336 return $queryInfo;
337 }
338
339 function getIndexField() {
340 return 'rev_timestamp';
341 }
342
343 function formatRow( $row ) {
344 if( $this->lastRow ) {
345 $latest = ($this->counter == 1 && $this->mIsFirst);
346 $firstInList = $this->counter == 1;
347 $s = $this->historyLine( $this->lastRow, $row, $this->counter++,
348 $this->title->getNotificationTimestamp(), $latest, $firstInList );
349 } else {
350 $s = '';
351 }
352 $this->lastRow = $row;
353 return $s;
354 }
355
356 /**
357 * Creates begin of history list with a submit button
358 *
359 * @return string HTML output
360 */
361 function getStartBody() {
362 global $wgScript, $wgUser, $wgOut, $wgContLang;
363 $this->lastRow = false;
364 $this->counter = 1;
365 $this->oldIdChecked = 0;
366
367 $wgOut->wrapWikiMsg( "<div class='mw-history-legend'>\n$1</div>", 'histlegend' );
368 $s = Xml::openElement( 'form', array( 'action' => $wgScript,
369 'id' => 'mw-history-compare' ) ) . "\n";
370 $s .= Xml::hidden( 'title', $this->title->getPrefixedDbKey() ) . "\n";
371 $s .= Xml::hidden( 'action', 'historysubmit' ) . "\n";
372
373 $this->buttons = '<div>';
374 if( $wgUser->isAllowed('deleterevision') ) {
375 $float = $wgContLang->alignEnd();
376 # Note bug #20966, <button> is non-standard in IE<8
377 $this->buttons .= Xml::element( 'button',
378 array(
379 'type' => 'submit',
380 'name' => 'revisiondelete',
381 'value' => '1',
382 'style' => "float: $float;",
383 'class' => 'mw-history-revisiondelete-button',
384 ),
385 wfMsg( 'showhideselectedversions' )
386 ) . "\n";
387 }
388 $this->buttons .= $this->submitButton( wfMsg( 'compareselectedversions'),
389 array(
390 'class' => 'historysubmit',
391 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ),
392 'title' => wfMsg( 'tooltip-compareselectedversions' ),
393 )
394 ) . "\n";
395 $this->buttons .= '</div>';
396 $s .= $this->buttons . '<ul id="pagehistory">' . "\n";
397 return $s;
398 }
399
400 function getEndBody() {
401 if( $this->lastRow ) {
402 $latest = $this->counter == 1 && $this->mIsFirst;
403 $firstInList = $this->counter == 1;
404 if( $this->mIsBackwards ) {
405 # Next row is unknown, but for UI reasons, probably exists if an offset has been specified
406 if( $this->mOffset == '' ) {
407 $next = null;
408 } else {
409 $next = 'unknown';
410 }
411 } else {
412 # The next row is the past-the-end row
413 $next = $this->mPastTheEndRow;
414 }
415 $s = $this->historyLine( $this->lastRow, $next, $this->counter++,
416 $this->title->getNotificationTimestamp(), $latest, $firstInList );
417 } else {
418 $s = '';
419 }
420 $s .= "</ul>\n";
421 $s .= $this->buttons;
422 $s .= '</form>';
423 return $s;
424 }
425
426 /**
427 * Creates a submit button
428 *
429 * @param array $attributes attributes
430 * @return string HTML output for the submit button
431 */
432 function submitButton($message, $attributes = array() ) {
433 # Disable submit button if history has 1 revision only
434 if( $this->getNumRows() > 1 ) {
435 return Xml::submitButton( $message , $attributes );
436 } else {
437 return '';
438 }
439 }
440
441 /**
442 * Returns a row from the history printout.
443 *
444 * @todo document some more, and maybe clean up the code (some params redundant?)
445 *
446 * @param Row $row The database row corresponding to the previous line.
447 * @param mixed $next The database row corresponding to the next line.
448 * @param int $counter Apparently a counter of what row number we're at, counted from the top row = 1.
449 * @param $notificationtimestamp
450 * @param bool $latest Whether this row corresponds to the page's latest revision.
451 * @param bool $firstInList Whether this row corresponds to the first displayed on this history page.
452 * @return string HTML output for the row
453 */
454 function historyLine( $row, $next, $counter = '', $notificationtimestamp = false,
455 $latest = false, $firstInList = false )
456 {
457 global $wgUser, $wgLang;
458 $rev = new Revision( $row );
459 $rev->setTitle( $this->title );
460
461 $curlink = $this->curLink( $rev, $latest );
462 $lastlink = $this->lastLink( $rev, $next, $counter );
463 $diffButtons = $this->diffButtons( $rev, $firstInList, $counter );
464 $histLinks = Html::rawElement(
465 'span',
466 array( 'class' => 'mw-history-histlinks' ),
467 '(' . $curlink . $this->historyPage->message['pipe-separator'] . $lastlink . ') '
468 );
469 $s = $histLinks . $diffButtons;
470
471 $link = $this->revLink( $rev );
472 $classes = array();
473
474 $del = '';
475 // User can delete revisions...
476 if( $wgUser->isAllowed( 'deleterevision' ) ) {
477 // If revision was hidden from sysops, disable the checkbox
478 if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
479 $del = Xml::check( 'deleterevisions', false, array( 'disabled' => 'disabled' ) );
480 // Otherwise, enable the checkbox...
481 } else {
482 $del = Xml::check( 'showhiderevisions', false, array( 'name' => 'ids['.$rev->getId().']' ) );
483 }
484 // User can only view deleted revisions...
485 } else if( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) {
486 // If revision was hidden from sysops, disable the link
487 if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
488 $cdel = $this->getSkin()->revDeleteLinkDisabled( false );
489 // Otherwise, show the link...
490 } else {
491 $query = array( 'type' => 'revision',
492 'target' => $this->title->getPrefixedDbkey(), 'ids' => $rev->getId() );
493 $del .= $this->getSkin()->revDeleteLink( $query,
494 $rev->isDeleted( Revision::DELETED_RESTRICTED ), false );
495 }
496 }
497 if( $del ) $s .= " $del ";
498
499 $s .= " $link";
500 $s .= " <span class='history-user'>" . $this->getSkin()->revUserTools( $rev, true ) . "</span>";
501
502 if( $rev->isMinor() ) {
503 $s .= ' ' . ChangesList::flag( 'minor' );
504 }
505
506 if( !is_null( $size = $rev->getSize() ) && !$rev->isDeleted( Revision::DELETED_TEXT ) ) {
507 $s .= ' ' . $this->getSkin()->formatRevisionSize( $size );
508 }
509
510 $s .= $this->getSkin()->revComment( $rev, false, true );
511
512 if( $notificationtimestamp && ($row->rev_timestamp >= $notificationtimestamp) ) {
513 $s .= ' <span class="updatedmarker">' . wfMsgHtml( 'updatedmarker' ) . '</span>';
514 }
515
516 $tools = array();
517
518 # Rollback and undo links
519 if( !is_null( $next ) && is_object( $next ) ) {
520 if( $latest && $this->title->userCan( 'rollback' ) && $this->title->userCan( 'edit' ) ) {
521 $tools[] = '<span class="mw-rollback-link">'.
522 $this->getSkin()->buildRollbackLink( $rev ).'</span>';
523 }
524
525 if( $this->title->quickUserCan( 'edit' )
526 && !$rev->isDeleted( Revision::DELETED_TEXT )
527 && !$next->rev_deleted & Revision::DELETED_TEXT )
528 {
529 # Create undo tooltip for the first (=latest) line only
530 $undoTooltip = $latest
531 ? array( 'title' => wfMsg( 'tooltip-undo' ) )
532 : array();
533 $undolink = $this->getSkin()->link(
534 $this->title,
535 wfMsgHtml( 'editundo' ),
536 $undoTooltip,
537 array(
538 'action' => 'edit',
539 'undoafter' => $next->rev_id,
540 'undo' => $rev->getId()
541 ),
542 array( 'known', 'noclasses' )
543 );
544 $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
545 }
546 }
547
548 if( $tools ) {
549 $s .= ' (' . $wgLang->pipeList( $tools ) . ')';
550 }
551
552 # Tags
553 list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $row->ts_tags, 'history' );
554 $classes = array_merge( $classes, $newClasses );
555 $s .= " $tagSummary";
556
557 wfRunHooks( 'PageHistoryLineEnding', array( $this, &$row , &$s ) );
558
559 $attribs = array();
560 if ( $classes ) {
561 $attribs['class'] = implode( ' ', $classes );
562 }
563
564 return Xml::tags( 'li', $attribs, $s ) . "\n";
565 }
566
567 /**
568 * Create a link to view this revision of the page
569 * @param Revision $rev
570 * @returns string
571 */
572 function revLink( $rev ) {
573 global $wgLang;
574 $date = $wgLang->timeanddate( wfTimestamp(TS_MW, $rev->getTimestamp()), true );
575 $date = htmlspecialchars( $date );
576 if( !$rev->isDeleted( Revision::DELETED_TEXT ) ) {
577 $link = $this->getSkin()->link(
578 $this->title,
579 $date,
580 array(),
581 array( 'oldid' => $rev->getId() ),
582 array( 'known', 'noclasses' )
583 );
584 } else {
585 $link = "<span class=\"history-deleted\">$date</span>";
586 }
587 return $link;
588 }
589
590 /**
591 * Create a diff-to-current link for this revision for this page
592 * @param Revision $rev
593 * @param Bool $latest, this is the latest revision of the page?
594 * @returns string
595 */
596 function curLink( $rev, $latest ) {
597 $cur = $this->historyPage->message['cur'];
598 if( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) {
599 return $cur;
600 } else {
601 return $this->getSkin()->link(
602 $this->title,
603 $cur,
604 array(),
605 array(
606 'diff' => $this->title->getLatestRevID(),
607 'oldid' => $rev->getId()
608 ),
609 array( 'known', 'noclasses' )
610 );
611 }
612 }
613
614 /**
615 * Create a diff-to-previous link for this revision for this page.
616 * @param Revision $prevRev, the previous revision
617 * @param mixed $next, the newer revision
618 * @param int $counter, what row on the history list this is
619 * @returns string
620 */
621 function lastLink( $prevRev, $next, $counter ) {
622 $last = $this->historyPage->message['last'];
623 # $next may either be a Row, null, or "unkown"
624 $nextRev = is_object($next) ? new Revision( $next ) : $next;
625 if( is_null($next) ) {
626 # Probably no next row
627 return $last;
628 } elseif( $next === 'unknown' ) {
629 # Next row probably exists but is unknown, use an oldid=prev link
630 return $this->getSkin()->link(
631 $this->title,
632 $last,
633 array(),
634 array(
635 'diff' => $prevRev->getId(),
636 'oldid' => 'prev'
637 ),
638 array( 'known', 'noclasses' )
639 );
640 } elseif( !$prevRev->userCan(Revision::DELETED_TEXT) || !$nextRev->userCan(Revision::DELETED_TEXT) ) {
641 return $last;
642 } else {
643 return $this->getSkin()->link(
644 $this->title,
645 $last,
646 array(),
647 array(
648 'diff' => $prevRev->getId(),
649 'oldid' => $next->rev_id
650 ),
651 array( 'known', 'noclasses' )
652 );
653 }
654 }
655
656 /**
657 * Create radio buttons for page history
658 *
659 * @param object $rev Revision
660 * @param bool $firstInList Is this version the first one?
661 * @param int $counter A counter of what row number we're at, counted from the top row = 1.
662 * @return string HTML output for the radio buttons
663 */
664 function diffButtons( $rev, $firstInList, $counter ) {
665 if( $this->getNumRows() > 1 ) {
666 $id = $rev->getId();
667 $radio = array( 'type' => 'radio', 'value' => $id );
668 /** @todo: move title texts to javascript */
669 if( $firstInList ) {
670 $first = Xml::element( 'input',
671 array_merge( $radio, array(
672 'style' => 'visibility:hidden',
673 'name' => 'oldid',
674 'id' => 'mw-oldid-null' ) )
675 );
676 $checkmark = array( 'checked' => 'checked' );
677 } else {
678 # Check visibility of old revisions
679 if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
680 $radio['disabled'] = 'disabled';
681 $checkmark = array(); // We will check the next possible one
682 } else if( $counter == 2 || !$this->oldIdChecked ) {
683 $checkmark = array( 'checked' => 'checked' );
684 $this->oldIdChecked = $id;
685 } else {
686 $checkmark = array();
687 }
688 $first = Xml::element( 'input',
689 array_merge( $radio, $checkmark, array(
690 'name' => 'oldid',
691 'id' => "mw-oldid-$id" ) ) );
692 $checkmark = array();
693 }
694 $second = Xml::element( 'input',
695 array_merge( $radio, $checkmark, array(
696 'name' => 'diff',
697 'id' => "mw-diff-$id" ) ) );
698 return $first . $second;
699 } else {
700 return '';
701 }
702 }
703 }
704
705 /**
706 * Backwards-compatibility aliases
707 */
708 class PageHistory extends HistoryPage {}
709 class PageHistoryPager extends HistoryPager {}