mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 21:53:35 +00:00
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:
parent
f1ce33bc5e
commit
453af554b9
Notes:
Raimond Spekking
2012-03-12 20:46:25 +00:00
|
@ -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 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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' );
|
||||
|
|
Loading…
Reference in a new issue