Index: trunk/extensions/AbuseFilter/AbuseFilter.parser.php |
— | — | @@ -207,7 +207,7 @@ |
208 | 208 | |
209 | 209 | public static function keywordRegex( $str, $regex, $pos, $insensitive = false ) { |
210 | 210 | $str = $str->toString(); |
211 | | - $pattern = $regex = $regex->toString(); |
| 211 | + $pattern = $regex->toString(); |
212 | 212 | |
213 | 213 | $pattern = preg_replace( '!(\\\\\\\\)*(\\\\)?/!', '$1\/', $pattern ); |
214 | 214 | $pattern = "/$pattern/u"; |
— | — | @@ -1279,7 +1279,6 @@ |
1280 | 1280 | if ( preg_match( $radixRegex, $code, $matches, 0, $offset ) ) { |
1281 | 1281 | $input = $matches[1]; |
1282 | 1282 | $baseChar = @$matches[2]; |
1283 | | - $num = null; |
1284 | 1283 | // Sometimes the base char gets mixed in with the rest of it because |
1285 | 1284 | // the regex targets hex, too. |
1286 | 1285 | // This mostly happens with binary |
— | — | @@ -1378,7 +1377,7 @@ |
1379 | 1378 | $s = $args[0]->toString(); |
1380 | 1379 | |
1381 | 1380 | $s = preg_replace( '/[\d\W]+/', '', $s ); |
1382 | | - $s = strtolower( $value ); |
| 1381 | + $s = strtolower( $s ); |
1383 | 1382 | return new AFPData( AFPData::DString, $s ); |
1384 | 1383 | } |
1385 | 1384 | |
— | — | @@ -1442,20 +1441,16 @@ |
1443 | 1442 | ); |
1444 | 1443 | } |
1445 | 1444 | |
1446 | | - $offset = -1; |
1447 | | - |
1448 | 1445 | if ( count( $args ) == 1 ) { |
1449 | 1446 | $count = count( explode( ',', $args[0]->toString() ) ); |
1450 | 1447 | } else { |
1451 | | - $needle = $regex = $args[0]->toString(); |
| 1448 | + $needle = $args[0]->toString(); |
1452 | 1449 | $haystack = $args[1]->toString(); |
1453 | | - $pos = $this->mCur->pos; |
1454 | 1450 | |
1455 | 1451 | # Munge the regex |
1456 | 1452 | $needle = preg_replace( '!(\\\\\\\\)*(\\\\)?/!', '$1\/', $needle ); |
1457 | 1453 | $needle = "/$needle/u"; |
1458 | 1454 | |
1459 | | - $count = 0; |
1460 | 1455 | $matches = array(); |
1461 | 1456 | |
1462 | 1457 | try { |
— | — | @@ -1554,7 +1549,6 @@ |
1555 | 1550 | } |
1556 | 1551 | |
1557 | 1552 | protected function rmspecials( $s ) { |
1558 | | - $orig = $s; |
1559 | 1553 | $s = preg_replace( '/[^\p{L}\p{N}]/u', '', $s ); |
1560 | 1554 | |
1561 | 1555 | return $s; |
Index: trunk/extensions/AbuseFilter/abusefilter.css |
— | — | @@ -65,9 +65,8 @@ |
66 | 66 | #mw-abusefilter-syntaxresult, |
67 | 67 | li.mw-abusefilter-changeslist-nomatch, |
68 | 68 | li.mw-abusefilter-changeslist-match { |
69 | | - background-repeat: no-repeat; |
| 69 | + background: no-repeat left center; |
70 | 70 | padding-left: 25px; |
71 | | - background-position: left center; |
72 | 71 | } |
73 | 72 | |
74 | 73 | .mw-abusefilter-navigation { |
Index: trunk/extensions/AbuseFilter/ApiQueryAbuseFilters.php |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | $showhidden = $wgUser->isAllowed( 'abusefilter-modify' ); |
99 | 99 | |
100 | 100 | $count = 0; |
101 | | - while ( $row = $res->fetchObject() ) { |
| 101 | + foreach ( $res as $row ) { |
102 | 102 | if ( ++$count > $params['limit'] ) { |
103 | 103 | // We've had enough |
104 | 104 | $this->setContinueEnumParameter( 'startid', $row->af_id ); |
Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php |
— | — | @@ -1219,7 +1219,6 @@ |
1220 | 1220 | |
1221 | 1221 | // Figure out if we've triggered overflows and blocks. |
1222 | 1222 | $overflow_triggered = ( self::$condCount > $wgAbuseFilterConditionLimit ); |
1223 | | - $filter_triggered = count( $blocking_filters ) > 0; |
1224 | 1223 | |
1225 | 1224 | // Store some keys... |
1226 | 1225 | $overflow_key = self::filterLimitReachedKey(); |
— | — | @@ -1589,9 +1588,13 @@ |
1590 | 1589 | return $vars; |
1591 | 1590 | } |
1592 | 1591 | |
| 1592 | + /** |
| 1593 | + * @static |
| 1594 | + * @param $title Title |
| 1595 | + * @return AbuseFilterVariableHolder |
| 1596 | + */ |
1593 | 1597 | public static function getEditVars( $title ) { |
1594 | 1598 | $vars = new AbuseFilterVariableHolder; |
1595 | | - $article = new Article( $title ); |
1596 | 1599 | |
1597 | 1600 | $vars->setLazyLoadVar( 'edit_diff', 'diff', |
1598 | 1601 | array( 'oldtext-var' => 'old_wikitext', 'newtext-var' => 'new_wikitext' ) ); |
Index: trunk/extensions/AbuseFilter/AbuseFilterVariableHolder.php |
— | — | @@ -330,7 +330,7 @@ |
331 | 331 | ); |
332 | 332 | |
333 | 333 | $users = array(); |
334 | | - while ( $user = $dbr->fetchRow( $res ) ) { |
| 334 | + foreach ( $res as $user ) { |
335 | 335 | $users[] = $user[0]; |
336 | 336 | } |
337 | 337 | $result = $users; |
Index: trunk/extensions/AbuseFilter/edit.js |
— | — | @@ -152,7 +152,7 @@ |
153 | 153 | addOnloadHook( function() { |
154 | 154 | addHandler( document.getElementById( wgFilterBoxName ), 'keyup', function() { |
155 | 155 | el = document.getElementById( 'mw-abusefilter-syntaxresult' ); |
156 | | - if ( el.syntaxOk == true ) { |
| 156 | + if ( el.syntaxOk ) { |
157 | 157 | el.style.display = 'none'; |
158 | 158 | } |
159 | 159 | } ); |
Index: trunk/extensions/AbuseFilter/ApiQueryAbuseLog.php |
— | — | @@ -104,7 +104,7 @@ |
105 | 105 | $res = $this->select( __METHOD__ ); |
106 | 106 | |
107 | 107 | $count = 0; |
108 | | - while ( $row = $res->fetchObject() ) { |
| 108 | + foreach ( $res as $row ) { |
109 | 109 | if ( ++$count > $params['limit'] ) { |
110 | 110 | // We've had enough |
111 | 111 | $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->afl_timestamp ) ); |
Index: trunk/extensions/AbuseFilter/AbuseFilter.hooks.php |
— | — | @@ -155,7 +155,7 @@ |
156 | 156 | array( 'abuse_filter' => array( 'INNER JOIN', 'afa_filter=af_id' ) ) |
157 | 157 | ); |
158 | 158 | |
159 | | - while ( $row = $res->fetchObject() ) { |
| 159 | + foreach ( $res as $row ) { |
160 | 160 | $emptyTags = array_filter( |
161 | 161 | array_merge( explode( "\n", $row->afa_parameters ), $emptyTags ) |
162 | 162 | ); |