* (bug 22315) SpecialRecentChangesQuery hook now pass $query_options and checks the...
[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,namespace; other params would randomly not work
71 $opts->fetchValuesFromRequest( $wgRequest, array( 'limit', 'hideminor', 'namespace' ) );
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, $opts['namespace'] );
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 on watchlist for users
282 if( $uid ) {
283 $tables[] = 'watchlist';
284 $join_conds['watchlist'] = array('LEFT JOIN',
285 "wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace");
286 }
287 if ($wgUser->isAllowed("rollback")) {
288 $tables[] = 'page';
289 $join_conds['page'] = array('LEFT JOIN', 'rc_cur_id=page_id');
290 }
291 // Tag stuff.
292 $fields = array();
293 // Fields are * in this case, so let the function modify an empty array to keep it happy.
294 ChangeTags::modifyDisplayQuery(
295 $tables, $fields, $conds, $join_conds, $query_options, $opts['tagfilter']
296 );
297
298 if ( !wfRunHooks( 'SpecialRecentChangesQuery', array( &$conds, &$tables, &$join_conds, $opts, &$query_options ) ) )
299 return false;
300
301 // Don't use the new_namespace_time timestamp index if:
302 // (a) "All namespaces" selected
303 // (b) We want all pages NOT in a certain namespaces (inverted)
304 // (c) There is a tag to filter on (use tag index instead)
305 // (d) UNION + sort/limit is not an option for the DBMS
306 if( is_null($namespace)
307 || $invert
308 || $opts['tagfilter'] != ''
309 || !$dbr->unionSupportsOrderAndLimit() )
310 {
311 $res = $dbr->select( $tables, '*', $conds, __METHOD__,
312 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit ) +
313 $query_options,
314 $join_conds );
315 // We have a new_namespace_time index! UNION over new=(0,1) and sort result set!
316 } else {
317 // New pages
318 $sqlNew = $dbr->selectSQLText( $tables, '*',
319 array( 'rc_new' => 1 ) + $conds,
320 __METHOD__,
321 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit,
322 'USE INDEX' => array('recentchanges' => 'rc_timestamp') ),
323 $join_conds );
324 // Old pages
325 $sqlOld = $dbr->selectSQLText( $tables, '*',
326 array( 'rc_new' => 0 ) + $conds,
327 __METHOD__,
328 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit,
329 'USE INDEX' => array('recentchanges' => 'rc_timestamp') ),
330 $join_conds );
331 # Join the two fast queries, and sort the result set
332 $sql = $dbr->unionQueries(array($sqlNew, $sqlOld), false).' ORDER BY rc_timestamp DESC';
333 $sql = $dbr->limitResult($sql, $limit, false);
334 $res = $dbr->query( $sql, __METHOD__ );
335 }
336
337 return $res;
338 }
339
340 /**
341 * Send output to $wgOut, only called if not used feeds
342 *
343 * @param $rows array of database rows
344 * @param $opts FormOptions
345 */
346 public function webOutput( $rows, $opts ) {
347 global $wgOut, $wgUser, $wgRCShowWatchingUsers, $wgShowUpdatedMarker;
348 global $wgAllowCategorizedRecentChanges;
349
350 $limit = $opts['limit'];
351
352 if( !$this->including() ) {
353 // Output options box
354 $this->doHeader( $opts );
355 }
356
357 // And now for the content
358 $wgOut->setSyndicated( true );
359
360 if( $wgAllowCategorizedRecentChanges ) {
361 $this->filterByCategories( $rows, $opts );
362 }
363
364 $showWatcherCount = $wgRCShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' );
365 $watcherCache = array();
366
367 $dbr = wfGetDB( DB_SLAVE );
368
369 $counter = 1;
370 $list = ChangesList::newFromUser( $wgUser );
371
372 $s = $list->beginRecentChangesList();
373 foreach( $rows as $obj ) {
374 if( $limit == 0 ) break;
375 $rc = RecentChange::newFromRow( $obj );
376 $rc->counter = $counter++;
377 # Check if the page has been updated since the last visit
378 if( $wgShowUpdatedMarker && !empty($obj->wl_notificationtimestamp) ) {
379 $rc->notificationtimestamp = ($obj->rc_timestamp >= $obj->wl_notificationtimestamp);
380 } else {
381 $rc->notificationtimestamp = false; // Default
382 }
383 # Check the number of users watching the page
384 $rc->numberofWatchingusers = 0; // Default
385 if( $showWatcherCount && $obj->rc_namespace >= 0 ) {
386 if( !isset($watcherCache[$obj->rc_namespace][$obj->rc_title]) ) {
387 $watcherCache[$obj->rc_namespace][$obj->rc_title] =
388 $dbr->selectField( 'watchlist',
389 'COUNT(*)',
390 array(
391 'wl_namespace' => $obj->rc_namespace,
392 'wl_title' => $obj->rc_title,
393 ),
394 __METHOD__ . '-watchers' );
395 }
396 $rc->numberofWatchingusers = $watcherCache[$obj->rc_namespace][$obj->rc_title];
397 }
398 $s .= $list->recentChangesLine( $rc, !empty( $obj->wl_user ), $counter );
399 --$limit;
400 }
401 $s .= $list->endRecentChangesList();
402 $wgOut->addHTML( $s );
403 }
404
405 /**
406 * Return the text to be displayed above the changes
407 *
408 * @param $opts FormOptions
409 * @return String: XHTML
410 */
411 public function doHeader( $opts ) {
412 global $wgScript, $wgOut;
413
414 $this->setTopText( $wgOut, $opts );
415
416 $defaults = $opts->getAllValues();
417 $nondefaults = $opts->getChangedValues();
418 $opts->consumeValues( array( 'namespace', 'invert', 'tagfilter' ) );
419
420 $panel = array();
421 $panel[] = $this->optionsPanel( $defaults, $nondefaults );
422 $panel[] = '<hr />';
423
424 $extraOpts = $this->getExtraOptions( $opts );
425 $extraOptsCount = count( $extraOpts );
426 $count = 0;
427 $submit = ' ' . Xml::submitbutton( wfMsg( 'allpagessubmit' ) );
428
429 $out = Xml::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
430 foreach( $extraOpts as $optionRow ) {
431 # Add submit button to the last row only
432 ++$count;
433 $addSubmit = $count === $extraOptsCount ? $submit : '';
434
435 $out .= Xml::openElement( 'tr' );
436 if( is_array( $optionRow ) ) {
437 $out .= Xml::tags( 'td', array( 'class' => 'mw-label' ), $optionRow[0] );
438 $out .= Xml::tags( 'td', array( 'class' => 'mw-input' ), $optionRow[1] . $addSubmit );
439 } else {
440 $out .= Xml::tags( 'td', array( 'class' => 'mw-input', 'colspan' => 2 ), $optionRow . $addSubmit );
441 }
442 $out .= Xml::closeElement( 'tr' );
443 }
444 $out .= Xml::closeElement( 'table' );
445
446 $unconsumed = $opts->getUnconsumedValues();
447 foreach( $unconsumed as $key => $value ) {
448 $out .= Xml::hidden( $key, $value );
449 }
450
451 $t = $this->getTitle();
452 $out .= Xml::hidden( 'title', $t->getPrefixedText() );
453 $form = Xml::tags( 'form', array( 'action' => $wgScript ), $out );
454 $panel[] = $form;
455 $panelString = implode( "\n", $panel );
456
457 $wgOut->addHTML(
458 Xml::fieldset( wfMsg( 'recentchanges-legend' ), $panelString, array( 'class' => 'rcoptions' ) )
459 );
460
461 $wgOut->addHTML( ChangesList::flagLegend() );
462
463 $this->setBottomText( $wgOut, $opts );
464 }
465
466 /**
467 * Get options to be displayed in a form
468 *
469 * @param $opts FormOptions
470 * @return array
471 */
472 function getExtraOptions( $opts ){
473 $extraOpts = array();
474 $extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
475
476 global $wgAllowCategorizedRecentChanges;
477 if( $wgAllowCategorizedRecentChanges ) {
478 $extraOpts['category'] = $this->categoryFilterForm( $opts );
479 }
480
481 $tagFilter = ChangeTags::buildTagFilterSelector( $opts['tagfilter'] );
482 if ( count($tagFilter) )
483 $extraOpts['tagfilter'] = $tagFilter;
484
485 wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
486 return $extraOpts;
487 }
488
489 /**
490 * Send the text to be displayed above the options
491 *
492 * @param $out OutputPage
493 * @param $opts FormOptions
494 */
495 function setTopText( OutputPage $out, FormOptions $opts ){
496 $out->addWikiText( wfMsgForContentNoTrans( 'recentchangestext' ) );
497 }
498
499 /**
500 * Send the text to be displayed after the options, for use in
501 * Recentchangeslinked
502 *
503 * @param $out OutputPage
504 * @param $opts FormOptions
505 */
506 function setBottomText( OutputPage $out, FormOptions $opts ){}
507
508 /**
509 * Creates the choose namespace selection
510 *
511 * @param $opts FormOptions
512 * @return string
513 */
514 protected function namespaceFilterForm( FormOptions $opts ) {
515 $nsSelect = Xml::namespaceSelector( $opts['namespace'], '' );
516 $nsLabel = Xml::label( wfMsg('namespace'), 'namespace' );
517 $invert = Xml::checkLabel( wfMsg('invert'), 'invert', 'nsinvert', $opts['invert'] );
518 return array( $nsLabel, "$nsSelect $invert" );
519 }
520
521 /**
522 * Create a input to filter changes by categories
523 *
524 * @param $opts FormOptions
525 * @return array
526 */
527 protected function categoryFilterForm( FormOptions $opts ) {
528 list( $label, $input ) = Xml::inputLabelSep( wfMsg('rc_categories'),
529 'categories', 'mw-categories', false, $opts['categories'] );
530
531 $input .= ' ' . Xml::checkLabel( wfMsg('rc_categories_any'),
532 'categories_any', 'mw-categories_any', $opts['categories_any'] );
533
534 return array( $label, $input );
535 }
536
537 /**
538 * Filter $rows by categories set in $opts
539 *
540 * @param $rows array of database rows
541 * @param $opts FormOptions
542 */
543 function filterByCategories( &$rows, FormOptions $opts ) {
544 $categories = array_map( 'trim', explode( "|" , $opts['categories'] ) );
545
546 if( empty($categories) ) {
547 return;
548 }
549
550 # Filter categories
551 $cats = array();
552 foreach( $categories as $cat ) {
553 $cat = trim( $cat );
554 if( $cat == "" ) continue;
555 $cats[] = $cat;
556 }
557
558 # Filter articles
559 $articles = array();
560 $a2r = array();
561 foreach( $rows AS $k => $r ) {
562 $nt = Title::makeTitle( $r->rc_namespace, $r->rc_title );
563 $id = $nt->getArticleID();
564 if( $id == 0 ) continue; # Page might have been deleted...
565 if( !in_array($id, $articles) ) {
566 $articles[] = $id;
567 }
568 if( !isset($a2r[$id]) ) {
569 $a2r[$id] = array();
570 }
571 $a2r[$id][] = $k;
572 }
573
574 # Shortcut?
575 if( !count($articles) || !count($cats) )
576 return ;
577
578 # Look up
579 $c = new Categoryfinder ;
580 $c->seed( $articles, $cats, $opts['categories_any'] ? "OR" : "AND" ) ;
581 $match = $c->run();
582
583 # Filter
584 $newrows = array();
585 foreach( $match AS $id ) {
586 foreach( $a2r[$id] AS $rev ) {
587 $k = $rev;
588 $newrows[$k] = $rows[$k];
589 }
590 }
591 $rows = $newrows;
592 }
593
594 /**
595 * Makes change an option link which carries all the other options
596 * @param $title see Title
597 * @param $override
598 * @param $options
599 */
600 function makeOptionsLink( $title, $override, $options, $active = false ) {
601 global $wgUser;
602 $sk = $wgUser->getSkin();
603 $params = $override + $options;
604 if ( $active ) {
605 return $sk->link( $this->getTitle(), '<strong>' . htmlspecialchars( $title ) . '</strong>',
606 array(), $params, array( 'known' ) );
607 } else {
608 return $sk->link( $this->getTitle(), htmlspecialchars( $title ), array() , $params, array( 'known' ) );
609 }
610 }
611
612 /**
613 * Creates the options panel.
614 * @param $defaults array
615 * @param $nondefaults array
616 */
617 function optionsPanel( $defaults, $nondefaults ) {
618 global $wgLang, $wgUser, $wgRCLinkLimits, $wgRCLinkDays;
619
620 $options = $nondefaults + $defaults;
621
622 $note = '';
623 if( !wfEmptyMsg( 'rclegend', wfMsg('rclegend') ) ) {
624 $note .= '<div class="mw-rclegend">' . wfMsgExt( 'rclegend', array('parseinline') ) . "</div>\n";
625 }
626 if( $options['from'] ) {
627 $note .= wfMsgExt( 'rcnotefrom', array( 'parseinline' ),
628 $wgLang->formatNum( $options['limit'] ),
629 $wgLang->timeanddate( $options['from'], true ),
630 $wgLang->date( $options['from'], true ),
631 $wgLang->time( $options['from'], true ) ) . '<br />';
632 }
633
634 # Sort data for display and make sure it's unique after we've added user data.
635 $wgRCLinkLimits[] = $options['limit'];
636 $wgRCLinkDays[] = $options['days'];
637 sort( $wgRCLinkLimits );
638 sort( $wgRCLinkDays );
639 $wgRCLinkLimits = array_unique( $wgRCLinkLimits );
640 $wgRCLinkDays = array_unique( $wgRCLinkDays );
641
642 // limit links
643 foreach( $wgRCLinkLimits as $value ) {
644 $cl[] = $this->makeOptionsLink( $wgLang->formatNum( $value ),
645 array( 'limit' => $value ), $nondefaults, $value == $options['limit'] ) ;
646 }
647 $cl = $wgLang->pipeList( $cl );
648
649 // day links, reset 'from' to none
650 foreach( $wgRCLinkDays as $value ) {
651 $dl[] = $this->makeOptionsLink( $wgLang->formatNum( $value ),
652 array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] ) ;
653 }
654 $dl = $wgLang->pipeList( $dl );
655
656
657 // show/hide links
658 $showhide = array( wfMsg( 'show' ), wfMsg( 'hide' ) );
659 $minorLink = $this->makeOptionsLink( $showhide[1-$options['hideminor']],
660 array( 'hideminor' => 1-$options['hideminor'] ), $nondefaults);
661 $botLink = $this->makeOptionsLink( $showhide[1-$options['hidebots']],
662 array( 'hidebots' => 1-$options['hidebots'] ), $nondefaults);
663 $anonsLink = $this->makeOptionsLink( $showhide[ 1 - $options['hideanons'] ],
664 array( 'hideanons' => 1 - $options['hideanons'] ), $nondefaults );
665 $liuLink = $this->makeOptionsLink( $showhide[1-$options['hideliu']],
666 array( 'hideliu' => 1-$options['hideliu'] ), $nondefaults);
667 $patrLink = $this->makeOptionsLink( $showhide[1-$options['hidepatrolled']],
668 array( 'hidepatrolled' => 1-$options['hidepatrolled'] ), $nondefaults);
669 $myselfLink = $this->makeOptionsLink( $showhide[1-$options['hidemyself']],
670 array( 'hidemyself' => 1-$options['hidemyself'] ), $nondefaults);
671
672 $links[] = wfMsgHtml( 'rcshowhideminor', $minorLink );
673 $links[] = wfMsgHtml( 'rcshowhidebots', $botLink );
674 $links[] = wfMsgHtml( 'rcshowhideanons', $anonsLink );
675 $links[] = wfMsgHtml( 'rcshowhideliu', $liuLink );
676 if( $wgUser->useRCPatrol() )
677 $links[] = wfMsgHtml( 'rcshowhidepatr', $patrLink );
678 $links[] = wfMsgHtml( 'rcshowhidemine', $myselfLink );
679 $hl = $wgLang->pipeList( $links );
680
681 // show from this onward link
682 $now = $wgLang->timeanddate( wfTimestampNow(), true );
683 $tl = $this->makeOptionsLink( $now, array( 'from' => wfTimestampNow() ), $nondefaults );
684
685 $rclinks = wfMsgExt( 'rclinks', array( 'parseinline', 'replaceafter' ),
686 $cl, $dl, $hl );
687 $rclistfrom = wfMsgExt( 'rclistfrom', array( 'parseinline', 'replaceafter' ), $tl );
688 return "{$note}$rclinks<br />$rclistfrom";
689 }
690 }