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