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