Index: branches/wmf/1.17wmf1/extensions/TitleBlacklist/TitleBlacklist.list.php |
— | — | @@ -28,7 +28,6 @@ |
29 | 29 | //Try to find something in the cache |
30 | 30 | $cachedBlacklist = $wgMemc->get( wfMemcKey( "title_blacklist_entries" ) ); |
31 | 31 | if( is_array( $cachedBlacklist ) && count( $cachedBlacklist ) > 0 && ( $cachedBlacklist[0]->getFormatVersion() == self::VERSION ) ) { |
32 | | - |
33 | 32 | $this->mBlacklist = $cachedBlacklist; |
34 | 33 | wfProfileOut( __METHOD__ ); |
35 | 34 | return; |
— | — | @@ -105,7 +104,7 @@ |
106 | 105 | |
107 | 106 | return ''; |
108 | 107 | } |
109 | | - |
| 108 | + |
110 | 109 | /** |
111 | 110 | * Parse blacklist from a string |
112 | 111 | * |
— | — | @@ -116,8 +115,7 @@ |
117 | 116 | wfProfileIn( __METHOD__ ); |
118 | 117 | $lines = preg_split( "/\r?\n/", $list ); |
119 | 118 | $result = array(); |
120 | | - foreach ( $lines as $line ) |
121 | | - { |
| 119 | + foreach ( $lines as $line ) { |
122 | 120 | $line = TitleBlacklistEntry :: newFromString( $line ); |
123 | 121 | if ( $line ) { |
124 | 122 | $result[] = $line; |
— | — | @@ -147,7 +145,7 @@ |
148 | 146 | } |
149 | 147 | |
150 | 148 | /** |
151 | | - * Check whether the blacklist restricts |
| 149 | + * Check whether the blacklist restricts |
152 | 150 | * performing a specific action on the given Title |
153 | 151 | * |
154 | 152 | * @param $title Title to check |
— | — | @@ -161,18 +159,18 @@ |
162 | 160 | } |
163 | 161 | $blacklist = $this->getBlacklist(); |
164 | 162 | foreach ( $blacklist as $item ) { |
165 | | - if( !$item->matches( $title, $action ) ) { |
| 163 | + if( $item->matches( $title, $action ) ) { |
166 | 164 | if( $this->isWhitelisted( $title, $action ) ) { |
167 | 165 | return false; |
168 | 166 | } |
169 | | - return $item; |
| 167 | + return $item; // "returning true" |
170 | 168 | } |
171 | 169 | } |
172 | 170 | return false; |
173 | 171 | } |
174 | | - |
| 172 | + |
175 | 173 | /** |
176 | | - * Check whether it has been explicitly whitelisted that the |
| 174 | + * Check whether it has been explicitly whitelisted that the |
177 | 175 | * current User may perform a specific action on the given Title |
178 | 176 | * |
179 | 177 | * @param $title Title to check |
— | — | @@ -186,13 +184,13 @@ |
187 | 185 | } |
188 | 186 | $whitelist = $this->getWhitelist(); |
189 | 187 | foreach( $whitelist as $item ) { |
190 | | - if( !$item->matches( $title, $action ) ) { |
| 188 | + if( $item->matches( $title, $action ) ) { |
191 | 189 | return true; |
192 | 190 | } |
193 | 191 | } |
194 | 192 | return false; |
195 | 193 | } |
196 | | - |
| 194 | + |
197 | 195 | /** |
198 | 196 | * Get the current blacklist |
199 | 197 | * |
— | — | @@ -204,7 +202,7 @@ |
205 | 203 | } |
206 | 204 | return $this->mBlacklist; |
207 | 205 | } |
208 | | - |
| 206 | + |
209 | 207 | /* |
210 | 208 | * Get the current whitelist |
211 | 209 | * |
— | — | @@ -216,7 +214,7 @@ |
217 | 215 | } |
218 | 216 | return $this->mWhitelist; |
219 | 217 | } |
220 | | - |
| 218 | + |
221 | 219 | /** |
222 | 220 | * Get the text of a blacklist source via HTTP |
223 | 221 | * |
— | — | @@ -236,7 +234,7 @@ |
237 | 235 | } |
238 | 236 | return $result; |
239 | 237 | } |
240 | | - |
| 238 | + |
241 | 239 | /** |
242 | 240 | * Invalidate the blacklist cache |
243 | 241 | */ |
— | — | @@ -256,13 +254,14 @@ |
257 | 255 | foreach( $blacklist as $e ) { |
258 | 256 | wfSuppressWarnings(); |
259 | 257 | $regex = $e->getRegex(); |
260 | | - if( preg_match( "/{$regex}/u", '' ) === false ) |
| 258 | + if( preg_match( "/{$regex}/u", '' ) === false ) { |
261 | 259 | $badEntries[] = $e->getRaw(); |
| 260 | + } |
262 | 261 | wfRestoreWarnings(); |
263 | 262 | } |
264 | 263 | return $badEntries; |
265 | 264 | } |
266 | | - |
| 265 | + |
267 | 266 | /** |
268 | 267 | * Inidcates whether user can override blacklist on certain action. |
269 | 268 | * |
— | — | @@ -306,7 +305,8 @@ |
307 | 306 | * |
308 | 307 | * @param $title Title to check |
309 | 308 | * @param $action %Action to check |
310 | | - * @return TRUE if the user can; otherwise FALSE |
| 309 | + * @return TRUE if the the regex matches the title, and is not overridden |
| 310 | + * else false if it doesn't match (or was overridden) |
311 | 311 | */ |
312 | 312 | public function matches( $title, $action ) { |
313 | 313 | global $wgUser; |
— | — | @@ -315,24 +315,24 @@ |
316 | 316 | wfRestoreWarnings(); |
317 | 317 | if( $match ) { |
318 | 318 | if( isset( $this->mParams['autoconfirmed'] ) && $wgUser->isAllowed( 'autoconfirmed' ) ) { |
319 | | - return true; |
| 319 | + return false; |
320 | 320 | } |
321 | 321 | if( isset( $this->mParams['moveonly'] ) && $action != 'move' ) { |
322 | | - return true; |
| 322 | + return false; |
323 | 323 | } |
324 | 324 | if( isset( $this->mParams['newaccountonly'] ) && $action != 'new-account' ) { |
325 | | - return true; |
| 325 | + return false; |
326 | 326 | } |
327 | 327 | if( !isset( $this->mParams['noedit'] ) && $action == 'edit' ) { |
328 | | - return true; |
| 328 | + return false; |
329 | 329 | } |
330 | 330 | if ( isset( $this->mParams['reupload'] ) && $action == 'upload' ) { |
331 | 331 | // Special:Upload also checks 'create' permissions when not reuploading |
332 | | - return true; |
| 332 | + return false; |
333 | 333 | } |
334 | | - return false; |
| 334 | + return true; |
335 | 335 | } |
336 | | - return true; |
| 336 | + return false; |
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
Index: branches/wmf/1.17wmf1/includes/upload/UploadBase.php |
— | — | @@ -402,7 +402,7 @@ |
403 | 403 | } |
404 | 404 | $permErrors = $nt->getUserPermissionsErrors( 'edit', $user ); |
405 | 405 | $permErrorsUpload = $nt->getUserPermissionsErrors( 'upload', $user ); |
406 | | - if ( $nt->exists() ) { |
| 406 | + if ( !$nt->exists() ) { |
407 | 407 | $permErrorsCreate = $nt->getUserPermissionsErrors( 'createpage', $user ); |
408 | 408 | } else { |
409 | 409 | $permErrorsCreate = array(); |
Property changes on: branches/wmf/1.17wmf1/includes/upload/UploadBase.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
410 | 410 | Merged /trunk/phase3/includes/upload/UploadBase.php:r84573 |
Index: branches/wmf/1.17wmf1/includes/specials/SpecialUpload.php |
— | — | @@ -448,8 +448,8 @@ |
449 | 449 | $permErrors = $this->mUpload->verifyPermissions( $wgUser ); |
450 | 450 | if( $permErrors !== true ) { |
451 | 451 | $code = array_shift( $permErrors[0] ); |
452 | | - $this->showRecoverableUploadError( wfMsgExt( $code[0], |
453 | | - 'parseinline', $code[1] ) ); |
| 452 | + $this->showRecoverableUploadError( wfMsgExt( $code, |
| 453 | + 'parseinline', $permErrors[0] ) ); |
454 | 454 | return; |
455 | 455 | } |
456 | 456 | |
Property changes on: branches/wmf/1.17wmf1/includes/specials/SpecialUpload.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
457 | 457 | Merged /trunk/phase3/includes/specials/SpecialUpload.php:r84579 |