Merge "Update mediawiki.ui button styles"
[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 $tables = array( 'recentchanges' );
186 $join_conds = array();
187 $query_options = array();
188
189 $uid = $this->getUser()->getId();
190 $dbr = $this->getDB();
191 $limit = $opts['limit'];
192 $namespace = $opts['namespace'];
193 $invert = $opts['invert'];
194 $associated = $opts['associated'];
195
196 $fields = RecentChange::selectFields();
197 // JOIN on watchlist for users
198 if ( $uid && $this->getUser()->isAllowed( 'viewmywatchlist' ) ) {
199 $tables[] = 'watchlist';
200 $fields[] = 'wl_user';
201 $fields[] = 'wl_notificationtimestamp';
202 $join_conds['watchlist'] = array( 'LEFT JOIN', array(
203 'wl_user' => $uid,
204 'wl_title=rc_title',
205 'wl_namespace=rc_namespace'
206 ) );
207 }
208 if ( $this->getUser()->isAllowed( 'rollback' ) ) {
209 $tables[] = 'page';
210 $fields[] = 'page_latest';
211 $join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
212 }
213 // Tag stuff.
214 ChangeTags::modifyDisplayQuery(
215 $tables,
216 $fields,
217 $conds,
218 $join_conds,
219 $query_options,
220 $opts['tagfilter']
221 );
222
223 if ( !wfRunHooks( 'SpecialRecentChangesQuery',
224 array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ) )
225 ) {
226 return false;
227 }
228
229 // rc_new is not an ENUM, but adding a redundant rc_new IN (0,1) gives mysql enough
230 // knowledge to use an index merge if it wants (it may use some other index though).
231 return $dbr->select(
232 $tables,
233 $fields,
234 $conds + array( 'rc_new' => array( 0, 1 ) ),
235 __METHOD__,
236 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit ) + $query_options,
237 $join_conds
238 );
239 }
240
241 /**
242 * Send output to the OutputPage object, only called if not used feeds
243 *
244 * @param array $rows Database rows
245 * @param FormOptions $opts
246 */
247 public function webOutput( $rows, $opts ) {
248 global $wgRCShowWatchingUsers, $wgShowUpdatedMarker, $wgAllowCategorizedRecentChanges;
249
250 // Build the final data
251
252 if ( $wgAllowCategorizedRecentChanges ) {
253 $this->filterByCategories( $rows, $opts );
254 }
255
256 $limit = $opts['limit'];
257
258 $showWatcherCount = $wgRCShowWatchingUsers && $this->getUser()->getOption( 'shownumberswatching' );
259 $watcherCache = array();
260
261 $dbr = $this->getDB();
262
263 $counter = 1;
264 $list = ChangesList::newFromContext( $this->getContext() );
265
266 $rclistOutput = $list->beginRecentChangesList();
267 foreach ( $rows as $obj ) {
268 if ( $limit == 0 ) {
269 break;
270 }
271 $rc = RecentChange::newFromRow( $obj );
272 $rc->counter = $counter++;
273 # Check if the page has been updated since the last visit
274 if ( $wgShowUpdatedMarker && !empty( $obj->wl_notificationtimestamp ) ) {
275 $rc->notificationtimestamp = ( $obj->rc_timestamp >= $obj->wl_notificationtimestamp );
276 } else {
277 $rc->notificationtimestamp = false; // Default
278 }
279 # Check the number of users watching the page
280 $rc->numberofWatchingusers = 0; // Default
281 if ( $showWatcherCount && $obj->rc_namespace >= 0 ) {
282 if ( !isset( $watcherCache[$obj->rc_namespace][$obj->rc_title] ) ) {
283 $watcherCache[$obj->rc_namespace][$obj->rc_title] =
284 $dbr->selectField(
285 'watchlist',
286 'COUNT(*)',
287 array(
288 'wl_namespace' => $obj->rc_namespace,
289 'wl_title' => $obj->rc_title,
290 ),
291 __METHOD__ . '-watchers'
292 );
293 }
294 $rc->numberofWatchingusers = $watcherCache[$obj->rc_namespace][$obj->rc_title];
295 }
296
297 $changeLine = $list->recentChangesLine( $rc, !empty( $obj->wl_user ), $counter );
298 if ( $changeLine !== false ) {
299 $rclistOutput .= $changeLine;
300 --$limit;
301 }
302 }
303 $rclistOutput .= $list->endRecentChangesList();
304
305 // Print things out
306
307 if ( !$this->including() ) {
308 // Output options box
309 $this->doHeader( $opts );
310 }
311
312 // And now for the content
313 $feedQuery = $this->getFeedQuery();
314 if ( $feedQuery !== '' ) {
315 $this->getOutput()->setFeedAppendQuery( $feedQuery );
316 } else {
317 $this->getOutput()->setFeedAppendQuery( false );
318 }
319
320 if ( $rows->numRows() === 0 ) {
321 $this->getOutput()->addHtml(
322 '<div class="mw-changeslist-empty">' . $this->msg( 'recentchanges-noresult' )->parse() . '</div>'
323 );
324 } else {
325 $this->getOutput()->addHTML( $rclistOutput );
326 }
327 }
328
329 /**
330 * Return the text to be displayed above the changes
331 *
332 * @param FormOptions $opts
333 * @return string XHTML
334 */
335 public function doHeader( $opts ) {
336 global $wgScript;
337
338 $this->setTopText( $opts );
339
340 $defaults = $opts->getAllValues();
341 $nondefaults = $opts->getChangedValues();
342
343 $panel = array();
344 $panel[] = self::makeLegend( $this->getContext() );
345 $panel[] = $this->optionsPanel( $defaults, $nondefaults );
346 $panel[] = '<hr />';
347
348 $extraOpts = $this->getExtraOptions( $opts );
349 $extraOptsCount = count( $extraOpts );
350 $count = 0;
351 $submit = ' ' . Xml::submitbutton( $this->msg( 'allpagessubmit' )->text() );
352
353 $out = Xml::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
354 foreach ( $extraOpts as $name => $optionRow ) {
355 # Add submit button to the last row only
356 ++$count;
357 $addSubmit = ( $count === $extraOptsCount ) ? $submit : '';
358
359 $out .= Xml::openElement( 'tr' );
360 if ( is_array( $optionRow ) ) {
361 $out .= Xml::tags(
362 'td',
363 array( 'class' => 'mw-label mw-' . $name . '-label' ),
364 $optionRow[0]
365 );
366 $out .= Xml::tags(
367 'td',
368 array( 'class' => 'mw-input' ),
369 $optionRow[1] . $addSubmit
370 );
371 } else {
372 $out .= Xml::tags(
373 'td',
374 array( 'class' => 'mw-input', 'colspan' => 2 ),
375 $optionRow . $addSubmit
376 );
377 }
378 $out .= Xml::closeElement( 'tr' );
379 }
380 $out .= Xml::closeElement( 'table' );
381
382 $unconsumed = $opts->getUnconsumedValues();
383 foreach ( $unconsumed as $key => $value ) {
384 $out .= Html::hidden( $key, $value );
385 }
386
387 $t = $this->getPageTitle();
388 $out .= Html::hidden( 'title', $t->getPrefixedText() );
389 $form = Xml::tags( 'form', array( 'action' => $wgScript ), $out );
390 $panel[] = $form;
391 $panelString = implode( "\n", $panel );
392
393 $this->getOutput()->addHTML(
394 Xml::fieldset(
395 $this->msg( 'recentchanges-legend' )->text(),
396 $panelString,
397 array( 'class' => 'rcoptions' )
398 )
399 );
400
401 $this->setBottomText( $opts );
402 }
403
404 /**
405 * Send the text to be displayed above the options
406 *
407 * @param FormOptions $opts Unused
408 */
409 function setTopText( FormOptions $opts ) {
410 global $wgContLang;
411
412 $message = $this->msg( 'recentchangestext' )->inContentLanguage();
413 if ( !$message->isDisabled() ) {
414 $this->getOutput()->addWikiText(
415 Html::rawElement( 'p',
416 array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ),
417 "\n" . $message->plain() . "\n"
418 ),
419 /* $lineStart */ false,
420 /* $interface */ false
421 );
422 }
423 }
424
425 /**
426 * Get options to be displayed in a form
427 *
428 * @param FormOptions $opts
429 * @return array
430 */
431 function getExtraOptions( $opts ) {
432 $opts->consumeValues( array(
433 'namespace', 'invert', 'associated', 'tagfilter', 'categories', 'categories_any'
434 ) );
435
436 $extraOpts = array();
437 $extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
438
439 global $wgAllowCategorizedRecentChanges;
440 if ( $wgAllowCategorizedRecentChanges ) {
441 $extraOpts['category'] = $this->categoryFilterForm( $opts );
442 }
443
444 $tagFilter = ChangeTags::buildTagFilterSelector( $opts['tagfilter'] );
445 if ( count( $tagFilter ) ) {
446 $extraOpts['tagfilter'] = $tagFilter;
447 }
448
449 // Don't fire the hook for subclasses. (Or should we?)
450 if ( $this->getName() === 'Recentchanges' ) {
451 wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
452 }
453
454 return $extraOpts;
455 }
456
457 /**
458 * Add page-specific modules.
459 */
460 protected function addModules() {
461 parent::addModules();
462 $out = $this->getOutput();
463 $out->addModules( 'mediawiki.special.recentchanges' );
464 }
465
466 /**
467 * Get last modified date, for client caching
468 * Don't use this if we are using the patrol feature, patrol changes don't
469 * update the timestamp
470 *
471 * @param string $feedFormat
472 * @return string|bool
473 */
474 public function checkLastModified( $feedFormat ) {
475 $dbr = $this->getDB();
476 $lastmod = $dbr->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, __METHOD__ );
477 if ( $feedFormat || !$this->getUser()->useRCPatrol() ) {
478 if ( $lastmod && $this->getOutput()->checkLastModified( $lastmod ) ) {
479 # Client cache fresh and headers sent, nothing more to do.
480 return false;
481 }
482 }
483
484 return $lastmod;
485 }
486
487 /**
488 * Return an array with a ChangesFeed object and ChannelFeed object.
489 *
490 * @param string $feedFormat Feed's format (either 'rss' or 'atom')
491 * @return array
492 */
493 public function getFeedObject( $feedFormat ) {
494 $changesFeed = new ChangesFeed( $feedFormat, 'rcfeed' );
495 $formatter = $changesFeed->getFeedObject(
496 $this->msg( 'recentchanges' )->inContentLanguage()->text(),
497 $this->msg( 'recentchanges-feed-description' )->inContentLanguage()->text(),
498 $this->getPageTitle()->getFullURL()
499 );
500
501 return array( $changesFeed, $formatter );
502 }
503
504 /**
505 * Get the query string to append to feed link URLs.
506 *
507 * @return string
508 */
509 public function getFeedQuery() {
510 global $wgFeedLimit;
511
512 $this->getOptions()->validateIntBounds( 'limit', 0, $wgFeedLimit );
513 $options = $this->getOptions()->getChangedValues();
514
515 // wfArrayToCgi() omits options set to null or false
516 foreach ( $options as &$value ) {
517 if ( $value === false ) {
518 $value = '0';
519 }
520 }
521 unset( $value );
522
523 return wfArrayToCgi( $options );
524 }
525
526 /**
527 * Creates the choose namespace selection
528 *
529 * @param FormOptions $opts
530 * @return string
531 */
532 protected function namespaceFilterForm( FormOptions $opts ) {
533 $nsSelect = Html::namespaceSelector(
534 array( 'selected' => $opts['namespace'], 'all' => '' ),
535 array( 'name' => 'namespace', 'id' => 'namespace' )
536 );
537 $nsLabel = Xml::label( $this->msg( 'namespace' )->text(), 'namespace' );
538 $invert = Xml::checkLabel(
539 $this->msg( 'invert' )->text(), 'invert', 'nsinvert',
540 $opts['invert'],
541 array( 'title' => $this->msg( 'tooltip-invert' )->text() )
542 );
543 $associated = Xml::checkLabel(
544 $this->msg( 'namespace_association' )->text(), 'associated', 'nsassociated',
545 $opts['associated'],
546 array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
547 );
548
549 return array( $nsLabel, "$nsSelect $invert $associated" );
550 }
551
552 /**
553 * Create a input to filter changes by categories
554 *
555 * @param FormOptions $opts
556 * @return array
557 */
558 protected function categoryFilterForm( FormOptions $opts ) {
559 list( $label, $input ) = Xml::inputLabelSep( $this->msg( 'rc_categories' )->text(),
560 'categories', 'mw-categories', false, $opts['categories'] );
561
562 $input .= ' ' . Xml::checkLabel( $this->msg( 'rc_categories_any' )->text(),
563 'categories_any', 'mw-categories_any', $opts['categories_any'] );
564
565 return array( $label, $input );
566 }
567
568 /**
569 * Filter $rows by categories set in $opts
570 *
571 * @param ResultWrapper $rows Database rows
572 * @param FormOptions $opts
573 */
574 function filterByCategories( &$rows, FormOptions $opts ) {
575 $categories = array_map( 'trim', explode( '|', $opts['categories'] ) );
576
577 if ( !count( $categories ) ) {
578 return;
579 }
580
581 # Filter categories
582 $cats = array();
583 foreach ( $categories as $cat ) {
584 $cat = trim( $cat );
585 if ( $cat == '' ) {
586 continue;
587 }
588 $cats[] = $cat;
589 }
590
591 # Filter articles
592 $articles = array();
593 $a2r = array();
594 $rowsarr = array();
595 foreach ( $rows as $k => $r ) {
596 $nt = Title::makeTitle( $r->rc_namespace, $r->rc_title );
597 $id = $nt->getArticleID();
598 if ( $id == 0 ) {
599 continue; # Page might have been deleted...
600 }
601 if ( !in_array( $id, $articles ) ) {
602 $articles[] = $id;
603 }
604 if ( !isset( $a2r[$id] ) ) {
605 $a2r[$id] = array();
606 }
607 $a2r[$id][] = $k;
608 $rowsarr[$k] = $r;
609 }
610
611 # Shortcut?
612 if ( !count( $articles ) || !count( $cats ) ) {
613 return;
614 }
615
616 # Look up
617 $c = new Categoryfinder;
618 $c->seed( $articles, $cats, $opts['categories_any'] ? 'OR' : 'AND' );
619 $match = $c->run();
620
621 # Filter
622 $newrows = array();
623 foreach ( $match as $id ) {
624 foreach ( $a2r[$id] as $rev ) {
625 $k = $rev;
626 $newrows[$k] = $rowsarr[$k];
627 }
628 }
629 $rows = $newrows;
630 }
631
632 /**
633 * Makes change an option link which carries all the other options
634 *
635 * @param string $title Title
636 * @param array $override Options to override
637 * @param array $options Current options
638 * @param bool $active Whether to show the link in bold
639 * @return string
640 */
641 function makeOptionsLink( $title, $override, $options, $active = false ) {
642 $params = $override + $options;
643
644 // Bug 36524: false values have be converted to "0" otherwise
645 // wfArrayToCgi() will omit it them.
646 foreach ( $params as &$value ) {
647 if ( $value === false ) {
648 $value = '0';
649 }
650 }
651 unset( $value );
652
653 $text = htmlspecialchars( $title );
654 if ( $active ) {
655 $text = '<strong>' . $text . '</strong>';
656 }
657
658 return Linker::linkKnown( $this->getPageTitle(), $text, array(), $params );
659 }
660
661 /**
662 * Creates the options panel.
663 *
664 * @param array $defaults
665 * @param array $nondefaults
666 * @return string
667 */
668 function optionsPanel( $defaults, $nondefaults ) {
669 global $wgRCLinkLimits, $wgRCLinkDays;
670
671 $options = $nondefaults + $defaults;
672
673 $note = '';
674 $msg = $this->msg( 'rclegend' );
675 if ( !$msg->isDisabled() ) {
676 $note .= '<div class="mw-rclegend">' . $msg->parse() . "</div>\n";
677 }
678
679 $lang = $this->getLanguage();
680 $user = $this->getUser();
681 if ( $options['from'] ) {
682 $note .= $this->msg( 'rcnotefrom' )->numParams( $options['limit'] )->params(
683 $lang->userTimeAndDate( $options['from'], $user ),
684 $lang->userDate( $options['from'], $user ),
685 $lang->userTime( $options['from'], $user ) )->parse() . '<br />';
686 }
687
688 # Sort data for display and make sure it's unique after we've added user data.
689 $linkLimits = $wgRCLinkLimits;
690 $linkLimits[] = $options['limit'];
691 sort( $linkLimits );
692 $linkLimits = array_unique( $linkLimits );
693
694 $linkDays = $wgRCLinkDays;
695 $linkDays[] = $options['days'];
696 sort( $linkDays );
697 $linkDays = array_unique( $linkDays );
698
699 // limit links
700 $cl = array();
701 foreach ( $linkLimits as $value ) {
702 $cl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
703 array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
704 }
705 $cl = $lang->pipeList( $cl );
706
707 // day links, reset 'from' to none
708 $dl = array();
709 foreach ( $linkDays as $value ) {
710 $dl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
711 array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
712 }
713 $dl = $lang->pipeList( $dl );
714
715 // show/hide links
716 $showhide = array( $this->msg( 'show' )->text(), $this->msg( 'hide' )->text() );
717 $filters = array(
718 'hideminor' => 'rcshowhideminor',
719 'hidebots' => 'rcshowhidebots',
720 'hideanons' => 'rcshowhideanons',
721 'hideliu' => 'rcshowhideliu',
722 'hidepatrolled' => 'rcshowhidepatr',
723 'hidemyself' => 'rcshowhidemine'
724 );
725 foreach ( $this->getCustomFilters() as $key => $params ) {
726 $filters[$key] = $params['msg'];
727 }
728 // Disable some if needed
729 if ( !$user->useRCPatrol() ) {
730 unset( $filters['hidepatrolled'] );
731 }
732
733 $links = array();
734 foreach ( $filters as $key => $msg ) {
735 $link = $this->makeOptionsLink( $showhide[1 - $options[$key]],
736 array( $key => 1 - $options[$key] ), $nondefaults );
737 $links[] = $this->msg( $msg )->rawParams( $link )->escaped();
738 }
739
740 // show from this onward link
741 $timestamp = wfTimestampNow();
742 $now = $lang->userTimeAndDate( $timestamp, $user );
743 $tl = $this->makeOptionsLink(
744 $now, array( 'from' => $timestamp ), $nondefaults
745 );
746
747 $rclinks = $this->msg( 'rclinks' )->rawParams( $cl, $dl, $lang->pipeList( $links ) )
748 ->parse();
749 $rclistfrom = $this->msg( 'rclistfrom' )->rawParams( $tl )->parse();
750
751 return "{$note}$rclinks<br />$rclistfrom";
752 }
753
754 public function isIncludable() {
755 return true;
756 }
757 }