r22442 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22441‎ | r22442 | r22443 >
Date:23:14, 25 May 2007
Author:aaron
Status:old
Tags:
Comment:
*Don't let people who can't edit due to protection review pages, this could fuck up the main page especially
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -793,7 +793,11 @@
794794
795795 if( !$wgArticle || !$wgArticle->exists() || !$wgArticle->mTitle->isContentPage() || $action !='view' )
796796 return;
797 -
 797+ // Check if page is protected
 798+ if( !$wgArticle->mTitle->quickUserCan( 'edit' ) ) {
 799+ return;
 800+ }
 801+ // Get revision ID
798802 $revId = ( $wgArticle->mRevision ) ? $wgArticle->mRevision->mId : $wgArticle->getLatest();
799803 // We cannot review deleted revisions
800804 if( is_object($wgArticle->mRevision) && $wgArticle->mRevision->mDeleted )
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.body.php
@@ -25,7 +25,6 @@
2626 $this->target = $wgRequest->getText( 'target' );
2727 // Revision ID
2828 $this->oldid = $wgRequest->getIntOrNull( 'oldid' );
29 -
3029 // Must be a valid content page
3130 $this->page = Title::newFromUrl( $this->target );
3231 if ( !$this->target || !$this->oldid || !$this->page->isContentPage() ) {
@@ -36,6 +35,11 @@
3736 $wgOut->showErrorPage('notargettitle', 'notargettext' );
3837 return;
3938 }
 39+ // Check if page is protected
 40+ if( !$this->page->quickUserCan( 'edit' ) ) {
 41+ $wgOut->permissionRequired( 'badaccess-group0' );
 42+ return;
 43+ }
4044 // Special parameter mapping
4145 $this->templateParams = $wgRequest->getVal( 'templateParams' );
4246 $this->imageParams = $wgRequest->getVal( 'imageParams' );