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