mAttribs = $rc->mAttribs; $rc2->mExtra = $rc->mExtra; return $rc2; } } /** * Class to show various lists of changes: * - what links here * - related changes * - recent changes */ class ChangesList { # Called by history lists and recent changes public $skin; protected $watchlist = false; /** * Changeslist contructor * @param $skin Skin */ public function __construct( $skin ) { $this->skin = $skin; $this->preCacheMessages(); } /** * Fetch an appropriate changes list class for the specified user * Some users might want to use an enhanced list format, for instance * * @param $user User to fetch the list class for * @return ChangesList derivative */ public static function newFromUser( &$user ) { $sk = $user->getSkin(); $list = null; if( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) { return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk ); } else { return $list; } } /** * Sets the list to use a
'.$tl.' '; # Main line $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, ' ', $bot ); # Timestamp $r .= ' '.$block[0]->timestamp.' | '; # Article link if( $namehidden ) { $r .= ' ' . wfMsgHtml( 'rev-deleted-event' ) . ''; } else if( $allLogs ) { $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched ); } else { $this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched ); } $r .= $wgContLang->getDirMark(); $queryParams['curid'] = $curId; # Changes message $n = count($block); static $nchanges = array(); if ( !isset( $nchanges[$n] ) ) { $nchanges[$n] = wfMsgExt( 'nchanges', array( 'parsemag', 'escape' ), $wgLang->formatNum( $n ) ); } # Total change link $r .= ' '; if( !$allLogs ) { $r .= '('; if( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT ) ) { $r .= $nchanges[$n]; } else if( $isnew ) { $r .= $nchanges[$n]; } else { $params = $queryParams; $params['diff'] = $currentRevision; $params['oldid'] = $oldid; $r .= $this->skin->link( $block[0]->getTitle(), $nchanges[$n], array(), $params, array( 'known', 'noclasses' ) ); } } # History if( $allLogs ) { // don't show history link for logs } else if( $namehidden || !$block[0]->getTitle()->exists() ) { $r .= $this->message['pipe-separator'] . $this->message['hist'] . ')'; } else { $params = $queryParams; $params['action'] = 'history'; $r .= $this->message['pipe-separator'] . $this->skin->link( $block[0]->getTitle(), $this->message['hist'], array(), $params, array( 'known', 'noclasses' ) ) . ')'; } $r .= ' . . '; # Character difference (does not apply if only log items) if( $wgRCShowChangedSize && !$allLogs ) { $last = 0; $first = count($block) - 1; # Some events (like logs) have an "empty" size, so we need to skip those... while( $last < $first && $block[$last]->mAttribs['rc_new_len'] === null ) { $last++; } while( $first > $last && $block[$first]->mAttribs['rc_old_len'] === null ) { $first--; } # Get net change $chardiff = $rcObj->getCharacterDifference( $block[$first]->mAttribs['rc_old_len'], $block[$last]->mAttribs['rc_new_len'] ); if( $chardiff == '' ) { $r .= ' '; } else { $r .= ' ' . $chardiff. ' . . '; } } $r .= $users; $r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers); $r .= " |
'.$this->spacerArrow(); $r .= ' | |
'; $r .= $this->spacerIndent() . $this->spacerIndent(); $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot ); $r .= ' | '; $params = $queryParams; if( $rc_this_oldid != 0 ) { $params['oldid'] = $rc_this_oldid; } # Log timestamp if( $rc_type == RC_LOG ) { $link = $rcObj->timestamp; # Revision link } else if( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) { $link = ''.$rcObj->timestamp.' '; } else { if ( $rcObj->unpatrolled && $rc_type == RC_NEW) { $params['rcid'] = $rcObj->mAttribs['rc_id']; } $link = $this->skin->link( $rcObj->getTitle(), $rcObj->timestamp, array(), $params, array( 'known', 'noclasses' ) ); if( $this->isDeleted($rcObj,Revision::DELETED_TEXT) ) $link = ''.$link.' '; } $r .= $link . ''; if ( !$rc_type == RC_LOG || $rc_type == RC_NEW ) { $r .= ' ('; $r .= $rcObj->curlink; $r .= $this->message['pipe-separator']; $r .= $rcObj->lastlink; $r .= ')'; } $r .= ' . . '; # Character diff if( $wgRCShowChangedSize ) { $r .= ( $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ' ) ; } # User links $r .= $rcObj->userlink; $r .= $rcObj->usertalklink; // log action $this->insertAction( $r, $rcObj ); // log comment $this->insertComment( $r, $rcObj ); # Rollback $this->insertRollback( $r, $rcObj ); # Tags $this->insertTags( $r, $rcObj, $classes ); $r .= " |
' . $this->spacerArrow() . ' '; # Flag and Timestamp if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { $r .= ' '; // 4 flags -> 4 spaces } else { $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot ); } $r .= ' '.$rcObj->timestamp.' | '; # Article or log link if( $rc_log_type ) { $logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL ); $logname = LogPage::logName( $rc_log_type ); $r .= '(' . $this->skin->link( $logtitle, $logname, array(), array(), array( 'known', 'noclasses' ) ) . ')'; } else { $this->insertArticleLink( $r, $rcObj, $rcObj->unpatrolled, $rcObj->watched ); } # Diff and hist links if ( $rc_type != RC_LOG ) { $r .= ' ('. $rcObj->difflink . $this->message['pipe-separator']; $query['action'] = 'history'; $r .= $this->skin->link( $rcObj->getTitle(), $this->message['hist'], array(), $query, array( 'known', 'noclasses' ) ) . ')'; } $r .= ' . . '; # Character diff if( $wgRCShowChangedSize && ($cd = $rcObj->getCharacterDifference()) ) { $r .= "$cd . . "; } # User/talk $r .= ' '.$rcObj->userlink . $rcObj->usertalklink; # Log action (if any) if( $rc_log_type ) { if( $this->isDeleted($rcObj,LogPage::DELETED_ACTION) ) { $r .= ' ' . wfMsgHtml('rev-deleted-event') . ''; } else { $r .= ' ' . LogPage::actionText( $rc_log_type, $rc_log_action, $rcObj->getTitle(), $this->skin, LogPage::extractParams($rc_params), true, true ); } } $this->insertComment( $r, $rcObj ); $this->insertRollback( $r, $rcObj ); # Tags $this->insertTags( $r, $rcObj, $classes ); # Show how many people are watching this if enabled $r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers); $r .= " |