For the "includes/" directory:
[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
218 /**
219 * Generate a list of changes using the good old system (no javascript)
220 */
221 class OldChangesList extends ChangesList {
222 /**
223 * Format a line using the old system (aka without any javascript).
224 */
225 function recentChangesLine( &$rc, $watched = false ) {
226 global $wgContLang, $wgRCShowChangedSize;
227
228 $fname = 'ChangesList::recentChangesLineOld';
229 wfProfileIn( $fname );
230
231 # Extract DB fields into local scope
232 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
233 extract( $rc->mAttribs );
234
235 # Should patrol-related stuff be shown?
236 $unpatrolled = $this->usePatrol() && $rc_patrolled == 0;
237
238 $this->insertDateHeader($s,$rc_timestamp);
239
240 $s .= '<li>';
241
242 // moved pages
243 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
244 $this->insertMove( $s, $rc );
245 // log entries
246 } elseif ( $rc_namespace == NS_SPECIAL ) {
247 list( $specialName, $specialSubpage ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
248 if ( $specialName == 'Log' ) {
249 $this->insertLog( $s, $rc->getTitle(), $specialSubpage );
250 } else {
251 wfDebug( "Unexpected special page in recentchanges\n" );
252 }
253 // all other stuff
254 } else {
255 wfProfileIn($fname.'-page');
256
257 $this->insertDiffHist($s, $rc, $unpatrolled);
258
259 # M, N, b and ! (minor, new, bot and unpatrolled)
260 $s .= ' ' . $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '', $rc_bot );
261 $this->insertArticleLink($s, $rc, $unpatrolled, $watched);
262
263 wfProfileOut($fname.'-page');
264 }
265
266 wfProfileIn( $fname.'-rest' );
267
268 $this->insertTimestamp($s,$rc);
269
270 if( $wgRCShowChangedSize ) {
271 $s .= ( $rc->getCharacterDifference() == '' ? '' : $rc->getCharacterDifference() . ' . . ' );
272 }
273
274 $this->insertUserRelatedLinks($s,$rc);
275 $this->insertComment($s, $rc);
276
277 if($rc->numberofWatchingusers > 0) {
278 $s .= ' ' . wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rc->numberofWatchingusers));
279 }
280
281 $s .= "</li>\n";
282
283 wfProfileOut( $fname.'-rest' );
284
285 wfProfileOut( $fname );
286 return $s;
287 }
288 }
289
290
291 /**
292 * Generate a list of changes using an Enhanced system (use javascript).
293 */
294 class EnhancedChangesList extends ChangesList {
295 /**
296 * Format a line for enhanced recentchange (aka with javascript and block of lines).
297 */
298 function recentChangesLine( &$baseRC, $watched = false ) {
299 global $wgLang, $wgContLang;
300
301 # Create a specialised object
302 $rc = RCCacheEntry::newFromParent( $baseRC );
303
304 # Extract fields from DB into the function scope (rc_xxxx variables)
305 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
306 extract( $rc->mAttribs );
307 $curIdEq = 'curid=' . $rc_cur_id;
308
309 # If it's a new day, add the headline and flush the cache
310 $date = $wgLang->date( $rc_timestamp, true);
311 $ret = '';
312 if( $date != $this->lastdate ) {
313 # Process current cache
314 $ret = $this->recentChangesBlock();
315 $this->rc_cache = array();
316 $ret .= "<h4>{$date}</h4>\n";
317 $this->lastdate = $date;
318 }
319
320 # Should patrol-related stuff be shown?
321 if( $this->usePatrol() ) {
322 $rc->unpatrolled = !$rc_patrolled;
323 } else {
324 $rc->unpatrolled = false;
325 }
326
327 # Make article link
328 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
329 $msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
330 $clink = wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
331 $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
332 } elseif( $rc_namespace == NS_SPECIAL ) {
333 list( $specialName, $logtype ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
334 if ( $specialName == 'Log' ) {
335 # Log updates, etc
336 $logname = LogPage::logName( $logtype );
337 $clink = '(' . $this->skin->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
338 } else {
339 wfDebug( "Unexpected special page in recentchanges\n" );
340 $clink = '';
341 }
342 } elseif( $rc->unpatrolled && $rc_type == RC_NEW ) {
343 # Unpatrolled new page, give rc_id in query
344 $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
345 } else {
346 $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '' );
347 }
348
349 $time = $wgContLang->time( $rc_timestamp, true, true );
350 $rc->watched = $watched;
351 $rc->link = $clink;
352 $rc->timestamp = $time;
353 $rc->numberofWatchingusers = $baseRC->numberofWatchingusers;
354
355 # Make "cur" and "diff" links
356 if( $rc->unpatrolled ) {
357 $rcIdQuery = "&rcid={$rc_id}";
358 } else {
359 $rcIdQuery = '';
360 }
361 $querycur = $curIdEq."&diff=0&oldid=$rc_this_oldid";
362 $querydiff = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid$rcIdQuery";
363 $aprops = ' tabindex="'.$baseRC->counter.'"';
364 $curLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['cur'], $querycur, '' ,'', $aprops );
365 if( $rc_type == RC_NEW || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
366 if( $rc_type != RC_NEW ) {
367 $curLink = $this->message['cur'];
368 }
369 $diffLink = $this->message['diff'];
370 } else {
371 $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'], $querydiff, '' ,'', $aprops );
372 }
373
374 # Make "last" link
375 if( $rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
376 $lastLink = $this->message['last'];
377 } else {
378 $lastLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['last'],
379 $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
380 }
381
382 $rc->userlink = $this->skin->userLink( $rc_user, $rc_user_text );
383
384 $rc->lastlink = $lastLink;
385 $rc->curlink = $curLink;
386 $rc->difflink = $diffLink;
387
388 $rc->usertalklink = $this->skin->userToolLinks( $rc_user, $rc_user_text );
389
390 # Put accumulated information into the cache, for later display
391 # Page moves go on their own line
392 $title = $rc->getTitle();
393 $secureName = $title->getPrefixedDBkey();
394 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
395 # Use an @ character to prevent collision with page names
396 $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array($rc);
397 } else {
398 if( !isset ( $this->rc_cache[$secureName] ) ) {
399 $this->rc_cache[$secureName] = array();
400 }
401 array_push( $this->rc_cache[$secureName], $rc );
402 }
403 return $ret;
404 }
405
406 /**
407 * Enhanced RC group
408 */
409 function recentChangesBlockGroup( $block ) {
410 global $wgContLang, $wgRCShowChangedSize;
411 $r = '';
412
413 # Collate list of users
414 $isnew = false;
415 $unpatrolled = false;
416 $userlinks = array();
417 foreach( $block as $rcObj ) {
418 $oldid = $rcObj->mAttribs['rc_last_oldid'];
419 if( $rcObj->mAttribs['rc_new'] ) {
420 $isnew = true;
421 }
422 $u = $rcObj->userlink;
423 if( !isset( $userlinks[$u] ) ) {
424 $userlinks[$u] = 0;
425 }
426 if( $rcObj->unpatrolled ) {
427 $unpatrolled = true;
428 }
429 $bot = $rcObj->mAttribs['rc_bot'];
430 $userlinks[$u]++;
431 }
432
433 # Sort the list and convert to text
434 krsort( $userlinks );
435 asort( $userlinks );
436 $users = array();
437 foreach( $userlinks as $userlink => $count) {
438 $text = $userlink;
439 $text .= $wgContLang->getDirMark();
440 if( $count > 1 ) {
441 $text .= ' ('.$count.'&times;)';
442 }
443 array_push( $users, $text );
444 }
445
446 $users = ' <span class="changedby">['.implode('; ',$users).']</span>';
447
448 # Arrow
449 $rci = 'RCI'.$this->rcCacheIndex;
450 $rcl = 'RCL'.$this->rcCacheIndex;
451 $rcm = 'RCM'.$this->rcCacheIndex;
452 $toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')";
453 $tl = '<span id="'.$rcm.'"><a href="'.$toggleLink.'">' . $this->sideArrow() . '</a></span>';
454 $tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'">' . $this->downArrow() . '</a></span>';
455 $r .= $tl;
456
457 # Main line
458 $r .= '<tt>';
459 $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, '&nbsp;', $bot );
460
461 # Timestamp
462 $r .= ' '.$block[0]->timestamp.' </tt>';
463
464 # Article link
465 $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
466 $r .= $wgContLang->getDirMark();
467
468 $curIdEq = 'curid=' . $block[0]->mAttribs['rc_cur_id'];
469 $currentRevision = $block[0]->mAttribs['rc_this_oldid'];
470 if( $block[0]->mAttribs['rc_type'] != RC_LOG ) {
471 # Changes
472 $r .= ' ('.count($block).' ';
473
474 if( $isnew ) {
475 $r .= $this->message['changes'];
476 } else {
477 $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
478 $this->message['changes'], $curIdEq."&diff=$currentRevision&oldid=$oldid" );
479 }
480
481 $r .= ') . . ';
482
483 # Character difference
484 $chardiff = $rcObj->getCharacterDifference( $block[ count( $block ) - 1 ]->mAttribs['rc_old_len'],
485 $block[0]->mAttribs['rc_new_len'] );
486 if( $chardiff == '' ) {
487 $r .= ' (';
488 } else {
489 $r .= ' ' . $chardiff. ' . . (';
490 }
491
492
493 # History
494 $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
495 $this->message['history'], $curIdEq.'&action=history' );
496 $r .= ')';
497 }
498
499 $r .= $users;
500
501 if($block[0]->numberofWatchingusers > 0) {
502 global $wgContLang;
503 $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($block[0]->numberofWatchingusers));
504 }
505 $r .= "<br />\n";
506
507 # Sub-entries
508 $r .= '<div id="'.$rci.'" style="display:none">';
509 foreach( $block as $rcObj ) {
510 # Get rc_xxxx variables
511 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
512 extract( $rcObj->mAttribs );
513
514 $r .= $this->spacerArrow();
515 $r .= '<tt>&nbsp; &nbsp; &nbsp; &nbsp;';
516 $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
517 $r .= '&nbsp;</tt>';
518
519 $o = '';
520 if( $rc_this_oldid != 0 ) {
521 $o = 'oldid='.$rc_this_oldid;
522 }
523 if( $rc_type == RC_LOG ) {
524 $link = $rcObj->timestamp;
525 } else {
526 $link = $this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o );
527 }
528 $link = '<tt>'.$link.'</tt>';
529
530 $r .= $link;
531 $r .= ' (';
532 $r .= $rcObj->curlink;
533 $r .= '; ';
534 $r .= $rcObj->lastlink;
535 $r .= ') . . ';
536
537 # Character diff
538 if( $wgRCShowChangedSize ) {
539 $r .= ( $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ' ) ;
540 }
541
542 $r .= $rcObj->userlink;
543 $r .= $rcObj->usertalklink;
544 $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
545 $r .= "<br />\n";
546 }
547 $r .= "</div>\n";
548
549 $this->rcCacheIndex++;
550 return $r;
551 }
552
553 function maybeWatchedLink( $link, $watched=false ) {
554 if( $watched ) {
555 // FIXME: css style might be more appropriate
556 return '<strong>' . $link . '</strong>';
557 } else {
558 return $link;
559 }
560 }
561
562 /**
563 * Generate HTML for an arrow or placeholder graphic
564 * @param string $dir one of '', 'd', 'l', 'r'
565 * @param string $alt text
566 * @return string HTML <img> tag
567 * @access private
568 */
569 function arrow( $dir, $alt='' ) {
570 global $wgStylePath;
571 $encUrl = htmlspecialchars( $wgStylePath . '/common/images/Arr_' . $dir . '.png' );
572 $encAlt = htmlspecialchars( $alt );
573 return "<img src=\"$encUrl\" width=\"12\" height=\"12\" alt=\"$encAlt\" />";
574 }
575
576 /**
577 * Generate HTML for a right- or left-facing arrow,
578 * depending on language direction.
579 * @return string HTML <img> tag
580 * @access private
581 */
582 function sideArrow() {
583 global $wgContLang;
584 $dir = $wgContLang->isRTL() ? 'l' : 'r';
585 return $this->arrow( $dir, '+' );
586 }
587
588 /**
589 * Generate HTML for a down-facing arrow
590 * depending on language direction.
591 * @return string HTML <img> tag
592 * @access private
593 */
594 function downArrow() {
595 return $this->arrow( 'd', '-' );
596 }
597
598 /**
599 * Generate HTML for a spacer image
600 * @return string HTML <img> tag
601 * @access private
602 */
603 function spacerArrow() {
604 return $this->arrow( '', ' ' );
605 }
606
607 /**
608 * Enhanced RC ungrouped line.
609 * @return string a HTML formated line (generated using $r)
610 */
611 function recentChangesBlockLine( $rcObj ) {
612 global $wgContLang, $wgRCShowChangedSize;
613
614 # Get rc_xxxx variables
615 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
616 extract( $rcObj->mAttribs );
617 $curIdEq = 'curid='.$rc_cur_id;
618
619 $r = '';
620
621 # Spacer image
622 $r .= $this->spacerArrow();
623
624 # Flag and Timestamp
625 $r .= '<tt>';
626
627 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
628 $r .= '&nbsp;&nbsp;&nbsp;';
629 } else {
630 $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
631 }
632 $r .= ' '.$rcObj->timestamp.' </tt>';
633
634 # Article link
635 $r .= $this->maybeWatchedLink( $rcObj->link, $rcObj->watched );
636
637 # Diff
638 $r .= ' ('. $rcObj->difflink .'; ';
639
640 # Hist
641 $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ') . . ';
642
643 # Character diff
644 if( $wgRCShowChangedSize ) {
645 $r .= ( $rcObj->getCharacterDifference() == '' ? '' : '&nbsp;' . $rcObj->getCharacterDifference() . ' . . ' ) ;
646 }
647
648 # User/talk
649 $r .= $rcObj->userlink . $rcObj->usertalklink;
650
651 # Comment
652 if( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
653 $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
654 }
655
656 if( $rcObj->numberofWatchingusers > 0 ) {
657 $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rcObj->numberofWatchingusers));
658 }
659
660 $r .= "<br />\n";
661 return $r;
662 }
663
664 /**
665 * If enhanced RC is in use, this function takes the previously cached
666 * RC lines, arranges them, and outputs the HTML
667 */
668 function recentChangesBlock() {
669 if( count ( $this->rc_cache ) == 0 ) {
670 return '';
671 }
672 $blockOut = '';
673 foreach( $this->rc_cache as $block ) {
674 if( count( $block ) < 2 ) {
675 $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
676 } else {
677 $blockOut .= $this->recentChangesBlockGroup( $block );
678 }
679 }
680
681 return '<div>'.$blockOut.'</div>';
682 }
683
684 /**
685 * Returns text for the end of RC
686 * If enhanced RC is in use, returns pretty much all the text
687 */
688 function endRecentChangesList() {
689 return $this->recentChangesBlock() . parent::endRecentChangesList();
690 }
691
692 }
693 ?>