ab0b094d63a97d3a6da807dab7da36cf110f9ac4
[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 * @package MediaWiki
12 */
13 class ChangesList {
14 # Called by history lists and recent changes
15 #
16
17 /** @todo document */
18 function ChangesList( &$skin ) {
19 $this->skin =& $skin;
20 $this->preCacheMessages();
21 }
22
23 /**
24 * As we use the same small set of messages in various methods and that
25 * they are called often, we call them once and save them in $this->message
26 */
27 function preCacheMessages() {
28 // Precache various messages
29 if( !isset( $this->message ) ) {
30 foreach( explode(' ', 'cur diff hist minoreditletter newpageletter last blocklink' ) as $msg ) {
31 $this->message[$msg] = wfMsg( $msg );
32 }
33 }
34 }
35
36
37 /**
38 * Returns the appropiate flags for new page, minor change and patrolling
39 */
40 function recentChangesFlags( $new, $minor, $patrolled, $nothing = '&nbsp;' ) {
41 $f = $new ? '<span class="newpage">' . wfMsgHtml( 'newpageletter' ) . '</span>'
42 : $nothing;
43 $f .= $minor ? '<span class="minor">' . wfMsgHtml( 'minoreditletter' ) . '</span>'
44 : $nothing;
45 $f .= $patrolled ? '<span class="unpatrolled">!</span>' : $nothing;
46 return $f;
47 }
48
49 /**
50 * Returns text for the start of the tabular part of RC
51 */
52 function beginRecentChangesList() {
53 $this->rc_cache = array() ;
54 $this->rcMoveIndex = 0;
55 $this->rcCacheIndex = 0 ;
56 $this->lastdate = '';
57 $this->rclistOpen = false;
58 return '';
59 }
60
61 /**
62 * Returns text for the end of RC
63 * If enhanced RC is in use, returns pretty much all the text
64 */
65 function endRecentChangesList() {
66 $s = $this->recentChangesBlock() ;
67 if( $this->rclistOpen ) {
68 $s .= "</ul>\n";
69 }
70 return $s;
71 }
72
73 /**
74 * Enhanced RC ungrouped line.
75 * @return string a HTML formated line (generated using $r)
76 */
77 function recentChangesBlockLine ( $rcObj ) {
78 global $wgStylePath, $wgContLang ;
79
80 # Get rc_xxxx variables
81 extract( $rcObj->mAttribs ) ;
82 $curIdEq = 'curid='.$rc_cur_id;
83
84 $r = '' ;
85
86 # Spacer image
87 $r .= '<img src="'.$wgStylePath.'/common/images/Arr_.png" width="12" height="12" border="0" />' ;
88
89 # Flag and Timestamp
90 $r .= '<tt>' ;
91
92 if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
93 $r .= '&nbsp;&nbsp;&nbsp;';
94 } else {
95 $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled );
96 }
97 $r .= ' '.$rcObj->timestamp.' </tt>' ;
98
99 # Article link
100 $link = $rcObj->link ;
101 // FIXME: should be handled with a css class
102 if ( $rcObj->watched ) $link = '<strong>'.$link.'</strong>' ;
103 $r .= $link ;
104
105 # Diff
106 $r .= ' ('. $rcObj->difflink .'; ' ;
107
108 # Hist
109 $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' );
110
111 # User/talk
112 $r .= ') . . '.$rcObj->userlink . $rcObj->usertalklink ;
113
114 # Comment
115 if ( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
116 $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
117 }
118
119 if ($rcObj->numberofWatchingusers > 0) {
120 $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rcObj->numberofWatchingusers));
121 }
122
123 $r .= "<br />\n" ;
124 return $r ;
125 }
126
127 /**
128 * If enhanced RC is in use, this function takes the previously cached
129 * RC lines, arranges them, and outputs the HTML
130 */
131 function recentChangesBlock () {
132 global $wgStylePath ;
133 if ( count ( $this->rc_cache ) == 0 ) return '' ;
134 $blockOut = '';
135 foreach ( $this->rc_cache AS $secureName => $block ) {
136 if ( count ( $block ) < 2 ) {
137 $blockOut .= $this->recentChangesBlockLine ( array_shift ( $block ) ) ;
138 } else {
139 $blockOut .= $this->recentChangesBlockGroup ( $block ) ;
140 }
141 }
142
143 return '<div>'.$blockOut.'</div>' ;
144 }
145
146
147 function insertMove(&$s) {
148 # Diff
149 $s .= '(' . $this->message['diff'] . ') (';
150 # Hist
151 $s .= $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), $this->message['hist'], 'action=history' ) .
152 ') . . ';
153
154 # "[[x]] moved to [[y]]"
155 $msg = ( $rc_type == RC_MOVE ) ? '1movedto2' : '1movedto2_redir';
156 $s .= wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
157 $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
158 }
159
160 function insertDateHeader(&$s, $rc_timestamp) {
161 global $wgLang;
162
163 # Make date header if necessary
164 $date = $wgLang->date( $rc_timestamp, true, true );
165 $s = '';
166 if ( $date != $this->lastdate ) {
167 if ( '' != $this->lastdate ) { $s .= "</ul>\n"; }
168 $s .= '<h4>'.$date."</h4>\n<ul class=\"special\">";
169 $this->lastdate = $date;
170 $this->rclistOpen = true;
171 }
172 }
173
174 function insertLog(&$s, $title, $logtype) {
175 $logname = LogPage::logName( $logtype );
176 $s .= '(' . $this->skin->makeKnownLinkObj($title, $logname ) . ')';
177 }
178
179
180 function insertDiffHist(&$s, &$rc, $unpatrolled) {
181 # Diff link
182 if ( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
183 $diffLink = $this->message['diff'];
184 } else {
185 $rcidparam = $unpatrolled ? '&rcid='.$rc->mAttribs['rc_id'] : '';
186 $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'],
187 $curIdEq.'&diff='.$rc->mAttribs['rc_this_oldid'].'&oldid='.$rc->mAttribs['rc_last_oldid'].$rcidparam,
188 '', '', ' tabindex="'.$rc->counter.'"');
189 }
190 $s .= '('.$diffLink.') (';
191
192 # History link
193 $s .= $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['hist'], 'curid='.$this->mAttribs['rc_cur_id'].'&action=history' );
194 $s .= ') . . ';
195 }
196
197 function insertArticleLink(&$s, &$rc, $unpatrolled, $watched) {
198 # Article link
199 # If it's a new article, there is no diff link, but if it hasn't been
200 # patrolled yet, we need to give users a way to do so
201 if ( $unpatrolled && $rc->mAttribs['rc_type'] == RC_NEW ) {
202 $articlelink .= ' '. $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'rcid='.$this->mAttribs['rc_id'] );
203 } else {
204 $articlelink .= ' '. $this->skin->makeKnownLinkObj( $rc->getTitle(), '' );
205 }
206 if($watched) $articlelink = '<strong>'.$articlelink.'</strong>';
207
208 $s .= ' '.$articlelink;
209 }
210
211 function insertTimestamp(&$s, &$rc) {
212 global $wgLang;
213 # Timestamp
214 $s .= '; ' . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
215 }
216
217 /** Insert links to user page, user talk page and eventually a blocking link */
218 function insertUserRelatedLinks(&$s, &$rc) {
219 $this->insertUserLink($s,$rc);
220 $openParenthesis = false;
221
222 global $wgDisableAnonTalk;
223 if(!( 0 == $rc->mAttribs['rc_user'] && $wgDisableAnonTalk)) {
224 $openParenthesis = true;
225 $s .= ' (';
226 $this->insertUserTalkLink($s,$rc);
227 }
228
229 global $wgSysopUserBans, $wgUser;
230 if ( ( $wgSysopUserBans || 0 == $rc->mAttribs['rc_user'] ) && $wgUser->isAllowed('block') ) {
231 $s .= $openParenthesis ? ' | ' : '(';
232 $this->insertUserBlockLink($s,$rc);
233 }
234 $s .= $openParenthesis ? ') ' : '';
235 }
236
237 /** insert a formatted link to the user page */
238 function insertUserLink(&$s, &$rc) {
239 # User link (or contributions for unregistered users)
240 if ( 0 == $rc->mAttribs['rc_user'] ) {
241 $contribsPage =& Title::makeTitle( NS_SPECIAL, 'Contributions' );
242 $userLink = $this->skin->makeKnownLinkObj( $contribsPage,
243 $rc->mAttribs['rc_user_text'], 'target=' . $rc->mAttribs['rc_user_text'] );
244 } else {
245 $userPage =& Title::makeTitle( NS_USER, $rc->mAttribs['rc_user_text'] );
246 $userLink = $this->skin->makeLinkObj( $userPage, htmlspecialchars( $rc->mAttribs['rc_user_text'] ) );
247 }
248 $s .= $userLink;
249 }
250
251 /** insert a formatted link to the user talk page */
252 function insertUserTalkLink(&$s, &$rc) {
253 # User talk link
254 global $wgContLang;
255 $talkname = $wgContLang->getNsText(NS_TALK); # use the shorter name
256 $userTalkPage =& Title::makeTitle( NS_USER_TALK, $rc->mAttribs['rc_user_text'] );
257 $userTalkLink= $this->skin->makeLinkObj( $userTalkPage, htmlspecialchars( $talkname ) );
258 $s .= $userTalkLink;
259 }
260
261 /** insert a formatted link to block an user */
262 function insertUserBlockLink(&$s, &$rc) {
263 # Block link
264 $blockLinkPage = Title::makeTitle( NS_SPECIAL, 'Blockip' );
265 $blockLink = $this->skin->makeKnownLinkObj( $blockLinkPage,
266 htmlspecialchars( $this->message['blocklink'] ), 'ip=' . urlencode( $rc->mAttribs['user_text'] ) );
267 $s .= $blockLink;
268 }
269
270 /** insert a formatted comment */
271 function insertComment(&$s, &$rc) {
272 # Add comment
273 if ( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
274 $s .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
275 }
276 }
277 }
278
279
280 /**
281 * Generate a list of changes using the good old system (no javascript)
282 */
283 class OldChangesList extends ChangesList {
284 /**
285 * Format a line using the old system (aka without any javascript).
286 */
287 function recentChangesLine( &$rc, $watched = false ) {
288 global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgUseRCPatrol,
289 $wgOnlySysopsCanPatrol, $wgSysopUserBans;
290
291 $fname = 'ChangesList::recentChangesLineOld';
292 wfProfileIn( $fname );
293
294
295 # Extract DB fields into local scope
296 extract( $rc->mAttribs );
297 $curIdEq = 'curid=' . $rc_cur_id;
298
299 # Should patrol-related stuff be shown?
300 $unpatrolled = $wgUseRCPatrol && $wgUser->isLoggedIn() &&
301 ( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed('patrol') ) && $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);
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 $wgTitle, $wgLang, $wgContLang, $wgUser,
355 $wgUseRCPatrol, $wgOnlySysopsCanPatrol, $wgSysopUserBans;
356
357 # Create a specialised object
358 $rc = RCCacheEntry::newFromParent( $baseRC ) ;
359
360 # Extract fields from DB into the function scope (rc_xxxx variables)
361 extract( $rc->mAttribs );
362 $curIdEq = 'curid=' . $rc_cur_id;
363
364 # If it's a new day, add the headline and flush the cache
365 $date = $wgLang->date( $rc_timestamp, true);
366 $ret = '';
367 if ( $date != $this->lastdate ) {
368 # Process current cache
369 $ret = $this->recentChangesBlock () ;
370 $this->rc_cache = array() ;
371 $ret .= "<h4>{$date}</h4>\n";
372 $this->lastdate = $date;
373 }
374
375 # Should patrol-related stuff be shown?
376 if ( $wgUseRCPatrol && $wgUser->isLoggedIn() &&
377 ( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed('patrol') )) {
378 $rc->unpatrolled = !$rc_patrolled;
379 } else {
380 $rc->unpatrolled = false;
381 }
382
383 # Make article link
384 if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
385 $msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
386 $clink = wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
387 $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
388 } elseif( $rc_namespace == NS_SPECIAL && preg_match( '!^Log/(.*)$!', $rc_title, $matches ) ) {
389 # Log updates, etc
390 $logtype = $matches[1];
391 $logname = LogPage::logName( $logtype );
392 $clink = '(' . $this->skin->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
393 } elseif ( $rc->unpatrolled && $rc_type == RC_NEW ) {
394 # Unpatrolled new page, give rc_id in query
395 $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
396 } else {
397 $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '' ) ;
398 }
399
400 $time = $wgContLang->time( $rc_timestamp, true, true );
401 $rc->watched = $watched ;
402 $rc->link = $clink ;
403 $rc->timestamp = $time;
404 $rc->numberofWatchingusers = $baseRC->numberofWatchingusers;
405
406 # Make "cur" and "diff" links
407 $titleObj = $rc->getTitle();
408 if ( $rc->unpatrolled ) {
409 $rcIdQuery = "&rcid={$rc_id}";
410 } else {
411 $rcIdQuery = '';
412 }
413 $query = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid";
414 $aprops = ' tabindex="'.$baseRC->counter.'"';
415 $curLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['cur'], $query, '' ,'' , $aprops );
416 if( $rc_type == RC_NEW || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
417 if( $rc_type != RC_NEW ) {
418 $curLink = $this->message['cur'];
419 }
420 $diffLink = $this->message['diff'];
421 } else {
422 $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'], $query . $rcIdQuery, '' ,'' , $aprops );
423 }
424
425 # Make "last" link
426 if ( $rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
427 $lastLink = $this->message['last'];
428 } else {
429 $lastLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['last'],
430 $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
431 }
432
433 # Make user link (or user contributions for unregistered users)
434 if ( $rc_user == 0 ) {
435 $contribsPage =& Title::makeTitle( NS_SPECIAL, 'Contributions' );
436 $userLink = $this->skin->makeKnownLinkObj( $contribsPage,
437 $rc_user_text, 'target=' . $rc_user_text );
438 } else {
439 $userPage =& Title::makeTitle( NS_USER, $rc_user_text );
440 $userLink = $this->skin->makeLinkObj( $userPage, $rc_user_text );
441 }
442
443 $rc->userlink = $userLink;
444 $rc->lastlink = $lastLink;
445 $rc->curlink = $curLink;
446 $rc->difflink = $diffLink;
447
448 # Make user talk link
449 $talkname = $wgContLang->getNsText( NS_TALK ); # use the shorter name
450 $userTalkPage =& Title::makeTitle( NS_USER_TALK, $rc_user_text );
451 $userTalkLink = $this->skin->makeLinkObj( $userTalkPage, $talkname );
452
453 global $wgDisableAnonTalk;
454 if ( ( $wgSysopUserBans || 0 == $rc_user ) && $wgUser->isAllowed('block') ) {
455 $blockPage =& Title::makeTitle( NS_SPECIAL, 'Blockip' );
456 $blockLink = $this->skin->makeKnownLinkObj( $blockPage,
457 $this->message['blocklink'], 'ip='.$rc_user_text );
458 if( $wgDisableAnonTalk )
459 $rc->usertalklink = ' ('.$blockLink.')';
460 else
461 $rc->usertalklink = ' ('.$userTalkLink.' | '.$blockLink.')';
462 } else {
463 if( $wgDisableAnonTalk && ($rc_user == 0) )
464 $rc->usertalklink = '';
465 else
466 $rc->usertalklink = ' ('.$userTalkLink.')';
467 }
468
469 # Put accumulated information into the cache, for later display
470 # Page moves go on their own line
471 $title = $rc->getTitle();
472 $secureName = $title->getPrefixedDBkey();
473 if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
474 # Use an @ character to prevent collision with page names
475 $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array($rc);
476 } else {
477 if ( !isset ( $this->rc_cache[$secureName] ) ) $this->rc_cache[$secureName] = array() ;
478 array_push ( $this->rc_cache[$secureName] , $rc ) ;
479 }
480 return $ret;
481 }
482
483 /**
484 * Enhanced RC group
485 */
486 function recentChangesBlockGroup ( $block ) {
487 global $wgStylePath, $wgContLang ;
488
489 $r = '';
490
491 # Collate list of users
492 $isnew = false ;
493 $unpatrolled = false;
494 $userlinks = array () ;
495 foreach ( $block AS $rcObj ) {
496 $oldid = $rcObj->mAttribs['rc_last_oldid'];
497 $newid = $rcObj->mAttribs['rc_this_oldid'];
498 if ( $rcObj->mAttribs['rc_new'] ) {
499 $isnew = true ;
500 }
501 $u = $rcObj->userlink ;
502 if ( !isset ( $userlinks[$u] ) ) {
503 $userlinks[$u] = 0 ;
504 }
505 if ( $rcObj->unpatrolled ) {
506 $unpatrolled = true;
507 }
508 $userlinks[$u]++ ;
509 }
510
511 # Sort the list and convert to text
512 krsort ( $userlinks ) ;
513 asort ( $userlinks ) ;
514 $users = array () ;
515 foreach ( $userlinks as $userlink => $count) {
516 $text = $userlink;
517 if ( $count > 1 ) $text .= ' ('.$count.'&times;)' ;
518 array_push ( $users , $text ) ;
519 }
520
521 $users = ' <span class="changedby">['.implode('; ',$users).']</span>';
522
523 # Arrow
524 $rci = 'RCI'.$this->rcCacheIndex ;
525 $rcl = 'RCL'.$this->rcCacheIndex ;
526 $rcm = 'RCM'.$this->rcCacheIndex ;
527 $toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')" ;
528 $arrowdir = $wgContLang->isRTL() ? 'l' : 'r';
529 $tl = '<span id="'.$rcm.'"><a href="'.$toggleLink.'"><img src="'.$wgStylePath.'/common/images/Arr_'.$arrowdir.'.png" width="12" height="12" alt="+" /></a></span>' ;
530 $tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'"><img src="'.$wgStylePath.'/common/images/Arr_d.png" width="12" height="12" alt="-" /></a></span>' ;
531 $r .= $tl ;
532
533 # Main line
534 $r .= '<tt>' ;
535 $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled );
536
537 # Timestamp
538 $r .= ' '.$block[0]->timestamp.' ' ;
539 $r .= '</tt>' ;
540
541 # Article link
542 $link = $block[0]->link ;
543 if ( $block[0]->watched ) $link = '<strong>'.$link.'</strong>' ;
544 $r .= $link ;
545
546 $curIdEq = 'curid=' . $block[0]->mAttribs['rc_cur_id'];
547 $currentRevision = $block[0]->mAttribs['rc_this_oldid'];
548 if ( $block[0]->mAttribs['rc_type'] != RC_LOG ) {
549 # Changes
550 $r .= ' ('.count($block).' ' ;
551 if ( $isnew ) $r .= wfMsg('changes');
552 else $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle() , wfMsg('changes') ,
553 $curIdEq."&diff=$currentRevision&oldid=$oldid" ) ;
554 $r .= '; ' ;
555
556 # History
557 $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(), wfMsg( 'history' ), $curIdEq.'&action=history' );
558 $r .= ')' ;
559 }
560
561 $r .= $users ;
562
563 if ($block[0]->numberofWatchingusers > 0) {
564 $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($block[0]->numberofWatchingusers));
565 }
566 $r .= "<br />\n" ;
567
568 # Sub-entries
569 $r .= '<div id="'.$rci.'" style="display:none">' ;
570 foreach ( $block AS $rcObj ) {
571 # Get rc_xxxx variables
572 extract( $rcObj->mAttribs );
573
574 $r .= '<img src="'.$wgStylePath.'/common/images/Arr_.png" width="12" height="12" />';
575 $r .= '<tt>&nbsp; &nbsp; &nbsp; &nbsp;' ;
576 $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled );
577 $r .= '&nbsp;</tt>' ;
578
579 $o = '' ;
580 if ( $rc_last_oldid != 0 ) {
581 $o = 'oldid='.$rc_last_oldid ;
582 }
583 if ( $rc_type == RC_LOG ) {
584 $link = $rcObj->timestamp;
585 } else {
586 $link = $this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp , $curIdEq.'&'.$o );
587 }
588 $link = '<tt>'.$link.'</tt>' ;
589
590 $r .= $link ;
591 $r .= ' (' ;
592 $r .= $rcObj->curlink ;
593 $r .= '; ' ;
594 $r .= $rcObj->lastlink ;
595 $r .= ') . . '.$rcObj->userlink ;
596 $r .= $rcObj->usertalklink ;
597 $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
598 $r .= "<br />\n" ;
599 }
600 $r .= "</div>\n" ;
601
602 $this->rcCacheIndex++ ;
603 return $r ;
604 }
605 }
606 ?>