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