Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -399,10 +399,9 @@ |
400 | 400 | * Returns true if a user can set $tag to $value. |
401 | 401 | * @param string $tag |
402 | 402 | * @param int $value |
403 | | - * @param array $config (optional page config) |
404 | 403 | * @returns bool |
405 | 404 | */ |
406 | | - public static function userCanSetTag( $tag, $value, $config = null ) { |
| 405 | + public static function userCanSetTag( $tag, $value ) { |
407 | 406 | global $wgUser; |
408 | 407 | # Sanity check tag and value |
409 | 408 | $levels = self::getTagLevels( $tag ); |
— | — | @@ -435,10 +434,9 @@ |
436 | 435 | * to the given levels for each tag. |
437 | 436 | * @param array $flags, suggested flags |
438 | 437 | * @param array $oldflags, pre-existing flags |
439 | | - * @param array $config, visibility settings |
440 | 438 | * @returns bool |
441 | 439 | */ |
442 | | - public static function userCanSetFlags( $flags, $oldflags = array(), $config = null ) { |
| 440 | + public static function userCanSetFlags( $flags, $oldflags = array() ) { |
443 | 441 | global $wgUser; |
444 | 442 | if ( !$wgUser->isAllowed( 'review' ) ) |
445 | 443 | return false; // User is not able to review pages |
— | — | @@ -447,12 +445,12 @@ |
448 | 446 | foreach ( self::getDimensions() as $qal => $levels ) { |
449 | 447 | $level = isset( $flags[$qal] ) ? $flags[$qal] : 0; |
450 | 448 | $highest = count( $levels ) - 1; // highest valid level |
451 | | - if ( !self::userCanSetTag( $qal, $level, $config ) ) { |
| 449 | + if ( !self::userCanSetTag( $qal, $level ) ) { |
452 | 450 | return false; // user cannot set proposed flag |
453 | 451 | } elseif ( isset( $oldflags[$qal] ) |
454 | 452 | && !self::userCanSetTag( $qal, $oldflags[$qal] ) ) |
455 | 453 | { |
456 | | - return false; // user cannot change old flag ($config is ignored here) |
| 454 | + return false; // user cannot change old flag |
457 | 455 | } |
458 | 456 | } |
459 | 457 | return true; |
Index: trunk/extensions/FlaggedRevs/forms/PageStabilityForm.php |
— | — | @@ -1,4 +1,5 @@ |
2 | 2 | <?php |
| 3 | +# (c) Aaron Schulz 2010 GPL |
3 | 4 | if ( !defined( 'MEDIAWIKI' ) ) { |
4 | 5 | echo "FlaggedRevs extension\n"; |
5 | 6 | exit( 1 ); |
— | — | @@ -209,7 +210,7 @@ |
210 | 211 | |
211 | 212 | /** |
212 | 213 | * Submit the form parameters for the page config to the DB. |
213 | | - * Note: caller is responsible for permission checks. |
| 214 | + * Note: caller is responsible for basic permission checks. |
214 | 215 | * |
215 | 216 | * @return mixed (true on success, error string on failure) |
216 | 217 | */ |
Index: trunk/extensions/FlaggedRevs/specialpages/RevisionReview_body.php |
— | — | @@ -128,10 +128,8 @@ |
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
132 | | - $fa = FlaggedArticle::getTitleInstance( $this->page ); |
133 | | - $this->config = $fa->getVisibilitySettings(); |
134 | 132 | # Check permissions and validate |
135 | | - if ( !FlaggedRevs::userCanSetFlags( $this->dims, $this->oflags, $this->config ) ) { |
| 133 | + if ( !FlaggedRevs::userCanSetFlags( $this->dims, $this->oflags ) ) { |
136 | 134 | $wgOut->permissionRequired( 'badaccess-group0' ); |
137 | 135 | return; |
138 | 136 | } |
— | — | @@ -288,12 +286,10 @@ |
289 | 287 | if ( $form->validatedParams !== $k ) { |
290 | 288 | return '<err#>' . wfMsgExt( 'revreview-failed', 'parseinline' ); |
291 | 289 | } |
292 | | - $fa = FlaggedArticle::getTitleInstance( $form->page ); |
293 | | - $form->config = $fa->getVisibilitySettings(); |
294 | 290 | # Get the revision's current flags, if any |
295 | 291 | $form->oflags = FlaggedRevs::getRevisionTags( $form->page, $form->oldid ); |
296 | 292 | # Check tag permissions |
297 | | - if ( !FlaggedRevs::userCanSetFlags( $form->dims, $form->oflags, $form->config ) ) { |
| 293 | + if ( !FlaggedRevs::userCanSetFlags( $form->dims, $form->oflags ) ) { |
298 | 294 | return '<err#>' . wfMsgExt( 'revreview-failed', 'parseinline' ); |
299 | 295 | } |
300 | 296 | list( $approved, $status ) = $form->submit(); |
— | — | @@ -334,7 +330,7 @@ |
335 | 331 | } |
336 | 332 | # Double-check permissions |
337 | 333 | if ( !$this->page->quickUserCan( 'edit' ) |
338 | | - || !FlaggedRevs::userCanSetFlags( $this->dims, $this->oflags, $this->config ) ) |
| 334 | + || !FlaggedRevs::userCanSetFlags( $this->dims, $this->oflags ) ) |
339 | 335 | { |
340 | 336 | return array( $approved, false ); |
341 | 337 | } |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php |
— | — | @@ -378,16 +378,15 @@ |
379 | 379 | |
380 | 380 | /** |
381 | 381 | * @param array $flags, selected flags |
382 | | - * @param array $config, page config |
383 | 382 | * @param bool $disabled, form disabled |
384 | 383 | * @param bool $reviewed, rev already reviewed |
385 | 384 | * @returns string |
386 | 385 | * Generates a main tag inputs (checkboxes/radios/selects) for review form |
387 | 386 | */ |
388 | | - public static function ratingInputs( $flags, $config, $disabled, $reviewed ) { |
| 387 | + public static function ratingInputs( $flags, $disabled, $reviewed ) { |
389 | 388 | $form = ''; |
390 | 389 | # Get all available tags for this page/user |
391 | | - list( $labels, $minLevels ) = self::ratingFormTags( $flags, $config ); |
| 390 | + list( $labels, $minLevels ) = self::ratingFormTags( $flags ); |
392 | 391 | if ( $labels === false ) { |
393 | 392 | $disabled = true; // a tag is unsettable |
394 | 393 | } |
— | — | @@ -462,13 +461,13 @@ |
463 | 462 | return $form; |
464 | 463 | } |
465 | 464 | |
466 | | - protected static function ratingFormTags( $selected, $config ) { |
| 465 | + protected static function ratingFormTags( $selected ) { |
467 | 466 | $labels = array(); |
468 | 467 | $minLevels = array(); |
469 | 468 | # Build up all levels available to user |
470 | 469 | foreach ( FlaggedRevs::getDimensions() as $tag => $levels ) { |
471 | 470 | if ( isset( $selected[$tag] ) && |
472 | | - !FlaggedRevs::userCanSetTag( $tag, $selected[$tag], $config ) ) |
| 471 | + !FlaggedRevs::userCanSetTag( $tag, $selected[$tag] ) ) |
473 | 472 | { |
474 | 473 | return array( false, false ); // form will have to be disabled |
475 | 474 | } |
— | — | @@ -476,7 +475,7 @@ |
477 | 476 | $minLevels[$tag] = false; // first non-zero level number |
478 | 477 | foreach ( $levels as $i => $msg ) { |
479 | 478 | # Some levels may be restricted or not applicable... |
480 | | - if ( !FlaggedRevs::userCanSetTag( $tag, $i, $config ) ) { |
| 479 | + if ( !FlaggedRevs::userCanSetTag( $tag, $i ) ) { |
481 | 480 | continue; // skip this level |
482 | 481 | } else if ( $i > 0 && !$minLevels[$tag] ) { |
483 | 482 | $minLevels[$tag] = $i; // first non-zero level number |
— | — | @@ -634,7 +633,6 @@ |
635 | 634 | # Do we need to get inclusion IDs from parser output? |
636 | 635 | $getPOut = ( $templateIDs && $imageSHA1Keys ); |
637 | 636 | |
638 | | - $config = $article->getVisibilitySettings(); |
639 | 637 | # Variable for sites with no flags, otherwise discarded |
640 | 638 | $approve = $wgRequest->getBool( 'wpApprove' ); |
641 | 639 | # See if the version being displayed is flagged... |
— | — | @@ -697,7 +695,7 @@ |
698 | 696 | |
699 | 697 | # Add main checkboxes/selects |
700 | 698 | $form .= Xml::openElement( 'span', array( 'id' => 'mw-fr-ratingselects' ) ); |
701 | | - $form .= FlaggedRevsXML::ratingInputs( $flags, $config, $disabled, (bool)$frev ); |
| 699 | + $form .= FlaggedRevsXML::ratingInputs( $flags, $disabled, (bool)$frev ); |
702 | 700 | $form .= Xml::closeElement( 'span' ); |
703 | 701 | # Add review notes input |
704 | 702 | if ( FlaggedRevs::allowComments() && $wgUser->isAllowed( 'validate' ) ) { |
Index: trunk/extensions/FlaggedRevs/api/ApiReview.php |
— | — | @@ -75,11 +75,9 @@ |
76 | 76 | |
77 | 77 | // Check if user is even allowed to set the flags |
78 | 78 | $form->oflags = FlaggedRevs::getRevisionTags( $title, $form->oldid ); |
79 | | - $fa = FlaggedArticle::getTitleInstance( $form->page ); |
80 | | - $form->config = $fa->getVisibilitySettings(); |
81 | 79 | |
82 | 80 | if ( !$title->quickUserCan( 'edit' ) |
83 | | - || !FlaggedRevs::userCanSetFlags( $form->dims, $form->oflags, $form->config ) ) |
| 81 | + || !FlaggedRevs::userCanSetFlags( $form->dims, $form->oflags ) ) |
84 | 82 | { |
85 | 83 | $this->dieUsage( "You don't have the necessary rights to set the specified flags.", 'permissiondenied' ); |
86 | 84 | } |