* Updated special pages using IndexPager or one if its subclasses to pass the context object and use it instead of global variables
* Call Linker methods statically
* Changed LogPager::getUser() to LogPager::getAuthor() to avoid conflict with ContextSource::getUser()
return $this->out->getTitle();
}
+ public function getContext() {
+ return $this->out->getContext();
+ }
+
/**
* @param $queryTypes Array
* @return String: Formatted HTML
public static function showLogExtract(
&$out, $types=array(), $page='', $user='', $param = array()
) {
- global $wgUser, $wgOut;
$defaultParameters = array(
'lim' => 25,
'conds' => array(),
if ( !is_array( $msgKey ) ) {
$msgKey = array( $msgKey );
}
+
+ if ( $out instanceof OutputPage ) {
+ $context = $out->getContext();
+ } else {
+ $context = RequestContext::getMain();
+ }
+
# Insert list of top 50 (or top $lim) items
- $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, $flags );
+ $loglist = new LogEventsList( $context->getSkin(), $context->getOutput(), $flags );
$pager = new LogPager( $loglist, $types, $user, $page, '', $conds );
if ( isset( $param['offset'] ) ) { # Tell pager to ignore $wgRequest offset
$pager->setOffset( $param['offset'] );
* @ingroup Pager
*/
class LogPager extends ReverseChronologicalPager {
- private $types = array(), $user = '', $title = '', $pattern = '';
+ private $types = array(), $author = '', $title = '', $pattern = '';
private $typeCGI = '';
public $mLogEventsList;
*
* @param $list LogEventsList
* @param $types String or Array: log types to show
- * @param $user String: the user who made the log entries
+ * @param $author String: the user who made the log entries
* @param $title String: the page title the log entries are for
* @param $pattern String: do a prefix search rather than an exact title match
* @param $conds Array: extra conditions for the query
* @param $month Integer: the month to start from
* @param $tagFilter String: tag
*/
- public function __construct( $list, $types = array(), $user = '', $title = '', $pattern = '',
+ public function __construct( $list, $types = array(), $author = '', $title = '', $pattern = '',
$conds = array(), $year = false, $month = false, $tagFilter = '' ) {
- parent::__construct();
+ parent::__construct( $list->getContext() );
$this->mConds = $conds;
$this->mLogEventsList = $list;
$this->limitType( $types ); // also excludes hidden types
- $this->limitUser( $user );
+ $this->limitAuthor( $author );
$this->limitTitle( $title, $pattern );
$this->getDateCond( $year, $month );
$this->mTagFilter = $tagFilter;
public function getDefaultQuery() {
$query = parent::getDefaultQuery();
$query['type'] = $this->typeCGI; // arrays won't work here
- $query['user'] = $this->user;
+ $query['user'] = $this->author;
$query['month'] = $this->mMonth;
$query['year'] = $this->mYear;
return $query;
}
- /**
- * @return Title
- */
- function getTitle() {
- return $this->mLogEventsList->getDisplayTitle();
- }
-
// Call ONLY after calling $this->limitType() already!
public function getFilterParams() {
global $wgFilterLogTypes, $wgUser, $wgRequest;
*
* @param $name String: (In)valid user name
*/
- private function limitUser( $name ) {
+ private function limitAuthor( $name ) {
if( $name == '' ) {
return false;
}
$this->mConds[] = $this->mDb->bitAnd('log_deleted', LogPage::SUPPRESSED_USER) .
' != ' . LogPage::SUPPRESSED_USER;
}
- $this->user = $usertitle->getText();
+ $this->author = $usertitle->getText();
}
}
# Avoid usage of the wrong index by limiting
# the choices of available indexes. This mainly
# avoids site-breaking filesorts.
- } elseif( $this->title || $this->pattern || $this->user ) {
+ } elseif( $this->title || $this->pattern || $this->author ) {
$index['logging'] = array( 'page_time', 'user_time' );
if( count($this->types) == 1 ) {
$index['logging'][] = 'log_user_type_time';
/**
* @return string
*/
- public function getUser() {
- return $this->user;
+ public function getAuthor() {
+ return $this->author;
}
/**
*
* @ingroup Pager
*/
-abstract class IndexPager implements Pager {
+abstract class IndexPager extends ContextSource implements Pager {
public $mRequest;
public $mLimitsShown = array( 20, 50, 100, 250, 500 );
public $mDefaultLimit = 50;
*/
public $mResult;
- public function __construct() {
- global $wgRequest, $wgUser;
- $this->mRequest = $wgRequest;
+ public function __construct( RequestContext $context = null ) {
+ if ( $context ) {
+ $this->setContext( $context );
+ }
+
+ $this->mRequest = $this->getRequest();
# NB: the offset is quoted, not validated. It is treated as an
# arbitrary string to support the widest variety of index types. Be
$this->mOffset = $this->mRequest->getText( 'offset' );
# Use consistent behavior for the limit options
- $this->mDefaultLimit = intval( $wgUser->getOption( 'rclimit' ) );
+ $this->mDefaultLimit = intval( $this->getUser()->getOption( 'rclimit' ) );
list( $this->mLimit, /* $offset */ ) = $this->mRequest->getLimitOffset();
$this->mIsBackwards = ( $this->mRequest->getVal( 'dir' ) == 'prev' );
}
/**
- * Set the offset from an other source than $wgRequest
+ * Set the offset from an other source than the request
*/
function setOffset( $offset ) {
$this->mOffset = $offset;
}
/**
- * Set the limit from an other source than $wgRequest
+ * Set the limit from an other source than the request
*/
function setLimit( $limit ) {
$this->mLimit = $limit;
if( $type ) {
$attrs['class'] = "mw-{$type}link";
}
- return $this->getSkin()->link(
+ return Linker::linkKnown(
$this->getTitle(),
$text,
$attrs,
- $query + $this->getDefaultQuery(),
- array( 'noclasses', 'known' )
+ $query + $this->getDefaultQuery()
);
}
return '';
}
- /**
- * Title used for self-links. Override this if you want to be able to
- * use a title other than $wgTitle
- *
- * @return Title object
- */
- function getTitle() {
- return $GLOBALS['wgTitle'];
- }
-
- /**
- * Get the current skin. This can be overridden if necessary.
- *
- * @return Skin object
- */
- function getSkin() {
- if ( !isset( $this->mSkin ) ) {
- global $wgUser;
- $this->mSkin = $wgUser->getSkin();
- }
- return $this->mSkin;
- }
-
/**
* Get an array of query parameters that should be put into self-links.
* By default, all parameters passed in the URL are used, except for a
* @return Associative array
*/
function getDefaultQuery() {
- global $wgRequest;
-
if ( !isset( $this->mDefaultQuery ) ) {
- $this->mDefaultQuery = $wgRequest->getQueryValues();
+ $this->mDefaultQuery = $this->getRequest()->getQueryValues();
unset( $this->mDefaultQuery['title'] );
unset( $this->mDefaultQuery['dir'] );
unset( $this->mDefaultQuery['offset'] );
}
function getLimitLinks() {
- global $wgLang;
$links = array();
if ( $this->mIsBackwards ) {
$offset = $this->mPastTheEndIndex;
}
foreach ( $this->mLimitsShown as $limit ) {
$links[] = $this->makeLink(
- $wgLang->formatNum( $limit ),
+ $this->getLang()->formatNum( $limit ),
array( 'offset' => $offset, 'limit' => $limit ),
'num'
);
* didn't want to do class magic as may be still revamped
*/
function getNavigationBar() {
- global $wgLang;
-
if ( !$this->isNavigationBarShown() ) return '';
if( isset( $this->mNavigationBar ) ) {
return $this->mNavigationBar;
}
+ $lang = $this->getLang();
+
$opts = array( 'parsemag', 'escapenoentities' );
$linkTexts = array(
'prev' => wfMsgExt(
'prevn',
$opts,
- $wgLang->formatNum( $this->mLimit )
+ $lang->formatNum( $this->mLimit )
),
'next' => wfMsgExt(
'nextn',
$opts,
- $wgLang->formatNum($this->mLimit )
+ $lang->formatNum($this->mLimit )
),
'first' => wfMsgExt( 'page_first', $opts ),
'last' => wfMsgExt( 'page_last', $opts )
$pagingLinks = $this->getPagingLinks( $linkTexts );
$limitLinks = $this->getLimitLinks();
- $limits = $wgLang->pipeList( $limitLinks );
+ $limits = $lang->pipeList( $limitLinks );
$this->mNavigationBar =
- "(" . $wgLang->pipeList(
+ "(" . $lang->pipeList(
array( $pagingLinks['first'],
$pagingLinks['last'] )
) . ") " .
public $mYear;
public $mMonth;
- function __construct() {
- parent::__construct();
- }
-
function getNavigationBar() {
- global $wgLang;
-
if ( !$this->isNavigationBarShown() ) {
return '';
}
if ( isset( $this->mNavigationBar ) ) {
return $this->mNavigationBar;
}
- $nicenumber = $wgLang->formatNum( $this->mLimit );
+
+ $nicenumber = $this->getLang()->formatNum( $this->mLimit );
$linkTexts = array(
'prev' => wfMsgExt(
'pager-newer-n',
$pagingLinks = $this->getPagingLinks( $linkTexts );
$limitLinks = $this->getLimitLinks();
- $limits = $wgLang->pipeList( $limitLinks );
+ $limits = $this->getLang()->pipeList( $limitLinks );
$this->mNavigationBar = "({$pagingLinks['first']}" .
wfMsgExt( 'pipe-separator' , 'escapenoentities' ) .
var $mSort;
var $mCurrentRow;
- function __construct() {
- global $wgRequest;
- $this->mSort = $wgRequest->getText( 'sort' );
+ function __construct( RequestContext $context = null ) {
+ if ( $context ) {
+ $this->setContext( $context );
+ }
+
+ $this->mSort = $this->getRequest()->getText( 'sort' );
if ( !array_key_exists( $this->mSort, $this->getFieldNames() ) ) {
$this->mSort = $this->getDefaultSort();
}
- if ( $wgRequest->getBool( 'asc' ) ) {
+ if ( $this->getRequest()->getBool( 'asc' ) ) {
$this->mDefaultDirection = false;
- } elseif ( $wgRequest->getBool( 'desc' ) ) {
+ } elseif ( $this->getRequest()->getBool( 'desc' ) ) {
$this->mDefaultDirection = true;
} /* Else leave it at whatever the class default is */
* A navigation bar with images
*/
function getNavigationBar() {
- global $wgStylePath, $wgLang;
+ global $wgStylePath;
if ( !$this->isNavigationBarShown() ) {
return '';
'next' => 'arrow_disabled_right_25.png',
'last' => 'arrow_disabled_last_25.png',
);
- if( $wgLang->isRTL() ) {
+ if( $this->getLang()->isRTL() ) {
$keys = array_keys( $labels );
$images = array_combine( $keys, array_reverse( $images ) );
$disabledImages = array_combine( $keys, array_reverse( $disabledImages ) );
* @return String: HTML fragment
*/
function getLimitSelect() {
- global $wgLang;
-
# Add the current limit from the query string
# to avoid that the limit is lost after clicking Go next time
if ( !in_array( $this->mLimit, $this->mLimitsShown ) ) {
# will be a string.
if( is_int( $value ) ){
$limit = $value;
- $text = $wgLang->formatNum( $limit );
+ $text = $this->getLang()->formatNum( $limit );
} else {
$limit = $key;
$text = $value;
* @return String: HTML fragment
*/
function getHiddenFields( $blacklist = array() ) {
- global $wgRequest;
-
$blacklist = (array)$blacklist;
- $query = $wgRequest->getQueryValues();
+ $query = $this->getRequest()->getQueryValues();
foreach ( $blacklist as $name ) {
unset( $query[$name] );
}
*/
protected $groups;
- function __construct( $group = null ) {
- global $wgRequest, $wgActiveUserDays;
+ function __construct( RequestContext $context = null, $group = null ) {
+ global $wgActiveUserDays;
+
+ parent::__construct( $context );
+
$this->RCMaxAge = $wgActiveUserDays;
- $un = $wgRequest->getText( 'username' );
+ $un = $this->getRequest()->getText( 'username' );
$this->requestedUser = '';
if ( $un != '' ) {
$username = Title::makeTitleSafe( NS_USER, $un );
}
$this->setupOptions();
-
- parent::__construct();
- }
-
- function getTitle() {
- return SpecialPage::getTitleFor( 'Activeusers' );
}
public function setupOptions() {
- global $wgRequest;
-
$this->opts = new FormOptions();
$this->opts->add( 'hidebots', false, FormOptions::BOOL );
$this->opts->add( 'hidesysops', false, FormOptions::BOOL );
- $this->opts->fetchValuesFromRequest( $wgRequest );
+ $this->opts->fetchValuesFromRequest( $this->getRequest() );
$this->groups = array();
if ( $this->opts->getValue( 'hidebots' ) == 1 ) {
}
function formatRow( $row ) {
- global $wgLang;
$userName = $row->user_name;
- $ulinks = $this->getSkin()->userLink( $row->user_id, $userName );
- $ulinks .= $this->getSkin()->userToolLinks( $row->user_id, $userName );
+ $ulinks = Linker::userLink( $row->user_id, $userName );
+ $ulinks .= Linker::userToolLinks( $row->user_id, $userName );
$list = array();
foreach( self::getGroups( $row->user_id ) as $group ) {
}
$list[] = self::buildGroupLink( $group );
}
- $groups = $wgLang->commaList( $list );
+ $groups = $this->getLang()->commaList( $list );
$item = wfSpecialList( $ulinks, $groups );
$count = wfMsgExt( 'activeusers-count',
array( 'parsemag' ),
- $wgLang->formatNum( $row->recentedits ),
+ $this->getLang()->formatNum( $row->recentedits ),
$userName,
- $wgLang->formatNum ( $this->RCMaxAge )
+ $this->getLang()->formatNum( $this->RCMaxAge )
);
$blocked = $row->blocked ? ' ' . wfMsgExt( 'listusers-blocked', array( 'parsemag' ), $userName ) : '';
* @param $par Mixed: parameter passed to the page or null
*/
public function execute( $par ) {
- global $wgOut, $wgLang, $wgActiveUserDays;
+ global $wgActiveUserDays;
$this->setHeaders();
$this->outputHeader();
- $up = new ActiveUsersPager();
+ $up = new ActiveUsersPager( $this->getContext() );
# getBody() first to check, if empty
$usersbody = $up->getBody();
$s = Html::rawElement( 'div', array( 'class' => 'mw-activeusers-intro' ),
- wfMsgExt( 'activeusers-intro', array( 'parsemag', 'escape' ), $wgLang->formatNum( $wgActiveUserDays ) )
+ wfMsgExt( 'activeusers-intro', array( 'parsemag', 'escape' ), $this->getLang()->formatNum( $wgActiveUserDays ) )
);
$s .= $up->getPageHeader();
$s .= Html::element( 'p', array(), wfMsg( 'activeusers-noresult' ) );
}
- $wgOut->addHTML( $s );
+ $this->getOutput()->addHTML( $s );
}
}
public $custom;
function __construct( $page, $conds, $langObj = null ) {
- parent::__construct();
+ parent::__construct( $page->getContext() );
$this->mIndexField = 'am_title';
$this->mPage = $page;
$this->mConds = $conds;
$this->mDefaultDirection = true; // always sort ascending
$this->mLimitsShown = array( 20, 50, 100, 250, 500, 5000 );
- global $wgLang, $wgContLang, $wgRequest;
+ global $wgContLang;
$this->talk = htmlspecialchars( wfMsg( 'talkpagelinktext' ) );
$this->langcode = $this->lang->getCode();
$this->foreign = $this->langcode != $wgContLang->getCode();
- if( $wgRequest->getVal( 'filter', 'all' ) === 'all' ){
+ $request = $this->getRequest();
+
+ if( $request->getVal( 'filter', 'all' ) === 'all' ){
$this->custom = null; // So won't match in either case
} else {
- $this->custom = ($wgRequest->getVal( 'filter' ) == 'unmodified');
+ $this->custom = ($request->getVal( 'filter' ) == 'unmodified');
}
- $prefix = $wgLang->ucfirst( $wgRequest->getVal( 'prefix', '' ) );
- $prefix = $prefix != '' ? Title::makeTitleSafe( NS_MEDIAWIKI, $wgRequest->getVal( 'prefix', null ) ) : null;
+ $prefix = $this->getLang()->ucfirst( $request->getVal( 'prefix', '' ) );
+ $prefix = $prefix != '' ? Title::makeTitleSafe( NS_MEDIAWIKI, $request->getVal( 'prefix', null ) ) : null;
if( $prefix !== null ){
$this->displayPrefix = $prefix->getDBkey();
$this->prefix = '/^' . preg_quote( $this->displayPrefix ) . '/i';
}
function formatValue( $field, $value ){
- global $wgLang;
switch( $field ){
case 'am_title' :
$talk = Title::makeTitle( NS_MEDIAWIKI_TALK, $value . $this->suffix );
if( $this->mCurrentRow->am_customised ){
- $title = Linker::linkKnown( $title, $wgLang->lcfirst( $value ) );
+ $title = Linker::linkKnown( $title, $this->getLang()->lcfirst( $value ) );
} else {
$title = Linker::link(
$title,
- $wgLang->lcfirst( $value ),
+ $this->getLang()->lcfirst( $value ),
array(),
array(),
array( 'broken' )
function getRowAttrs( $row, $isSecond = false ){
$arr = array();
- global $wgLang;
if( $row->am_customised ){
$arr['class'] = 'allmessages-customised';
}
if( !$isSecond ){
- $arr['id'] = Sanitizer::escapeId( 'msg_' . $wgLang->lcfirst( $row->am_title ) );
+ $arr['id'] = Sanitizer::escapeId( 'msg_' . $this->getLang()->lcfirst( $row->am_title ) );
}
return $arr;
}
* @param $par String title fragment
*/
public function execute( $par ) {
- global $wgOut, $wgRequest;
-
$this->setHeaders();
$this->outputHeader();
- $wgOut->setPageTitle( wfMsg( 'ipblocklist' ) );
- $wgOut->addModuleStyles( 'mediawiki.special' );
+ $out = $this->getOutput();
+ $out->setPageTitle( wfMsg( 'ipblocklist' ) );
+ $out->addModuleStyles( 'mediawiki.special' );
- $par = $wgRequest->getVal( 'ip', $par );
- $this->target = trim( $wgRequest->getVal( 'wpTarget', $par ) );
+ $request = $this->getRequest();
+ $par = $request->getVal( 'ip', $par );
+ $this->target = trim( $request->getVal( 'wpTarget', $par ) );
- $this->options = $wgRequest->getArray( 'wpOptions', array() );
+ $this->options = $request->getArray( 'wpOptions', array() );
- $action = $wgRequest->getText( 'action' );
+ $action = $request->getText( 'action' );
- if( $action == 'unblock' || $action == 'submit' && $wgRequest->wasPosted() ) {
+ if( $action == 'unblock' || $action == 'submit' && $request->wasPosted() ) {
# B/C @since 1.18: Unblock interface is now at Special:Unblock
$title = SpecialPage::getTitleFor( 'Unblock', $this->target );
- $wgOut->redirect( $title->getFullUrl() );
+ $out->redirect( $title->getFullUrl() );
return;
}
}
function showList() {
- global $wgOut, $wgUser;
-
# Purge expired entries on one in every 10 queries
if ( !mt_rand( 0, 10 ) ) {
Block::purgeExpired();
$conds = array();
# Is the user allowed to see hidden blocks?
- if ( !$wgUser->isAllowed( 'hideuser' ) ){
+ if ( !$this->getUser()->isAllowed( 'hideuser' ) ){
$conds['ipb_deleted'] = 0;
}
$otherBlockLink = array();
wfRunHooks( 'OtherBlockLogLink', array( &$otherBlockLink, $this->target ) );
+ $out = $this->getOutput();
+
# Show additional header for the local block only when other blocks exists.
# Not necessary in a standard installation without such extensions enabled
if( count( $otherBlockLink ) ) {
- $wgOut->addHTML(
+ $out->addHTML(
Html::rawElement( 'h2', array(), wfMsg( 'ipblocklist-localblock' ) ) . "\n"
);
}
$pager = new BlockListPager( $this, $conds );
if ( $pager->getNumRows() ) {
- $wgOut->addHTML(
+ $out->addHTML(
$pager->getNavigationBar() .
$pager->getBody().
$pager->getNavigationBar()
);
} elseif ( $this->target ) {
- $wgOut->addWikiMsg( 'ipblocklist-no-results' );
+ $out->addWikiMsg( 'ipblocklist-no-results' );
} else {
- $wgOut->addWikiMsg( 'ipblocklist-empty' );
+ $out->addWikiMsg( 'ipblocklist-empty' );
}
if( count( $otherBlockLink ) ) {
- $wgOut->addHTML(
+ $out->addHTML(
Html::rawElement(
'h2',
array(),
foreach( $otherBlockLink as $link ) {
$list .= Html::rawElement( 'li', array(), $link ) . "\n";
}
- $wgOut->addHTML( Html::rawElement( 'ul', array( 'class' => 'mw-ipblocklist-otherblocks' ), $list ) . "\n" );
+ $out->addHTML( Html::rawElement( 'ul', array( 'class' => 'mw-ipblocklist-otherblocks' ), $list ) . "\n" );
}
}
}
$this->page = $page;
$this->conds = $conds;
$this->mDefaultDirection = true;
- parent::__construct();
+ parent::__construct( $page->getContext() );
}
function getFieldNames() {
}
function formatValue( $name, $value ) {
- global $wgLang, $wgUser;
-
- static $sk, $msg;
- if ( empty( $sk ) ) {
- $sk = $this->getSkin();
+ static $msg = null;
+ if ( $msg === null ) {
$msg = array(
'anononlyblock',
'createaccountblock',
switch( $name ) {
case 'ipb_timestamp':
- $formatted = $wgLang->timeanddate( $value );
+ $formatted = $this->getLang()->timeanddate( $value );
break;
case 'ipb_target':
switch( $type ){
case Block::TYPE_USER:
case Block::TYPE_IP:
- $formatted = $sk->userLink( $target->getId(), $target );
- $formatted .= $sk->userToolLinks(
+ $formatted = Linker::userLink( $target->getId(), $target );
+ $formatted .= Linker::userToolLinks(
$target->getId(),
$target,
false,
break;
case 'ipb_expiry':
- $formatted = $wgLang->formatExpiry( $value );
- if( $wgUser->isAllowed( 'block' ) ){
+ $formatted = $this->getLang()->formatExpiry( $value );
+ if( $this->getUser()->isAllowed( 'block' ) ){
if( $row->ipb_auto ){
- $links[] = $sk->linkKnown(
+ $links[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'Unblock' ),
$msg['unblocklink'],
array(),
array( 'wpTarget' => "#{$row->ipb_id}" )
);
} else {
- $links[] = $sk->linkKnown(
+ $links[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'Unblock', $row->ipb_address ),
$msg['unblocklink']
);
- $links[] = $sk->linkKnown(
+ $links[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'Block', $row->ipb_address ),
$msg['change-blocklink']
);
$formatted .= ' ' . Html::rawElement(
'span',
array( 'class' => 'mw-blocklist-actions' ),
- wfMsg( 'parentheses', $wgLang->pipeList( $links ) )
+ wfMsg( 'parentheses', $this->getLang()->pipeList( $links ) )
);
}
break;
case 'ipb_by':
$user = User::newFromId( $value );
if( $user instanceof User ){
- $formatted = $sk->userLink( $user->getId(), $user->getName() );
- $formatted .= $sk->userToolLinks( $user->getId(), $user->getName() );
+ $formatted = Linker::userLink( $user->getId(), $user->getName() );
+ $formatted .= Linker::userToolLinks( $user->getId(), $user->getName() );
}
break;
case 'ipb_reason':
- $formatted = $sk->commentBlock( $value );
+ $formatted = Linker::commentBlock( $value );
break;
case 'ipb_params':
$properties[] = $msg['blocklist-nousertalk'];
}
- $formatted = $wgLang->commaList( $properties );
+ $formatted = $this->getLang()->commaList( $properties );
break;
default:
'conds' => $this->conds,
);
- global $wgUser;
# Is the user allowed to see hidden blocks?
- if ( !$wgUser->isAllowed( 'hideuser' ) ){
+ if ( !$this->getUser()->isAllowed( 'hideuser' ) ){
$conds['ipb_deleted'] = 0;
}
function isFieldSortable( $name ) {
return false;
}
-
- function getTitle() {
- return $this->page->getTitle();
- }
}
}
function execute( $par ) {
- global $wgOut, $wgRequest;
-
$this->setHeaders();
$this->outputHeader();
- $wgOut->allowClickjacking();
+ $this->getOutput()->allowClickjacking();
- $from = $wgRequest->getText( 'from', $par );
+ $from = $this->getRequest()->getText( 'from', $par );
- $cap = new CategoryPager( $from );
+ $cap = new CategoryPager( $this->getContext(), $from );
$cap->doQuery();
- $wgOut->addHTML(
+ $this->getOutput()->addHTML(
Html::openElement( 'div', array( 'class' => 'mw-spcontent' ) ) .
wfMsgExt( 'categoriespagetext', array( 'parse' ), $cap->getNumRows() ) .
$cap->getStartForm( $from ) .
* @ingroup SpecialPage Pager
*/
class CategoryPager extends AlphabeticPager {
- function __construct( $from ) {
- parent::__construct();
+ function __construct( RequestContext $context, $from ) {
+ parent::__construct( $context );
$from = str_replace( ' ', '_', $from );
if( $from !== '' ) {
$from = Title::capitalize( $from, NS_CATEGORY );
);
}
- function getTitle() {
- return SpecialPage::getTitleFor( 'Categories' );
- }
-
function getIndexField() {
# return array( 'abc' => 'cat_title', 'count' => 'cat_pages' );
return 'cat_title';
}
function formatRow($result) {
- global $wgLang;
$title = Title::makeTitle( NS_CATEGORY, $result->cat_title );
$titleText = Linker::link( $title, htmlspecialchars( $title->getText() ) );
$count = wfMsgExt( 'nmembers', array( 'parsemag', 'escape' ),
- $wgLang->formatNum( $result->cat_pages ) );
+ $this->getLang()->formatNum( $result->cat_pages ) );
return Xml::tags('li', null, wfSpecialList( $titleText, $count ) ) . "\n";
}
}
public function execute( $par ) {
- global $wgUser, $wgOut, $wgRequest;
-
$this->setHeaders();
$this->outputHeader();
- $wgOut->addModuleStyles( 'mediawiki.special' );
+ $out = $this->getOutput();
+ $out->addModuleStyles( 'mediawiki.special' );
$this->opts = array();
+ $request = $this->getRequest();
if( $par == 'newbies' ) {
$target = 'newbies';
$this->opts['contribs'] = 'newbie';
- } elseif( isset( $par ) ) {
+ } elseif( $par !== null ) {
$target = $par;
} else {
- $target = $wgRequest->getVal( 'target' );
+ $target = $request->getVal( 'target' );
}
// check for radiobox
- if( $wgRequest->getVal( 'contribs' ) == 'newbie' ) {
+ if( $request->getVal( 'contribs' ) == 'newbie' ) {
$target = 'newbies';
$this->opts['contribs'] = 'newbie';
}
- $this->opts['deletedOnly'] = $wgRequest->getBool( 'deletedOnly' );
+ $this->opts['deletedOnly'] = $request->getBool( 'deletedOnly' );
if( !strlen( $target ) ) {
- $wgOut->addHTML( $this->getForm() );
+ $out->addHTML( $this->getForm() );
return;
}
- $this->opts['limit'] = $wgRequest->getInt( 'limit', $wgUser->getOption('rclimit') );
+ $user = $this->getUser();
+
+ $this->opts['limit'] = $request->getInt( 'limit', $user->getOption('rclimit') );
$this->opts['target'] = $target;
- $this->opts['topOnly'] = $wgRequest->getBool( 'topOnly' );
+ $this->opts['topOnly'] = $request->getBool( 'topOnly' );
$nt = Title::makeTitleSafe( NS_USER, $target );
if( !$nt ) {
- $wgOut->addHTML( $this->getForm() );
+ $out->addHTML( $this->getForm() );
return;
}
$id = User::idFromName( $nt->getText() );
if( $target != 'newbies' ) {
$target = $nt->getText();
- $wgOut->setSubtitle( $this->contributionsSub( $nt, $id ) );
- $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsgExt( 'contributions-title', array( 'parsemag' ),$target ) ) );
- $user = User::newFromName( $target, false );
- if ( is_object( $user ) ) {
- $this->getSkin()->setRelevantUser( $user );
+ $out->setSubtitle( $this->contributionsSub( $nt, $id ) );
+ $out->setHTMLTitle( wfMsg( 'pagetitle', wfMsgExt( 'contributions-title', array( 'parsemag' ),$target ) ) );
+ $userObj = User::newFromName( $target, false );
+ if ( is_object( $userObj ) ) {
+ $this->getSkin()->setRelevantUser( $userObj );
}
} else {
- $wgOut->setSubtitle( wfMsgHtml( 'sp-contributions-newbies-sub') );
- $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsg( 'sp-contributions-newbies-title' ) ) );
+ $out->setSubtitle( wfMsgHtml( 'sp-contributions-newbies-sub') );
+ $out->setHTMLTitle( wfMsg( 'pagetitle', wfMsg( 'sp-contributions-newbies-title' ) ) );
}
- if( ( $ns = $wgRequest->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
+ if( ( $ns = $request->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
$this->opts['namespace'] = intval( $ns );
} else {
$this->opts['namespace'] = '';
}
- $this->opts['tagFilter'] = (string) $wgRequest->getVal( 'tagFilter' );
+ $this->opts['tagFilter'] = (string) $request->getVal( 'tagFilter' );
// Allows reverts to have the bot flag in recent changes. It is just here to
// be passed in the form at the top of the page
- if( $wgUser->isAllowed( 'markbotedits' ) && $wgRequest->getBool( 'bot' ) ) {
+ if( $user->isAllowed( 'markbotedits' ) && $request->getBool( 'bot' ) ) {
$this->opts['bot'] = '1';
}
- $skip = $wgRequest->getText( 'offset' ) || $wgRequest->getText( 'dir' ) == 'prev';
+ $skip = $request->getText( 'offset' ) || $request->getText( 'dir' ) == 'prev';
# Offset overrides year/month selection
if( $skip ) {
$this->opts['year'] = '';
$this->opts['month'] = '';
} else {
- $this->opts['year'] = $wgRequest->getIntOrNull( 'year' );
- $this->opts['month'] = $wgRequest->getIntOrNull( 'month' );
+ $this->opts['year'] = $request->getIntOrNull( 'year' );
+ $this->opts['month'] = $request->getIntOrNull( 'month' );
}
- $feedType = $wgRequest->getVal( 'feed' );
+ $feedType = $request->getVal( 'feed' );
if( $feedType ) {
// Maintain some level of backwards compatability
// If people request feeds using the old parameters, redirect to API
$url = wfScript( 'api' ) . '?' . wfArrayToCGI( $apiParams );
- $wgOut->redirect( $url, '301' );
+ $out->redirect( $url, '301' );
return;
}
if ( wfRunHooks( 'SpecialContributionsBeforeMainOutput', array( $id ) ) ) {
- $wgOut->addHTML( $this->getForm() );
+ $out->addHTML( $this->getForm() );
$pager = new ContribsPager( array(
'target' => $target,
'topOnly' => $this->opts['topOnly'],
) );
if( !$pager->getNumRows() ) {
- $wgOut->addWikiMsg( 'nocontribs', $target );
+ $out->addWikiMsg( 'nocontribs', $target );
} else {
# Show a message about slave lag, if applicable
$lag = wfGetLB()->safeGetLag( $pager->getDatabase() );
if( $lag > 0 )
- $wgOut->showLagWarning( $lag );
+ $out->showLagWarning( $lag );
- $wgOut->addHTML(
+ $out->addHTML(
'<p>' . $pager->getNavigationBar() . '</p>' .
$pager->getBody() .
'<p>' . $pager->getNavigationBar() . '</p>'
);
}
- $wgOut->preventClickjacking( $pager->getPreventClickjacking() );
+ $out->preventClickjacking( $pager->getPreventClickjacking() );
# Show the appropriate "footer" message - WHOIS tools, etc.
if( $target != 'newbies' ) {
if ( IP::isIPAddress( $target ) ) {
$message = 'sp-contributions-footer-anon';
} else {
- $user = User::newFromName( $target );
- if ( !$user || $user->isAnon() ) {
+ $userObj = User::newFromName( $target );
+ if ( !$userObj || $userObj->isAnon() ) {
// No message for non-existing users
return;
}
}
if( !wfMessage( $message, $target )->isDisabled() ) {
- $wgOut->wrapWikiMsg(
+ $out->wrapWikiMsg(
"<div class='mw-contributions-footer'>\n$1\n</div>",
array( $message, $target ) );
}
* @todo FIXME: Almost the same as getSubTitle in SpecialDeletedContributions.php. Could be combined.
*/
protected function contributionsSub( $nt, $id ) {
- global $wgLang, $wgUser, $wgOut;
-
- $sk = $this->getSkin();
-
if ( $id === null ) {
$user = htmlspecialchars( $nt->getText() );
} else {
- $user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) );
+ $user = Linker::link( $nt, htmlspecialchars( $nt->getText() ) );
}
$userObj = User::newFromName( $nt->getText(), /* check for username validity not needed */ false );
$talk = $nt->getTalkPage();
if( $talk ) {
- $tools = self::getUserLinks( $nt, $talk, $userObj, $wgUser );
- $links = $wgLang->pipeList( $tools );
+ $tools = self::getUserLinks( $nt, $talk, $userObj, $this->getUser() );
+ $links = $this->getLang()->pipeList( $tools );
// Show a note if the user is blocked and display the last block log entry.
if ( $userObj->isBlocked() ) {
+ $out = $this->getOutput(); // showLogExtract() wants first parameter by reference
LogEventsList::showLogExtract(
- $wgOut,
+ $out,
'block',
$nt->getPrefixedText(),
'',
'sp-contributions-blocked-notice',
$nt->getText() # Support GENDER in 'sp-contributions-blocked-notice'
),
- 'offset' => '' # don't use $wgRequest parameter offset
+ 'offset' => '' # don't use WebRequest parameter offset
)
);
}
* @param $userpage Title: Target user page
* @param $talkpage Title: Talk page
* @param $target User: Target user object
- * @param $subject User: The viewing user ($wgUser is still checked in some cases, like userrights page!!)
+ * @param $subject User: The viewing user ($wgUser might be still checked in some cases)
*/
public static function getUserLinks( Title $userpage, Title $talkpage, User $target, User $subject ) {
- $sk = $subject->getSkin();
$id = $target->getId();
$username = $target->getName();
- $tools[] = $sk->link( $talkpage, wfMsgHtml( 'sp-contributions-talk' ) );
+ $tools[] = Linker::link( $talkpage, wfMsgHtml( 'sp-contributions-talk' ) );
if( ( $id !== null ) || ( $id === null && IP::isIPAddress( $username ) ) ) {
if( $subject->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
if ( $target->isBlocked() ) {
- $tools[] = $sk->linkKnown( # Change block link
+ $tools[] = Linker::linkKnown( # Change block link
SpecialPage::getTitleFor( 'Block', $username ),
wfMsgHtml( 'change-blocklink' )
);
- $tools[] = $sk->linkKnown( # Unblock link
+ $tools[] = Linker::linkKnown( # Unblock link
SpecialPage::getTitleFor( 'Unblock', $username ),
wfMsgHtml( 'unblocklink' )
);
} else { # User is not blocked
- $tools[] = $sk->linkKnown( # Block link
+ $tools[] = Linker::linkKnown( # Block link
SpecialPage::getTitleFor( 'Block', $username ),
wfMsgHtml( 'blocklink' )
);
}
}
# Block log link
- $tools[] = $sk->linkKnown(
+ $tools[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'Log', 'block' ),
wfMsgHtml( 'sp-contributions-blocklog' ),
array(),
);
}
# Uploads
- $tools[] = $sk->linkKnown(
+ $tools[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'Listfiles', $username ),
wfMsgHtml( 'sp-contributions-uploads' )
);
# Other logs link
- $tools[] = $sk->linkKnown(
+ $tools[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'Log', $username ),
wfMsgHtml( 'sp-contributions-logs' )
);
# Add link to deleted user contributions for priviledged users
if( $subject->isAllowed( 'deletedhistory' ) && !$subject->isBlocked() ) {
- $tools[] = $sk->linkKnown(
+ $tools[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'DeletedContributions', $username ),
wfMsgHtml( 'sp-contributions-deleted' )
);
# Add a link to change user rights for privileged users
$userrightsPage = new UserrightsPage();
+ $userrightsPage->getContext()->setUser( $subject );
if( $id !== null && $userrightsPage->userCanChangeRights( $target ) ) {
- $tools[] = $sk->linkKnown(
+ $tools[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'Userrights', $username ),
wfMsgHtml( 'sp-contributions-userrights' )
);
return $query;
}
- function getTitle() {
- return SpecialPage::getTitleFor( 'Contributions' );
- }
-
function getQueryInfo() {
- global $wgUser;
list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond();
+ $user = $this->getUser();
$conds = array_merge( $userCond, $this->getNamespaceCond() );
// Paranoia: avoid brute force searches (bug 17342)
- if( !$wgUser->isAllowed( 'deletedhistory' ) || $wgUser->isBlocked() ) {
+ if( !$user->isAllowed( 'deletedhistory' ) || $user->isBlocked() ) {
$conds[] = $this->mDb->bitAnd('rev_deleted',Revision::DELETED_USER) . ' = 0';
- } elseif( !$wgUser->isAllowed( 'suppressrevision' ) ) {
+ } elseif( !$user->isAllowed( 'suppressrevision' ) ) {
$conds[] = $this->mDb->bitAnd('rev_deleted',Revision::SUPPRESSED_USER) .
' != ' . Revision::SUPPRESSED_USER;
}
* @todo This would probably look a lot nicer in a table.
*/
function formatRow( $row ) {
- global $wgUser, $wgLang;
wfProfileIn( __METHOD__ );
- $sk = $this->getSkin();
$rev = new Revision( $row );
$classes = array();
$page = Title::newFromRow( $row );
- $link = $sk->link(
+ $link = Linker::link(
$page,
htmlspecialchars( $page->getPrefixedText() ),
array(),
&& $page->quickUserCan( 'edit' ) )
{
$this->preventClickjacking();
- $topmarktext .= ' '.$sk->generateRollback( $rev );
+ $topmarktext .= ' '.Linker::generateRollback( $rev );
}
}
# Is there a visible previous revision?
if( $rev->userCan( Revision::DELETED_TEXT ) && $rev->getParentId() !== 0 ) {
- $difftext = $sk->linkKnown(
+ $difftext = Linker::linkKnown(
$page,
$this->messages['diff'],
array(),
} else {
$difftext = $this->messages['diff'];
}
- $histlink = $sk->linkKnown(
+ $histlink = Linker::linkKnown(
$page,
$this->messages['hist'],
array(),
array( 'action' => 'history' )
);
- if ( isset( $this->mParentLens[$row->rev_parent_id] ) ) {
- $chardiff = ' . . ' . ChangesList::showCharacterDifference(
- $this->mParentLens[$row->rev_parent_id], $row->rev_len ) . ' . . ';
- } else {
- $chardiff = '';
- }
-
- $comment = $wgLang->getDirMark() . $sk->revComment( $rev, false, true );
- $date = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->rev_timestamp ), true );
+ $comment = $this->getLang()->getDirMark() . Linker::revComment( $rev, false, true );
+ $date = $this->getLang()->timeanddate( wfTimestamp( TS_MW, $row->rev_timestamp ), true );
if( $rev->userCan( Revision::DELETED_TEXT ) ) {
- $d = $sk->linkKnown(
+ $d = Linker::linkKnown(
$page,
htmlspecialchars($date),
array(),
}
if( $this->target == 'newbies' ) {
- $userlink = ' . . ' . $sk->userLink( $row->rev_user, $row->rev_user_text );
- $userlink .= ' ' . wfMsg( 'parentheses', $sk->userTalkLink( $row->rev_user, $row->rev_user_text ) ) . ' ';
+ $userlink = ' . . ' . Linker::userLink( $row->rev_user, $row->rev_user_text );
+ $userlink .= ' ' . wfMsg( 'parentheses', Linker::userTalkLink( $row->rev_user, $row->rev_user_text ) ) . ' ';
} else {
$userlink = '';
}
}
// Don't show useless link to people who cannot hide revisions
- $canHide = $wgUser->isAllowed( 'deleterevision' );
- if( $canHide || ($rev->getVisibility() && $wgUser->isAllowed('deletedhistory')) ) {
+ $canHide = $this->getUser()->isAllowed( 'deleterevision' );
+ if( $canHide || ($rev->getVisibility() && $this->getUser()->isAllowed('deletedhistory')) ) {
if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
- $del = $this->mSkin->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
+ $del = Linker::revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
} else {
$query = array(
'type' => 'revision',
'target' => $page->getPrefixedDbkey(),
'ids' => $rev->getId()
);
- $del = $this->mSkin->revDeleteLink( $query,
+ $del = Linker::revDeleteLink( $query,
$rev->isDeleted( Revision::DELETED_RESTRICTED ), $canHide );
}
$del .= ' ';
}
function getQueryInfo() {
- global $wgUser;
list( $index, $userCond ) = $this->getUserCond();
$conds = array_merge( $userCond, $this->getNamespaceCond() );
+ $user = $this->getUser();
// Paranoia: avoid brute force searches (bug 17792)
- if( !$wgUser->isAllowed( 'deletedhistory' ) ) {
+ if( !$user->isAllowed( 'deletedhistory' ) ) {
$conds[] = $this->mDb->bitAnd('ar_deleted',Revision::DELETED_USER) . ' = 0';
- } elseif( !$wgUser->isAllowed( 'suppressrevision' ) ) {
+ } elseif( !$user->isAllowed( 'suppressrevision' ) ) {
$conds[] = $this->mDb->bitAnd('ar_deleted',Revision::SUPPRESSED_USER) .
' != ' . Revision::SUPPRESSED_USER;
}
}
function getNavigationBar() {
- global $wgLang;
-
if ( isset( $this->mNavigationBar ) ) {
return $this->mNavigationBar;
}
- $fmtLimit = $wgLang->formatNum( $this->mLimit );
+ $lang = $this->getLang();
+ $fmtLimit = $lang->formatNum( $this->mLimit );
$linkTexts = array(
'prev' => wfMsgExt( 'pager-newer-n', array( 'escape', 'parsemag' ), $fmtLimit ),
'next' => wfMsgExt( 'pager-older-n', array( 'escape', 'parsemag' ), $fmtLimit ),
$pagingLinks = $this->getPagingLinks( $linkTexts );
$limitLinks = $this->getLimitLinks();
- $limits = $wgLang->pipeList( $limitLinks );
+ $limits = $lang->pipeList( $limitLinks );
- $this->mNavigationBar = "(" . $wgLang->pipeList( array( $pagingLinks['first'], $pagingLinks['last'] ) ) . ") " .
+ $this->mNavigationBar = "(" . $lang->pipeList( array( $pagingLinks['first'], $pagingLinks['last'] ) ) . ") " .
wfMsgExt( 'viewprevnext', array( 'parsemag', 'escape', 'replaceafter' ), $pagingLinks['prev'], $pagingLinks['next'], $limits );
return $this->mNavigationBar;
}
* @todo This would probably look a lot nicer in a table.
*/
function formatRow( $row ) {
- global $wgUser, $wgLang;
wfProfileIn( __METHOD__ );
- $sk = $this->getSkin();
-
$rev = new Revision( array(
'id' => $row->ar_rev_id,
'comment' => $row->ar_comment,
$undelete = SpecialPage::getTitleFor( 'Undelete' );
$logs = SpecialPage::getTitleFor( 'Log' );
- $dellog = $sk->linkKnown(
+ $dellog = Linker::linkKnown(
$logs,
$this->messages['deletionlog'],
array(),
)
);
- $reviewlink = $sk->linkKnown(
+ $reviewlink = Linker::linkKnown(
SpecialPage::getTitleFor( 'Undelete', $page->getPrefixedDBkey() ),
$this->messages['undeleteviewlink']
);
- if( $wgUser->isAllowed('deletedtext') ) {
- $last = $sk->linkKnown(
+ $user = $this->getUser();
+
+ if( $user->isAllowed('deletedtext') ) {
+ $last = Linker::linkKnown(
$undelete,
$this->messages['diff'],
array(),
$last = $this->messages['diff'];
}
- $comment = $sk->revComment( $rev );
- $date = htmlspecialchars( $wgLang->timeanddate( $rev->getTimestamp(), true ) );
+ $comment = Linker::revComment( $rev );
+ $date = htmlspecialchars( $this->getLang()->timeanddate( $rev->getTimestamp(), true ) );
- if( !$wgUser->isAllowed('undelete') || !$rev->userCan(Revision::DELETED_TEXT) ) {
+ if( !$user->isAllowed('undelete') || !$rev->userCan(Revision::DELETED_TEXT) ) {
$link = $date; // unusable link
} else {
- $link = $sk->linkKnown(
+ $link = Linker::linkKnown(
$undelete,
$date,
array(),
$link = '<span class="history-deleted">' . $link . '</span>';
}
- $pagelink = $sk->link( $page );
+ $pagelink = Linker::link( $page );
if( $rev->isMinor() ) {
$mflag = ChangesList::flag( 'minor' );
}
// Revision delete link
- $del = Linker::getRevDeleteLink( $wgUser, $rev, $page );
+ $del = Linker::getRevDeleteLink( $user, $rev, $page );
if ( $del ) $del .= ' ';
$tools = Html::rawElement(
'span',
array( 'class' => 'mw-deletedcontribs-tools' ),
- wfMsg( 'parentheses', $wgLang->pipeList( array( $last, $dellog, $reviewlink ) ) )
+ wfMsg( 'parentheses', $this->getLang()->pipeList( array( $last, $dellog, $reviewlink ) ) )
);
$ret = "{$del}{$link} {$tools} . . {$mflag} {$pagelink} {$comment}";
* @param $par String: (optional) user name of the user for which to show the contributions
*/
function execute( $par ) {
- global $wgUser;
$this->setHeaders();
- if ( !$this->userCanExecute( $wgUser ) ) {
+ $user = $this->getUser();
+
+ if ( !$this->userCanExecute( $user ) ) {
$this->displayRestrictionError();
return;
}
- if( $wgUser->isBlocked() ){
- throw new UserBlockedError( $wgUser->getBlock() );
+ if( $user->isBlocked() ){
+ throw new UserBlockedError( $user->getBlock() );
}
- global $wgOut, $wgRequest;
-
- $wgOut->setPageTitle( wfMsgExt( 'deletedcontributions-title', array( 'parsemag' ) ) );
+ $request = $this->getRequest();
+ $out = $this->getOutput();
+ $out->setPageTitle( wfMsgExt( 'deletedcontributions-title', array( 'parsemag' ) ) );
$options = array();
- if ( isset( $par ) ) {
+ if ( $par !== null ) {
$target = $par;
} else {
- $target = $wgRequest->getVal( 'target' );
+ $target = $request->getVal( 'target' );
}
if ( !strlen( $target ) ) {
- $wgOut->addHTML( $this->getForm( '' ) );
+ $out->addHTML( $this->getForm( '' ) );
return;
}
- $options['limit'] = $wgRequest->getInt( 'limit', 50 );
+ $options['limit'] = $request->getInt( 'limit', 50 );
$options['target'] = $target;
$nt = Title::makeTitleSafe( NS_USER, $target );
if ( !$nt ) {
- $wgOut->addHTML( $this->getForm( '' ) );
+ $out->addHTML( $this->getForm( '' ) );
return;
}
$id = User::idFromName( $nt->getText() );
$target = $nt->getText();
- $wgOut->setSubtitle( $this->getSubTitle( $nt, $id ) );
+ $out->setSubtitle( $this->getSubTitle( $nt, $id ) );
- if ( ( $ns = $wgRequest->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
+ if ( ( $ns = $request->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
$options['namespace'] = intval( $ns );
} else {
$options['namespace'] = '';
}
- $wgOut->addHTML( $this->getForm( $options ) );
+ $out->addHTML( $this->getForm( $options ) );
$pager = new DeletedContribsPager( $target, $options['namespace'] );
if ( !$pager->getNumRows() ) {
- $wgOut->addWikiMsg( 'nocontribs' );
+ $out->addWikiMsg( 'nocontribs' );
return;
}
# Show a message about slave lag, if applicable
$lag = wfGetLB()->safeGetLag( $pager->getDatabase() );
if( $lag > 0 )
- $wgOut->showLagWarning( $lag );
+ $out->showLagWarning( $lag );
- $wgOut->addHTML(
+ $out->addHTML(
'<p>' . $pager->getNavigationBar() . '</p>' .
$pager->getBody() .
'<p>' . $pager->getNavigationBar() . '</p>' );
: 'sp-contributions-footer';
if( !wfMessage( $message )->isDisabled() ) {
- $wgOut->wrapWikiMsg( "<div class='mw-contributions-footer'>\n$1\n</div>", array( $message, $target ) );
+ $out->wrapWikiMsg( "<div class='mw-contributions-footer'>\n$1\n</div>", array( $message, $target ) );
}
}
}
* @todo FIXME: Almost the same as contributionsSub in SpecialContributions.php. Could be combined.
*/
function getSubTitle( $nt, $id ) {
- global $wgLang, $wgUser, $wgOut;
-
- $sk = $this->getSkin();
-
if ( $id === null ) {
$user = htmlspecialchars( $nt->getText() );
} else {
- $user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) );
+ $user = Linker::link( $nt, htmlspecialchars( $nt->getText() ) );
}
$userObj = User::newFromName( $nt->getText(), /* check for username validity not needed */ false );
$talk = $nt->getTalkPage();
if( $talk ) {
# Talk page link
- $tools[] = $sk->link( $talk, wfMsgHtml( 'sp-contributions-talk' ) );
+ $tools[] = Linker::link( $talk, wfMsgHtml( 'sp-contributions-talk' ) );
if( ( $id !== null ) || ( $id === null && IP::isIPAddress( $nt->getText() ) ) ) {
- if( $wgUser->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
+ if( $this->getUser()->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
if ( $userObj->isBlocked() ) {
- $tools[] = $sk->linkKnown( # Change block link
+ $tools[] = Linker::linkKnown( # Change block link
SpecialPage::getTitleFor( 'Block', $nt->getDBkey() ),
wfMsgHtml( 'change-blocklink' )
);
- $tools[] = $sk->linkKnown( # Unblock link
+ $tools[] = Linker::linkKnown( # Unblock link
SpecialPage::getTitleFor( 'BlockList' ),
wfMsgHtml( 'unblocklink' ),
array(),
);
}
else { # User is not blocked
- $tools[] = $sk->linkKnown( # Block link
+ $tools[] = Linker::linkKnown( # Block link
SpecialPage::getTitleFor( 'Block', $nt->getDBkey() ),
wfMsgHtml( 'blocklink' )
);
}
}
# Block log link
- $tools[] = $sk->linkKnown(
+ $tools[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'Log' ),
wfMsgHtml( 'sp-contributions-blocklog' ),
array(),
);
}
# Other logs link
- $tools[] = $sk->linkKnown(
+ $tools[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'Log' ),
wfMsgHtml( 'sp-contributions-logs' ),
array(),
array( 'user' => $nt->getText() )
);
# Link to contributions
- $tools[] = $sk->linkKnown(
+ $tools[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'Contributions', $nt->getDBkey() ),
wfMsgHtml( 'sp-deletedcontributions-contribs' )
);
# Add a link to change user rights for privileged users
$userrightsPage = new UserrightsPage();
if( $id !== null && $userrightsPage->userCanChangeRights( User::newFromId( $id ) ) ) {
- $tools[] = $sk->linkKnown(
+ $tools[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'Userrights', $nt->getDBkey() ),
wfMsgHtml( 'sp-contributions-userrights' )
);
wfRunHooks( 'ContributionsToolLinks', array( $id, $nt, &$tools ) );
- $links = $wgLang->pipeList( $tools );
+ $links = $this->getLang()->pipeList( $tools );
// Show a note if the user is blocked and display the last block log entry.
if ( $userObj->isBlocked() ) {
+ $out = $this->getOutput(); // LogEventsList::showLogExtract() wants the first parameter by ref
LogEventsList::showLogExtract(
- $wgOut,
+ $out,
'block',
$nt->getPrefixedText(),
'',
'sp-contributions-blocked-notice',
$nt->getText() # Support GENDER in 'sp-contributions-blocked-notice'
),
- 'offset' => '' # don't use $wgRequest parameter offset
+ 'offset' => '' # don't use $this->getRequest() parameter offset
)
);
}
function getForm( $options ) {
global $wgScript;
- $options['title'] = SpecialPage::getTitleFor( 'DeletedContributions' )->getPrefixedText();
+ $options['title'] = $this->getTitle()->getPrefixedText();
if ( !isset( $options['target'] ) ) {
$options['target'] = '';
} else {
}
public function execute( $par ){
- global $wgOut, $wgRequest;
$this->setHeaders();
$this->outputHeader();
$userName = $par;
$search = '';
} else {
- $userName = $wgRequest->getText( 'user', $par );
- $search = $wgRequest->getText( 'ilsearch', '' );
+ $userName = $this->getRequest()->getText( 'user', $par );
+ $search = $this->getRequest()->getText( 'ilsearch', '' );
}
- $pager = new ImageListPager( $userName, $search, $this->including() );
+ $pager = new ImageListPager( $this->getContext(), $userName, $search, $this->including() );
if ( $this->including() ) {
$html = $pager->getBody();
$nav = $pager->getNavigationBar();
$html = "$form<br />\n$body<br />\n$nav";
}
- $wgOut->addHTML( $html );
+ $this->getOutput()->addHTML( $html );
}
}
var $mSearch = '';
var $mIncluding = false;
- function __construct( $userName = null, $search = '', $including = false ) {
- global $wgRequest, $wgMiserMode;
+ function __construct( RequestContext $context, $userName = null, $search = '', $including = false ) {
+ global $wgMiserMode;
$this->mIncluding = $including;
}
if ( !$including ) {
- if ( $wgRequest->getText( 'sort', 'img_date' ) == 'img_date' ) {
+ if ( $context->getRequest()->getText( 'sort', 'img_date' ) == 'img_date' ) {
$this->mDefaultDirection = true;
} else {
$this->mDefaultDirection = false;
$this->mDefaultDirection = true;
}
- parent::__construct();
- }
-
- function getTitle() {
- return SpecialPage::getTitleFor( 'Listfiles' );
+ parent::__construct( $context );
}
/**
}
function formatValue( $field, $value ) {
- global $wgLang;
switch ( $field ) {
case 'thumb':
$file = wfLocalFile( $value );
$thumb = $file->transform( array( 'width' => 180, 'height' => 360 ) );
return $thumb->toHtml( array( 'desc-link' => true ) );
case 'img_timestamp':
- return htmlspecialchars( $wgLang->timeanddate( $value, true ) );
+ return htmlspecialchars( $this->getLang()->timeanddate( $value, true ) );
case 'img_name':
static $imgfile = null;
if ( $imgfile === null ) $imgfile = wfMsg( 'imgfile' );
// Weird files can maybe exist? Bug 22227
$filePage = Title::makeTitleSafe( NS_FILE, $value );
if( $filePage ) {
- $link = $this->getSkin()->linkKnown( $filePage, htmlspecialchars( $filePage->getText() ) );
+ $link = Linker::linkKnown( $filePage, htmlspecialchars( $filePage->getText() ) );
$download = Xml::element( 'a',
array( 'href' => wfLocalFile( $filePage )->getURL() ),
$imgfile
}
case 'img_user_text':
if ( $this->mCurrentRow->img_user ) {
- $link = $this->getSkin()->link(
+ $link = Linker::link(
Title::makeTitle( NS_USER, $value ),
htmlspecialchars( $value )
);
}
return $link;
case 'img_size':
- return $this->getSkin()->formatSize( $value );
+ return htmlspecialchars( $this->getLang()->formatSize( $value ) );
case 'img_description':
- return $this->getSkin()->commentBlock( $value );
+ return Linker::commentBlock( $value );
case 'count':
return intval( $value ) + 1;
}
*/
class UsersPager extends AlphabeticPager {
- function __construct( $par=null ) {
- global $wgRequest;
+ function __construct( RequestContext $context = null, $par = null ) {
+ parent::__construct( $context );
+
+ $request = $this->getRequest();
$parms = explode( '/', ($par = ( $par !== null ) ? $par : '' ) );
$symsForAll = array( '*', 'user' );
if ( $parms[0] != '' && ( in_array( $par, User::getAllGroups() ) || in_array( $par, $symsForAll ) ) ) {
$this->requestedGroup = $par;
- $un = $wgRequest->getText( 'username' );
+ $un = $request->getText( 'username' );
} elseif ( count( $parms ) == 2 ) {
$this->requestedGroup = $parms[0];
$un = $parms[1];
} else {
- $this->requestedGroup = $wgRequest->getVal( 'group' );
- $un = ( $par != '' ) ? $par : $wgRequest->getText( 'username' );
+ $this->requestedGroup = $request->getVal( 'group' );
+ $un = ( $par != '' ) ? $par : $request->getText( 'username' );
}
if ( in_array( $this->requestedGroup, $symsForAll ) ) {
$this->requestedGroup = '';
}
- $this->editsOnly = $wgRequest->getBool( 'editsOnly' );
- $this->creationSort = $wgRequest->getBool( 'creationSort' );
+ $this->editsOnly = $request->getBool( 'editsOnly' );
+ $this->creationSort = $request->getBool( 'creationSort' );
$this->requestedUser = '';
if ( $un != '' ) {
parent::__construct();
}
- function getTitle() {
- return SpecialPage::getTitleFor( 'Listusers' );
- }
-
function getIndexField() {
return $this->creationSort ? 'user_id' : 'user_name';
}
function getQueryInfo() {
- global $wgUser;
$dbr = wfGetDB( DB_SLAVE );
$conds = array();
// Don't show hidden names
- if( !$wgUser->isAllowed('hideuser') ) {
+ if( !$this->getUser()->isAllowed('hideuser') ) {
$conds[] = 'ipb_deleted IS NULL';
}
}
function formatRow( $row ) {
- global $wgLang;
-
if ($row->user_id == 0) #Bug 16487
return '';
$list = array();
foreach( $groups_list as $group )
$list[] = self::buildGroupLink( $group );
- $groups = $wgLang->commaList( $list );
+ $groups = $this->getLang()->commaList( $list );
} else {
$groups = '';
}
global $wgEdititis;
if ( $wgEdititis ) {
- $editCount = $wgLang->formatNum( $row->edits );
+ $editCount = $this->getLang()->formatNum( $row->edits );
$edits = ' [' . wfMsgExt( 'usereditcount', array( 'parsemag', 'escape' ), $editCount ) . ']';
} else {
$edits = '';
$created = '';
# Some rows may be NULL
if( $row->creation ) {
- $d = $wgLang->date( wfTimestamp( TS_MW, $row->creation ), true );
- $t = $wgLang->time( wfTimestamp( TS_MW, $row->creation ), true );
+ $d = $this->getLang()->date( wfTimestamp( TS_MW, $row->creation ), true );
+ $t = $this->getLang()->time( wfTimestamp( TS_MW, $row->creation ), true );
$created = ' (' . wfMsg( 'usercreated', $d, $t ) . ')';
$created = htmlspecialchars( $created );
}
* @param $par string (optional) A group to list users from
*/
public function execute( $par ) {
- global $wgOut;
-
$this->setHeaders();
$this->outputHeader();
- $up = new UsersPager( $par );
+ $up = new UsersPager( $this->getContext(), $par );
# getBody() first to check, if empty
$usersbody = $up->getBody();
$s .= wfMessage( 'listusers-noresult' )->parseAsBlock();
}
- $wgOut->addHTML( $s );
+ $this->getOutput()->addHTML( $s );
}
}
}
public function execute( $par ) {
- global $wgRequest;
-
$this->setHeaders();
$this->outputHeader();
$opts->add( 'offender', '' );
// Set values
- $opts->fetchValuesFromRequest( $wgRequest );
+ $opts->fetchValuesFromRequest( $this->getRequest() );
if ( $par ) {
$this->parseParams( $opts, (string)$par );
}
}
private function show( FormOptions $opts, array $extraConds ) {
- global $wgOut;
-
# Create a LogPager item to get the results and a LogEventsList item to format them...
- $loglist = new LogEventsList( $this->getSkin(), $wgOut, 0 );
+ $loglist = new LogEventsList( $this->getSkin(), $this->getOutput(), 0 );
$pager = new LogPager( $loglist, $opts->getValue( 'type' ), $opts->getValue( 'user' ),
$opts->getValue( 'page' ), $opts->getValue( 'pattern' ), $extraConds, $opts->getValue( 'year' ),
$opts->getValue( 'month' ), $opts->getValue( 'tagfilter' ) );
$this->addHeader( $opts->getValue( 'type' ) );
# Set relevant user
- if ( $pager->getUser() ) {
- $this->getSkin()->setRelevantUser( User::newFromName( $pager->getUser() ) );
+ if ( $pager->getAuthor() ) {
+ $this->getSkin()->setRelevantUser( User::newFromName( $pager->getAuthor() ) );
}
# Show form options
- $loglist->showOptions( $pager->getType(), $pager->getUser(), $pager->getPage(), $pager->getPattern(),
+ $loglist->showOptions( $pager->getType(), $pager->getAuthor(), $pager->getPage(), $pager->getPattern(),
$pager->getYear(), $pager->getMonth(), $pager->getFilterParams(), $opts->getValue( 'tagfilter' ) );
# Insert list
$logBody = $pager->getBody();
if ( $logBody ) {
- $wgOut->addHTML(
+ $this->getOutput()->addHTML(
$pager->getNavigationBar() .
$loglist->beginLogEventsList() .
$logBody .
$pager->getNavigationBar()
);
} else {
- $wgOut->addWikiMsg( 'logempty' );
+ $this->getOutput()->addWikiMsg( 'logempty' );
}
}
}
/**
- * @param $request WebRequest
* @return void
*/
- private function loadRequestParams( $request ) {
- global $wgUser;
-
+ private function loadRequestParams() {
+ $request = $this->getRequest();
$this->mAction = $request->getVal( 'action' );
$this->mTarget = $request->getVal( 'target' );
$this->mDest = $request->getVal( 'dest' );
}
$this->mComment = $request->getText( 'wpComment' );
- $this->mMerge = $request->wasPosted() && $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) );
+ $this->mMerge = $request->wasPosted() && $this->getUser()->matchEditToken( $request->getVal( 'wpEditToken' ) );
// target page
if( $this->mSubmitted ) {
$this->mTargetObj = Title::newFromURL( $this->mTarget );
}
public function execute( $par ) {
- global $wgOut, $wgRequest, $wgUser;
-
- if ( wfReadOnly() ) {
- $wgOut->readOnlyPage();
+ $user = $this->getUser();
+ if( !$this->userCanExecute( $user ) ) {
+ $this->displayRestrictionError();
return;
}
- if( !$this->userCanExecute( $wgUser ) ) {
- $this->displayRestrictionError();
- return;
+ if ( wfReadOnly() ) {
+ throw new ReadOnlyError;
}
- $this->loadRequestParams( $wgRequest );
+ $this->loadRequestParams();
$this->setHeaders();
$this->outputHeader();
if ( count( $errors ) ) {
$this->showMergeForm();
- $wgOut->addHTML( implode( "\n", $errors ) );
+ $this->getOutput()->addHTML( implode( "\n", $errors ) );
} else {
$this->showHistory();
}
}
function showMergeForm() {
- global $wgOut, $wgScript;
+ global $wgScript;
- $wgOut->addWikiMsg( 'mergehistory-header' );
+ $this->getOutput()->addWikiMsg( 'mergehistory-header' );
- $wgOut->addHTML(
+ $this->getOutput()->addHTML(
Xml::openElement( 'form', array(
'method' => 'get',
'action' => $wgScript ) ) .
}
private function showHistory() {
- global $wgUser, $wgOut;
-
- $this->sk = $this->getSkin();
-
- $wgOut->setPageTitle( wfMsg( 'mergehistory' ) );
+ $out = $this->getOutput();
+ $out->setPageTitle( wfMsg( 'mergehistory' ) );
$this->showMergeForm();
'id' => 'merge'
)
);
- $wgOut->addHTML( $top );
+ $out->addHTML( $top );
if( $haveRevisions ) {
# Format the user-visible controls (comment field, submission button)
Xml::closeElement( 'table' ) .
Xml::closeElement( 'fieldset' );
- $wgOut->addHTML( $table );
+ $out->addHTML( $table );
}
- $wgOut->addHTML(
+ $out->addHTML(
'<h2 id="mw-mergehistory">' .
wfMsgHtml( 'mergehistory-list' ) . "</h2>\n"
);
if( $haveRevisions ) {
- $wgOut->addHTML( $revisions->getNavigationBar() );
- $wgOut->addHTML( '<ul>' );
- $wgOut->addHTML( $revisions->getBody() );
- $wgOut->addHTML( '</ul>' );
- $wgOut->addHTML( $revisions->getNavigationBar() );
+ $out->addHTML( $revisions->getNavigationBar() );
+ $out->addHTML( '<ul>' );
+ $out->addHTML( $revisions->getBody() );
+ $out->addHTML( '</ul>' );
+ $out->addHTML( $revisions->getNavigationBar() );
} else {
- $wgOut->addWikiMsg( 'mergehistory-empty' );
+ $out->addWikiMsg( 'mergehistory-empty' );
}
# Show relevant lines from the deletion log:
- $wgOut->addHTML( '<h2>' . htmlspecialchars( LogPage::logName( 'merge' ) ) . "</h2>\n" );
- LogEventsList::showLogExtract( $wgOut, 'merge', $this->mTargetObj->getPrefixedText() );
+ $out->addHTML( '<h2>' . htmlspecialchars( LogPage::logName( 'merge' ) ) . "</h2>\n" );
+ LogEventsList::showLogExtract( $out, 'merge', $this->mTargetObj->getPrefixedText() );
# When we submit, go by page ID to avoid some nasty but unlikely collisions.
# Such would happen if a page was renamed after the form loaded, but before submit
$misc .= Html::hidden( 'destID', $this->mDestObj->getArticleID() );
$misc .= Html::hidden( 'target', $this->mTarget );
$misc .= Html::hidden( 'dest', $this->mDest );
- $misc .= Html::hidden( 'wpEditToken', $wgUser->editToken() );
+ $misc .= Html::hidden( 'wpEditToken', $this->getUser()->editToken() );
$misc .= Xml::closeElement( 'form' );
- $wgOut->addHTML( $misc );
+ $out->addHTML( $misc );
return true;
}
function formatRevisionRow( $row ) {
- global $wgLang;
-
$rev = new Revision( $row );
$stxt = '';
$ts = wfTimestamp( TS_MW, $row->rev_timestamp );
$checkBox = Xml::radio( 'mergepoint', $ts, false );
- $pageLink = $this->sk->linkKnown(
+ $pageLink = Linker::linkKnown(
$rev->getTitle(),
- htmlspecialchars( $wgLang->timeanddate( $ts ) ),
+ htmlspecialchars( $this->getLang()->timeanddate( $ts ) ),
array(),
array( 'oldid' => $rev->getId() )
);
if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
$last = $this->message['last'];
} elseif( isset( $this->prevId[$row->rev_id] ) ) {
- $last = $this->sk->linkKnown(
+ $last = Linker::linkKnown(
$rev->getTitle(),
$this->message['last'],
array(),
);
}
- $userLink = $this->sk->revUserTools( $rev );
+ $userLink = Linker::revUserTools( $rev );
$size = $row->rev_len;
if( !is_null( $size ) ) {
- $stxt = $this->sk->formatRevisionSize( $size );
+ $stxt = Linker::formatRevisionSize( $size );
}
- $comment = $this->sk->revComment( $rev );
+ $comment = Linker::revComment( $rev );
return "<li>$checkBox ($last) $pageLink . . $userLink $stxt $comment</li>";
}
* @return string
*/
function getPageLink( $row, $titleObj, $ts, $target ) {
- global $wgLang;
-
if( !$this->userCan( $row, Revision::DELETED_TEXT ) ) {
return '<span class="history-deleted">' .
- $wgLang->timeanddate( $ts, true ) . '</span>';
+ $this->getLang()->timeanddate( $ts, true ) . '</span>';
} else {
- $link = $this->sk->linkKnown(
+ $link = Linker::linkKnown(
$titleObj,
- $wgLang->timeanddate( $ts, true ),
+ $this->getLang()->timeanddate( $ts, true ),
array(),
array(
'target' => $target,
}
function merge() {
- global $wgOut;
# Get the titles directly from the IDs, in case the target page params
# were spoofed. The queries are done based on the IDs, so it's best to
# keep it consistent...
);
# Destination page must exist with revisions
if( !$maxtimestamp ) {
- $wgOut->addWikiMsg( 'mergehistory-fail' );
+ $this->getOutput()->addWikiMsg( 'mergehistory-fail' );
return false;
}
# Get the latest timestamp of the source
);
# $this->mTimestamp must be older than $maxtimestamp
if( $this->mTimestamp >= $maxtimestamp ) {
- $wgOut->addWikiMsg( 'mergehistory-fail' );
+ $this->getOutput()->addWikiMsg( 'mergehistory-fail' );
return false;
}
# Update the revisions
$destTitle->invalidateCache(); // update histories
# Check if this did anything
if( !$count ) {
- $wgOut->addWikiMsg( 'mergehistory-fail' );
+ $this->getOutput()->addWikiMsg( 'mergehistory-fail' );
return false;
}
# Update our logs
array( $destTitle->getPrefixedText(), $timestampLimit )
);
- $wgOut->addHTML(
+ $this->getOutput()->addHTML(
wfMsgExt( 'mergehistory-success', array('parseinline'),
$targetTitle->getPrefixedText(), $destTitle->getPrefixedText(), $count ) );
);
$this->maxTimestamp = $maxtimestamp;
- parent::__construct();
- }
-
- function getTitle() {
- return SpecialPage::getTitleFor( 'Contributions' );
+ parent::__construct( $form->getContext() );
}
function getStartBody() {
$this->setHeaders();
$this->outputHeader();
- $pager = new NewFilesPager( $par );
+ $pager = new NewFilesPager( $this->getContext(), $par );
if ( !$this->including() ) {
$form = $pager->getForm();
*/
class NewFilesPager extends ReverseChronologicalPager {
- function __construct( $par = null ) {
- global $wgRequest;
+ function __construct( RequestContext $context, $par = null ) {
+ $this->like = $context->getRequest()->getText( 'like' );
+ $this->showbots = $context->getRequest()->getBool( 'showbots' , 0 );
- $this->like = $wgRequest->getText( 'like' );
- $this->showbots = $wgRequest->getBool( 'showbots' , 0 );
- $this->skin = $this->getSkin();
-
- parent::__construct();
- }
-
- function getTitle() {
- return SpecialPage::getTitleFor( 'Newimages' );
+ parent::__construct( $context );
}
function getQueryInfo() {
}
function formatRow( $row ) {
- global $wgLang;
-
$name = $row->img_name;
$user = User::newFromId( $row->img_user );
$title = Title::makeTitle( NS_FILE, $name );
- $ul = $this->skin->link( $user->getUserpage(), $user->getName() );
+ $ul = Linker::link( $user->getUserpage(), $user->getName() );
$this->gallery->add(
$title,
"$ul<br />\n<i>"
- . htmlspecialchars( $wgLang->timeanddate( $row->img_timestamp, true ) )
+ . htmlspecialchars( $this->getLang()->timeanddate( $row->img_timestamp, true ) )
. "</i><br />\n"
);
}
function getForm() {
- global $wgRequest, $wgMiserMode;
+ global $wgMiserMode;
$fields = array(
'like' => array(
'type' => 'check',
'label' => wfMessage( 'showhidebots', wfMsg( 'show' ) ),
'name' => 'showbots',
- # 'default' => $wgRequest->getBool( 'showbots', 0 ),
+ # 'default' => $this->getRequest()->getBool( 'showbots', 0 ),
),
'limit' => array(
'type' => 'hidden',
- 'default' => $wgRequest->getText( 'limit' ),
+ 'default' => $this->getRequest()->getText( 'limit' ),
'name' => 'limit',
),
'offset' => array(
'type' => 'hidden',
- 'default' => $wgRequest->getText( 'offset' ),
+ 'default' => $this->getRequest()->getText( 'offset' ),
'name' => 'offset',
),
);
unset( $fields['like'] );
}
- $form = new HTMLForm( $fields );
+ $form = new HTMLForm( $fields, $this->getContext() );
$form->setTitle( $this->getTitle() );
$form->setSubmitText( wfMsg( 'ilsubmit' ) );
$form->setMethod( 'get' );
$self = $this->getTitle();
foreach ( $filters as $key => $msg ) {
$onoff = 1 - $this->opts->getValue( $key );
- $link = $this->getSkin()->link( $self, $showhide[$onoff], array(),
+ $link = Linker::link( $self, $showhide[$onoff], array(),
array( $key => $onoff ) + $changed
);
$links[$key] = wfMsgHtml( $msg, $link );
$query['rcid'] = $result->rc_id;
}
- $plink = $this->getSkin()->linkKnown(
+ $plink = Linker::linkKnown(
$title,
null,
array( 'class' => 'mw-newpages-pagename' ),
$query,
array( 'known' ) // Set explicitly to avoid the default of 'known','noclasses'. This breaks the colouration for stubs
);
- $histLink = $this->getSkin()->linkKnown(
+ $histLink = Linker::linkKnown(
$title,
wfMsgHtml( 'hist' ),
array(),
']'
);
- $ulink = $this->getSkin()->revUserTools( $rev );
- $comment = $this->getSkin()->revComment( $rev );
+ $ulink = Linker::revUserTools( $rev );
+ $comment = Linker::revComment( $rev );
if ( $this->patrollable( $result ) ) {
$classes[] = 'not-patrolled';
protected $mForm;
function __construct( $form, FormOptions $opts ) {
- parent::__construct();
+ parent::__construct( $form->getContext() );
$this->mForm = $form;
$this->opts = $opts;
}
- /**
- * @return Title
- */
- function getTitle() {
- static $title = null;
- if ( $title === null ) {
- $title = $this->mForm->getTitle();
- }
- return $title;
- }
-
- /**
- * @return User
- */
- function getUser() {
- static $user = null;
- if ( $user === null ) {
- $user = $this->mForm->getUser();
- }
- return $user;
- }
-
function getQueryInfo() {
global $wgEnableNewpagesUserFilter, $wgGroupPermissions;
$conds = array();
}
public function execute( $par ) {
- global $wgOut, $wgRequest;
-
$this->setHeaders();
$this->outputHeader();
Title::purgeExpiredRestrictions();
}
- $type = $wgRequest->getVal( $this->IdType );
- $level = $wgRequest->getVal( $this->IdLevel );
- $sizetype = $wgRequest->getVal( 'sizetype' );
- $size = $wgRequest->getIntOrNull( 'size' );
- $NS = $wgRequest->getIntOrNull( 'namespace' );
- $indefOnly = $wgRequest->getBool( 'indefonly' ) ? 1 : 0;
- $cascadeOnly = $wgRequest->getBool('cascadeonly') ? 1 : 0;
+ $request = $this->getRequest();
+ $type = $request->getVal( $this->IdType );
+ $level = $request->getVal( $this->IdLevel );
+ $sizetype = $request->getVal( 'sizetype' );
+ $size = $request->getIntOrNull( 'size' );
+ $NS = $request->getIntOrNull( 'namespace' );
+ $indefOnly = $request->getBool( 'indefonly' ) ? 1 : 0;
+ $cascadeOnly = $request->getBool('cascadeonly') ? 1 : 0;
$pager = new ProtectedPagesPager( $this, array(), $type, $level, $NS, $sizetype, $size, $indefOnly, $cascadeOnly );
- $wgOut->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size, $indefOnly, $cascadeOnly ) );
+ $this->getOutput()->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size, $indefOnly, $cascadeOnly ) );
if( $pager->getNumRows() ) {
$s = $pager->getNavigationBar();
} else {
$s = '<p>' . wfMsgHtml( 'protectedpagesempty' ) . '</p>';
}
- $wgOut->addHTML( $s );
+ $this->getOutput()->addHTML( $s );
}
/**
* @return string Formatted <li> element
*/
public function formatRow( $row ) {
- global $wgUser, $wgLang;
-
wfProfileIn( __METHOD__ );
- static $skin = null, $infinity = null;
+ static $infinity = null;
- if( is_null( $skin ) ){
- $skin = $this->getSkin();
+ if( is_null( $infinity ) ){
$infinity = wfGetDB( DB_SLAVE )->getInfinity();
}
$title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
- $link = $skin->link( $title );
+ $link = Linker::link( $title );
$description_items = array ();
}
$stxt = '';
+ $lang = $this->getLang();
- $expiry = $wgLang->formatExpiry( $row->pr_expiry, TS_MW );
+ $expiry = $lang->formatExpiry( $row->pr_expiry, TS_MW );
if( $expiry != $infinity ) {
$expiry_description = wfMsg(
'protect-expiring-local',
- $wgLang->timeanddate( $expiry, true ),
- $wgLang->date( $expiry, true ),
- $wgLang->time( $expiry, true )
+ $lang->timeanddate( $expiry, true ),
+ $lang->date( $expiry, true ),
+ $lang->time( $expiry, true )
);
$description_items[] = htmlspecialchars($expiry_description);
}
if(!is_null($size = $row->page_len)) {
- $stxt = $wgLang->getDirMark() . ' ' . $skin->formatRevisionSize( $size );
+ $stxt = $lang->getDirMark() . ' ' . Linker::formatRevisionSize( $size );
}
# Show a link to the change protection form for allowed users otherwise a link to the protection log
- if( $wgUser->isAllowed( 'protect' ) ) {
- $changeProtection = ' (' . $skin->linkKnown(
+ if( $this->getUser()->isAllowed( 'protect' ) ) {
+ $changeProtection = ' (' . Linker::linkKnown(
$title,
wfMsgHtml( 'protect_change' ),
array(),
) . ')';
} else {
$ltitle = SpecialPage::getTitleFor( 'Log' );
- $changeProtection = ' (' . $skin->linkKnown(
+ $changeProtection = ' (' . Linker::linkKnown(
$ltitle,
wfMsgHtml( 'protectlogpage' ),
array(),
return Html::rawElement(
'li',
array(),
- wfSpecialList( $link . $stxt, $wgLang->commaList( $description_items ), false ) . $changeProtection ) . "\n";
+ wfSpecialList( $link . $stxt, $lang->commaList( $description_items ), false ) . $changeProtection ) . "\n";
}
/**
*/
protected function showOptions( $namespace, $type='edit', $level, $sizetype, $size, $indefOnly, $cascadeOnly ) {
global $wgScript;
- $title = SpecialPage::getTitleFor( 'Protectedpages' );
+ $title = $this->getTitle();
return Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
Xml::openElement( 'fieldset' ) .
Xml::element( 'legend', array(), wfMsg( 'protectedpages' ) ) .
$this->size = intval($size);
$this->indefonly = (bool)$indefonly;
$this->cascadeonly = (bool)$cascadeonly;
- parent::__construct();
+ parent::__construct( $form->getContext() );
}
function getStartBody() {
return '';
}
- function getTitle() {
- return SpecialPage::getTitleFor( 'Protectedpages' );
- }
-
function formatRow( $row ) {
return $this->mForm->formatRow( $row );
}
}
function execute( $par ) {
- global $wgOut, $wgRequest;
-
$this->setHeaders();
$this->outputHeader();
Title::purgeExpiredRestrictions();
}
- $type = $wgRequest->getVal( $this->IdType );
- $level = $wgRequest->getVal( $this->IdLevel );
- $sizetype = $wgRequest->getVal( 'sizetype' );
- $size = $wgRequest->getIntOrNull( 'size' );
- $NS = $wgRequest->getIntOrNull( 'namespace' );
+ $request = $this->getRequest();
+ $type = $request->getVal( $this->IdType );
+ $level = $request->getVal( $this->IdLevel );
+ $sizetype = $request->getVal( 'sizetype' );
+ $size = $request->getIntOrNull( 'size' );
+ $NS = $request->getIntOrNull( 'namespace' );
$pager = new ProtectedTitlesPager( $this, array(), $type, $level, $NS, $sizetype, $size );
- $wgOut->addHTML( $this->showOptions( $NS, $type, $level ) );
+ $this->getOutput()->addHTML( $this->showOptions( $NS, $type, $level ) );
if ( $pager->getNumRows() ) {
$s = $pager->getNavigationBar();
} else {
$s = '<p>' . wfMsgHtml( 'protectedtitlesempty' ) . '</p>';
}
- $wgOut->addHTML( $s );
+ $this->getOutput()->addHTML( $s );
}
/**
* @return string
*/
function formatRow( $row ) {
- global $wgLang;
-
wfProfileIn( __METHOD__ );
- static $skin = null, $infinity = null;
+ static $infinity = null;
- if( is_null( $skin ) ){
- $skin = $this->getSkin();
+ if( is_null( $infinity ) ){
$infinity = wfGetDB( DB_SLAVE )->getInfinity();
}
$title = Title::makeTitleSafe( $row->pt_namespace, $row->pt_title );
- $link = $skin->link( $title );
+ $link = Linker::link( $title );
$description_items = array ();
$description_items[] = $protType;
- $expiry = strlen( $row->pt_expiry ) ? $wgLang->formatExpiry( $row->pt_expiry, TS_MW ) : $infinity;
+ $expiry = strlen( $row->pt_expiry ) ? $lang->formatExpiry( $row->pt_expiry, TS_MW ) : $infinity;
if( $expiry != $infinity ) {
-
$expiry_description = wfMsg(
'protect-expiring-local',
- $wgLang->timeanddate( $expiry, true ),
- $wgLang->date( $expiry, true ),
- $wgLang->time( $expiry, true )
+ $lang->timeanddate( $expiry, true ),
+ $lang->date( $expiry, true ),
+ $lang->time( $expiry, true )
);
$description_items[] = htmlspecialchars($expiry_description);
function showOptions( $namespace, $type='edit', $level ) {
global $wgScript;
$action = htmlspecialchars( $wgScript );
- $title = SpecialPage::getTitleFor( 'Protectedtitles' );
+ $title = $this->getTitle();
$special = htmlspecialchars( $title->getPrefixedDBkey() );
return "<form action=\"$action\" method=\"get\">\n" .
'<fieldset>' .
$this->level = $level;
$this->namespace = $namespace;
$this->size = intval($size);
- parent::__construct();
+ parent::__construct( $form->getContext() );
}
function getStartBody() {