Index: trunk/extensions/AbuseFilter/AbuseFilter.php |
— | — | @@ -110,7 +110,8 @@ |
111 | 111 | 'scripts' => 'ext.abuseFilter.edit.js', |
112 | 112 | 'messages' => array( |
113 | 113 | 'abusefilter-edit-syntaxok', |
114 | | - 'abusefilter-edit-syntaxerr' |
| 114 | + 'abusefilter-edit-syntaxerr', |
| 115 | + 'unknown-error', |
115 | 116 | ), |
116 | 117 | 'dependencies' => array( |
117 | 118 | 'jquery.textSelection', |
Index: trunk/extensions/AbuseFilter/modules/ext.abuseFilter.edit.js |
— | — | @@ -61,6 +61,13 @@ |
62 | 62 | .show() |
63 | 63 | .removeClass('mw-abusefilter-syntaxresult-ok mw-abusefilter-syntaxresult-error'); |
64 | 64 | |
| 65 | + if ( data === undefined ) { |
| 66 | + $el.text( mw.msg( 'unknown-error' ) ) |
| 67 | + .attr( 'class', 'mw-abusefilter-syntaxresult-error' ) |
| 68 | + .data( 'syntaxOk', false ); |
| 69 | + return; |
| 70 | + } |
| 71 | + |
65 | 72 | if ( data.status == 'ok' ) { |
66 | 73 | // Successful |
67 | 74 | $el.text( mw.msg( 'abusefilter-edit-syntaxok' ) ) |
— | — | @@ -115,7 +122,9 @@ |
116 | 123 | abflimit: 1 |
117 | 124 | }, function ( data ) { |
118 | 125 | $.removeSpinner( 'fetch-spinner' ); |
119 | | - $filterBox.text( data.query.abusefilters[0].pattern ); |
| 126 | + if ( data.query.abusefilters[0] !== undefined ) { |
| 127 | + $filterBox.text( data.query.abusefilters[0].pattern ); |
| 128 | + } |
120 | 129 | } |
121 | 130 | ); |
122 | 131 | }; |
— | — | @@ -126,6 +135,7 @@ |
127 | 136 | */ |
128 | 137 | this.hideDeselectedActions = function() { |
129 | 138 | $( 'input.mw-abusefilter-action-checkbox' ).each( function() { |
| 139 | + // mw-abusefilter-action-checkbox-{$action} |
130 | 140 | var action = this.id.substr( 31 ); |
131 | 141 | var $params = $( '#mw-abusefilter-' + action + '-parameters' ); |
132 | 142 | |
— | — | @@ -149,7 +159,7 @@ |
150 | 160 | title: 'MediaWiki:' + message, |
151 | 161 | action: 'render' |
152 | 162 | }, function( data ) { |
153 | | - $( '#mw-abusefilter-warn-preview' ).html( data ) |
| 163 | + $( '#mw-abusefilter-warn-preview' ).html( data ) |
154 | 164 | } ); |
155 | 165 | }; |
156 | 166 | |
Index: trunk/extensions/AbuseFilter/modules/ext.abuseFilter.tools.js |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | $.removeSpinner( 'abusefilter-expr' ); |
33 | 33 | |
34 | 34 | $( '#mw-abusefilter-expr-result' ) |
35 | | - .html( mw.html.escape( data.abusefilterevalexpression.result ) ); |
| 35 | + .text( mw.html.escape( data.abusefilterevalexpression.result ) ); |
36 | 36 | }; |
37 | 37 | |
38 | 38 | /** |
Index: trunk/extensions/AbuseFilter/api/ApiAbuseFilterCheckMatch.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | } |
14 | 14 | |
15 | 15 | if ( $params['vars'] ) { |
16 | | - $vars = json_decode( $params['vars'], true ); |
| 16 | + $vars = FormatJson::decode( $params['vars'], true ); |
17 | 17 | } elseif ( $params['rcid'] ) { |
18 | 18 | $dbr = wfGetDB( DB_SLAVE ); |
19 | 19 | $row = $dbr->selectRow( |
Index: trunk/extensions/AbuseFilter/api/ApiAbuseFilterUnblockAutopromote.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | $user = User::newFromName( $params['user'] ); |
14 | 14 | |
15 | 15 | if ( $user === false ) { |
16 | | - // Same as below |
| 16 | + // Oh god this is so bad but this message uses GENDER |
17 | 17 | $msg = wfMsgExt( 'abusefilter-reautoconfirm-none', array( 'parsemag' ), $params['user'] ); |
18 | 18 | $this->dieUsage( $msg, 'notsuspended' ); |
19 | 19 | } |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | $key = AbuseFilter::autoPromoteBlockKey( $user ); |
23 | 23 | |
24 | 24 | if ( !$wgMemc->get( $key ) ) { |
25 | | - // Oh god this is so bad but this message uses GENDER |
| 25 | + // Same as above :( |
26 | 26 | $msg = wfMsgExt( 'abusefilter-reautoconfirm-none', array( 'parsemag' ), $params['user'] ); |
27 | 27 | $this->dieUsage( $msg, 'notsuspended' ); |
28 | 28 | } |