// but the db allows multiples separated by commas.
$this->mRestrictions[$action] = implode( '', $this->mTitle->getRestrictions( $action ) );
}
- $this->mRestrictions['robots'] = implode( ',', $this->mTitle->getRestrictions( 'robots' ) );
$this->mCascade = $this->mTitle->areRestrictionsCascading();
$this->mRestrictions[$action] = $val;
}
}
-
- // Read checkboxes only if user is allowed to change robots policy, otherwise keep previous policy
- if ( $wgUser->isAllowed( 'editrobots' ) ) {
- $robotspolicy = $wgRequest->getBool( 'mwProtect-robots-noindex' ) ? 'noindex' : 'index';
- $robotspolicy .= $wgRequest->getBool( 'mwProtect-robots-nofollow' ) ? ',nofollow' : ',follow';
- // 'index,follow' is default, no need to set this explicitly at this point; is done at Article::view()
- $this->mRestrictions['robots'] = ( $robotspolicy == 'index,follow' ) ? '' : $robotspolicy;
- }
}
}
-
+
function execute() {
global $wgRequest;
if( $wgRequest->wasPosted() ) {
if( $this->save() ) {
global $wgOut;
- $wgOut->redirect( $this->mTitle->getFullUrl() );
+ $wgOut->redirect( $this->mTitle->getFullUrl( 'redirect=no' ) );
}
} else {
$this->show();
}
function buildForm() {
- global $wgUser, $wgRestrictionTypes;
+ global $wgUser;
$out = '';
if( !$this->disabled ) {
$out .= "<tr>\n";
foreach( $this->mRestrictions as $action => $required ) {
/* Not all languages have V_x <-> N_x relation */
- if ( in_array( $action, $wgRestrictionTypes ) )
- $out .= "<th>" . wfMsgHtml( 'restriction-' . $action ) . "</th>\n";
+ $out .= "<th>" . wfMsgHtml( 'restriction-' . $action ) . "</th>\n";
}
$out .= "</tr>\n";
$out .= "<tr>\n";
foreach( $this->mRestrictions as $action => $selected ) {
- if ( in_array( $action, $wgRestrictionTypes ) ) {
- $out .= "<td>\n";
- $out .= $this->buildSelector( $action, $selected );
- $out .= "</td>\n";
- }
+ $out .= "<td>\n";
+ $out .= $this->buildSelector( $action, $selected );
+ $out .= "</td>\n";
}
$out .= "</tr>\n";
if( $wgEnableCascadingProtection )
$out .= '<tr><td></td><td>' . $this->buildCascadeInput() . "</td></tr>\n";
- if( !$this->disabled )
- $out .= '<tr><td></td><td>' . $this->buildWatchInput() . "</td></tr>\n";
-
- $out .= $this->buildRobotsInput();
$out .= $this->buildExpiryInput();
if( !$this->disabled ) {
$out .= "<tr><td>" . $this->buildReasonInput() . "</td></tr>\n";
+ $out .= "<tr><td></td><td>" . $this->buildWatchInput() . "</td></tr>\n";
$out .= "<tr><td></td><td>" . $this->buildSubmit() . "</td></tr>\n";
}
return $ci;
}
- function buildRobotsInput() {
- global $wgUser, $wgContLang;
- $robotsallowed = $wgUser->isAllowed( 'editrobots' ) ? array() : array( 'disabled' => 'disabled' );
- $noindexset = ( isset( $this->mRestrictions['robots'] ) && strstr( $this->mRestrictions['robots'], 'noindex' ) ) ? true : false;
- $nofollowset = ( isset( $this->mRestrictions['robots'] ) && strstr( $this->mRestrictions['robots'], 'nofollow' ) ) ? true : false;
- $ret = "<tr><td align=\"right\">";
- $ret .= '<label>' . wfMsgExt( 'protect-robotspolicy', array( 'parseinline' ) ) . '</label>';
- $ret .= "</td><td align=\"left\" width=\"60\">";
- $ret .= Xml::checkLabel( wfMsgHtml( 'protect-robots-noindex' ), 'mwProtect-robots-noindex', 'mwProtect-robots-noindex', $noindexset, $robotsallowed );
- $ret .= $wgContLang->getDirMark();
- $ret .= Xml::checkLabel( wfMsgHtml( 'protect-robots-nofollow' ), 'mwProtect-robots-nofollow', 'mwProtect-robots-nofollow', $nofollowset, $robotsallowed );
- $ret .= "</td></tr>";
- return $ret;
- }
-
function buildExpiryInput() {
$attribs = array( 'id' => 'expires' ) + $this->disabledAttrib;
return '<tr>'