Index: trunk/extensions/AbuseFilter/AbuseFilter.php |
— | — | @@ -57,8 +57,9 @@ |
58 | 58 | $wgAvailableRights[] = 'abusefilter-view'; |
59 | 59 | $wgAvailableRights[] = 'abusefilter-log'; |
60 | 60 | $wgAvailableRights[] = 'abusefilter-private'; |
| 61 | +$wgAvailableRights[] = 'abusefilter-modify-restricted'; |
61 | 62 | |
62 | | -$wgAbuseFilterAvailableActions = array( 'flag', 'throttle', 'warn', 'disallow', 'blockautopromote', 'block', 'degroup', 'rangeblock' /*, 'tag' Disabled for now to avoid trunk changes. */ ); |
| 63 | +$wgAbuseFilterAvailableActions = array( 'flag', 'throttle', 'warn', 'disallow', 'blockautopromote', 'block', 'degroup', /* Disabled because it's ridiculously excessive 'rangeblock'*/ /*, 'tag' Disabled for now to avoid trunk changes. */ ); |
63 | 64 | |
64 | 65 | // Conditions take about 4ms to check, so 100 conditions would take 400ms |
65 | 66 | // Currently, has no effect. |
— | — | @@ -80,4 +81,6 @@ |
81 | 82 | $wgAjaxExportList[] = 'AbuseFilter::ajaxReAutoconfirm'; |
82 | 83 | |
83 | 84 | // Bump the version number every time you change any of the .css/.js files |
84 | | -$wgAbuseFilterStyleVersion = 2; |
\ No newline at end of file |
| 85 | +$wgAbuseFilterStyleVersion = 2; |
| 86 | + |
| 87 | +$wgAbuseFilterRestrictedActions = array( 'block', 'degroup' ); |
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php |
— | — | @@ -25,7 +25,8 @@ |
26 | 26 | // Check syntax |
27 | 27 | $syntaxerr = AbuseFilter::checkSyntax( $wgRequest->getVal( 'wpFilterRules' ) ); |
28 | 28 | if ($syntaxerr !== true ) { |
29 | | - $wgOut->addHTML( $this->buildFilterEditor( wfMsgExt( 'abusefilter-edit-badsyntax', array( 'parseinline' ), array( $syntaxerr ) ), $filter, $history_id ) ); |
| 29 | + $wgOut->addHTML( $this->buildFilterEditor( wfMsgExt( 'abusefilter-edit-badsyntax', array( 'parse' ), array( $syntaxerr ) ), $filter, $history_id ) ); |
| 30 | + return; |
30 | 31 | } |
31 | 32 | |
32 | 33 | $dbw = wfGetDB( DB_MASTER ); |
— | — | @@ -37,11 +38,19 @@ |
38 | 39 | unset( $newRow->mOriginalRow ); |
39 | 40 | unset( $newRow->mOriginalActions ); |
40 | 41 | |
| 42 | + // Check for non-changes |
41 | 43 | if (!count($differences)) { |
42 | 44 | $wgOut->redirect( $this->getTitle()->getLocalURL() ); |
43 | 45 | return; |
44 | 46 | } |
45 | 47 | |
| 48 | + // Check for restricted actions |
| 49 | + global $wgAbuseFilterRestrictedActions; |
| 50 | + if ( count( array_intersect( $wgAbuseFilterRestrictedActions, array_keys( array_filter( $actions ) ) ) ) ) { |
| 51 | + $wgOut->addHTML( $this->buildFilterEditor( wfMsgExt( 'abusefilter-edit-restricted', 'parse' ), $this->mFilter, $history_id ) ); |
| 52 | + return; |
| 53 | + } |
| 54 | + |
46 | 55 | $newRow = get_object_vars($newRow); // Convert from object to array |
47 | 56 | |
48 | 57 | // Set last modifier. |
Index: trunk/extensions/AbuseFilter/AbuseFilter.i18n.php |
— | — | @@ -162,6 +162,7 @@ |
163 | 163 | 'abusefilter-edit-done-subtitle' => 'Filter edited', |
164 | 164 | 'abusefilter-edit-done' => "You have successfully saved your changes to filter $1.", |
165 | 165 | 'abusefilter-edit-badsyntax' => "There is a syntax error in the filter you specified. The output from the parser was: <pre>$1</pre>", |
| 166 | + 'abusefilter-edit-restricted' => 'You cannot edit this filter, because it contains one or more restricted actions. Please ask a user with permission to add restricted actions to make the change for you.', |
166 | 167 | 'abusefilter-edit-viewhistory' => "View this filter's history", |
167 | 168 | 'abusefilter-edit-history' => 'History', |
168 | 169 | 'abusefilter-edit-check' => 'Check syntax', |