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