r111131 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111130‎ | r111131 | r111132 >
Date:00:26, 10 February 2012
Author:werdna
Status:ok (Comments)
Tags:
Comment:
AbuseFilter: Do not show the syntax checking / boxes / etc if the user cannot edit.
* Resolves bug 20472.
* Patch by EdoDodo with modifications.
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php
@@ -24,9 +24,7 @@
2525 public static $builderValues = array(
2626 'op-arithmetic' => array(
2727 '+' => 'addition',
28 - '-' => 'subtraction',
29 - '*' => 'multiplication',
30 - '/' => 'divide',
 28+ '-' => 'subtraction', '*' => 'multiplication', '/' => 'divide',
3129 '%' => 'modulo',
3230 '**' => 'pow'
3331 ),
@@ -1318,45 +1316,47 @@
13191317 $rules = rtrim( $rules ) . "\n";
13201318 $rules = Xml::textarea( $textName, $rules, 40, 5, $textareaAttrib );
13211319
1322 - $dropDown = self::getBuilderValues();
1323 - // Generate builder drop-down
1324 - $builder = '';
 1320+ if ( $canEdit ) {
 1321+ $dropDown = self::getBuilderValues();
 1322+ // Generate builder drop-down
 1323+ $builder = '';
13251324
1326 - $builder .= Xml::option( wfMsg( 'abusefilter-edit-builder-select' ) );
 1325+ $builder .= Xml::option( wfMsg( 'abusefilter-edit-builder-select' ) );
13271326
1328 - foreach ( $dropDown as $group => $values ) {
1329 - $builder .=
1330 - Xml::openElement(
1331 - 'optgroup',
1332 - array( 'label' => wfMsg( "abusefilter-edit-builder-group-$group" ) )
1333 - ) . "\n";
1334 -
1335 - foreach ( $values as $content => $name ) {
 1327+ foreach ( $dropDown as $group => $values ) {
13361328 $builder .=
1337 - Xml::option(
1338 - wfMsg( "abusefilter-edit-builder-$group-$name" ),
1339 - $content
 1329+ Xml::openElement(
 1330+ 'optgroup',
 1331+ array( 'label' => wfMsg( "abusefilter-edit-builder-group-$group" ) )
13401332 ) . "\n";
 1333+
 1334+ foreach ( $values as $content => $name ) {
 1335+ $builder .=
 1336+ Xml::option(
 1337+ wfMsg( "abusefilter-edit-builder-$group-$name" ),
 1338+ $content
 1339+ ) . "\n";
 1340+ }
 1341+
 1342+ $builder .= Xml::closeElement( 'optgroup' ) . "\n";
13411343 }
13421344
1343 - $builder .= Xml::closeElement( 'optgroup' ) . "\n";
 1345+ $rules .=
 1346+ Xml::tags(
 1347+ 'select',
 1348+ array( 'id' => 'wpFilterBuilder', ),
 1349+ $builder
 1350+ ) . ' ';
 1351+
 1352+ // Add syntax checking
 1353+ $rules .= Xml::element( 'input',
 1354+ array(
 1355+ 'type' => 'button',
 1356+ 'value' => wfMsg( 'abusefilter-edit-check' ),
 1357+ 'id' => 'mw-abusefilter-syntaxcheck'
 1358+ ) + $noTestAttrib );
13441359 }
13451360
1346 - $rules .=
1347 - Xml::tags(
1348 - 'select',
1349 - array( 'id' => 'wpFilterBuilder', ),
1350 - $builder
1351 - ) . ' ';
1352 -
1353 - // Add syntax checking
1354 - $rules .= Xml::element( 'input',
1355 - array(
1356 - 'type' => 'button',
1357 - 'value' => wfMsg( 'abusefilter-edit-check' ),
1358 - 'id' => 'mw-abusefilter-syntaxcheck'
1359 - ) + $noTestAttrib );
1360 -
13611361 if ( $addResultDiv )
13621362 $rules .= Xml::element( 'div',
13631363 array( 'id' => 'mw-abusefilter-syntaxresult', 'style' => 'display: none;' ),

Follow-up revisions

RevisionCommit summaryAuthorDate
r111174Revert formatting changes in r111131werdna18:20, 10 February 2012

Comments

#Comment by Nikerabbit (talk | contribs)   09:08, 10 February 2012

What's up with the first change?

#Comment by Werdna (talk | contribs)   18:21, 10 February 2012

Reverted that part in r111174.

Status & tagging log