Merge "ChangesListSpecialPage: Implement doMainQuery()"
[lhc/web/wiklou.git] / includes / specials / SpecialRecentchanges.php
1 <?php
2 /**
3 * Implements Special:Recentchanges
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup SpecialPage
22 */
23
24 /**
25 * A special page that lists last changes made to the wiki
26 *
27 * @ingroup SpecialPage
28 */
29 class SpecialRecentChanges extends ChangesListSpecialPage {
30
31 public function __construct( $name = 'Recentchanges', $restriction = '' ) {
32 parent::__construct( $name, $restriction );
33 }
34
35 /**
36 * Main execution point
37 *
38 * @param string $subpage
39 */
40 public function execute( $subpage ) {
41 // 10 seconds server-side caching max
42 $this->getOutput()->setSquidMaxage( 10 );
43 // Check if the client has a cached version
44 $lastmod = $this->checkLastModified( $this->feedFormat );
45 if ( $lastmod === false ) {
46 return;
47 }
48
49 parent::execute( $subpage );
50 }
51
52 /**
53 * Get a FormOptions object containing the default options
54 *
55 * @return FormOptions
56 */
57 public function getDefaultOptions() {
58 $opts = parent::getDefaultOptions();
59 $user = $this->getUser();
60
61 $opts->add( 'days', $user->getIntOption( 'rcdays' ) );
62 $opts->add( 'limit', $user->getIntOption( 'rclimit' ) );
63 $opts->add( 'from', '' );
64
65 $opts->add( 'hideminor', $user->getBoolOption( 'hideminor' ) );
66 $opts->add( 'hidebots', true );
67 $opts->add( 'hideanons', false );
68 $opts->add( 'hideliu', false );
69 $opts->add( 'hidepatrolled', $user->getBoolOption( 'hidepatrolled' ) );
70 $opts->add( 'hidemyself', false );
71
72 $opts->add( 'categories', '' );
73 $opts->add( 'categories_any', false );
74 $opts->add( 'tagfilter', '' );
75
76 return $opts;
77 }
78
79 /**
80 * Get custom show/hide filters
81 *
82 * @return array Map of filter URL param names to properties (msg/default)
83 */
84 protected function getCustomFilters() {
85 if ( $this->customFilters === null ) {
86 $this->customFilters = array();
87 wfRunHooks( 'SpecialRecentChangesFilters', array( $this, &$this->customFilters ) );
88 }
89
90 return $this->customFilters;
91 }
92
93 /**
94 * Process $par and put options found in $opts. Used when including the page.
95 *
96 * @param string $par
97 * @param FormOptions $opts
98 */
99 public function parseParameters( $par, FormOptions $opts ) {
100 $bits = preg_split( '/\s*,\s*/', trim( $par ) );
101 foreach ( $bits as $bit ) {
102 if ( 'hidebots' === $bit ) {
103 $opts['hidebots'] = true;
104 }
105 if ( 'bots' === $bit ) {
106 $opts['hidebots'] = false;
107 }
108 if ( 'hideminor' === $bit ) {
109 $opts['hideminor'] = true;
110 }
111 if ( 'minor' === $bit ) {
112 $opts['hideminor'] = false;
113 }
114 if ( 'hideliu' === $bit ) {
115 $opts['hideliu'] = true;
116 }
117 if ( 'hidepatrolled' === $bit ) {
118 $opts['hidepatrolled'] = true;
119 }
120 if ( 'hideanons' === $bit ) {
121 $opts['hideanons'] = true;
122 }
123 if ( 'hidemyself' === $bit ) {
124 $opts['hidemyself'] = true;
125 }
126
127 if ( is_numeric( $bit ) ) {
128 $opts['limit'] = $bit;
129 }
130
131 $m = array();
132 if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
133 $opts['limit'] = $m[1];
134 }
135 if ( preg_match( '/^days=(\d+)$/', $bit, $m ) ) {
136 $opts['days'] = $m[1];
137 }
138 if ( preg_match( '/^namespace=(\d+)$/', $bit, $m ) ) {
139 $opts['namespace'] = $m[1];
140 }
141 }
142 }
143
144 public function validateOptions( FormOptions $opts ) {
145 global $wgFeedLimit;
146 $opts->validateIntBounds( 'limit', 0, $this->feedFormat ? $wgFeedLimit : 5000 );
147 }
148
149 /**
150 * Return an array of conditions depending of options set in $opts
151 * @todo Whyyyy is this mutating $opts…
152 *
153 * @param FormOptions $opts
154 * @return array
155 */
156 public function buildMainQueryConds( FormOptions $opts ) {
157 $dbr = $this->getDB();
158 $conds = parent::buildMainQueryConds( $opts );
159
160 // Calculate cutoff
161 $cutoff_unixtime = time() - ( $opts['days'] * 86400 );
162 $cutoff_unixtime = $cutoff_unixtime - ( $cutoff_unixtime % 86400 );
163 $cutoff = $dbr->timestamp( $cutoff_unixtime );
164
165 $fromValid = preg_match( '/^[0-9]{14}$/', $opts['from'] );
166 if ( $fromValid && $opts['from'] > wfTimestamp( TS_MW, $cutoff ) ) {
167 $cutoff = $dbr->timestamp( $opts['from'] );
168 } else {
169 $opts->reset( 'from' );
170 }
171
172 $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes( $cutoff );
173
174 return $conds;
175 }
176
177 /**
178 * Process the query
179 *
180 * @param array $conds
181 * @param FormOptions $opts
182 * @return bool|ResultWrapper Result or false (for Recentchangeslinked only)
183 */
184 public function doMainQuery( $conds, $opts ) {
185 $dbr = $this->getDB();
186 $user = $this->getUser();
187
188 $tables = array( 'recentchanges' );
189 $fields = RecentChange::selectFields();
190 $query_options = array();
191 $join_conds = array();
192
193 // JOIN on watchlist for users
194 if ( $user->getId() && $user->isAllowed( 'viewmywatchlist' ) ) {
195 $tables[] = 'watchlist';
196 $fields[] = 'wl_user';
197 $fields[] = 'wl_notificationtimestamp';
198 $join_conds['watchlist'] = array( 'LEFT JOIN', array(
199 'wl_user' => $user->getId(),
200 'wl_title=rc_title',
201 'wl_namespace=rc_namespace'
202 ) );
203 }
204
205 if ( $user->isAllowed( 'rollback' ) ) {
206 $tables[] = 'page';
207 $fields[] = 'page_latest';
208 $join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
209 }
210
211 ChangeTags::modifyDisplayQuery(
212 $tables,
213 $fields,
214 $conds,
215 $join_conds,
216 $query_options,
217 $opts['tagfilter']
218 );
219
220 if ( !wfRunHooks( 'SpecialRecentChangesQuery',
221 array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ) )
222 ) {
223 return false;
224 }
225
226 // rc_new is not an ENUM, but adding a redundant rc_new IN (0,1) gives mysql enough
227 // knowledge to use an index merge if it wants (it may use some other index though).
228 return $dbr->select(
229 $tables,
230 $fields,
231 $conds + array( 'rc_new' => array( 0, 1 ) ),
232 __METHOD__,
233 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $opts['limit'] ) + $query_options,
234 $join_conds
235 );
236 }
237
238 /**
239 * Send output to the OutputPage object, only called if not used feeds
240 *
241 * @param array $rows Database rows
242 * @param FormOptions $opts
243 */
244 public function webOutput( $rows, $opts ) {
245 global $wgRCShowWatchingUsers, $wgShowUpdatedMarker, $wgAllowCategorizedRecentChanges;
246
247 // Build the final data
248
249 if ( $wgAllowCategorizedRecentChanges ) {
250 $this->filterByCategories( $rows, $opts );
251 }
252
253 $limit = $opts['limit'];
254
255 $showWatcherCount = $wgRCShowWatchingUsers && $this->getUser()->getOption( 'shownumberswatching' );
256 $watcherCache = array();
257
258 $dbr = $this->getDB();
259
260 $counter = 1;
261 $list = ChangesList::newFromContext( $this->getContext() );
262
263 $rclistOutput = $list->beginRecentChangesList();
264 foreach ( $rows as $obj ) {
265 if ( $limit == 0 ) {
266 break;
267 }
268 $rc = RecentChange::newFromRow( $obj );
269 $rc->counter = $counter++;
270 # Check if the page has been updated since the last visit
271 if ( $wgShowUpdatedMarker && !empty( $obj->wl_notificationtimestamp ) ) {
272 $rc->notificationtimestamp = ( $obj->rc_timestamp >= $obj->wl_notificationtimestamp );
273 } else {
274 $rc->notificationtimestamp = false; // Default
275 }
276 # Check the number of users watching the page
277 $rc->numberofWatchingusers = 0; // Default
278 if ( $showWatcherCount && $obj->rc_namespace >= 0 ) {
279 if ( !isset( $watcherCache[$obj->rc_namespace][$obj->rc_title] ) ) {
280 $watcherCache[$obj->rc_namespace][$obj->rc_title] =
281 $dbr->selectField(
282 'watchlist',
283 'COUNT(*)',
284 array(
285 'wl_namespace' => $obj->rc_namespace,
286 'wl_title' => $obj->rc_title,
287 ),
288 __METHOD__ . '-watchers'
289 );
290 }
291 $rc->numberofWatchingusers = $watcherCache[$obj->rc_namespace][$obj->rc_title];
292 }
293
294 $changeLine = $list->recentChangesLine( $rc, !empty( $obj->wl_user ), $counter );
295 if ( $changeLine !== false ) {
296 $rclistOutput .= $changeLine;
297 --$limit;
298 }
299 }
300 $rclistOutput .= $list->endRecentChangesList();
301
302 // Print things out
303
304 if ( !$this->including() ) {
305 // Output options box
306 $this->doHeader( $opts );
307 }
308
309 // And now for the content
310 $feedQuery = $this->getFeedQuery();
311 if ( $feedQuery !== '' ) {
312 $this->getOutput()->setFeedAppendQuery( $feedQuery );
313 } else {
314 $this->getOutput()->setFeedAppendQuery( false );
315 }
316
317 if ( $rows->numRows() === 0 ) {
318 $this->getOutput()->addHtml(
319 '<div class="mw-changeslist-empty">' . $this->msg( 'recentchanges-noresult' )->parse() . '</div>'
320 );
321 } else {
322 $this->getOutput()->addHTML( $rclistOutput );
323 }
324 }
325
326 /**
327 * Return the text to be displayed above the changes
328 *
329 * @param FormOptions $opts
330 * @return string XHTML
331 */
332 public function doHeader( $opts ) {
333 global $wgScript;
334
335 $this->setTopText( $opts );
336
337 $defaults = $opts->getAllValues();
338 $nondefaults = $opts->getChangedValues();
339
340 $panel = array();
341 $panel[] = self::makeLegend( $this->getContext() );
342 $panel[] = $this->optionsPanel( $defaults, $nondefaults );
343 $panel[] = '<hr />';
344
345 $extraOpts = $this->getExtraOptions( $opts );
346 $extraOptsCount = count( $extraOpts );
347 $count = 0;
348 $submit = ' ' . Xml::submitbutton( $this->msg( 'allpagessubmit' )->text() );
349
350 $out = Xml::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
351 foreach ( $extraOpts as $name => $optionRow ) {
352 # Add submit button to the last row only
353 ++$count;
354 $addSubmit = ( $count === $extraOptsCount ) ? $submit : '';
355
356 $out .= Xml::openElement( 'tr' );
357 if ( is_array( $optionRow ) ) {
358 $out .= Xml::tags(
359 'td',
360 array( 'class' => 'mw-label mw-' . $name . '-label' ),
361 $optionRow[0]
362 );
363 $out .= Xml::tags(
364 'td',
365 array( 'class' => 'mw-input' ),
366 $optionRow[1] . $addSubmit
367 );
368 } else {
369 $out .= Xml::tags(
370 'td',
371 array( 'class' => 'mw-input', 'colspan' => 2 ),
372 $optionRow . $addSubmit
373 );
374 }
375 $out .= Xml::closeElement( 'tr' );
376 }
377 $out .= Xml::closeElement( 'table' );
378
379 $unconsumed = $opts->getUnconsumedValues();
380 foreach ( $unconsumed as $key => $value ) {
381 $out .= Html::hidden( $key, $value );
382 }
383
384 $t = $this->getPageTitle();
385 $out .= Html::hidden( 'title', $t->getPrefixedText() );
386 $form = Xml::tags( 'form', array( 'action' => $wgScript ), $out );
387 $panel[] = $form;
388 $panelString = implode( "\n", $panel );
389
390 $this->getOutput()->addHTML(
391 Xml::fieldset(
392 $this->msg( 'recentchanges-legend' )->text(),
393 $panelString,
394 array( 'class' => 'rcoptions' )
395 )
396 );
397
398 $this->setBottomText( $opts );
399 }
400
401 /**
402 * Send the text to be displayed above the options
403 *
404 * @param FormOptions $opts Unused
405 */
406 function setTopText( FormOptions $opts ) {
407 global $wgContLang;
408
409 $message = $this->msg( 'recentchangestext' )->inContentLanguage();
410 if ( !$message->isDisabled() ) {
411 $this->getOutput()->addWikiText(
412 Html::rawElement( 'p',
413 array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ),
414 "\n" . $message->plain() . "\n"
415 ),
416 /* $lineStart */ false,
417 /* $interface */ false
418 );
419 }
420 }
421
422 /**
423 * Get options to be displayed in a form
424 *
425 * @param FormOptions $opts
426 * @return array
427 */
428 function getExtraOptions( $opts ) {
429 $opts->consumeValues( array(
430 'namespace', 'invert', 'associated', 'tagfilter', 'categories', 'categories_any'
431 ) );
432
433 $extraOpts = array();
434 $extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
435
436 global $wgAllowCategorizedRecentChanges;
437 if ( $wgAllowCategorizedRecentChanges ) {
438 $extraOpts['category'] = $this->categoryFilterForm( $opts );
439 }
440
441 $tagFilter = ChangeTags::buildTagFilterSelector( $opts['tagfilter'] );
442 if ( count( $tagFilter ) ) {
443 $extraOpts['tagfilter'] = $tagFilter;
444 }
445
446 // Don't fire the hook for subclasses. (Or should we?)
447 if ( $this->getName() === 'Recentchanges' ) {
448 wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
449 }
450
451 return $extraOpts;
452 }
453
454 /**
455 * Add page-specific modules.
456 */
457 protected function addModules() {
458 parent::addModules();
459 $out = $this->getOutput();
460 $out->addModules( 'mediawiki.special.recentchanges' );
461 }
462
463 /**
464 * Get last modified date, for client caching
465 * Don't use this if we are using the patrol feature, patrol changes don't
466 * update the timestamp
467 *
468 * @param string $feedFormat
469 * @return string|bool
470 */
471 public function checkLastModified( $feedFormat ) {
472 $dbr = $this->getDB();
473 $lastmod = $dbr->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, __METHOD__ );
474 if ( $feedFormat || !$this->getUser()->useRCPatrol() ) {
475 if ( $lastmod && $this->getOutput()->checkLastModified( $lastmod ) ) {
476 # Client cache fresh and headers sent, nothing more to do.
477 return false;
478 }
479 }
480
481 return $lastmod;
482 }
483
484 /**
485 * Return an array with a ChangesFeed object and ChannelFeed object.
486 *
487 * @param string $feedFormat Feed's format (either 'rss' or 'atom')
488 * @return array
489 */
490 public function getFeedObject( $feedFormat ) {
491 $changesFeed = new ChangesFeed( $feedFormat, 'rcfeed' );
492 $formatter = $changesFeed->getFeedObject(
493 $this->msg( 'recentchanges' )->inContentLanguage()->text(),
494 $this->msg( 'recentchanges-feed-description' )->inContentLanguage()->text(),
495 $this->getPageTitle()->getFullURL()
496 );
497
498 return array( $changesFeed, $formatter );
499 }
500
501 /**
502 * Get the query string to append to feed link URLs.
503 *
504 * @return string
505 */
506 public function getFeedQuery() {
507 global $wgFeedLimit;
508
509 $this->getOptions()->validateIntBounds( 'limit', 0, $wgFeedLimit );
510 $options = $this->getOptions()->getChangedValues();
511
512 // wfArrayToCgi() omits options set to null or false
513 foreach ( $options as &$value ) {
514 if ( $value === false ) {
515 $value = '0';
516 }
517 }
518 unset( $value );
519
520 return wfArrayToCgi( $options );
521 }
522
523 /**
524 * Creates the choose namespace selection
525 *
526 * @param FormOptions $opts
527 * @return string
528 */
529 protected function namespaceFilterForm( FormOptions $opts ) {
530 $nsSelect = Html::namespaceSelector(
531 array( 'selected' => $opts['namespace'], 'all' => '' ),
532 array( 'name' => 'namespace', 'id' => 'namespace' )
533 );
534 $nsLabel = Xml::label( $this->msg( 'namespace' )->text(), 'namespace' );
535 $invert = Xml::checkLabel(
536 $this->msg( 'invert' )->text(), 'invert', 'nsinvert',
537 $opts['invert'],
538 array( 'title' => $this->msg( 'tooltip-invert' )->text() )
539 );
540 $associated = Xml::checkLabel(
541 $this->msg( 'namespace_association' )->text(), 'associated', 'nsassociated',
542 $opts['associated'],
543 array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
544 );
545
546 return array( $nsLabel, "$nsSelect $invert $associated" );
547 }
548
549 /**
550 * Create a input to filter changes by categories
551 *
552 * @param FormOptions $opts
553 * @return array
554 */
555 protected function categoryFilterForm( FormOptions $opts ) {
556 list( $label, $input ) = Xml::inputLabelSep( $this->msg( 'rc_categories' )->text(),
557 'categories', 'mw-categories', false, $opts['categories'] );
558
559 $input .= ' ' . Xml::checkLabel( $this->msg( 'rc_categories_any' )->text(),
560 'categories_any', 'mw-categories_any', $opts['categories_any'] );
561
562 return array( $label, $input );
563 }
564
565 /**
566 * Filter $rows by categories set in $opts
567 *
568 * @param ResultWrapper $rows Database rows
569 * @param FormOptions $opts
570 */
571 function filterByCategories( &$rows, FormOptions $opts ) {
572 $categories = array_map( 'trim', explode( '|', $opts['categories'] ) );
573
574 if ( !count( $categories ) ) {
575 return;
576 }
577
578 # Filter categories
579 $cats = array();
580 foreach ( $categories as $cat ) {
581 $cat = trim( $cat );
582 if ( $cat == '' ) {
583 continue;
584 }
585 $cats[] = $cat;
586 }
587
588 # Filter articles
589 $articles = array();
590 $a2r = array();
591 $rowsarr = array();
592 foreach ( $rows as $k => $r ) {
593 $nt = Title::makeTitle( $r->rc_namespace, $r->rc_title );
594 $id = $nt->getArticleID();
595 if ( $id == 0 ) {
596 continue; # Page might have been deleted...
597 }
598 if ( !in_array( $id, $articles ) ) {
599 $articles[] = $id;
600 }
601 if ( !isset( $a2r[$id] ) ) {
602 $a2r[$id] = array();
603 }
604 $a2r[$id][] = $k;
605 $rowsarr[$k] = $r;
606 }
607
608 # Shortcut?
609 if ( !count( $articles ) || !count( $cats ) ) {
610 return;
611 }
612
613 # Look up
614 $c = new Categoryfinder;
615 $c->seed( $articles, $cats, $opts['categories_any'] ? 'OR' : 'AND' );
616 $match = $c->run();
617
618 # Filter
619 $newrows = array();
620 foreach ( $match as $id ) {
621 foreach ( $a2r[$id] as $rev ) {
622 $k = $rev;
623 $newrows[$k] = $rowsarr[$k];
624 }
625 }
626 $rows = $newrows;
627 }
628
629 /**
630 * Makes change an option link which carries all the other options
631 *
632 * @param string $title Title
633 * @param array $override Options to override
634 * @param array $options Current options
635 * @param bool $active Whether to show the link in bold
636 * @return string
637 */
638 function makeOptionsLink( $title, $override, $options, $active = false ) {
639 $params = $override + $options;
640
641 // Bug 36524: false values have be converted to "0" otherwise
642 // wfArrayToCgi() will omit it them.
643 foreach ( $params as &$value ) {
644 if ( $value === false ) {
645 $value = '0';
646 }
647 }
648 unset( $value );
649
650 $text = htmlspecialchars( $title );
651 if ( $active ) {
652 $text = '<strong>' . $text . '</strong>';
653 }
654
655 return Linker::linkKnown( $this->getPageTitle(), $text, array(), $params );
656 }
657
658 /**
659 * Creates the options panel.
660 *
661 * @param array $defaults
662 * @param array $nondefaults
663 * @return string
664 */
665 function optionsPanel( $defaults, $nondefaults ) {
666 global $wgRCLinkLimits, $wgRCLinkDays;
667
668 $options = $nondefaults + $defaults;
669
670 $note = '';
671 $msg = $this->msg( 'rclegend' );
672 if ( !$msg->isDisabled() ) {
673 $note .= '<div class="mw-rclegend">' . $msg->parse() . "</div>\n";
674 }
675
676 $lang = $this->getLanguage();
677 $user = $this->getUser();
678 if ( $options['from'] ) {
679 $note .= $this->msg( 'rcnotefrom' )->numParams( $options['limit'] )->params(
680 $lang->userTimeAndDate( $options['from'], $user ),
681 $lang->userDate( $options['from'], $user ),
682 $lang->userTime( $options['from'], $user ) )->parse() . '<br />';
683 }
684
685 # Sort data for display and make sure it's unique after we've added user data.
686 $linkLimits = $wgRCLinkLimits;
687 $linkLimits[] = $options['limit'];
688 sort( $linkLimits );
689 $linkLimits = array_unique( $linkLimits );
690
691 $linkDays = $wgRCLinkDays;
692 $linkDays[] = $options['days'];
693 sort( $linkDays );
694 $linkDays = array_unique( $linkDays );
695
696 // limit links
697 $cl = array();
698 foreach ( $linkLimits as $value ) {
699 $cl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
700 array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
701 }
702 $cl = $lang->pipeList( $cl );
703
704 // day links, reset 'from' to none
705 $dl = array();
706 foreach ( $linkDays as $value ) {
707 $dl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
708 array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
709 }
710 $dl = $lang->pipeList( $dl );
711
712 // show/hide links
713 $showhide = array( $this->msg( 'show' )->text(), $this->msg( 'hide' )->text() );
714 $filters = array(
715 'hideminor' => 'rcshowhideminor',
716 'hidebots' => 'rcshowhidebots',
717 'hideanons' => 'rcshowhideanons',
718 'hideliu' => 'rcshowhideliu',
719 'hidepatrolled' => 'rcshowhidepatr',
720 'hidemyself' => 'rcshowhidemine'
721 );
722 foreach ( $this->getCustomFilters() as $key => $params ) {
723 $filters[$key] = $params['msg'];
724 }
725 // Disable some if needed
726 if ( !$user->useRCPatrol() ) {
727 unset( $filters['hidepatrolled'] );
728 }
729
730 $links = array();
731 foreach ( $filters as $key => $msg ) {
732 $link = $this->makeOptionsLink( $showhide[1 - $options[$key]],
733 array( $key => 1 - $options[$key] ), $nondefaults );
734 $links[] = $this->msg( $msg )->rawParams( $link )->escaped();
735 }
736
737 // show from this onward link
738 $timestamp = wfTimestampNow();
739 $now = $lang->userTimeAndDate( $timestamp, $user );
740 $tl = $this->makeOptionsLink(
741 $now, array( 'from' => $timestamp ), $nondefaults
742 );
743
744 $rclinks = $this->msg( 'rclinks' )->rawParams( $cl, $dl, $lang->pipeList( $links ) )
745 ->parse();
746 $rclistfrom = $this->msg( 'rclistfrom' )->rawParams( $tl )->parse();
747
748 return "{$note}$rclinks<br />$rclistfrom";
749 }
750
751 public function isIncludable() {
752 return true;
753 }
754 }