From: Aaron Schulz Date: Sat, 6 Sep 2008 07:20:13 +0000 (+0000) Subject: Set values from query params (bug 12750) X-Git-Tag: 1.31.0-rc.0~45449 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=b7b98cda9274362fe48fce23b3e76c79bdbd811c;p=lhc%2Fweb%2Fwiklou.git Set values from query params (bug 12750) --- diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index aa682bfa2a..4b3eaffd57 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -64,25 +64,23 @@ class ProtectionForm { ? array( 'disabled' => 'disabled' ) : array(); - if( $wgRequest->wasPosted() ) { - $this->mReason = $wgRequest->getText( 'mwProtect-reason' ); - $this->mCascade = $wgRequest->getBool( 'mwProtect-cascade' ); - $this->mExpiry = $wgRequest->getText( 'mwProtect-expiry' ); - - foreach( $this->mApplicableTypes as $action ) { - $val = $wgRequest->getVal( "mwProtect-level-$action" ); - if( isset( $val ) && in_array( $val, $wgRestrictionLevels ) ) { - //prevent users from setting levels that they cannot later unset - if( $val == 'sysop' ) { - //special case, rewrite sysop to either protect and editprotected - if( !$wgUser->isAllowed('protect') && !$wgUser->isAllowed('editprotected') ) - continue; - } else { - if( !$wgUser->isAllowed($val) ) - continue; - } - $this->mRestrictions[$action] = $val; + $this->mReason = $wgRequest->getText( 'mwProtect-reason' ); + $this->mCascade = $wgRequest->getBool( 'mwProtect-cascade' ); + $this->mExpiry = $wgRequest->getText( 'mwProtect-expiry', 'infinite' ); + + foreach( $this->mApplicableTypes as $action ) { + $val = $wgRequest->getVal( "mwProtect-level-$action" ); + if( isset( $val ) && in_array( $val, $wgRestrictionLevels ) ) { + // Prevent users from setting levels that they cannot later unset + if( $val == 'sysop' ) { + // Special case, rewrite sysop to either protect and editprotected + if( !$wgUser->isAllowed('protect') && !$wgUser->isAllowed('editprotected') ) + continue; + } else { + if( !$wgUser->isAllowed($val) ) + continue; } + $this->mRestrictions[$action] = $val; } } }