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