r40518 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40517‎ | r40518 | r40519 >
Date:07:20, 6 September 2008
Author:aaron
Status:old
Tags:
Comment:
Set values from query params (bug 12750)
Modified paths:
  • /trunk/phase3/includes/ProtectionForm.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ProtectionForm.php
@@ -64,25 +64,23 @@
6565 ? array( 'disabled' => 'disabled' )
6666 : array();
6767
68 - if( $wgRequest->wasPosted() ) {
69 - $this->mReason = $wgRequest->getText( 'mwProtect-reason' );
70 - $this->mCascade = $wgRequest->getBool( 'mwProtect-cascade' );
71 - $this->mExpiry = $wgRequest->getText( 'mwProtect-expiry' );
 68+ $this->mReason = $wgRequest->getText( 'mwProtect-reason' );
 69+ $this->mCascade = $wgRequest->getBool( 'mwProtect-cascade' );
 70+ $this->mExpiry = $wgRequest->getText( 'mwProtect-expiry', 'infinite' );
7271
73 - foreach( $this->mApplicableTypes as $action ) {
74 - $val = $wgRequest->getVal( "mwProtect-level-$action" );
75 - if( isset( $val ) && in_array( $val, $wgRestrictionLevels ) ) {
76 - //prevent users from setting levels that they cannot later unset
77 - if( $val == 'sysop' ) {
78 - //special case, rewrite sysop to either protect and editprotected
79 - if( !$wgUser->isAllowed('protect') && !$wgUser->isAllowed('editprotected') )
80 - continue;
81 - } else {
82 - if( !$wgUser->isAllowed($val) )
83 - continue;
84 - }
85 - $this->mRestrictions[$action] = $val;
 72+ foreach( $this->mApplicableTypes as $action ) {
 73+ $val = $wgRequest->getVal( "mwProtect-level-$action" );
 74+ if( isset( $val ) && in_array( $val, $wgRestrictionLevels ) ) {
 75+ // Prevent users from setting levels that they cannot later unset
 76+ if( $val == 'sysop' ) {
 77+ // Special case, rewrite sysop to either protect and editprotected
 78+ if( !$wgUser->isAllowed('protect') && !$wgUser->isAllowed('editprotected') )
 79+ continue;
 80+ } else {
 81+ if( !$wgUser->isAllowed($val) )
 82+ continue;
8683 }
 84+ $this->mRestrictions[$action] = $val;
8785 }
8886 }
8987 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r40542Fix regression from r40518; keep current values of page when no query params ...aaron17:12, 6 September 2008