skin =& $skin; } /** * Returns the appropiate flags for new page, minor change and patrolling */ function recentChangesFlags( $new, $minor, $patrolled, $nothing = ' ' ) { $f = $new ? '' . htmlspecialchars( wfMsg( 'newpageletter' ) ) . '' : $nothing; $f .= $minor ? '' . htmlspecialchars( wfMsg( 'minoreditletter' ) ) . '' : $nothing; $f .= $patrolled ? '!' : $nothing; return $f; } /** * Returns text for the start of the tabular part of RC */ function beginRecentChangesList() { $this->rc_cache = array() ; $this->rcMoveIndex = 0; $this->rcCacheIndex = 0 ; $this->lastdate = ''; $this->rclistOpen = false; return ''; } /** * Returns text for the end of RC * If enhanced RC is in use, returns pretty much all the text */ function endRecentChangesList() { $s = $this->recentChangesBlock() ; if( $this->rclistOpen ) { $s .= "\n"; } return $s; } /** * Enhanced RC ungrouped line */ function recentChangesBlockLine ( $rcObj ) { global $wgStylePath, $wgContLang ; # Get rc_xxxx variables extract( $rcObj->mAttribs ) ; $curIdEq = 'curid='.$rc_cur_id; # Spacer image $r = '' ; $r .= '' ; $r .= '' ; if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { $r .= '   '; } else { $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled ); } # Timestamp $r .= ' '.$rcObj->timestamp.' ' ; $r .= '' ; # Article link $link = $rcObj->link ; if ( $rcObj->watched ) $link = ''.$link.'' ; $r .= $link ; # Diff $r .= ' (' ; $r .= $rcObj->difflink ; $r .= '; ' ; # Hist $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ); # User/talk $r .= ') . . '.$rcObj->userlink ; $r .= $rcObj->usertalklink ; # Comment if ( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) { $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() ); } if ($rcObj->numberofWatchingusers > 0) { $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rcObj->numberofWatchingusers)); } $r .= "
\n" ; return $r ; } /** * Enhanced RC group */ function recentChangesBlockGroup ( $block ) { global $wgStylePath, $wgContLang ; $r = ''; # Collate list of users $isnew = false ; $unpatrolled = false; $userlinks = array () ; foreach ( $block AS $rcObj ) { $oldid = $rcObj->mAttribs['rc_last_oldid']; $newid = $rcObj->mAttribs['rc_this_oldid']; if ( $rcObj->mAttribs['rc_new'] ) { $isnew = true ; } $u = $rcObj->userlink ; if ( !isset ( $userlinks[$u] ) ) { $userlinks[$u] = 0 ; } if ( $rcObj->unpatrolled ) { $unpatrolled = true; } $userlinks[$u]++ ; } # Sort the list and convert to text krsort ( $userlinks ) ; asort ( $userlinks ) ; $users = array () ; foreach ( $userlinks as $userlink => $count) { $text = $userlink ; if ( $count > 1 ) $text .= " ({$count}×)" ; array_push ( $users , $text ) ; } $users = ' ['.implode('; ',$users).']'; # Arrow $rci = 'RCI'.$this->rcCacheIndex ; $rcl = 'RCL'.$this->rcCacheIndex ; $rcm = 'RCM'.$this->rcCacheIndex ; $toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')" ; $arrowdir = $wgContLang->isRTL() ? 'l' : 'r'; $tl = '+' ; $tl .= '' ; $r .= $tl ; # Main line $r .= '' ; $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled ); # Timestamp $r .= ' '.$block[0]->timestamp.' ' ; $r .= '' ; # Article link $link = $block[0]->link ; if ( $block[0]->watched ) $link = ''.$link.'' ; $r .= $link ; $curIdEq = 'curid=' . $block[0]->mAttribs['rc_cur_id']; $currentRevision = $block[0]->mAttribs['rc_this_oldid']; if ( $block[0]->mAttribs['rc_type'] != RC_LOG ) { # Changes $r .= ' ('.count($block).' ' ; if ( $isnew ) $r .= wfMsg('changes'); else $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle() , wfMsg('changes') , $curIdEq."&diff=$currentRevision&oldid=$oldid" ) ; $r .= '; ' ; # History $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(), wfMsg( 'history' ), $curIdEq.'&action=history' ); $r .= ')' ; } $r .= $users ; if ($block[0]->numberofWatchingusers > 0) { $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($block[0]->numberofWatchingusers)); } $r .= "
\n" ; # Sub-entries $r .= '\n" ; $this->rcCacheIndex++ ; return $r ; } /** * If enhanced RC is in use, this function takes the previously cached * RC lines, arranges them, and outputs the HTML */ function recentChangesBlock () { global $wgStylePath ; if ( count ( $this->rc_cache ) == 0 ) return '' ; $blockOut = ''; foreach ( $this->rc_cache AS $secureName => $block ) { if ( count ( $block ) < 2 ) { $blockOut .= $this->recentChangesBlockLine ( array_shift ( $block ) ) ; } else { $blockOut .= $this->recentChangesBlockGroup ( $block ) ; } } return '
'.$blockOut.'
' ; } /** * Called in a loop over all displayed RC entries * Either returns the line, or caches it for later use */ function recentChangesLine( &$rc, $watched = false ) { global $wgUser; $usenew = $wgUser->getOption( 'usenewrc' ); if ( $usenew ) $line = $this->recentChangesLineNew ( $rc, $watched ) ; else $line = $this->recentChangesLineOld ( $rc, $watched ) ; return $line ; } function recentChangesLineOld( &$rc, $watched = false ) { global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgUseRCPatrol, $wgOnlySysopsCanPatrol, $wgSysopUserBans; $fname = 'Skin::recentChangesLineOld'; wfProfileIn( $fname ); static $message; if( !isset( $message ) ) { foreach( explode(' ', 'diff hist minoreditletter newpageletter blocklink' ) as $msg ) { $message[$msg] = wfMsg( $msg ); } } # Extract DB fields into local scope extract( $rc->mAttribs ); $curIdEq = 'curid=' . $rc_cur_id; # Should patrol-related stuff be shown? $unpatrolled = $wgUseRCPatrol && $wgUser->isLoggedIn() && ( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed('patrol') ) && $rc_patrolled == 0; # Make date header if necessary $date = $wgLang->date( $rc_timestamp, true, true ); $s = ''; if ( $date != $this->lastdate ) { if ( '' != $this->lastdate ) { $s .= "\n"; } $s .= "

{$date}

\n