Split out ParserOptions and ParserOutput classes in their own files.
[lhc/web/wiklou.git] / includes / ChangesList.php
1 <?php
2 /**
3 * @package MediaWiki
4 * Contain class to show various lists of change:
5 * - what's link here
6 * - related changes
7 * - recent changes
8 */
9
10 /**
11 * @todo document
12 * @package MediaWiki
13 */
14 class RCCacheEntry extends RecentChange
15 {
16 var $secureName, $link;
17 var $curlink , $difflink, $lastlink , $usertalklink , $versionlink ;
18 var $userlink, $timestamp, $watched;
19
20 function newFromParent( $rc )
21 {
22 $rc2 = new RCCacheEntry;
23 $rc2->mAttribs = $rc->mAttribs;
24 $rc2->mExtra = $rc->mExtra;
25 return $rc2;
26 }
27 } ;
28
29 /**
30 * @package MediaWiki
31 */
32 class ChangesList {
33 # Called by history lists and recent changes
34 #
35
36 /** @todo document */
37 function ChangesList( &$skin ) {
38 $this->skin =& $skin;
39 $this->preCacheMessages();
40 }
41
42 /**
43 * Fetch an appropriate changes list class for the specified user
44 * Some users might want to use an enhanced list format, for instance
45 *
46 * @param $user User to fetch the list class for
47 * @return ChangesList derivative
48 */
49 public static function newFromUser( &$user ) {
50 $sk =& $user->getSkin();
51 $list = NULL;
52 if( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) {
53 return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk );
54 } else {
55 return $list;
56 }
57 }
58
59 /**
60 * As we use the same small set of messages in various methods and that
61 * they are called often, we call them once and save them in $this->message
62 */
63 function preCacheMessages() {
64 // Precache various messages
65 if( !isset( $this->message ) ) {
66 foreach( explode(' ', 'cur diff hist minoreditletter newpageletter last '.
67 'blocklink changes history boteditletter' ) as $msg ) {
68 $this->message[$msg] = wfMsgExt( $msg, array( 'escape') );
69 }
70 }
71 }
72
73
74 /**
75 * Returns the appropriate flags for new page, minor change and patrolling
76 */
77 function recentChangesFlags( $new, $minor, $patrolled, $nothing = '&nbsp;', $bot = false ) {
78 $f = $new ? '<span class="newpage">' . $this->message['newpageletter'] . '</span>'
79 : $nothing;
80 $f .= $minor ? '<span class="minor">' . $this->message['minoreditletter'] . '</span>'
81 : $nothing;
82 $f .= $bot ? '<span class="bot">' . $this->message['boteditletter'] . '</span>' : $nothing;
83 $f .= $patrolled ? '<span class="unpatrolled">!</span>' : $nothing;
84 return $f;
85 }
86
87 /**
88 * Returns text for the start of the tabular part of RC
89 */
90 function beginRecentChangesList() {
91 $this->rc_cache = array();
92 $this->rcMoveIndex = 0;
93 $this->rcCacheIndex = 0;
94 $this->lastdate = '';
95 $this->rclistOpen = false;
96 return '';
97 }
98
99 /**
100 * Returns text for the end of RC
101 */
102 function endRecentChangesList() {
103 if( $this->rclistOpen ) {
104 return "</ul>\n";
105 } else {
106 return '';
107 }
108 }
109
110
111 function insertMove( &$s, $rc ) {
112 # Diff
113 $s .= '(' . $this->message['diff'] . ') (';
114 # Hist
115 $s .= $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), $this->message['hist'], 'action=history' ) .
116 ') . . ';
117
118 # "[[x]] moved to [[y]]"
119 $msg = ( $rc->mAttribs['rc_type'] == RC_MOVE ) ? '1movedto2' : '1movedto2_redir';
120 $s .= wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
121 $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
122 }
123
124 function insertDateHeader(&$s, $rc_timestamp) {
125 global $wgLang;
126
127 # Make date header if necessary
128 $date = $wgLang->date( $rc_timestamp, true, true );
129 $s = '';
130 if( $date != $this->lastdate ) {
131 if( '' != $this->lastdate ) {
132 $s .= "</ul>\n";
133 }
134 $s .= '<h4>'.$date."</h4>\n<ul class=\"special\">";
135 $this->lastdate = $date;
136 $this->rclistOpen = true;
137 }
138 }
139
140 function insertLog(&$s, $title, $logtype) {
141 $logname = LogPage::logName( $logtype );
142 $s .= '(' . $this->skin->makeKnownLinkObj($title, $logname ) . ')';
143 }
144
145
146 function insertDiffHist(&$s, &$rc, $unpatrolled) {
147 # Diff link
148 if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
149 $diffLink = $this->message['diff'];
150 } else {
151 $rcidparam = $unpatrolled
152 ? array( 'rcid' => $rc->mAttribs['rc_id'] )
153 : array();
154 $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'],
155 wfArrayToCGI( array(
156 'curid' => $rc->mAttribs['rc_cur_id'],
157 'diff' => $rc->mAttribs['rc_this_oldid'],
158 'oldid' => $rc->mAttribs['rc_last_oldid'] ),
159 $rcidparam ),
160 '', '', ' tabindex="'.$rc->counter.'"');
161 }
162 $s .= '('.$diffLink.') (';
163
164 # History link
165 $s .= $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['hist'],
166 wfArrayToCGI( array(
167 'curid' => $rc->mAttribs['rc_cur_id'],
168 'action' => 'history' ) ) );
169 $s .= ') . . ';
170 }
171
172 function insertArticleLink(&$s, &$rc, $unpatrolled, $watched) {
173 # Article link
174 # If it's a new article, there is no diff link, but if it hasn't been
175 # patrolled yet, we need to give users a way to do so
176 $params = ( $unpatrolled && $rc->mAttribs['rc_type'] == RC_NEW )
177 ? 'rcid='.$rc->mAttribs['rc_id']
178 : '';
179 $articlelink = ' '. $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
180 if($watched) $articlelink = '<strong>'.$articlelink.'</strong>';
181 global $wgContLang;
182 $articlelink .= $wgContLang->getDirMark();
183
184 $s .= ' '.$articlelink;
185 }
186
187 function insertTimestamp(&$s, $rc) {
188 global $wgLang;
189 # Timestamp
190 $s .= '; ' . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
191 }
192
193 /** Insert links to user page, user talk page and eventually a blocking link */
194 function insertUserRelatedLinks(&$s, &$rc) {
195 $s .= $this->skin->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
196 $s .= $this->skin->userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
197 }
198
199 /** insert a formatted comment */
200 function insertComment(&$s, &$rc) {
201 # Add comment
202 if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
203 $s .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
204 }
205 }
206
207 /**
208 * Check whether to enable recent changes patrol features
209 * @return bool
210 */
211 function usePatrol() {
212 global $wgUseRCPatrol, $wgUser;
213 return( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) );
214 }
215
216 /**
217 * Returns the string which indicates the number of watching users
218 */
219 function numberofWatchingusers( $count ) {
220 global $wgLang;
221 static $cache = array();
222 if ( $count > 0 ) {
223 if ( !isset( $cache[$count] ) ) {
224 $cache[$count] = wfMsgExt('number_of_watching_users_RCview',
225 array('parsemag', 'escape'), $wgLang->formatNum($count));
226 }
227 return $cache[$count];
228 } else {
229 return '';
230 }
231 }
232 }
233
234
235 /**
236 * Generate a list of changes using the good old system (no javascript)
237 */
238 class OldChangesList extends ChangesList {
239 /**
240 * Format a line using the old system (aka without any javascript).
241 */
242 function recentChangesLine( &$rc, $watched = false ) {
243 global $wgContLang, $wgRCShowChangedSize;
244
245 $fname = 'ChangesList::recentChangesLineOld';
246 wfProfileIn( $fname );
247
248 # Extract DB fields into local scope
249 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
250 extract( $rc->mAttribs );
251
252 # Should patrol-related stuff be shown?
253 $unpatrolled = $this->usePatrol() && $rc_patrolled == 0;
254
255 $this->insertDateHeader($s,$rc_timestamp);
256
257 $s .= '<li>';
258
259 // moved pages
260 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
261 $this->insertMove( $s, $rc );
262 // log entries
263 } elseif ( $rc_namespace == NS_SPECIAL ) {
264 list( $specialName, $specialSubpage ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
265 if ( $specialName == 'Log' ) {
266 $this->insertLog( $s, $rc->getTitle(), $specialSubpage );
267 } else {
268 wfDebug( "Unexpected special page in recentchanges\n" );
269 }
270 // all other stuff
271 } else {
272 wfProfileIn($fname.'-page');
273
274 $this->insertDiffHist($s, $rc, $unpatrolled);
275
276 # M, N, b and ! (minor, new, bot and unpatrolled)
277 $s .= ' ' . $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '', $rc_bot );
278 $this->insertArticleLink($s, $rc, $unpatrolled, $watched);
279
280 wfProfileOut($fname.'-page');
281 }
282
283 wfProfileIn( $fname.'-rest' );
284
285 $this->insertTimestamp($s,$rc);
286
287 if( $wgRCShowChangedSize ) {
288 $s .= ( $rc->getCharacterDifference() == '' ? '' : $rc->getCharacterDifference() . ' . . ' );
289 }
290
291 $this->insertUserRelatedLinks($s,$rc);
292 $this->insertComment($s, $rc);
293
294 $s .= rtrim(' ' . $this->numberofWatchingusers($rc->numberofWatchingusers));
295
296 $s .= "</li>\n";
297
298 wfProfileOut( $fname.'-rest' );
299
300 wfProfileOut( $fname );
301 return $s;
302 }
303 }
304
305
306 /**
307 * Generate a list of changes using an Enhanced system (use javascript).
308 */
309 class EnhancedChangesList extends ChangesList {
310 /**
311 * Format a line for enhanced recentchange (aka with javascript and block of lines).
312 */
313 function recentChangesLine( &$baseRC, $watched = false ) {
314 global $wgLang, $wgContLang;
315
316 # Create a specialised object
317 $rc = RCCacheEntry::newFromParent( $baseRC );
318
319 # Extract fields from DB into the function scope (rc_xxxx variables)
320 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
321 extract( $rc->mAttribs );
322 $curIdEq = 'curid=' . $rc_cur_id;
323
324 # If it's a new day, add the headline and flush the cache
325 $date = $wgLang->date( $rc_timestamp, true);
326 $ret = '';
327 if( $date != $this->lastdate ) {
328 # Process current cache
329 $ret = $this->recentChangesBlock();
330 $this->rc_cache = array();
331 $ret .= "<h4>{$date}</h4>\n";
332 $this->lastdate = $date;
333 }
334
335 # Should patrol-related stuff be shown?
336 if( $this->usePatrol() ) {
337 $rc->unpatrolled = !$rc_patrolled;
338 } else {
339 $rc->unpatrolled = false;
340 }
341
342 # Make article link
343 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
344 $msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
345 $clink = wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
346 $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
347 } elseif( $rc_namespace == NS_SPECIAL ) {
348 list( $specialName, $logtype ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
349 if ( $specialName == 'Log' ) {
350 # Log updates, etc
351 $logname = LogPage::logName( $logtype );
352 $clink = '(' . $this->skin->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
353 } else {
354 wfDebug( "Unexpected special page in recentchanges\n" );
355 $clink = '';
356 }
357 } elseif( $rc->unpatrolled && $rc_type == RC_NEW ) {
358 # Unpatrolled new page, give rc_id in query
359 $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
360 } else {
361 $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '' );
362 }
363
364 $time = $wgContLang->time( $rc_timestamp, true, true );
365 $rc->watched = $watched;
366 $rc->link = $clink;
367 $rc->timestamp = $time;
368 $rc->numberofWatchingusers = $baseRC->numberofWatchingusers;
369
370 # Make "cur" and "diff" links
371 if( $rc->unpatrolled ) {
372 $rcIdQuery = "&rcid={$rc_id}";
373 } else {
374 $rcIdQuery = '';
375 }
376 $querycur = $curIdEq."&diff=0&oldid=$rc_this_oldid";
377 $querydiff = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid$rcIdQuery";
378 $aprops = ' tabindex="'.$baseRC->counter.'"';
379 $curLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['cur'], $querycur, '' ,'', $aprops );
380 if( $rc_type == RC_NEW || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
381 if( $rc_type != RC_NEW ) {
382 $curLink = $this->message['cur'];
383 }
384 $diffLink = $this->message['diff'];
385 } else {
386 $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'], $querydiff, '' ,'', $aprops );
387 }
388
389 # Make "last" link
390 if( $rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
391 $lastLink = $this->message['last'];
392 } else {
393 $lastLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['last'],
394 $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
395 }
396
397 $rc->userlink = $this->skin->userLink( $rc_user, $rc_user_text );
398
399 $rc->lastlink = $lastLink;
400 $rc->curlink = $curLink;
401 $rc->difflink = $diffLink;
402
403 $rc->usertalklink = $this->skin->userToolLinks( $rc_user, $rc_user_text );
404
405 # Put accumulated information into the cache, for later display
406 # Page moves go on their own line
407 $title = $rc->getTitle();
408 $secureName = $title->getPrefixedDBkey();
409 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
410 # Use an @ character to prevent collision with page names
411 $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array($rc);
412 } else {
413 if( !isset ( $this->rc_cache[$secureName] ) ) {
414 $this->rc_cache[$secureName] = array();
415 }
416 array_push( $this->rc_cache[$secureName], $rc );
417 }
418 return $ret;
419 }
420
421 /**
422 * Enhanced RC group
423 */
424 function recentChangesBlockGroup( $block ) {
425 global $wgContLang, $wgRCShowChangedSize;
426 $r = '';
427
428 # Collate list of users
429 $isnew = false;
430 $unpatrolled = false;
431 $userlinks = array();
432 foreach( $block as $rcObj ) {
433 $oldid = $rcObj->mAttribs['rc_last_oldid'];
434 if( $rcObj->mAttribs['rc_new'] ) {
435 $isnew = true;
436 }
437 $u = $rcObj->userlink;
438 if( !isset( $userlinks[$u] ) ) {
439 $userlinks[$u] = 0;
440 }
441 if( $rcObj->unpatrolled ) {
442 $unpatrolled = true;
443 }
444 $bot = $rcObj->mAttribs['rc_bot'];
445 $userlinks[$u]++;
446 }
447
448 # Sort the list and convert to text
449 krsort( $userlinks );
450 asort( $userlinks );
451 $users = array();
452 foreach( $userlinks as $userlink => $count) {
453 $text = $userlink;
454 $text .= $wgContLang->getDirMark();
455 if( $count > 1 ) {
456 $text .= ' ('.$count.'&times;)';
457 }
458 array_push( $users, $text );
459 }
460
461 $users = ' <span class="changedby">['.implode('; ',$users).']</span>';
462
463 # Arrow
464 $rci = 'RCI'.$this->rcCacheIndex;
465 $rcl = 'RCL'.$this->rcCacheIndex;
466 $rcm = 'RCM'.$this->rcCacheIndex;
467 $toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')";
468 $tl = '<span id="'.$rcm.'"><a href="'.$toggleLink.'">' . $this->sideArrow() . '</a></span>';
469 $tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'">' . $this->downArrow() . '</a></span>';
470 $r .= $tl;
471
472 # Main line
473 $r .= '<tt>';
474 $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, '&nbsp;', $bot );
475
476 # Timestamp
477 $r .= ' '.$block[0]->timestamp.' </tt>';
478
479 # Article link
480 $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
481 $r .= $wgContLang->getDirMark();
482
483 $curIdEq = 'curid=' . $block[0]->mAttribs['rc_cur_id'];
484 $currentRevision = $block[0]->mAttribs['rc_this_oldid'];
485 if( $block[0]->mAttribs['rc_type'] != RC_LOG ) {
486 # Changes
487 $r .= ' ('.count($block).' ';
488
489 if( $isnew ) {
490 $r .= $this->message['changes'];
491 } else {
492 $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
493 $this->message['changes'], $curIdEq."&diff=$currentRevision&oldid=$oldid" );
494 }
495
496 $r .= ') . . ';
497
498 # Character difference
499 $chardiff = $rcObj->getCharacterDifference( $block[ count( $block ) - 1 ]->mAttribs['rc_old_len'],
500 $block[0]->mAttribs['rc_new_len'] );
501 if( $chardiff == '' ) {
502 $r .= ' (';
503 } else {
504 $r .= ' ' . $chardiff. ' . . (';
505 }
506
507
508 # History
509 $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
510 $this->message['history'], $curIdEq.'&action=history' );
511 $r .= ')';
512 }
513
514 $r .= $users;
515
516 $r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers);
517 $r .= "<br />\n";
518
519 # Sub-entries
520 $r .= '<div id="'.$rci.'" style="display:none">';
521 foreach( $block as $rcObj ) {
522 # Get rc_xxxx variables
523 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
524 extract( $rcObj->mAttribs );
525
526 $r .= $this->spacerArrow();
527 $r .= '<tt>&nbsp; &nbsp; &nbsp; &nbsp;';
528 $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
529 $r .= '&nbsp;</tt>';
530
531 $o = '';
532 if( $rc_this_oldid != 0 ) {
533 $o = 'oldid='.$rc_this_oldid;
534 }
535 if( $rc_type == RC_LOG ) {
536 $link = $rcObj->timestamp;
537 } else {
538 $link = $this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o );
539 }
540 $link = '<tt>'.$link.'</tt>';
541
542 $r .= $link;
543 $r .= ' (';
544 $r .= $rcObj->curlink;
545 $r .= '; ';
546 $r .= $rcObj->lastlink;
547 $r .= ') . . ';
548
549 # Character diff
550 if( $wgRCShowChangedSize ) {
551 $r .= ( $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ' ) ;
552 }
553
554 $r .= $rcObj->userlink;
555 $r .= $rcObj->usertalklink;
556 $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
557 $r .= "<br />\n";
558 }
559 $r .= "</div>\n";
560
561 $this->rcCacheIndex++;
562 return $r;
563 }
564
565 function maybeWatchedLink( $link, $watched=false ) {
566 if( $watched ) {
567 // FIXME: css style might be more appropriate
568 return '<strong>' . $link . '</strong>';
569 } else {
570 return $link;
571 }
572 }
573
574 /**
575 * Generate HTML for an arrow or placeholder graphic
576 * @param string $dir one of '', 'd', 'l', 'r'
577 * @param string $alt text
578 * @return string HTML <img> tag
579 * @access private
580 */
581 function arrow( $dir, $alt='' ) {
582 global $wgStylePath;
583 $encUrl = htmlspecialchars( $wgStylePath . '/common/images/Arr_' . $dir . '.png' );
584 $encAlt = htmlspecialchars( $alt );
585 return "<img src=\"$encUrl\" width=\"12\" height=\"12\" alt=\"$encAlt\" />";
586 }
587
588 /**
589 * Generate HTML for a right- or left-facing arrow,
590 * depending on language direction.
591 * @return string HTML <img> tag
592 * @access private
593 */
594 function sideArrow() {
595 global $wgContLang;
596 $dir = $wgContLang->isRTL() ? 'l' : 'r';
597 return $this->arrow( $dir, '+' );
598 }
599
600 /**
601 * Generate HTML for a down-facing arrow
602 * depending on language direction.
603 * @return string HTML <img> tag
604 * @access private
605 */
606 function downArrow() {
607 return $this->arrow( 'd', '-' );
608 }
609
610 /**
611 * Generate HTML for a spacer image
612 * @return string HTML <img> tag
613 * @access private
614 */
615 function spacerArrow() {
616 return $this->arrow( '', ' ' );
617 }
618
619 /**
620 * Enhanced RC ungrouped line.
621 * @return string a HTML formated line (generated using $r)
622 */
623 function recentChangesBlockLine( $rcObj ) {
624 global $wgContLang, $wgRCShowChangedSize;
625
626 # Get rc_xxxx variables
627 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
628 extract( $rcObj->mAttribs );
629 $curIdEq = 'curid='.$rc_cur_id;
630
631 $r = '';
632
633 # Spacer image
634 $r .= $this->spacerArrow();
635
636 # Flag and Timestamp
637 $r .= '<tt>';
638
639 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
640 $r .= '&nbsp;&nbsp;&nbsp;';
641 } else {
642 $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
643 }
644 $r .= ' '.$rcObj->timestamp.' </tt>';
645
646 # Article link
647 $r .= $this->maybeWatchedLink( $rcObj->link, $rcObj->watched );
648
649 # Diff
650 $r .= ' ('. $rcObj->difflink .'; ';
651
652 # Hist
653 $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ') . . ';
654
655 # Character diff
656 if( $wgRCShowChangedSize ) {
657 $r .= ( $rcObj->getCharacterDifference() == '' ? '' : '&nbsp;' . $rcObj->getCharacterDifference() . ' . . ' ) ;
658 }
659
660 # User/talk
661 $r .= $rcObj->userlink . $rcObj->usertalklink;
662
663 # Comment
664 if( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
665 $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
666 }
667
668 $r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
669
670 $r .= "<br />\n";
671 return $r;
672 }
673
674 /**
675 * If enhanced RC is in use, this function takes the previously cached
676 * RC lines, arranges them, and outputs the HTML
677 */
678 function recentChangesBlock() {
679 if( count ( $this->rc_cache ) == 0 ) {
680 return '';
681 }
682 $blockOut = '';
683 foreach( $this->rc_cache as $block ) {
684 if( count( $block ) < 2 ) {
685 $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
686 } else {
687 $blockOut .= $this->recentChangesBlockGroup( $block );
688 }
689 }
690
691 return '<div>'.$blockOut.'</div>';
692 }
693
694 /**
695 * Returns text for the end of RC
696 * If enhanced RC is in use, returns pretty much all the text
697 */
698 function endRecentChangesList() {
699 return $this->recentChangesBlock() . parent::endRecentChangesList();
700 }
701
702 }
703 ?>