r92140 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92139‎ | r92140 | r92141 >
Date:04:57, 14 July 2011
Author:robin
Status:ok
Tags:
Comment:
(bug 25898) AbuseFilter: clearer permission error when attempting to view diff of private filter
Also change some link functions to use Linker::link*
Modified paths:
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterViewDiff.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewDiff.php
@@ -11,8 +11,7 @@
1212 function show() {
1313 $show = $this->loadData();
1414
15 - global $wgOut, $wgUser, $wgLang;
16 - $this->mSkin = $wgUser->getSkin();
 15+ global $wgOut, $wgLang;
1716
1817 $links = array();
1918 if ( $this->mFilter ) {
@@ -21,7 +20,7 @@
2221 }
2322
2423 foreach ( $links as $msg => $title ) {
25 - $links[$msg] = $this->mSkin->link( $title, wfMsgExt( $msg, 'parseinline' ) );
 24+ $links[$msg] = Linker::link( $title, wfMsgExt( $msg, 'parseinline' ) );
2625 }
2726
2827 $backlinks = $wgLang->pipeList( $links );
@@ -33,10 +32,18 @@
3433 }
3534
3635 function loadData() {
 36+ global $wgUser;
3737 $oldSpec = $this->mParams[3];
3838 $newSpec = $this->mParams[4];
3939 $this->mFilter = $this->mParams[1];
4040
 41+ if ( AbuseFilter::filterHidden( $this->mFilter ) &&
 42+ !$wgUser->isAllowed( 'abusefilter-modify' ) ) {
 43+ global $wgOut;
 44+ $wgOut->addWikiMsg( 'abusefilter-history-error-hidden' );
 45+ return false;
 46+ }
 47+
4148 $this->mOldVersion = $this->loadSpec( $oldSpec, $newSpec );
4249 $this->mNewVersion = $this->loadSpec( $newSpec, $oldSpec );
4350
@@ -53,13 +60,6 @@
5461 static $dependentSpecs = array( 'prev', 'next' );
5562 static $cache = array();
5663
57 - global $wgUser;
58 -
59 - if ( AbuseFilter::filterHidden( $this->mFilter ) &&
60 - !$wgUser->isAllowed( 'abusefilter-modify' ) ) {
61 - return null;
62 - }
63 -
6464 if ( isset( $cache[$spec] ) )
6565 return $cache[$spec];
6666
@@ -153,15 +153,13 @@
154154 }
155155
156156 function formatVersionLink( $timestamp, $history_id ) {
157 - global $wgLang, $wgUser;
 157+ global $wgLang;
158158
159 - $sk = $wgUser->getSkin();
160 -
161159 $filter = $this->mFilter;
162160 $text = $wgLang->timeanddate( $timestamp, true );
163161 $title = $this->getTitle( "history/$filter/item/$history_id" );
164162
165 - $link = $sk->link( $title, $text );
 163+ $link = Linker::link( $title, $text );
166164
167165 return $link;
168166 }
@@ -180,12 +178,11 @@
181179 $newVersion['meta']['history_id']
182180 );
183181
184 - $sk = $this->mSkin;
185 - $oldUserLink = $sk->userLink(
 182+ $oldUserLink = Linker::userLink(
186183 $oldVersion['meta']['modified_by'],
187184 $oldVersion['meta']['modified_by_text']
188185 );
189 - $newUserLink = $sk->userLink(
 186+ $newUserLink = Linker::userLink(
190187 $newVersion['meta']['modified_by'],
191188 $newVersion['meta']['modified_by_text']
192189 );

Status & tagging log