Added context where possible to main AbuseFilter class

Most of the rest cannot get a context since it originates from hooks with no context sources. Instead of just getting the main context we might as well wait for a proper solution.
This commit is contained in:
John Du Hart 2011-11-17 00:55:53 +00:00
parent f1ce33bc5e
commit 453af554b9
Notes: Raimond Spekking 2012-03-12 20:46:25 +00:00
3 changed files with 7 additions and 8 deletions

View file

@ -120,8 +120,7 @@ class AbuseFilter {
);
public static $editboxName = null;
public static function addNavigationLinks( $out, $sk, $pageType ) {
global $wgLang, $wgUser;
public static function addNavigationLinks( IContextSource $context, $pageType ) {
$linkDefs = array(
'home' => 'Special:AbuseFilter',
'recentchanges' => 'Special:AbuseFilter/history',
@ -130,7 +129,7 @@ class AbuseFilter {
'log' => 'Special:AbuseLog',
);
if ( $wgUser->isAllowed( 'abusefilter-modify' ) ) {
if ( $context->getUser()->isAllowed( 'abusefilter-modify' ) ) {
$linkDefs = array_merge( $linkDefs, array(
'tools' => 'Special:AbuseFilter/tools',
'import' => 'Special:AbuseFilter/import',
@ -160,16 +159,16 @@ class AbuseFilter {
if ( $name == $pageType ) {
$links[] = Xml::tags( 'strong', null, $msg );
} else {
$links[] = $sk->link( $title, $msg );
$links[] = $context->getSkin()->link( $title, $msg );
}
}
$linkStr = wfMsg( 'parentheses', $wgLang->pipeList( $links ) );
$linkStr = wfMsg( 'parentheses', $context->getLang()->pipeList( $links ) );
$linkStr = wfMsgExt( 'abusefilter-topnav', 'parseinline' ) . " $linkStr";
$linkStr = Xml::tags( 'div', array( 'class' => 'mw-abusefilter-navigation' ), $linkStr );
$out->setSubtitle( $linkStr );
$context->getOutput()->setSubtitle( $linkStr );
}
/**

View file

@ -95,7 +95,7 @@ class SpecialAbuseFilter extends SpecialPage {
}
// Links at the top
AbuseFilter::addNavigationLinks( $out, $this->getSkin(), $pageType );
AbuseFilter::addNavigationLinks( $this->getContext(), $pageType );
$v = new $view( $this, $params );
$v->show();

View file

@ -25,7 +25,7 @@ class SpecialAbuseLog extends SpecialPage {
$out = $this->getOutput();
$request = $this->getRequest();
AbuseFilter::addNavigationLinks( $out, $this->getSkin(), 'log' );
AbuseFilter::addNavigationLinks( $this->getContext(), 'log' );
$this->setHeaders();
$this->outputHeader( 'abusefilter-log-summary' );