Throw an exception for invalid data in expandAttributes() so we get a backtrace and...
[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) $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 if( $wgRCShowChangedSize ) {
501 # Character difference
502 $chardiff = $rcObj->getCharacterDifference( $block[ count( $block ) - 1 ]->mAttribs['rc_old_len'],
503 $block[0]->mAttribs['rc_new_len'] );
504 if( $chardiff == '' ) {
505 $r .= ' (';
506 } else {
507 $r .= ' ' . $chardiff. ' . . ';
508 }
509 }
510
511 # History
512 $r .= '(' . $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
513 $this->message['history'], $curIdEq.'&action=history' );
514 $r .= ')';
515 }
516
517 $r .= $users;
518
519 $r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers);
520 $r .= "<br />\n";
521
522 # Sub-entries
523 $r .= '<div id="'.$rci.'" style="display:none">';
524 foreach( $block as $rcObj ) {
525 # Get rc_xxxx variables
526 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
527 extract( $rcObj->mAttribs );
528
529 $r .= $this->spacerArrow();
530 $r .= '<tt>&nbsp; &nbsp; &nbsp; &nbsp;';
531 $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
532 $r .= '&nbsp;</tt>';
533
534 $o = '';
535 if( $rc_this_oldid != 0 ) {
536 $o = 'oldid='.$rc_this_oldid;
537 }
538 if( $rc_type == RC_LOG ) {
539 $link = $rcObj->timestamp;
540 } else {
541 $link = $this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o );
542 }
543 $link = '<tt>'.$link.'</tt>';
544
545 $r .= $link;
546 $r .= ' (';
547 $r .= $rcObj->curlink;
548 $r .= '; ';
549 $r .= $rcObj->lastlink;
550 $r .= ') . . ';
551
552 # Character diff
553 if( $wgRCShowChangedSize ) {
554 $r .= ( $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ' ) ;
555 }
556
557 $r .= $rcObj->userlink;
558 $r .= $rcObj->usertalklink;
559 $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
560 $r .= "<br />\n";
561 }
562 $r .= "</div>\n";
563
564 $this->rcCacheIndex++;
565 return $r;
566 }
567
568 function maybeWatchedLink( $link, $watched=false ) {
569 if( $watched ) {
570 // FIXME: css style might be more appropriate
571 return '<strong>' . $link . '</strong>';
572 } else {
573 return $link;
574 }
575 }
576
577 /**
578 * Generate HTML for an arrow or placeholder graphic
579 * @param string $dir one of '', 'd', 'l', 'r'
580 * @param string $alt text
581 * @return string HTML <img> tag
582 * @access private
583 */
584 function arrow( $dir, $alt='' ) {
585 global $wgStylePath;
586 $encUrl = htmlspecialchars( $wgStylePath . '/common/images/Arr_' . $dir . '.png' );
587 $encAlt = htmlspecialchars( $alt );
588 return "<img src=\"$encUrl\" width=\"12\" height=\"12\" alt=\"$encAlt\" />";
589 }
590
591 /**
592 * Generate HTML for a right- or left-facing arrow,
593 * depending on language direction.
594 * @return string HTML <img> tag
595 * @access private
596 */
597 function sideArrow() {
598 global $wgContLang;
599 $dir = $wgContLang->isRTL() ? 'l' : 'r';
600 return $this->arrow( $dir, '+' );
601 }
602
603 /**
604 * Generate HTML for a down-facing arrow
605 * depending on language direction.
606 * @return string HTML <img> tag
607 * @access private
608 */
609 function downArrow() {
610 return $this->arrow( 'd', '-' );
611 }
612
613 /**
614 * Generate HTML for a spacer image
615 * @return string HTML <img> tag
616 * @access private
617 */
618 function spacerArrow() {
619 return $this->arrow( '', ' ' );
620 }
621
622 /**
623 * Enhanced RC ungrouped line.
624 * @return string a HTML formated line (generated using $r)
625 */
626 function recentChangesBlockLine( $rcObj ) {
627 global $wgContLang, $wgRCShowChangedSize;
628
629 # Get rc_xxxx variables
630 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
631 extract( $rcObj->mAttribs );
632 $curIdEq = 'curid='.$rc_cur_id;
633
634 $r = '';
635
636 # Spacer image
637 $r .= $this->spacerArrow();
638
639 # Flag and Timestamp
640 $r .= '<tt>';
641
642 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
643 $r .= '&nbsp;&nbsp;&nbsp;';
644 } else {
645 $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
646 }
647 $r .= ' '.$rcObj->timestamp.' </tt>';
648
649 # Article link
650 $r .= $this->maybeWatchedLink( $rcObj->link, $rcObj->watched );
651
652 # Diff
653 $r .= ' ('. $rcObj->difflink .'; ';
654
655 # Hist
656 $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ') . . ';
657
658 # Character diff
659 if( $wgRCShowChangedSize ) {
660 $r .= ( $rcObj->getCharacterDifference() == '' ? '' : '&nbsp;' . $rcObj->getCharacterDifference() . ' . . ' ) ;
661 }
662
663 # User/talk
664 $r .= $rcObj->userlink . $rcObj->usertalklink;
665
666 # Comment
667 if( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
668 $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
669 }
670
671 $r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
672
673 $r .= "<br />\n";
674 return $r;
675 }
676
677 /**
678 * If enhanced RC is in use, this function takes the previously cached
679 * RC lines, arranges them, and outputs the HTML
680 */
681 function recentChangesBlock() {
682 if( count ( $this->rc_cache ) == 0 ) {
683 return '';
684 }
685 $blockOut = '';
686 foreach( $this->rc_cache as $block ) {
687 if( count( $block ) < 2 ) {
688 $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
689 } else {
690 $blockOut .= $this->recentChangesBlockGroup( $block );
691 }
692 }
693
694 return '<div>'.$blockOut.'</div>';
695 }
696
697 /**
698 * Returns text for the end of RC
699 * If enhanced RC is in use, returns pretty much all the text
700 */
701 function endRecentChangesList() {
702 return $this->recentChangesBlock() . parent::endRecentChangesList();
703 }
704
705 }
706