2004-11-25 13:47:17 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
2006-01-05 04:11:27 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @todo document
|
|
|
|
|
|
*/
|
2008-11-28 23:06:25 +00:00
|
|
|
|
class RCCacheEntry extends RecentChange {
|
2006-05-11 22:40:38 +00:00
|
|
|
|
var $secureName, $link;
|
2008-11-28 23:06:25 +00:00
|
|
|
|
var $curlink , $difflink, $lastlink, $usertalklink, $versionlink;
|
2006-05-11 22:40:38 +00:00
|
|
|
|
var $userlink, $timestamp, $watched;
|
2006-01-05 04:11:27 +00:00
|
|
|
|
|
2007-05-20 12:00:13 +00:00
|
|
|
|
static function newFromParent( $rc ) {
|
2006-01-05 04:11:27 +00:00
|
|
|
|
$rc2 = new RCCacheEntry;
|
|
|
|
|
|
$rc2->mAttribs = $rc->mAttribs;
|
|
|
|
|
|
$rc2->mExtra = $rc->mExtra;
|
|
|
|
|
|
return $rc2;
|
|
|
|
|
|
}
|
2008-11-28 23:06:25 +00:00
|
|
|
|
}
|
2006-01-05 04:11:27 +00:00
|
|
|
|
|
2005-01-27 19:51:47 +00:00
|
|
|
|
/**
|
2007-04-04 05:22:37 +00:00
|
|
|
|
* Class to show various lists of changes:
|
|
|
|
|
|
* - what links here
|
|
|
|
|
|
* - related changes
|
|
|
|
|
|
* - recent changes
|
2005-01-27 19:51:47 +00:00
|
|
|
|
*/
|
2004-11-25 13:47:17 +00:00
|
|
|
|
class ChangesList {
|
|
|
|
|
|
# Called by history lists and recent changes
|
2008-11-29 00:17:10 +00:00
|
|
|
|
public $skin;
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2008-04-14 07:45:50 +00:00
|
|
|
|
/**
|
2008-04-04 04:44:22 +00:00
|
|
|
|
* Changeslist contructor
|
|
|
|
|
|
* @param Skin $skin
|
|
|
|
|
|
*/
|
2008-11-28 23:06:25 +00:00
|
|
|
|
public function __construct( &$skin ) {
|
2006-11-08 07:12:03 +00:00
|
|
|
|
$this->skin =& $skin;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$this->preCacheMessages();
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2006-06-21 00:18:55 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 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
|
|
|
|
|
|
*/
|
2006-11-29 05:45:03 +00:00
|
|
|
|
public static function newFromUser( &$user ) {
|
2007-03-14 18:35:23 +00:00
|
|
|
|
$sk = $user->getSkin();
|
2006-06-21 00:18:55 +00:00
|
|
|
|
$list = NULL;
|
2006-11-29 12:06:58 +00:00
|
|
|
|
if( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) {
|
2008-11-29 00:17:10 +00:00
|
|
|
|
return $user->getOption( 'usenewrc' ) ?
|
|
|
|
|
|
new EnhancedChangesList( $sk ) : new OldChangesList( $sk );
|
2005-09-15 00:40:51 +00:00
|
|
|
|
} else {
|
2006-06-21 00:18:55 +00:00
|
|
|
|
return $list;
|
2005-09-15 00:40:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2005-07-01 20:36:04 +00:00
|
|
|
|
|
2005-09-06 22:16:41 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* As we use the same small set of messages in various methods and that
|
|
|
|
|
|
* they are called often, we call them once and save them in $this->message
|
|
|
|
|
|
*/
|
2008-04-04 04:44:22 +00:00
|
|
|
|
private function preCacheMessages() {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
if( !isset( $this->message ) ) {
|
2006-04-27 17:36:51 +00:00
|
|
|
|
foreach( explode(' ', 'cur diff hist minoreditletter newpageletter last '.
|
2007-12-06 09:42:04 +00:00
|
|
|
|
'blocklink history boteditletter semicolon-separator' ) as $msg ) {
|
2008-06-14 10:41:46 +00:00
|
|
|
|
$this->message[$msg] = wfMsgExt( $msg, array( 'escapenoentities' ) );
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-24 15:43:49 +00:00
|
|
|
|
/**
|
2006-06-15 07:29:00 +00:00
|
|
|
|
* Returns the appropriate flags for new page, minor change and patrolling
|
2008-04-04 04:44:22 +00:00
|
|
|
|
* @param bool $new
|
|
|
|
|
|
* @param bool $minor
|
|
|
|
|
|
* @param bool $patrolled
|
|
|
|
|
|
* @param string $nothing, string to use for empty space
|
|
|
|
|
|
* @param bool $bot
|
|
|
|
|
|
* @return string
|
2005-04-24 15:43:49 +00:00
|
|
|
|
*/
|
2008-09-16 05:56:43 +00:00
|
|
|
|
protected function recentChangesFlags( $new, $minor, $patrolled, $nothing = ' ', $bot = false ) {
|
2008-11-28 23:06:25 +00:00
|
|
|
|
$f = $new ?
|
|
|
|
|
|
'<span class="newpage">' . $this->message['newpageletter'] . '</span>' : $nothing;
|
|
|
|
|
|
$f .= $minor ?
|
|
|
|
|
|
'<span class="minor">' . $this->message['minoreditletter'] . '</span>' : $nothing;
|
2006-06-15 07:29:00 +00:00
|
|
|
|
$f .= $bot ? '<span class="bot">' . $this->message['boteditletter'] . '</span>' : $nothing;
|
2005-04-24 15:43:49 +00:00
|
|
|
|
$f .= $patrolled ? '<span class="unpatrolled">!</span>' : $nothing;
|
2008-03-20 02:08:35 +00:00
|
|
|
|
return $f;
|
2005-04-24 15:43:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-07-01 20:36:04 +00:00
|
|
|
|
/**
|
2005-01-27 19:51:47 +00:00
|
|
|
|
* Returns text for the start of the tabular part of RC
|
2008-04-04 04:44:22 +00:00
|
|
|
|
* @return string
|
2005-01-27 19:51:47 +00:00
|
|
|
|
*/
|
2008-04-04 04:44:22 +00:00
|
|
|
|
public function beginRecentChangesList() {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$this->rc_cache = array();
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$this->rcMoveIndex = 0;
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$this->rcCacheIndex = 0;
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$this->lastdate = '';
|
|
|
|
|
|
$this->rclistOpen = false;
|
|
|
|
|
|
return '';
|
|
|
|
|
|
}
|
2008-11-16 23:18:43 +00:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Show formatted char difference
|
|
|
|
|
|
* @param int $old bytes
|
|
|
|
|
|
* @param int $new bytes
|
|
|
|
|
|
* @returns string
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static function showCharacterDifference( $old, $new ) {
|
|
|
|
|
|
global $wgRCChangedSizeThreshold, $wgLang;
|
|
|
|
|
|
$szdiff = $new - $old;
|
2009-01-25 16:34:21 +00:00
|
|
|
|
$formatedSize = wfMsgExt( 'rc-change-size', array( 'parsemag', 'escape' ), $wgLang->formatNum( $szdiff ) );
|
2008-11-16 23:18:43 +00:00
|
|
|
|
if( abs( $szdiff ) > abs( $wgRCChangedSizeThreshold ) ) {
|
|
|
|
|
|
$tag = 'strong';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$tag = 'span';
|
|
|
|
|
|
}
|
|
|
|
|
|
if( $szdiff === 0 ) {
|
|
|
|
|
|
return "<$tag class='mw-plusminus-null'>($formatedSize)</$tag>";
|
|
|
|
|
|
} elseif( $szdiff > 0 ) {
|
|
|
|
|
|
return "<$tag class='mw-plusminus-pos'>(+$formatedSize)</$tag>";
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return "<$tag class='mw-plusminus-neg'>($formatedSize)</$tag>";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Returns text for the end of RC
|
2008-04-04 04:44:22 +00:00
|
|
|
|
* @return string
|
2004-11-25 13:47:17 +00:00
|
|
|
|
*/
|
2008-04-04 04:44:22 +00:00
|
|
|
|
public function endRecentChangesList() {
|
2004-11-25 13:47:17 +00:00
|
|
|
|
if( $this->rclistOpen ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
return "</ul>\n";
|
2004-11-25 13:47:17 +00:00
|
|
|
|
} else {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
return '';
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2005-09-06 20:04:38 +00:00
|
|
|
|
|
2008-04-04 04:44:22 +00:00
|
|
|
|
protected function insertMove( &$s, $rc ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
# Diff
|
2008-11-14 02:21:45 +00:00
|
|
|
|
$s .= '(' . $this->message['diff'] . ') (';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
# Hist
|
2008-12-20 08:25:39 +00:00
|
|
|
|
$s .= $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), $this->message['hist'],
|
|
|
|
|
|
'action=history' ) . ') . . ';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
# "[[x]] moved to [[y]]"
|
2005-11-28 04:32:39 +00:00
|
|
|
|
$msg = ( $rc->mAttribs['rc_type'] == RC_MOVE ) ? '1movedto2' : '1movedto2_redir';
|
2008-06-19 14:19:54 +00:00
|
|
|
|
$s .= wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
|
2006-11-08 07:12:03 +00:00
|
|
|
|
$this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2008-11-28 23:06:25 +00:00
|
|
|
|
protected function insertDateHeader( &$s, $rc_timestamp ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
global $wgLang;
|
|
|
|
|
|
# Make date header if necessary
|
|
|
|
|
|
$date = $wgLang->date( $rc_timestamp, true, true );
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( $date != $this->lastdate ) {
|
|
|
|
|
|
if( '' != $this->lastdate ) {
|
|
|
|
|
|
$s .= "</ul>\n";
|
|
|
|
|
|
}
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$s .= '<h4>'.$date."</h4>\n<ul class=\"special\">";
|
|
|
|
|
|
$this->lastdate = $date;
|
|
|
|
|
|
$this->rclistOpen = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2008-11-28 23:06:25 +00:00
|
|
|
|
protected function insertLog( &$s, $title, $logtype ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$logname = LogPage::logName( $logtype );
|
2008-11-14 02:21:45 +00:00
|
|
|
|
$s .= '(' . $this->skin->makeKnownLinkObj($title, $logname ) . ')';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2008-11-28 23:06:25 +00:00
|
|
|
|
protected function insertDiffHist( &$s, &$rc, $unpatrolled ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
# Diff link
|
2008-12-20 08:25:39 +00:00
|
|
|
|
if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$diffLink = $this->message['diff'];
|
2008-12-20 08:25:39 +00:00
|
|
|
|
} else if( !$this->userCan($rc,Revision::DELETED_TEXT) ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$diffLink = $this->message['diff'];
|
|
|
|
|
|
} else {
|
2008-12-20 08:25:39 +00:00
|
|
|
|
$rcidparam = $unpatrolled ? array( 'rcid' => $rc->mAttribs['rc_id'] ) : array();
|
2006-11-08 07:12:03 +00:00
|
|
|
|
$diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'],
|
2005-09-11 01:55:16 +00:00
|
|
|
|
wfArrayToCGI( array(
|
|
|
|
|
|
'curid' => $rc->mAttribs['rc_cur_id'],
|
|
|
|
|
|
'diff' => $rc->mAttribs['rc_this_oldid'],
|
|
|
|
|
|
'oldid' => $rc->mAttribs['rc_last_oldid'] ),
|
|
|
|
|
|
$rcidparam ),
|
|
|
|
|
|
'', '', ' tabindex="'.$rc->counter.'"');
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2008-11-14 02:21:45 +00:00
|
|
|
|
$s .= '('.$diffLink.') (';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
# History link
|
2006-11-08 07:12:03 +00:00
|
|
|
|
$s .= $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['hist'],
|
2005-09-11 01:55:16 +00:00
|
|
|
|
wfArrayToCGI( array(
|
|
|
|
|
|
'curid' => $rc->mAttribs['rc_cur_id'],
|
|
|
|
|
|
'action' => 'history' ) ) );
|
2008-11-14 02:21:45 +00:00
|
|
|
|
$s .= ') . . ';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2004-12-18 03:47:11 +00:00
|
|
|
|
|
2008-11-28 23:06:25 +00:00
|
|
|
|
protected function insertArticleLink( &$s, &$rc, $unpatrolled, $watched ) {
|
|
|
|
|
|
global $wgContLang;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
# If it's a new article, there is no diff link, but if it hasn't been
|
|
|
|
|
|
# patrolled yet, we need to give users a way to do so
|
2008-11-28 23:06:25 +00:00
|
|
|
|
$params = ( $unpatrolled && $rc->mAttribs['rc_type'] == RC_NEW ) ?
|
|
|
|
|
|
'rcid='.$rc->mAttribs['rc_id'] : '';
|
2008-03-16 18:46:09 +00:00
|
|
|
|
if( $this->isDeleted($rc,Revision::DELETED_TEXT) ) {
|
|
|
|
|
|
$articlelink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
|
|
|
|
|
|
$articlelink = '<span class="history-deleted">'.$articlelink.'</span>';
|
|
|
|
|
|
} else {
|
2008-11-14 02:21:45 +00:00
|
|
|
|
$articlelink = ' '. $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
2008-11-28 23:06:25 +00:00
|
|
|
|
# Bolden pages watched by this user
|
|
|
|
|
|
if( $watched ) {
|
2008-11-14 02:21:45 +00:00
|
|
|
|
$articlelink = "<strong class=\"mw-watched\">{$articlelink}</strong>";
|
2008-11-28 23:06:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
# RTL/LTR marker
|
2006-06-19 19:32:53 +00:00
|
|
|
|
$articlelink .= $wgContLang->getDirMark();
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2008-11-29 00:17:10 +00:00
|
|
|
|
wfRunHooks( 'ChangesListInsertArticleLink',
|
|
|
|
|
|
array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched) );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-11-28 23:06:25 +00:00
|
|
|
|
$s .= " $articlelink";
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2008-11-28 23:06:25 +00:00
|
|
|
|
protected function insertTimestamp( &$s, $rc ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
global $wgLang;
|
2008-12-23 23:59:20 +00:00
|
|
|
|
$s .= $this->message['semicolon-separator'] .
|
|
|
|
|
|
$wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2005-09-06 22:16:41 +00:00
|
|
|
|
/** Insert links to user page, user talk page and eventually a blocking link */
|
2009-01-25 16:34:21 +00:00
|
|
|
|
public function insertUserRelatedLinks( &$s, &$rc ) {
|
|
|
|
|
|
if( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
|
|
|
|
|
|
$s .= ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
|
2008-03-16 18:46:09 +00:00
|
|
|
|
} else {
|
2008-11-14 02:21:45 +00:00
|
|
|
|
$s .= $this->skin->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
|
|
|
|
|
|
$s .= $this->skin->userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** insert a formatted action */
|
2009-01-25 16:34:21 +00:00
|
|
|
|
protected function insertAction( &$s, &$rc ) {
|
2008-03-16 18:46:09 +00:00
|
|
|
|
if( $rc->mAttribs['rc_type'] == RC_LOG ) {
|
2009-01-25 16:34:21 +00:00
|
|
|
|
if( $this->isDeleted( $rc, LogPage::DELETED_ACTION ) ) {
|
|
|
|
|
|
$s .= ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-event' ) . '</span>';
|
2008-03-16 18:46:09 +00:00
|
|
|
|
} else {
|
2008-12-20 08:25:39 +00:00
|
|
|
|
$s .= ' '.LogPage::actionText( $rc->mAttribs['rc_log_type'], $rc->mAttribs['rc_log_action'],
|
2009-01-25 16:34:21 +00:00
|
|
|
|
$rc->getTitle(), $this->skin, LogPage::extractParams( $rc->mAttribs['rc_params'] ), true, true );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
/** insert a formatted comment */
|
2009-01-25 16:34:21 +00:00
|
|
|
|
protected function insertComment( &$s, &$rc ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
|
2009-01-25 16:34:21 +00:00
|
|
|
|
if( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) {
|
|
|
|
|
|
$s .= ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-comment' ) . '</span>';
|
2008-03-16 18:46:09 +00:00
|
|
|
|
} else {
|
|
|
|
|
|
$s .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
|
|
|
|
|
|
}
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-04-13 17:55:10 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Check whether to enable recent changes patrol features
|
|
|
|
|
|
* @return bool
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static function usePatrol() {
|
|
|
|
|
|
global $wgUser;
|
|
|
|
|
|
return $wgUser->useRCPatrol();
|
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2007-01-17 18:13:56 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Returns the string which indicates the number of watching users
|
|
|
|
|
|
*/
|
2008-04-04 04:44:22 +00:00
|
|
|
|
protected function numberofWatchingusers( $count ) {
|
2007-01-17 18:13:56 +00:00
|
|
|
|
global $wgLang;
|
|
|
|
|
|
static $cache = array();
|
2008-12-20 08:25:39 +00:00
|
|
|
|
if( $count > 0 ) {
|
|
|
|
|
|
if( !isset( $cache[$count] ) ) {
|
2009-01-25 16:34:21 +00:00
|
|
|
|
$cache[$count] = wfMsgExt( 'number_of_watching_users_RCview',
|
|
|
|
|
|
array('parsemag', 'escape' ), $wgLang->formatNum( $count ) );
|
2007-01-17 18:13:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
return $cache[$count];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return '';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-04-04 04:44:22 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Determine if said field of a revision is hidden
|
|
|
|
|
|
* @param RCCacheEntry $rc
|
|
|
|
|
|
* @param int $field one of DELETED_* bitfield constants
|
|
|
|
|
|
* @return bool
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static function isDeleted( $rc, $field ) {
|
2009-01-25 16:34:21 +00:00
|
|
|
|
return ( $rc->mAttribs['rc_deleted'] & $field ) == $field;
|
2008-04-04 04:44:22 +00:00
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-04-04 04:44:22 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Determine if the current user is allowed to view a particular
|
|
|
|
|
|
* field of this revision, if it's marked as deleted.
|
|
|
|
|
|
* @param RCCacheEntry $rc
|
|
|
|
|
|
* @param int $field
|
|
|
|
|
|
* @return bool
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static function userCan( $rc, $field ) {
|
|
|
|
|
|
if( ( $rc->mAttribs['rc_deleted'] & $field ) == $field ) {
|
|
|
|
|
|
global $wgUser;
|
|
|
|
|
|
$permission = ( $rc->mAttribs['rc_deleted'] & Revision::DELETED_RESTRICTED ) == Revision::DELETED_RESTRICTED
|
2008-05-25 00:31:28 +00:00
|
|
|
|
? 'suppressrevision'
|
2008-04-04 04:44:22 +00:00
|
|
|
|
: 'deleterevision';
|
2008-12-23 23:59:20 +00:00
|
|
|
|
wfDebug( "Checking for $permission due to $field match on {$rc->mAttribs['rc_deleted']}\n" );
|
2008-04-04 04:44:22 +00:00
|
|
|
|
return $wgUser->isAllowed( $permission );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2008-11-09 21:44:56 +00:00
|
|
|
|
|
|
|
|
|
|
protected function maybeWatchedLink( $link, $watched=false ) {
|
|
|
|
|
|
if( $watched ) {
|
|
|
|
|
|
return '<strong class="mw-watched">' . $link . '</strong>';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return '<span class="mw-rc-unwatched">' . $link . '</span>';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2009-01-20 04:01:59 +00:00
|
|
|
|
|
|
|
|
|
|
/** Inserts a rollback link */
|
|
|
|
|
|
protected function insertRollback( &$s, &$rc ) {
|
|
|
|
|
|
global $wgUser;
|
|
|
|
|
|
if( !$rc->mAttribs['rc_new'] && $rc->mAttribs['rc_this_oldid'] && $wgUser->isAllowed('rollback') ) {
|
|
|
|
|
|
$page = $rc->getTitle();
|
|
|
|
|
|
/** Check for rollback and edit permissions, disallow special pages, and only
|
|
|
|
|
|
* show a link on the top-most revision */
|
|
|
|
|
|
if( $rc->mAttribs['rc_cur_id'] > 0 && $page->userCan('rollback') && $page->userCan('edit')
|
|
|
|
|
|
&& $page->getLatestRevID() == $rc->mAttribs['rc_this_oldid'] )
|
|
|
|
|
|
{
|
|
|
|
|
|
$rev = new Revision( array(
|
|
|
|
|
|
'id' => $rc->mAttribs['rc_this_oldid'],
|
|
|
|
|
|
'user' => $rc->mAttribs['rc_user'],
|
|
|
|
|
|
'user_text' => $rc->mAttribs['rc_user_text']
|
|
|
|
|
|
) );
|
|
|
|
|
|
$s .= ' '.$this->skin->generateRollback( $rev );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2009-01-28 19:08:18 +00:00
|
|
|
|
|
|
|
|
|
|
protected function insertTags( &$s, &$rc, &$classes ) {
|
|
|
|
|
|
list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $rc->mAttribs['ts_tags'], 'changeslist' );
|
|
|
|
|
|
$classes = array_merge( $classes, $newClasses );
|
|
|
|
|
|
$s .= ' ' . $tagSummary;
|
|
|
|
|
|
}
|
2005-09-06 18:43:45 +00:00
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
2005-09-06 18:43:45 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Generate a list of changes using the good old system (no javascript)
|
|
|
|
|
|
*/
|
|
|
|
|
|
class OldChangesList extends ChangesList {
|
2005-09-06 18:14:24 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Format a line using the old system (aka without any javascript).
|
|
|
|
|
|
*/
|
2008-08-19 00:15:05 +00:00
|
|
|
|
public function recentChangesLine( &$rc, $watched = false ) {
|
2009-01-25 16:34:21 +00:00
|
|
|
|
global $wgContLang, $wgLang, $wgRCShowChangedSize, $wgUser;
|
2008-11-29 00:17:10 +00:00
|
|
|
|
wfProfileIn( __METHOD__ );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
# Should patrol-related stuff be shown?
|
2008-12-20 08:25:39 +00:00
|
|
|
|
$unpatrolled = $wgUser->useRCPatrol() && !$rc->mAttribs['rc_patrolled'];
|
2005-07-01 20:36:04 +00:00
|
|
|
|
|
2008-12-20 08:25:39 +00:00
|
|
|
|
$dateheader = ''; // $s now contains only <li>...</li>, for hooks' convenience.
|
|
|
|
|
|
$this->insertDateHeader( $dateheader, $rc->mAttribs['rc_timestamp'] );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2008-09-15 15:51:45 +00:00
|
|
|
|
$s = '';
|
2009-01-28 19:08:18 +00:00
|
|
|
|
$classes = array();
|
2008-03-16 18:46:09 +00:00
|
|
|
|
// Moved pages
|
2008-12-20 08:25:39 +00:00
|
|
|
|
if( $rc->mAttribs['rc_type'] == RC_MOVE || $rc->mAttribs['rc_type'] == RC_MOVE_OVER_REDIRECT ) {
|
2005-11-28 04:32:39 +00:00
|
|
|
|
$this->insertMove( $s, $rc );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
// Log entries
|
2008-12-20 08:25:39 +00:00
|
|
|
|
} elseif( $rc->mAttribs['rc_log_type'] ) {
|
|
|
|
|
|
$logtitle = Title::newFromText( 'Log/'.$rc->mAttribs['rc_log_type'], NS_SPECIAL );
|
|
|
|
|
|
$this->insertLog( $s, $logtitle, $rc->mAttribs['rc_log_type'] );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
// Log entries (old format) or log targets, and special pages
|
2008-12-20 08:25:39 +00:00
|
|
|
|
} elseif( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
|
|
|
|
|
|
list( $name, $subpage ) = SpecialPage::resolveAliasWithSubpage( $rc->mAttribs['rc_title'] );
|
|
|
|
|
|
if( $name == 'Log' ) {
|
|
|
|
|
|
$this->insertLog( $s, $rc->getTitle(), $subpage );
|
2006-10-30 06:25:31 +00:00
|
|
|
|
}
|
2008-04-04 03:56:48 +00:00
|
|
|
|
// Regular entries
|
2007-03-16 16:01:07 +00:00
|
|
|
|
} else {
|
2008-12-20 08:25:39 +00:00
|
|
|
|
$this->insertDiffHist( $s, $rc, $unpatrolled );
|
2006-06-15 07:29:00 +00:00
|
|
|
|
# M, N, b and ! (minor, new, bot and unpatrolled)
|
2008-12-20 08:25:39 +00:00
|
|
|
|
$s .= $this->recentChangesFlags( $rc->mAttribs['rc_new'], $rc->mAttribs['rc_minor'],
|
|
|
|
|
|
$unpatrolled, '', $rc->mAttribs['rc_bot'] );
|
|
|
|
|
|
$this->insertArticleLink( $s, $rc, $unpatrolled, $watched );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2008-12-20 08:25:39 +00:00
|
|
|
|
# Edit/log timestamp
|
|
|
|
|
|
$this->insertTimestamp( $s, $rc );
|
|
|
|
|
|
# Bytes added or removed
|
2008-12-30 18:43:35 +00:00
|
|
|
|
if( $wgRCShowChangedSize ) {
|
|
|
|
|
|
$cd = $rc->getCharacterDifference();
|
|
|
|
|
|
if( $cd != '' ) {
|
|
|
|
|
|
$s .= "$cd . . ";
|
|
|
|
|
|
}
|
2006-12-13 20:08:02 +00:00
|
|
|
|
}
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# User tool links
|
2009-01-20 04:01:59 +00:00
|
|
|
|
$this->insertUserRelatedLinks( $s, $rc );
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# Log action text (if any)
|
2009-01-20 04:01:59 +00:00
|
|
|
|
$this->insertAction( $s, $rc );
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# Edit or log comment
|
2009-01-20 04:01:59 +00:00
|
|
|
|
$this->insertComment( $s, $rc );
|
2009-01-28 19:08:18 +00:00
|
|
|
|
# Tags
|
|
|
|
|
|
$this->insertTags( $s, $rc, $classes );
|
2009-01-20 04:01:59 +00:00
|
|
|
|
# Rollback
|
|
|
|
|
|
$this->insertRollback( $s, $rc );
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# Mark revision as deleted if so
|
2008-12-20 08:25:39 +00:00
|
|
|
|
if( !$rc->mAttribs['rc_log_type'] && $this->isDeleted($rc,Revision::DELETED_TEXT) ) {
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$s .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
|
2008-12-20 08:25:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
# How many users watch this page
|
|
|
|
|
|
if( $rc->numberofWatchingusers > 0 ) {
|
2009-01-25 16:34:21 +00:00
|
|
|
|
$s .= ' ' . wfMsgExt( 'number_of_watching_users_RCview',
|
|
|
|
|
|
array( 'parsemag', 'escape' ), $wgLang->formatNum( $rc->numberofWatchingusers ) );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
2004-12-18 03:47:11 +00:00
|
|
|
|
|
2008-09-15 15:51:45 +00:00
|
|
|
|
wfRunHooks( 'OldChangesListRecentChangesLine', array(&$this, &$s, $rc) );
|
2008-09-03 22:13:03 +00:00
|
|
|
|
|
2008-11-29 00:17:10 +00:00
|
|
|
|
wfProfileOut( __METHOD__ );
|
2009-01-28 19:08:18 +00:00
|
|
|
|
return "$dateheader<li class=\"".implode( ' ', $classes )."\">$s</li>\n";
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2005-09-06 18:43:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
2005-09-06 18:43:45 +00:00
|
|
|
|
/**
|
2008-12-20 08:25:39 +00:00
|
|
|
|
* Generate a list of changes using an Enhanced system (uses javascript).
|
2005-09-06 18:43:45 +00:00
|
|
|
|
*/
|
|
|
|
|
|
class EnhancedChangesList extends ChangesList {
|
2008-10-25 20:57:56 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Add the JavaScript file for enhanced changeslist
|
|
|
|
|
|
* @ return string
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function beginRecentChangesList() {
|
2008-10-28 12:41:51 +00:00
|
|
|
|
global $wgStylePath, $wgJsMimeType, $wgStyleVersion;
|
2008-10-25 20:57:56 +00:00
|
|
|
|
$this->rc_cache = array();
|
|
|
|
|
|
$this->rcMoveIndex = 0;
|
|
|
|
|
|
$this->rcCacheIndex = 0;
|
|
|
|
|
|
$this->lastdate = '';
|
|
|
|
|
|
$this->rclistOpen = false;
|
|
|
|
|
|
$script = Xml::tags( 'script', array(
|
2008-10-28 12:41:51 +00:00
|
|
|
|
'type' => $wgJsMimeType,
|
2008-10-25 20:57:56 +00:00
|
|
|
|
'src' => $wgStylePath . "/common/enhancedchanges.js?$wgStyleVersion" ), '' );
|
|
|
|
|
|
return $script;
|
|
|
|
|
|
}
|
2005-09-06 18:14:24 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Format a line for enhanced recentchange (aka with javascript and block of lines).
|
|
|
|
|
|
*/
|
2008-04-04 05:08:25 +00:00
|
|
|
|
public function recentChangesLine( &$baseRC, $watched = false ) {
|
2008-04-13 17:37:41 +00:00
|
|
|
|
global $wgLang, $wgContLang, $wgUser;
|
2005-07-01 20:36:04 +00:00
|
|
|
|
|
2004-11-25 13:47:17 +00:00
|
|
|
|
# Create a specialised object
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$rc = RCCacheEntry::newFromParent( $baseRC );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
|
|
|
|
|
# Extract fields from DB into the function scope (rc_xxxx variables)
|
2008-12-23 23:59:20 +00:00
|
|
|
|
// FIXME: Would be good to replace this extract() call with something
|
|
|
|
|
|
// that explicitly initializes variables.
|
2004-11-25 13:47:17 +00:00
|
|
|
|
extract( $rc->mAttribs );
|
|
|
|
|
|
$curIdEq = 'curid=' . $rc_cur_id;
|
|
|
|
|
|
|
|
|
|
|
|
# If it's a new day, add the headline and flush the cache
|
2008-12-18 19:45:58 +00:00
|
|
|
|
$date = $wgLang->date( $rc_timestamp, true );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$ret = '';
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( $date != $this->lastdate ) {
|
2004-11-25 13:47:17 +00:00
|
|
|
|
# Process current cache
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$ret = $this->recentChangesBlock();
|
|
|
|
|
|
$this->rc_cache = array();
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$ret .= "<h4>{$date}</h4>\n";
|
|
|
|
|
|
$this->lastdate = $date;
|
|
|
|
|
|
}
|
2005-07-01 20:36:04 +00:00
|
|
|
|
|
2004-11-25 13:47:17 +00:00
|
|
|
|
# Should patrol-related stuff be shown?
|
2008-04-13 17:46:00 +00:00
|
|
|
|
if( $wgUser->useRCPatrol() ) {
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$rc->unpatrolled = !$rc_patrolled;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$rc->unpatrolled = false;
|
|
|
|
|
|
}
|
2005-07-01 20:36:04 +00:00
|
|
|
|
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$showdifflinks = true;
|
2004-11-25 13:47:17 +00:00
|
|
|
|
# Make article link
|
2008-03-18 18:58:03 +00:00
|
|
|
|
// Page moves
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
|
2006-11-08 07:12:03 +00:00
|
|
|
|
$clink = wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
|
|
|
|
|
|
$this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
|
2008-04-04 03:56:48 +00:00
|
|
|
|
// New unpatrolled pages
|
2008-03-16 18:46:09 +00:00
|
|
|
|
} else if( $rc->unpatrolled && $rc_type == RC_NEW ) {
|
2006-11-08 07:12:03 +00:00
|
|
|
|
$clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
|
2008-04-12 03:23:02 +00:00
|
|
|
|
// Log entries
|
|
|
|
|
|
} else if( $rc_type == RC_LOG ) {
|
2008-04-15 21:39:33 +00:00
|
|
|
|
if( $rc_log_type ) {
|
2008-04-15 03:55:16 +00:00
|
|
|
|
$logtitle = SpecialPage::getTitleFor( 'Log', $rc_log_type );
|
2008-12-23 23:59:20 +00:00
|
|
|
|
$clink = '(' . $this->skin->makeKnownLinkObj( $logtitle,
|
|
|
|
|
|
LogPage::logName($rc_log_type) ) . ')';
|
2008-04-15 03:55:16 +00:00
|
|
|
|
} else {
|
|
|
|
|
|
$clink = $this->skin->makeLinkObj( $rc->getTitle(), '' );
|
|
|
|
|
|
}
|
|
|
|
|
|
$watched = false;
|
2008-12-18 19:45:58 +00:00
|
|
|
|
// Log entries (old format) and special pages
|
|
|
|
|
|
} elseif( $rc_namespace == NS_SPECIAL ) {
|
|
|
|
|
|
list( $specialName, $logtype ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
|
|
|
|
|
|
if ( $specialName == 'Log' ) {
|
|
|
|
|
|
# Log updates, etc
|
|
|
|
|
|
$logname = LogPage::logName( $logtype );
|
|
|
|
|
|
$clink = '(' . $this->skin->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
wfDebug( "Unexpected special page in recentchanges\n" );
|
|
|
|
|
|
$clink = '';
|
|
|
|
|
|
}
|
2008-04-12 03:23:02 +00:00
|
|
|
|
// Edits
|
2004-11-25 13:47:17 +00:00
|
|
|
|
} else {
|
2006-11-08 07:12:03 +00:00
|
|
|
|
$clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '' );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# Don't show unusable diff links
|
|
|
|
|
|
if ( !ChangesList::userCan($rc,Revision::DELETED_TEXT) ) {
|
|
|
|
|
|
$showdifflinks = false;
|
|
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2006-12-14 22:30:42 +00:00
|
|
|
|
$time = $wgContLang->time( $rc_timestamp, true, true );
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$rc->watched = $watched;
|
|
|
|
|
|
$rc->link = $clink;
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$rc->timestamp = $time;
|
2004-12-18 03:47:11 +00:00
|
|
|
|
$rc->numberofWatchingusers = $baseRC->numberofWatchingusers;
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
|
|
|
|
|
# Make "cur" and "diff" links
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( $rc->unpatrolled ) {
|
2004-11-29 04:00:05 +00:00
|
|
|
|
$rcIdQuery = "&rcid={$rc_id}";
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$rcIdQuery = '';
|
|
|
|
|
|
}
|
2005-11-23 18:44:32 +00:00
|
|
|
|
$querycur = $curIdEq."&diff=0&oldid=$rc_this_oldid";
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$querydiff = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid$rcIdQuery";
|
2005-07-24 00:38:44 +00:00
|
|
|
|
$aprops = ' tabindex="'.$baseRC->counter.'"';
|
2008-12-23 23:59:20 +00:00
|
|
|
|
$curLink = $this->skin->makeKnownLinkObj( $rc->getTitle(),
|
|
|
|
|
|
$this->message['cur'], $querycur, '' ,'', $aprops );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-03-16 18:46:09 +00:00
|
|
|
|
# Make "diff" an "cur" links
|
2008-04-04 03:56:48 +00:00
|
|
|
|
if( !$showdifflinks ) {
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$curLink = $this->message['cur'];
|
|
|
|
|
|
$diffLink = $this->message['diff'];
|
2009-01-09 23:18:47 +00:00
|
|
|
|
} else if( in_array( $rc_type, array(RC_NEW,RC_LOG,RC_MOVE,RC_MOVE_OVER_REDIRECT) ) ) {
|
|
|
|
|
|
$curLink = ($rc_type != RC_NEW) ? $this->message['cur'] : $curLink;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$diffLink = $this->message['diff'];
|
2004-11-25 13:47:17 +00:00
|
|
|
|
} else {
|
2008-12-23 23:59:20 +00:00
|
|
|
|
$diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'],
|
|
|
|
|
|
$querydiff, '' ,'', $aprops );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2004-11-25 13:47:17 +00:00
|
|
|
|
# Make "last" link
|
2009-01-09 23:18:47 +00:00
|
|
|
|
if( !$showdifflinks || !$rc_last_oldid ) {
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$lastLink = $this->message['last'];
|
2009-01-09 23:18:47 +00:00
|
|
|
|
} else if( $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$lastLink = $this->message['last'];
|
2004-11-25 13:47:17 +00:00
|
|
|
|
} else {
|
2006-11-08 07:12:03 +00:00
|
|
|
|
$lastLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['last'],
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
|
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-03-16 18:46:09 +00:00
|
|
|
|
# Make user links
|
2008-04-04 03:56:48 +00:00
|
|
|
|
if( $this->isDeleted($rc,Revision::DELETED_USER) ) {
|
2009-01-25 16:34:21 +00:00
|
|
|
|
$rc->userlink = ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
|
2008-03-16 18:46:09 +00:00
|
|
|
|
} else {
|
|
|
|
|
|
$rc->userlink = $this->skin->userLink( $rc_user, $rc_user_text );
|
|
|
|
|
|
$rc->usertalklink = $this->skin->userToolLinks( $rc_user, $rc_user_text );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2007-10-01 19:50:25 +00:00
|
|
|
|
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$rc->lastlink = $lastLink;
|
|
|
|
|
|
$rc->curlink = $curLink;
|
|
|
|
|
|
$rc->difflink = $diffLink;
|
|
|
|
|
|
|
|
|
|
|
|
# Put accumulated information into the cache, for later display
|
|
|
|
|
|
# Page moves go on their own line
|
|
|
|
|
|
$title = $rc->getTitle();
|
|
|
|
|
|
$secureName = $title->getPrefixedDBkey();
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
|
2004-11-25 13:47:17 +00:00
|
|
|
|
# Use an @ character to prevent collision with page names
|
|
|
|
|
|
$this->rc_cache['@@' . ($this->rcMoveIndex++)] = array($rc);
|
|
|
|
|
|
} else {
|
2008-04-15 21:39:33 +00:00
|
|
|
|
# Logs are grouped by type
|
|
|
|
|
|
if( $rc_type == RC_LOG ){
|
2008-04-09 09:20:55 +00:00
|
|
|
|
$secureName = SpecialPage::getTitleFor( 'Log', $rc_log_type )->getPrefixedDBkey();
|
|
|
|
|
|
}
|
2008-04-04 03:56:48 +00:00
|
|
|
|
if( !isset( $this->rc_cache[$secureName] ) ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$this->rc_cache[$secureName] = array();
|
|
|
|
|
|
}
|
|
|
|
|
|
array_push( $this->rc_cache[$secureName], $rc );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
return $ret;
|
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2005-09-06 22:16:41 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Enhanced RC group
|
|
|
|
|
|
*/
|
2008-04-04 13:16:58 +00:00
|
|
|
|
protected function recentChangesBlockGroup( $block ) {
|
2007-02-28 18:11:09 +00:00
|
|
|
|
global $wgLang, $wgContLang, $wgRCShowChangedSize;
|
2008-03-20 22:51:09 +00:00
|
|
|
|
$r = '<table cellpadding="0" cellspacing="0" border="0" style="background: none"><tr>';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
|
|
|
|
|
# Collate list of users
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$userlinks = array();
|
|
|
|
|
|
# Other properties
|
2008-09-16 05:56:43 +00:00
|
|
|
|
$unpatrolled = false;
|
|
|
|
|
|
$isnew = false;
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$curId = $currentRevision = 0;
|
|
|
|
|
|
# Some catalyst variables...
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$namehidden = true;
|
2008-12-11 21:34:15 +00:00
|
|
|
|
$allLogs = true;
|
2005-12-16 23:56:44 +00:00
|
|
|
|
foreach( $block as $rcObj ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$oldid = $rcObj->mAttribs['rc_last_oldid'];
|
2008-09-16 05:56:43 +00:00
|
|
|
|
if( $rcObj->mAttribs['rc_new'] ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$isnew = true;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2008-03-16 18:46:09 +00:00
|
|
|
|
// If all log actions to this page were hidden, then don't
|
|
|
|
|
|
// give the name of the affected page for this block!
|
2008-04-04 03:56:48 +00:00
|
|
|
|
if( !$this->isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$namehidden = false;
|
|
|
|
|
|
}
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$u = $rcObj->userlink;
|
|
|
|
|
|
if( !isset( $userlinks[$u] ) ) {
|
|
|
|
|
|
$userlinks[$u] = 0;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( $rcObj->unpatrolled ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$unpatrolled = true;
|
|
|
|
|
|
}
|
2008-04-01 22:41:19 +00:00
|
|
|
|
if( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
|
2008-12-11 21:34:15 +00:00
|
|
|
|
$allLogs = false;
|
2008-04-01 22:41:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
# Get the latest entry with a page_id and oldid
|
|
|
|
|
|
# since logs may not have these.
|
|
|
|
|
|
if( !$curId && $rcObj->mAttribs['rc_cur_id'] ) {
|
|
|
|
|
|
$curId = $rcObj->mAttribs['rc_cur_id'];
|
|
|
|
|
|
}
|
|
|
|
|
|
if( !$currentRevision && $rcObj->mAttribs['rc_this_oldid'] ) {
|
|
|
|
|
|
$currentRevision = $rcObj->mAttribs['rc_this_oldid'];
|
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2006-06-15 07:29:00 +00:00
|
|
|
|
$bot = $rcObj->mAttribs['rc_bot'];
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$userlinks[$u]++;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Sort the list and convert to text
|
2005-12-16 23:56:44 +00:00
|
|
|
|
krsort( $userlinks );
|
|
|
|
|
|
asort( $userlinks );
|
|
|
|
|
|
$users = array();
|
|
|
|
|
|
foreach( $userlinks as $userlink => $count) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$text = $userlink;
|
2006-09-13 10:29:56 +00:00
|
|
|
|
$text .= $wgContLang->getDirMark();
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( $count > 1 ) {
|
2008-08-12 13:19:28 +00:00
|
|
|
|
$text .= ' (' . $wgLang->formatNum( $count ) . '×)';
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
array_push( $users, $text );
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2008-12-23 23:59:20 +00:00
|
|
|
|
$users = ' <span class="changedby">[' .
|
|
|
|
|
|
implode( $this->message['semicolon-separator'], $users ) . ']</span>';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
2008-10-25 20:57:56 +00:00
|
|
|
|
# ID for JS visibility toggle
|
|
|
|
|
|
$jsid = $this->rcCacheIndex;
|
|
|
|
|
|
# onclick handler to toggle hidden/expanded
|
|
|
|
|
|
$toggleLink = "onclick='toggleVisibility($jsid); return false'";
|
|
|
|
|
|
# Title for <a> tags
|
2009-01-25 16:34:21 +00:00
|
|
|
|
$expandTitle = htmlspecialchars( wfMsg( 'rc-enhanced-expand' ) );
|
|
|
|
|
|
$closeTitle = htmlspecialchars( wfMsg( 'rc-enhanced-hide' ) );
|
2008-10-25 20:57:56 +00:00
|
|
|
|
|
2009-01-09 23:18:47 +00:00
|
|
|
|
$tl = "<span id='mw-rc-openarrow-$jsid' class='mw-changeslist-expanded' style='visibility:hidden'><a href='#' $toggleLink title='$expandTitle'>" . $this->sideArrow() . "</a></span>";
|
2008-10-25 20:57:56 +00:00
|
|
|
|
$tl .= "<span id='mw-rc-closearrow-$jsid' class='mw-changeslist-hidden' style='display:none'><a href='#' $toggleLink title='$closeTitle'>" . $this->downArrow() . "</a></span>";
|
2008-03-20 18:58:38 +00:00
|
|
|
|
$r .= '<td valign="top" style="white-space: nowrap"><tt>'.$tl.' ';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
|
|
|
|
|
# Main line
|
2008-09-16 05:56:43 +00:00
|
|
|
|
$r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, ' ', $bot );
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
|
|
|
|
|
# Timestamp
|
2008-03-20 02:08:35 +00:00
|
|
|
|
$r .= ' '.$block[0]->timestamp.' </tt></td><td>';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
|
|
|
|
|
# Article link
|
2008-04-12 03:23:02 +00:00
|
|
|
|
if( $namehidden ) {
|
2009-01-25 16:34:21 +00:00
|
|
|
|
$r .= ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-event' ) . '</span>';
|
2008-12-11 21:34:15 +00:00
|
|
|
|
} else if( $allLogs ) {
|
|
|
|
|
|
$r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
|
2008-04-01 22:41:19 +00:00
|
|
|
|
} else {
|
2008-11-29 00:17:10 +00:00
|
|
|
|
$this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched );
|
2008-04-01 22:41:19 +00:00
|
|
|
|
}
|
2007-02-28 18:11:09 +00:00
|
|
|
|
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$r .= $wgContLang->getDirMark();
|
2006-12-13 20:08:02 +00:00
|
|
|
|
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$curIdEq = 'curid=' . $curId;
|
|
|
|
|
|
# Changes message
|
|
|
|
|
|
$n = count($block);
|
|
|
|
|
|
static $nchanges = array();
|
|
|
|
|
|
if ( !isset( $nchanges[$n] ) ) {
|
2008-04-09 09:20:55 +00:00
|
|
|
|
$nchanges[$n] = wfMsgExt( 'nchanges', array( 'parsemag', 'escape' ), $wgLang->formatNum( $n ) );
|
2008-04-01 22:41:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
# Total change link
|
|
|
|
|
|
$r .= ' ';
|
2008-12-11 21:34:15 +00:00
|
|
|
|
if( !$allLogs ) {
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$r .= '(';
|
2009-01-25 16:34:21 +00:00
|
|
|
|
if( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT ) ) {
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$r .= $nchanges[$n];
|
2008-03-16 18:46:09 +00:00
|
|
|
|
} else if( $isnew ) {
|
2007-02-28 18:11:09 +00:00
|
|
|
|
$r .= $nchanges[$n];
|
2005-12-16 23:56:44 +00:00
|
|
|
|
} else {
|
2006-11-08 07:12:03 +00:00
|
|
|
|
$r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
|
2007-02-28 18:11:09 +00:00
|
|
|
|
$nchanges[$n], $curIdEq."&diff=$currentRevision&oldid=$oldid" );
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
2008-04-01 22:41:19 +00:00
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-11-18 12:54:53 +00:00
|
|
|
|
# History
|
2008-12-11 21:34:15 +00:00
|
|
|
|
if( $allLogs ) {
|
2008-11-18 12:54:53 +00:00
|
|
|
|
// don't show history link for logs
|
|
|
|
|
|
} else if( $namehidden || !$block[0]->getTitle()->exists() ) {
|
|
|
|
|
|
$r .= $this->message['semicolon-separator'] . $this->message['hist'] . ')';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$r .= $this->message['semicolon-separator'] . $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
|
|
|
|
|
|
$this->message['hist'], $curIdEq . '&action=history' ) . ')';
|
|
|
|
|
|
}
|
|
|
|
|
|
$r .= ' . . ';
|
|
|
|
|
|
|
2008-04-01 22:41:19 +00:00
|
|
|
|
# Character difference (does not apply if only log items)
|
2008-12-11 21:34:15 +00:00
|
|
|
|
if( $wgRCShowChangedSize && !$allLogs ) {
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$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'] );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-04-01 22:41:19 +00:00
|
|
|
|
if( $chardiff == '' ) {
|
|
|
|
|
|
$r .= ' ';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$r .= ' ' . $chardiff. ' . . ';
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$r .= $users;
|
2008-04-15 03:55:16 +00:00
|
|
|
|
$r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers);
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$r .= "</td></tr></table>\n";
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
|
|
|
|
|
# Sub-entries
|
2008-11-29 00:17:10 +00:00
|
|
|
|
$r .= '<div id="mw-rc-subentries-'.$jsid.'" class="mw-changeslist-hidden">';
|
|
|
|
|
|
$r .= '<table cellpadding="0" cellspacing="0" border="0" style="background: none">';
|
2005-12-16 23:56:44 +00:00
|
|
|
|
foreach( $block as $rcObj ) {
|
2008-12-23 23:59:20 +00:00
|
|
|
|
# Extract fields from DB into the function scope (rc_xxxx variables)
|
|
|
|
|
|
// FIXME: Would be good to replace this extract() call with something
|
|
|
|
|
|
// that explicitly initializes variables.
|
2005-09-06 22:16:41 +00:00
|
|
|
|
extract( $rcObj->mAttribs );
|
|
|
|
|
|
|
2008-03-16 18:46:09 +00:00
|
|
|
|
#$r .= '<tr><td valign="top">'.$this->spacerArrow();
|
2008-03-20 02:08:35 +00:00
|
|
|
|
$r .= '<tr><td valign="top">';
|
|
|
|
|
|
$r .= '<tt>'.$this->spacerIndent() . $this->spacerIndent();
|
2008-09-16 05:56:43 +00:00
|
|
|
|
$r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot );
|
2008-03-20 02:08:35 +00:00
|
|
|
|
$r .= ' </tt></td><td valign="top">';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$o = '';
|
|
|
|
|
|
if( $rc_this_oldid != 0 ) {
|
|
|
|
|
|
$o = 'oldid='.$rc_this_oldid;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2008-04-21 03:20:08 +00:00
|
|
|
|
# Log timestamp
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( $rc_type == RC_LOG ) {
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$link = '<tt>'.$rcObj->timestamp.'</tt> ';
|
2008-04-21 03:20:08 +00:00
|
|
|
|
# Revision link
|
2008-03-16 18:46:09 +00:00
|
|
|
|
} else if( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) {
|
|
|
|
|
|
$link = '<span class="history-deleted"><tt>'.$rcObj->timestamp.'</tt></span> ';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
} else {
|
2008-11-29 00:17:10 +00:00
|
|
|
|
$rcIdEq = ($rcObj->unpatrolled && $rc_type == RC_NEW) ?
|
|
|
|
|
|
'&rcid='.$rcObj->mAttribs['rc_id'] : '';
|
|
|
|
|
|
$link = '<tt>'.$this->skin->makeKnownLinkObj( $rcObj->getTitle(),
|
|
|
|
|
|
$rcObj->timestamp, $curIdEq.'&'.$o.$rcIdEq ).'</tt>';
|
2008-03-16 18:46:09 +00:00
|
|
|
|
if( $this->isDeleted($rcObj,Revision::DELETED_TEXT) )
|
|
|
|
|
|
$link = '<span class="history-deleted">'.$link.'</span> ';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$r .= $link;
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-04-09 09:20:55 +00:00
|
|
|
|
if ( !$rc_type == RC_LOG || $rc_type == RC_NEW ) {
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$r .= ' (';
|
|
|
|
|
|
$r .= $rcObj->curlink;
|
2008-08-07 12:19:22 +00:00
|
|
|
|
$r .= $this->message['semicolon-separator'];
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$r .= $rcObj->lastlink;
|
|
|
|
|
|
$r .= ')';
|
|
|
|
|
|
}
|
|
|
|
|
|
$r .= ' . . ';
|
2006-12-13 20:08:02 +00:00
|
|
|
|
|
|
|
|
|
|
# Character diff
|
|
|
|
|
|
if( $wgRCShowChangedSize ) {
|
|
|
|
|
|
$r .= ( $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ' ) ;
|
|
|
|
|
|
}
|
2008-03-16 18:46:09 +00:00
|
|
|
|
# User links
|
2006-12-13 20:08:02 +00:00
|
|
|
|
$r .= $rcObj->userlink;
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$r .= $rcObj->usertalklink;
|
2008-03-16 18:46:09 +00:00
|
|
|
|
// log action
|
2009-01-20 04:01:59 +00:00
|
|
|
|
$this->insertAction( $r, $rcObj );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
// log comment
|
2009-01-20 04:01:59 +00:00
|
|
|
|
$this->insertComment( $r, $rcObj );
|
|
|
|
|
|
# Rollback
|
|
|
|
|
|
$this->insertRollback( $r, $rcObj );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
# Mark revision as deleted
|
2008-04-04 04:44:22 +00:00
|
|
|
|
if( !$rc_log_type && $this->isDeleted($rcObj,Revision::DELETED_TEXT) ) {
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$r .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
|
2008-04-04 04:44:22 +00:00
|
|
|
|
}
|
2008-03-16 18:46:09 +00:00
|
|
|
|
|
|
|
|
|
|
$r .= "</td></tr>\n";
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$r .= "</table></div>\n";
|
2005-09-06 18:43:45 +00:00
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$this->rcCacheIndex++;
|
|
|
|
|
|
return $r;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Generate HTML for an arrow or placeholder graphic
|
|
|
|
|
|
* @param string $dir one of '', 'd', 'l', 'r'
|
|
|
|
|
|
* @param string $alt text
|
2008-10-26 02:41:43 +00:00
|
|
|
|
* @param string $title text
|
2005-12-16 23:56:44 +00:00
|
|
|
|
* @return string HTML <img> tag
|
|
|
|
|
|
*/
|
2008-10-26 02:41:43 +00:00
|
|
|
|
protected function arrow( $dir, $alt='', $title='' ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
global $wgStylePath;
|
|
|
|
|
|
$encUrl = htmlspecialchars( $wgStylePath . '/common/images/Arr_' . $dir . '.png' );
|
2008-10-26 02:41:43 +00:00
|
|
|
|
$encAlt = htmlspecialchars( $alt );
|
|
|
|
|
|
$encTitle = htmlspecialchars( $title );
|
|
|
|
|
|
return "<img src=\"$encUrl\" width=\"12\" height=\"12\" alt=\"$encAlt\" title=\"$encTitle\" />";
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Generate HTML for a right- or left-facing arrow,
|
|
|
|
|
|
* depending on language direction.
|
|
|
|
|
|
* @return string HTML <img> tag
|
|
|
|
|
|
*/
|
2008-04-04 13:16:58 +00:00
|
|
|
|
protected function sideArrow() {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
global $wgContLang;
|
|
|
|
|
|
$dir = $wgContLang->isRTL() ? 'l' : 'r';
|
2009-01-25 16:34:21 +00:00
|
|
|
|
return $this->arrow( $dir, '+', wfMsg( 'rc-enhanced-expand' ) );
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Generate HTML for a down-facing arrow
|
|
|
|
|
|
* depending on language direction.
|
|
|
|
|
|
* @return string HTML <img> tag
|
|
|
|
|
|
*/
|
2008-04-04 13:16:58 +00:00
|
|
|
|
protected function downArrow() {
|
2009-01-25 16:34:21 +00:00
|
|
|
|
return $this->arrow( 'd', '-', wfMsg( 'rc-enhanced-hide' ) );
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Generate HTML for a spacer image
|
|
|
|
|
|
* @return string HTML <img> tag
|
|
|
|
|
|
*/
|
2008-04-04 13:16:58 +00:00
|
|
|
|
protected function spacerArrow() {
|
2008-10-26 02:53:14 +00:00
|
|
|
|
return $this->arrow( '', codepointToUtf8( 0xa0 ) ); // non-breaking space
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-03-20 02:08:35 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Add a set of spaces
|
|
|
|
|
|
* @return string HTML <td> tag
|
2008-04-14 07:45:50 +00:00
|
|
|
|
*/
|
2008-04-04 13:16:58 +00:00
|
|
|
|
protected function spacerIndent() {
|
2008-03-16 18:46:09 +00:00
|
|
|
|
return ' ';
|
|
|
|
|
|
}
|
2005-12-16 23:56:44 +00:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Enhanced RC ungrouped line.
|
|
|
|
|
|
* @return string a HTML formated line (generated using $r)
|
|
|
|
|
|
*/
|
2008-04-04 13:16:58 +00:00
|
|
|
|
protected function recentChangesBlockLine( $rcObj ) {
|
2006-12-13 20:08:02 +00:00
|
|
|
|
global $wgContLang, $wgRCShowChangedSize;
|
2008-12-23 23:59:20 +00:00
|
|
|
|
# Extract fields from DB into the function scope (rc_xxxx variables)
|
|
|
|
|
|
// FIXME: Would be good to replace this extract() call with something
|
|
|
|
|
|
// that explicitly initializes variables.
|
2005-12-16 23:56:44 +00:00
|
|
|
|
extract( $rcObj->mAttribs );
|
2008-11-29 00:17:10 +00:00
|
|
|
|
$curIdEq = "curid={$rc_cur_id}";
|
2005-12-16 23:56:44 +00:00
|
|
|
|
|
2008-03-20 22:51:09 +00:00
|
|
|
|
$r = '<table cellspacing="0" cellpadding="0" border="0" style="background: none"><tr>';
|
2008-03-20 18:58:38 +00:00
|
|
|
|
$r .= '<td valign="top" style="white-space: nowrap"><tt>' . $this->spacerArrow() . ' ';
|
2005-12-16 23:56:44 +00:00
|
|
|
|
# Flag and Timestamp
|
|
|
|
|
|
if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
|
2008-03-20 02:08:35 +00:00
|
|
|
|
$r .= ' '; // 4 flags -> 4 spaces
|
2005-12-16 23:56:44 +00:00
|
|
|
|
} else {
|
2008-09-16 05:56:43 +00:00
|
|
|
|
$r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot );
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
2008-03-20 02:08:35 +00:00
|
|
|
|
$r .= ' '.$rcObj->timestamp.' </tt></td><td>';
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# Article or log link
|
|
|
|
|
|
if( $rc_log_type ) {
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL );
|
|
|
|
|
|
$logname = LogPage::logName( $rc_log_type );
|
|
|
|
|
|
$r .= '(' . $this->skin->makeKnownLinkObj($logtitle, $logname ) . ')';
|
|
|
|
|
|
} else {
|
2008-11-29 00:17:10 +00:00
|
|
|
|
$this->insertArticleLink( $r, $rcObj, $rcObj->unpatrolled, $rcObj->watched );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# Diff and hist links
|
2008-09-16 05:56:43 +00:00
|
|
|
|
if ( $rc_type != RC_LOG ) {
|
2008-12-23 23:59:20 +00:00
|
|
|
|
$r .= ' ('. $rcObj->difflink . $this->message['semicolon-separator'];
|
2009-01-25 16:34:21 +00:00
|
|
|
|
$r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), $this->message['hist'],
|
2008-12-23 23:59:20 +00:00
|
|
|
|
$curIdEq.'&action=history' ) . ')';
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
$r .= ' . . ';
|
2006-12-13 20:08:02 +00:00
|
|
|
|
# Character diff
|
2008-12-23 23:59:20 +00:00
|
|
|
|
if( $wgRCShowChangedSize && ($cd = $rcObj->getCharacterDifference()) ) {
|
|
|
|
|
|
$r .= "$cd . . ";
|
2006-12-13 20:08:02 +00:00
|
|
|
|
}
|
2005-12-16 23:56:44 +00:00
|
|
|
|
# User/talk
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$r .= ' '.$rcObj->userlink . $rcObj->usertalklink;
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# Log action (if any)
|
|
|
|
|
|
if( $rc_log_type ) {
|
|
|
|
|
|
if( $this->isDeleted($rcObj,LogPage::DELETED_ACTION) ) {
|
|
|
|
|
|
$r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
|
2008-03-16 18:46:09 +00:00
|
|
|
|
} else {
|
2008-04-21 03:20:08 +00:00
|
|
|
|
$r .= ' ' . LogPage::actionText( $rc_log_type, $rc_log_action, $rcObj->getTitle(),
|
|
|
|
|
|
$this->skin, LogPage::extractParams($rc_params), true, true );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
}
|
2008-04-04 03:56:48 +00:00
|
|
|
|
}
|
2009-01-20 04:01:59 +00:00
|
|
|
|
$this->insertComment( $r, $rcObj );
|
|
|
|
|
|
$this->insertRollback( $r, $rcObj );
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# Show how many people are watching this if enabled
|
2007-03-14 18:35:23 +00:00
|
|
|
|
$r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
|
2005-12-16 23:56:44 +00:00
|
|
|
|
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$r .= "</td></tr></table>\n";
|
2005-12-16 23:56:44 +00:00
|
|
|
|
return $r;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* If enhanced RC is in use, this function takes the previously cached
|
|
|
|
|
|
* RC lines, arranges them, and outputs the HTML
|
|
|
|
|
|
*/
|
2008-04-04 13:16:58 +00:00
|
|
|
|
protected function recentChangesBlock() {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( count ( $this->rc_cache ) == 0 ) {
|
|
|
|
|
|
return '';
|
|
|
|
|
|
}
|
|
|
|
|
|
$blockOut = '';
|
2006-11-29 11:43:58 +00:00
|
|
|
|
foreach( $this->rc_cache as $block ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( count( $block ) < 2 ) {
|
|
|
|
|
|
$blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$blockOut .= $this->recentChangesBlockGroup( $block );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return '<div>'.$blockOut.'</div>';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Returns text for the end of RC
|
|
|
|
|
|
* If enhanced RC is in use, returns pretty much all the text
|
|
|
|
|
|
*/
|
2008-04-04 05:08:25 +00:00
|
|
|
|
public function endRecentChangesList() {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
return $this->recentChangesBlock() . parent::endRecentChangesList();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|