// 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') )
+ if( !$wgUser->isAllowedAny( 'protect', 'editprotected' ) )
continue;
} else {
if( !$wgUser->isAllowed($val) )
$value = $this->mExpirySelection[$action];
}
if ( $value == 'infinite' || $value == 'indefinite' || $value == 'infinity' ) {
- $time = Block::infinity();
+ $time = wfGetDB( DB_SLAVE )->getInfinity();
} else {
$unix = strtotime( $value );
if( wfReadOnly() ) {
$wgOut->readOnlyPage();
} elseif( $this->mPermErrors ) {
- $wgOut->addWikiText( $wgOut->formatPermissionsErrorMessage( $this->mPermErrors ) );
+ $wgOut->showPermissionsErrorPage( $this->mPermErrors );
}
} else {
$wgOut->addWikiMsg( 'protect-text', $this->mTitle->getPrefixedText() );
foreach( $this->mRestrictions as $action => $selected ) {
/* Not all languages have V_x <-> N_x relation */
- $msg = wfMsg( 'restriction-' . $action );
- if( wfEmptyMsg( 'restriction-' . $action, $msg ) ) {
- $msg = $action;
- }
+ $msg = wfMessage( 'restriction-' . $action );
$out .= "<tr><td>".
Xml::openElement( 'fieldset' ) .
- Xml::element( 'legend', null, $msg ) .
+ Xml::element( 'legend', null, $msg->exists() ? $action : $msg->text() ) .
Xml::openElement( 'table', array( 'id' => "mw-protect-table-$action" ) ) .
"<tr><td>" . $this->buildSelector( $action, $selected ) . "</td></tr><tr><td>";
//don't let them choose levels above their own (aka so they can still unprotect and edit the page). but only when the form isn't disabled
if( $key == 'sysop' ) {
//special case, rewrite sysop to protect and editprotected
- if( !$wgUser->isAllowed('protect') && !$wgUser->isAllowed('editprotected') && !$this->disabled )
+ if( !$wgUser->isAllowedAny( 'protect', 'editprotected' ) && !$this->disabled )
continue;
} else {
if( !$wgUser->isAllowed($key) && !$this->disabled )
if( $permission == '' ) {
return wfMsg( 'protect-default' );
} else {
- $key = "protect-level-{$permission}";
- $msg = wfMsg( $key );
- if( wfEmptyMsg( $key, $msg ) )
- $msg = wfMsg( 'protect-fallback', $permission );
- return $msg;
+ $msg = wfMessage( "protect-level-{$permission}" );
+ if( !$msg->exists() ) {
+ return $msg->text();
+ }
+ return wfMsg( 'protect-fallback', $permission );
}
}