(bug 20256) Fixed SQL errors on Special:Recentchanges and Special:Recentchangeslinked...
[lhc/web/wiklou.git] / includes / specials / SpecialRecentchanges.php
1 <?php
2
3 /**
4 * Implements Special:Recentchanges
5 * @ingroup SpecialPage
6 */
7 class SpecialRecentChanges extends SpecialPage {
8 public function __construct() {
9 parent::__construct( 'Recentchanges' );
10 $this->includable( true );
11 }
12
13 /**
14 * Get a FormOptions object containing the default options
15 *
16 * @return FormOptions
17 */
18 public function getDefaultOptions() {
19 global $wgUser;
20 $opts = new FormOptions();
21
22 $opts->add( 'days', (int)$wgUser->getOption( 'rcdays' ) );
23 $opts->add( 'limit', (int)$wgUser->getOption( 'rclimit' ) );
24 $opts->add( 'from', '' );
25
26 $opts->add( 'hideminor', $wgUser->getBoolOption( 'hideminor' ) );
27 $opts->add( 'hidebots', true );
28 $opts->add( 'hideanons', false );
29 $opts->add( 'hideliu', false );
30 $opts->add( 'hidepatrolled', $wgUser->getBoolOption( 'hidepatrolled' ) );
31 $opts->add( 'hidemyself', false );
32
33 $opts->add( 'namespace', '', FormOptions::INTNULL );
34 $opts->add( 'invert', false );
35
36 $opts->add( 'categories', '' );
37 $opts->add( 'categories_any', false );
38 $opts->add( 'tagfilter', '' );
39 return $opts;
40 }
41
42 /**
43 * Get a FormOptions object with options as specified by the user
44 *
45 * @return FormOptions
46 */
47 public function setup( $parameters ) {
48 global $wgRequest;
49
50 $opts = $this->getDefaultOptions();
51 $opts->fetchValuesFromRequest( $wgRequest );
52
53 // Give precedence to subpage syntax
54 if( $parameters !== null ) {
55 $this->parseParameters( $parameters, $opts );
56 }
57
58 $opts->validateIntBounds( 'limit', 0, 5000 );
59 return $opts;
60 }
61
62 /**
63 * Get a FormOptions object sepcific for feed requests
64 *
65 * @return FormOptions
66 */
67 public function feedSetup() {
68 global $wgFeedLimit, $wgRequest;
69 $opts = $this->getDefaultOptions();
70 # Feed is cached on limit,hideminor; other params would randomly not work
71 $opts->fetchValuesFromRequest( $wgRequest, array( 'limit', 'hideminor' ) );
72 $opts->validateIntBounds( 'limit', 0, $wgFeedLimit );
73 return $opts;
74 }
75
76 /**
77 * Main execution point
78 *
79 * @param $parameters string
80 */
81 public function execute( $parameters ) {
82 global $wgRequest, $wgOut;
83 $feedFormat = $wgRequest->getVal( 'feed' );
84
85 # 10 seconds server-side caching max
86 $wgOut->setSquidMaxage( 10 );
87 # Check if the client has a cached version
88 $lastmod = $this->checkLastModified( $feedFormat );
89 if( $lastmod === false ) {
90 return;
91 }
92
93 $opts = $feedFormat ? $this->feedSetup() : $this->setup( $parameters );
94 $this->setHeaders();
95 $this->outputHeader();
96
97 // Fetch results, prepare a batch link existence check query
98 $rows = array();
99 $conds = $this->buildMainQueryConds( $opts );
100 $rows = $this->doMainQuery( $conds, $opts );
101 if( $rows === false ){
102 if( !$this->including() ) {
103 $this->doHeader( $opts );
104 }
105 return;
106 }
107
108 if( !$feedFormat ) {
109 $batch = new LinkBatch;
110 foreach( $rows as $row ) {
111 $batch->add( NS_USER, $row->rc_user_text );
112 $batch->add( NS_USER_TALK, $row->rc_user_text );
113 $batch->add( $row->rc_namespace, $row->rc_title );
114 }
115 $batch->execute();
116 }
117 $target = isset($opts['target']) ? $opts['target'] : ''; // RCL has targets
118 if( $feedFormat ) {
119 list( $feed, $feedObj ) = $this->getFeedObject( $feedFormat );
120 $feed->execute( $feedObj, $rows, $opts['limit'], $opts['hideminor'], $lastmod, $target );
121 } else {
122 $this->webOutput( $rows, $opts );
123 }
124
125 $rows->free();
126 }
127
128 /**
129 * Return an array with a ChangesFeed object and ChannelFeed object
130 *
131 * @return array
132 */
133 public function getFeedObject( $feedFormat ){
134 $feed = new ChangesFeed( $feedFormat, 'rcfeed' );
135 $feedObj = $feed->getFeedObject(
136 wfMsgForContent( 'recentchanges' ),
137 wfMsgForContent( 'recentchanges-feed-description' )
138 );
139 return array( $feed, $feedObj );
140 }
141
142 /**
143 * Process $par and put options found if $opts
144 * Mainly used when including the page
145 *
146 * @param $par String
147 * @param $opts FormOptions
148 */
149 public function parseParameters( $par, FormOptions $opts ) {
150 $bits = preg_split( '/\s*,\s*/', trim( $par ) );
151 foreach( $bits as $bit ) {
152 if( 'hidebots' === $bit ) $opts['hidebots'] = true;
153 if( 'bots' === $bit ) $opts['hidebots'] = false;
154 if( 'hideminor' === $bit ) $opts['hideminor'] = true;
155 if( 'minor' === $bit ) $opts['hideminor'] = false;
156 if( 'hideliu' === $bit ) $opts['hideliu'] = true;
157 if( 'hidepatrolled' === $bit ) $opts['hidepatrolled'] = true;
158 if( 'hideanons' === $bit ) $opts['hideanons'] = true;
159 if( 'hidemyself' === $bit ) $opts['hidemyself'] = true;
160
161 if( is_numeric( $bit ) ) $opts['limit'] = $bit;
162
163 $m = array();
164 if( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) $opts['limit'] = $m[1];
165 if( preg_match( '/^days=(\d+)$/', $bit, $m ) ) $opts['days'] = $m[1];
166 }
167 }
168
169 /**
170 * Get last modified date, for client caching
171 * Don't use this if we are using the patrol feature, patrol changes don't
172 * update the timestamp
173 *
174 * @param $feedFormat String
175 * @return string or false
176 */
177 public function checkLastModified( $feedFormat ) {
178 global $wgUseRCPatrol, $wgOut;
179 $dbr = wfGetDB( DB_SLAVE );
180 $lastmod = $dbr->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, __METHOD__ );
181 if( $feedFormat || !$wgUseRCPatrol ) {
182 if( $lastmod && $wgOut->checkLastModified( $lastmod ) ) {
183 # Client cache fresh and headers sent, nothing more to do.
184 return false;
185 }
186 }
187 return $lastmod;
188 }
189
190 /**
191 * Return an array of conditions depending of options set in $opts
192 *
193 * @param $opts FormOptions
194 * @return array
195 */
196 public function buildMainQueryConds( FormOptions $opts ) {
197 global $wgUser;
198
199 $dbr = wfGetDB( DB_SLAVE );
200 $conds = array();
201
202 # It makes no sense to hide both anons and logged-in users
203 # Where this occurs, force anons to be shown
204 $forcebot = false;
205 if( $opts['hideanons'] && $opts['hideliu'] ){
206 # Check if the user wants to show bots only
207 if( $opts['hidebots'] ){
208 $opts['hideanons'] = false;
209 } else {
210 $forcebot = true;
211 $opts['hidebots'] = false;
212 }
213 }
214
215 // Calculate cutoff
216 $cutoff_unixtime = time() - ( $opts['days'] * 86400 );
217 $cutoff_unixtime = $cutoff_unixtime - ($cutoff_unixtime % 86400);
218 $cutoff = $dbr->timestamp( $cutoff_unixtime );
219
220 $fromValid = preg_match('/^[0-9]{14}$/', $opts['from']);
221 if( $fromValid && $opts['from'] > wfTimestamp(TS_MW,$cutoff) ) {
222 $cutoff = $dbr->timestamp($opts['from']);
223 } else {
224 $opts->reset( 'from' );
225 }
226
227 $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes( $cutoff );
228
229
230 $hidePatrol = $wgUser->useRCPatrol() && $opts['hidepatrolled'];
231 $hideLoggedInUsers = $opts['hideliu'] && !$forcebot;
232 $hideAnonymousUsers = $opts['hideanons'] && !$forcebot;
233
234 if( $opts['hideminor'] ) $conds['rc_minor'] = 0;
235 if( $opts['hidebots'] ) $conds['rc_bot'] = 0;
236 if( $hidePatrol ) $conds['rc_patrolled'] = 0;
237 if( $forcebot ) $conds['rc_bot'] = 1;
238 if( $hideLoggedInUsers ) $conds[] = 'rc_user = 0';
239 if( $hideAnonymousUsers ) $conds[] = 'rc_user != 0';
240
241 if( $opts['hidemyself'] ) {
242 if( $wgUser->getId() ) {
243 $conds[] = 'rc_user != ' . $dbr->addQuotes( $wgUser->getId() );
244 } else {
245 $conds[] = 'rc_user_text != ' . $dbr->addQuotes( $wgUser->getName() );
246 }
247 }
248
249 # Namespace filtering
250 if( $opts['namespace'] !== '' ) {
251 if( !$opts['invert'] ) {
252 $conds[] = 'rc_namespace = ' . $dbr->addQuotes( $opts['namespace'] );
253 } else {
254 $conds[] = 'rc_namespace != ' . $dbr->addQuotes( $opts['namespace'] );
255 }
256 }
257
258 return $conds;
259 }
260
261 /**
262 * Process the query
263 *
264 * @param $conds array
265 * @param $opts FormOptions
266 * @return database result or false (for Recentchangeslinked only)
267 */
268 public function doMainQuery( $conds, $opts ) {
269 global $wgUser;
270
271 $tables = array( 'recentchanges' );
272 $join_conds = array();
273 $query_options = array( 'USE INDEX' => array('recentchanges' => 'rc_timestamp') );
274
275 $uid = $wgUser->getId();
276 $dbr = wfGetDB( DB_SLAVE );
277 $limit = $opts['limit'];
278 $namespace = $opts['namespace'];
279 $invert = $opts['invert'];
280
281 $join_conds = array();
282
283 // JOIN on watchlist for users
284 if( $uid ) {
285 $tables[] = 'watchlist';
286 $join_conds['watchlist'] = array('LEFT JOIN',
287 "wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace");
288 }
289 if ($wgUser->isAllowed("rollback")) {
290 $tables[] = 'page';
291 $join_conds['page'] = array('LEFT JOIN', 'rc_cur_id=page_id');
292 }
293 // Tag stuff.
294 $fields = array();
295 // Fields are * in this case, so let the function modify an empty array to keep it happy.
296 ChangeTags::modifyDisplayQuery( $tables,
297 $fields,
298 $conds,
299 $join_conds,
300 $query_options,
301 $opts['tagfilter']
302 );
303
304 wfRunHooks('SpecialRecentChangesQuery', array( &$conds, &$tables, &$join_conds, $opts ) );
305
306 // Is there either one namespace selected or excluded?
307 // Tag filtering also has a better index.
308 // Also, if this is "all" or main namespace, just use timestamp index.
309 if( is_null($namespace)
310 || $invert
311 || $opts['tagfilter']
312 || !$dbr->unionSupportsOrderAndLimit() )
313 {
314 $res = $dbr->select( $tables, '*', $conds, __METHOD__,
315 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit ) +
316 $query_options,
317 $join_conds );
318 // We have a new_namespace_time index! UNION over new=(0,1) and sort result set!
319 } else {
320 // New pages
321 $sqlNew = $dbr->selectSQLText( $tables, '*',
322 array( 'rc_new' => 1 ) + $conds,
323 __METHOD__,
324 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit,
325 'USE INDEX' => array('recentchanges' => 'rc_timestamp') ),
326 $join_conds );
327 // Old pages
328 $sqlOld = $dbr->selectSQLText( $tables, '*',
329 array( 'rc_new' => 0 ) + $conds,
330 __METHOD__,
331 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit,
332 'USE INDEX' => array('recentchanges' => 'rc_timestamp') ),
333 $join_conds );
334 # Join the two fast queries, and sort the result set
335 $sql = $dbr->unionQueries(array($sqlNew, $sqlOld), false).' ORDER BY rc_timestamp DESC';
336 $sql = $dbr->limitResult($sql, $limit, false);
337 $res = $dbr->query( $sql, __METHOD__ );
338 }
339
340 return $res;
341 }
342
343 /**
344 * Send output to $wgOut, only called if not used feeds
345 *
346 * @param $rows array of database rows
347 * @param $opts FormOptions
348 */
349 public function webOutput( $rows, $opts ) {
350 global $wgOut, $wgUser, $wgRCShowWatchingUsers, $wgShowUpdatedMarker;
351 global $wgAllowCategorizedRecentChanges;
352
353 $limit = $opts['limit'];
354
355 if( !$this->including() ) {
356 // Output options box
357 $this->doHeader( $opts );
358 }
359
360 // And now for the content
361 $wgOut->setSyndicated( true );
362
363 if( $wgAllowCategorizedRecentChanges ) {
364 $this->filterByCategories( $rows, $opts );
365 }
366
367 $showWatcherCount = $wgRCShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' );
368 $watcherCache = array();
369
370 $dbr = wfGetDB( DB_SLAVE );
371
372 $counter = 1;
373 $list = ChangesList::newFromUser( $wgUser );
374
375 $s = $list->beginRecentChangesList();
376 foreach( $rows as $obj ) {
377 if( $limit == 0 ) break;
378 $rc = RecentChange::newFromRow( $obj );
379 $rc->counter = $counter++;
380 # Check if the page has been updated since the last visit
381 if( $wgShowUpdatedMarker && !empty($obj->wl_notificationtimestamp) ) {
382 $rc->notificationtimestamp = ($obj->rc_timestamp >= $obj->wl_notificationtimestamp);
383 } else {
384 $rc->notificationtimestamp = false; // Default
385 }
386 # Check the number of users watching the page
387 $rc->numberofWatchingusers = 0; // Default
388 if( $showWatcherCount && $obj->rc_namespace >= 0 ) {
389 if( !isset($watcherCache[$obj->rc_namespace][$obj->rc_title]) ) {
390 $watcherCache[$obj->rc_namespace][$obj->rc_title] =
391 $dbr->selectField( 'watchlist',
392 'COUNT(*)',
393 array(
394 'wl_namespace' => $obj->rc_namespace,
395 'wl_title' => $obj->rc_title,
396 ),
397 __METHOD__ . '-watchers' );
398 }
399 $rc->numberofWatchingusers = $watcherCache[$obj->rc_namespace][$obj->rc_title];
400 }
401 $s .= $list->recentChangesLine( $rc, !empty( $obj->wl_user ), $counter );
402 --$limit;
403 }
404 $s .= $list->endRecentChangesList();
405 $wgOut->addHTML( $s );
406 }
407
408 /**
409 * Return the text to be displayed above the changes
410 *
411 * @param $opts FormOptions
412 * @return String: XHTML
413 */
414 public function doHeader( $opts ) {
415 global $wgScript, $wgOut;
416
417 $this->setTopText( $wgOut, $opts );
418
419 $defaults = $opts->getAllValues();
420 $nondefaults = $opts->getChangedValues();
421 $opts->consumeValues( array( 'namespace', 'invert', 'tagfilter' ) );
422
423 $panel = array();
424 $panel[] = $this->optionsPanel( $defaults, $nondefaults );
425 $panel[] = '<hr />';
426
427 $extraOpts = $this->getExtraOptions( $opts );
428 $extraOptsCount = count( $extraOpts );
429 $count = 0;
430 $submit = ' ' . Xml::submitbutton( wfMsg( 'allpagessubmit' ) );
431
432 $out = Xml::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
433 foreach( $extraOpts as $optionRow ) {
434 # Add submit button to the last row only
435 ++$count;
436 $addSubmit = $count === $extraOptsCount ? $submit : '';
437
438 $out .= Xml::openElement( 'tr' );
439 if( is_array( $optionRow ) ) {
440 $out .= Xml::tags( 'td', array( 'class' => 'mw-label' ), $optionRow[0] );
441 $out .= Xml::tags( 'td', array( 'class' => 'mw-input' ), $optionRow[1] . $addSubmit );
442 } else {
443 $out .= Xml::tags( 'td', array( 'class' => 'mw-input', 'colspan' => 2 ), $optionRow . $addSubmit );
444 }
445 $out .= Xml::closeElement( 'tr' );
446 }
447 $out .= Xml::closeElement( 'table' );
448
449 $unconsumed = $opts->getUnconsumedValues();
450 foreach( $unconsumed as $key => $value ) {
451 $out .= Xml::hidden( $key, $value );
452 }
453
454 $t = $this->getTitle();
455 $out .= Xml::hidden( 'title', $t->getPrefixedText() );
456 $form = Xml::tags( 'form', array( 'action' => $wgScript ), $out );
457 $panel[] = $form;
458 $panelString = implode( "\n", $panel );
459
460 $wgOut->addHTML(
461 Xml::fieldset( wfMsg( 'recentchanges-legend' ), $panelString, array( 'class' => 'rcoptions' ) )
462 );
463
464 $wgOut->addHTML( ChangesList::flagLegend() );
465
466 $this->setBottomText( $wgOut, $opts );
467 }
468
469 /**
470 * Get options to be displayed in a form
471 *
472 * @param $opts FormOptions
473 * @return array
474 */
475 function getExtraOptions( $opts ){
476 $extraOpts = array();
477 $extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
478
479 global $wgAllowCategorizedRecentChanges;
480 if( $wgAllowCategorizedRecentChanges ) {
481 $extraOpts['category'] = $this->categoryFilterForm( $opts );
482 }
483
484 $tagFilter = ChangeTags::buildTagFilterSelector( $opts['tagfilter'] );
485 if ( count($tagFilter) )
486 $extraOpts['tagfilter'] = $tagFilter;
487
488 wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
489 return $extraOpts;
490 }
491
492 /**
493 * Send the text to be displayed above the options
494 *
495 * @param $out OutputPage
496 * @param $opts FormOptions
497 */
498 function setTopText( OutputPage $out, FormOptions $opts ){
499 $out->addWikiText( wfMsgForContentNoTrans( 'recentchangestext' ) );
500 }
501
502 /**
503 * Send the text to be displayed after the options, for use in
504 * Recentchangeslinked
505 *
506 * @param $out OutputPage
507 * @param $opts FormOptions
508 */
509 function setBottomText( OutputPage $out, FormOptions $opts ){}
510
511 /**
512 * Creates the choose namespace selection
513 *
514 * @param $opts FormOptions
515 * @return string
516 */
517 protected function namespaceFilterForm( FormOptions $opts ) {
518 $nsSelect = Xml::namespaceSelector( $opts['namespace'], '' );
519 $nsLabel = Xml::label( wfMsg('namespace'), 'namespace' );
520 $invert = Xml::checkLabel( wfMsg('invert'), 'invert', 'nsinvert', $opts['invert'] );
521 return array( $nsLabel, "$nsSelect $invert" );
522 }
523
524 /**
525 * Create a input to filter changes by categories
526 *
527 * @param $opts FormOptions
528 * @return array
529 */
530 protected function categoryFilterForm( FormOptions $opts ) {
531 list( $label, $input ) = Xml::inputLabelSep( wfMsg('rc_categories'),
532 'categories', 'mw-categories', false, $opts['categories'] );
533
534 $input .= ' ' . Xml::checkLabel( wfMsg('rc_categories_any'),
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 $rows array of database rows
544 * @param $opts FormOptions
545 */
546 function filterByCategories( &$rows, FormOptions $opts ) {
547 $categories = array_map( 'trim', explode( "|" , $opts['categories'] ) );
548
549 if( empty($categories) ) {
550 return;
551 }
552
553 # Filter categories
554 $cats = array();
555 foreach( $categories as $cat ) {
556 $cat = trim( $cat );
557 if( $cat == "" ) continue;
558 $cats[] = $cat;
559 }
560
561 # Filter articles
562 $articles = array();
563 $a2r = array();
564 foreach( $rows AS $k => $r ) {
565 $nt = Title::makeTitle( $r->rc_namespace, $r->rc_title );
566 $id = $nt->getArticleID();
567 if( $id == 0 ) continue; # Page might have been deleted...
568 if( !in_array($id, $articles) ) {
569 $articles[] = $id;
570 }
571 if( !isset($a2r[$id]) ) {
572 $a2r[$id] = array();
573 }
574 $a2r[$id][] = $k;
575 }
576
577 # Shortcut?
578 if( !count($articles) || !count($cats) )
579 return ;
580
581 # Look up
582 $c = new Categoryfinder ;
583 $c->seed( $articles, $cats, $opts['categories_any'] ? "OR" : "AND" ) ;
584 $match = $c->run();
585
586 # Filter
587 $newrows = array();
588 foreach( $match AS $id ) {
589 foreach( $a2r[$id] AS $rev ) {
590 $k = $rev;
591 $newrows[$k] = $rows[$k];
592 }
593 }
594 $rows = $newrows;
595 }
596
597 /**
598 * Makes change an option link which carries all the other options
599 * @param $title see Title
600 * @param $override
601 * @param $options
602 */
603 function makeOptionsLink( $title, $override, $options, $active = false ) {
604 global $wgUser;
605 $sk = $wgUser->getSkin();
606 $params = $override + $options;
607 if ( $active ) {
608 return $sk->link( $this->getTitle(), '<strong>' . htmlspecialchars( $title ) . '</strong>',
609 array(), $params, array( 'known' ) );
610 } else {
611 return $sk->link( $this->getTitle(), htmlspecialchars( $title ), array() , $params, array( 'known' ) );
612 }
613 }
614
615 /**
616 * Creates the options panel.
617 * @param $defaults array
618 * @param $nondefaults array
619 */
620 function optionsPanel( $defaults, $nondefaults ) {
621 global $wgLang, $wgUser, $wgRCLinkLimits, $wgRCLinkDays;
622
623 $options = $nondefaults + $defaults;
624
625 $note = '';
626 if( !wfEmptyMsg( 'rclegend', wfMsg('rclegend') ) ) {
627 $note .= '<div class="mw-rclegend">' . wfMsgExt( 'rclegend', array('parseinline') ) . "</div>\n";
628 }
629 if( $options['from'] ) {
630 $note .= wfMsgExt( 'rcnotefrom', array( 'parseinline' ),
631 $wgLang->formatNum( $options['limit'] ),
632 $wgLang->timeanddate( $options['from'], true ),
633 $wgLang->date( $options['from'], true ),
634 $wgLang->time( $options['from'], true ) ) . '<br />';
635 }
636
637 # Sort data for display and make sure it's unique after we've added user data.
638 $wgRCLinkLimits[] = $options['limit'];
639 $wgRCLinkDays[] = $options['days'];
640 sort( $wgRCLinkLimits );
641 sort( $wgRCLinkDays );
642 $wgRCLinkLimits = array_unique( $wgRCLinkLimits );
643 $wgRCLinkDays = array_unique( $wgRCLinkDays );
644
645 // limit links
646 foreach( $wgRCLinkLimits as $value ) {
647 $cl[] = $this->makeOptionsLink( $wgLang->formatNum( $value ),
648 array( 'limit' => $value ), $nondefaults, $value == $options['limit'] ) ;
649 }
650 $cl = $wgLang->pipeList( $cl );
651
652 // day links, reset 'from' to none
653 foreach( $wgRCLinkDays as $value ) {
654 $dl[] = $this->makeOptionsLink( $wgLang->formatNum( $value ),
655 array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] ) ;
656 }
657 $dl = $wgLang->pipeList( $dl );
658
659
660 // show/hide links
661 $showhide = array( wfMsg( 'show' ), wfMsg( 'hide' ) );
662 $minorLink = $this->makeOptionsLink( $showhide[1-$options['hideminor']],
663 array( 'hideminor' => 1-$options['hideminor'] ), $nondefaults);
664 $botLink = $this->makeOptionsLink( $showhide[1-$options['hidebots']],
665 array( 'hidebots' => 1-$options['hidebots'] ), $nondefaults);
666 $anonsLink = $this->makeOptionsLink( $showhide[ 1 - $options['hideanons'] ],
667 array( 'hideanons' => 1 - $options['hideanons'] ), $nondefaults );
668 $liuLink = $this->makeOptionsLink( $showhide[1-$options['hideliu']],
669 array( 'hideliu' => 1-$options['hideliu'] ), $nondefaults);
670 $patrLink = $this->makeOptionsLink( $showhide[1-$options['hidepatrolled']],
671 array( 'hidepatrolled' => 1-$options['hidepatrolled'] ), $nondefaults);
672 $myselfLink = $this->makeOptionsLink( $showhide[1-$options['hidemyself']],
673 array( 'hidemyself' => 1-$options['hidemyself'] ), $nondefaults);
674
675 $links[] = wfMsgHtml( 'rcshowhideminor', $minorLink );
676 $links[] = wfMsgHtml( 'rcshowhidebots', $botLink );
677 $links[] = wfMsgHtml( 'rcshowhideanons', $anonsLink );
678 $links[] = wfMsgHtml( 'rcshowhideliu', $liuLink );
679 if( $wgUser->useRCPatrol() )
680 $links[] = wfMsgHtml( 'rcshowhidepatr', $patrLink );
681 $links[] = wfMsgHtml( 'rcshowhidemine', $myselfLink );
682 $hl = $wgLang->pipeList( $links );
683
684 // show from this onward link
685 $now = $wgLang->timeanddate( wfTimestampNow(), true );
686 $tl = $this->makeOptionsLink( $now, array( 'from' => wfTimestampNow() ), $nondefaults );
687
688 $rclinks = wfMsgExt( 'rclinks', array( 'parseinline', 'replaceafter' ),
689 $cl, $dl, $hl );
690 $rclistfrom = wfMsgExt( 'rclistfrom', array( 'parseinline', 'replaceafter' ), $tl );
691 return "{$note}$rclinks<br />$rclistfrom";
692 }
693 }