2005-12-22 05:41:06 +00:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* Copyright (C) 2005 Brion Vibber <brion@pobox.com>
|
|
|
|
|
* http://www.mediawiki.org/
|
2006-01-07 13:09:30 +00:00
|
|
|
*
|
2005-12-22 05:41:06 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2006-01-07 13:09:30 +00:00
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
2005-12-22 05:41:06 +00:00
|
|
|
* (at your option) any later version.
|
2006-01-07 13:09:30 +00:00
|
|
|
*
|
2005-12-22 05:41:06 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
2006-01-07 13:09:30 +00:00
|
|
|
*
|
2005-12-22 05:41:06 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
2006-04-05 07:43:17 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-12-22 05:41:06 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*/
|
|
|
|
|
|
2007-04-04 05:22:37 +00:00
|
|
|
/**
|
|
|
|
|
* @todo document, briefly.
|
2007-04-24 06:53:31 +00:00
|
|
|
* @addtogroup SpecialPage
|
2007-04-04 05:22:37 +00:00
|
|
|
*/
|
2005-12-22 05:41:06 +00:00
|
|
|
class ProtectionForm {
|
|
|
|
|
var $mRestrictions = array();
|
|
|
|
|
var $mReason = '';
|
2007-01-10 23:32:38 +00:00
|
|
|
var $mCascade = false;
|
2007-01-22 08:26:41 +00:00
|
|
|
var $mExpiry = null;
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2007-01-20 13:34:31 +00:00
|
|
|
function __construct( &$article ) {
|
2007-01-23 07:29:58 +00:00
|
|
|
global $wgRequest, $wgUser;
|
2005-12-22 05:41:06 +00:00
|
|
|
global $wgRestrictionTypes, $wgRestrictionLevels;
|
|
|
|
|
$this->mArticle =& $article;
|
|
|
|
|
$this->mTitle =& $article->mTitle;
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
if( $this->mTitle ) {
|
2007-01-22 08:26:41 +00:00
|
|
|
$this->mTitle->loadRestrictions();
|
|
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
foreach( $wgRestrictionTypes as $action ) {
|
|
|
|
|
// Fixme: this form currently requires individual selections,
|
|
|
|
|
// but the db allows multiples separated by commas.
|
|
|
|
|
$this->mRestrictions[$action] = implode( '', $this->mTitle->getRestrictions( $action ) );
|
|
|
|
|
}
|
2007-01-12 01:44:33 +00:00
|
|
|
|
2007-01-11 00:31:04 +00:00
|
|
|
$this->mCascade = $this->mTitle->areRestrictionsCascading();
|
2007-01-22 08:26:41 +00:00
|
|
|
|
|
|
|
|
if ( $this->mTitle->mRestrictionsExpiry == 'infinity' ) {
|
|
|
|
|
$this->mExpiry = 'infinite';
|
|
|
|
|
} else if ( strlen($this->mTitle->mRestrictionsExpiry) == 0 ) {
|
|
|
|
|
$this->mExpiry = '';
|
|
|
|
|
} else {
|
2007-01-22 20:59:00 +00:00
|
|
|
$this->mExpiry = wfTimestamp( TS_RFC2822, $this->mTitle->mRestrictionsExpiry );
|
2007-01-22 08:26:41 +00:00
|
|
|
}
|
2005-12-22 05:41:06 +00:00
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
// The form will be available in read-only to show levels.
|
2006-01-06 23:25:26 +00:00
|
|
|
$this->disabled = !$wgUser->isAllowed( 'protect' ) || wfReadOnly() || $wgUser->isBlocked();
|
2005-12-22 05:41:06 +00:00
|
|
|
$this->disabledAttrib = $this->disabled
|
|
|
|
|
? array( 'disabled' => 'disabled' )
|
|
|
|
|
: array();
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
if( $wgRequest->wasPosted() ) {
|
|
|
|
|
$this->mReason = $wgRequest->getText( 'mwProtect-reason' );
|
2007-01-10 23:32:38 +00:00
|
|
|
$this->mCascade = $wgRequest->getBool( 'mwProtect-cascade' );
|
2007-01-22 08:26:41 +00:00
|
|
|
$this->mExpiry = $wgRequest->getText( 'mwProtect-expiry' );
|
|
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
foreach( $wgRestrictionTypes as $action ) {
|
|
|
|
|
$val = $wgRequest->getVal( "mwProtect-level-$action" );
|
|
|
|
|
if( isset( $val ) && in_array( $val, $wgRestrictionLevels ) ) {
|
|
|
|
|
$this->mRestrictions[$action] = $val;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-01-22 20:59:00 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function execute() {
|
|
|
|
|
global $wgRequest;
|
|
|
|
|
if( $wgRequest->wasPosted() ) {
|
2007-01-22 08:26:41 +00:00
|
|
|
if( $this->save() ) {
|
|
|
|
|
global $wgOut;
|
|
|
|
|
$wgOut->redirect( $this->mTitle->getFullUrl() );
|
|
|
|
|
}
|
2007-01-22 20:59:00 +00:00
|
|
|
} else {
|
|
|
|
|
$this->show();
|
2005-12-22 05:41:06 +00:00
|
|
|
}
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2007-01-22 08:26:41 +00:00
|
|
|
function show( $err = null ) {
|
2007-04-02 07:39:32 +00:00
|
|
|
global $wgOut, $wgUser;
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
$wgOut->setRobotpolicy( 'noindex,nofollow' );
|
|
|
|
|
|
|
|
|
|
if( is_null( $this->mTitle ) ||
|
|
|
|
|
!$this->mTitle->exists() ||
|
|
|
|
|
$this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
|
2006-06-07 06:40:24 +00:00
|
|
|
$wgOut->showFatalError( wfMsg( 'badarticleerror' ) );
|
2005-12-22 05:41:06 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2007-05-08 09:09:46 +00:00
|
|
|
list( $cascadeSources, /* $restrictions */ ) = $this->mTitle->getCascadeProtectionSources();
|
2007-01-12 04:43:33 +00:00
|
|
|
|
2007-01-22 08:26:41 +00:00
|
|
|
if ( "" != $err ) {
|
|
|
|
|
$wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
|
|
|
|
|
$wgOut->addHTML( "<p class='error'>{$err}</p>\n" );
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-12 08:37:07 +00:00
|
|
|
if ( $cascadeSources && count($cascadeSources) > 0 ) {
|
2007-01-12 07:31:34 +00:00
|
|
|
$titles = '';
|
2007-01-12 04:43:33 +00:00
|
|
|
|
2007-01-12 07:31:34 +00:00
|
|
|
foreach ( $cascadeSources as $title ) {
|
2007-01-12 09:10:30 +00:00
|
|
|
$titles .= '* [[:' . $title->getPrefixedText() . "]]\n";
|
2007-01-12 07:31:34 +00:00
|
|
|
}
|
|
|
|
|
|
2007-04-24 02:04:04 +00:00
|
|
|
$notice = wfMsgExt( 'protect-cascadeon', array('parsemag'), count($cascadeSources) ) . "\r\n$titles";
|
2007-01-12 08:37:07 +00:00
|
|
|
|
|
|
|
|
$wgOut->addWikiText( $notice );
|
2007-01-12 04:43:33 +00:00
|
|
|
}
|
|
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
$wgOut->setPageTitle( wfMsg( 'confirmprotect' ) );
|
|
|
|
|
$wgOut->setSubtitle( wfMsg( 'protectsub', $this->mTitle->getPrefixedText() ) );
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2007-04-02 07:39:32 +00:00
|
|
|
# Show an appropriate message if the user isn't allowed or able to change
|
|
|
|
|
# the protection settings at this time
|
|
|
|
|
if( $this->disabled ) {
|
|
|
|
|
if( $wgUser->isAllowed( 'protect' ) ) {
|
|
|
|
|
if( $wgUser->isBlocked() ) {
|
|
|
|
|
# Blocked
|
|
|
|
|
$message = 'protect-locked-blocked';
|
|
|
|
|
} else {
|
|
|
|
|
# Database lock
|
|
|
|
|
$message = 'protect-locked-dblock';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
# Permission error
|
|
|
|
|
$message = 'protect-locked-access';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$message = 'protect-text';
|
|
|
|
|
}
|
|
|
|
|
$wgOut->addWikiText( wfMsg( $message, wfEscapeWikiText( $this->mTitle->getPrefixedText() ) ) );
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
$wgOut->addHTML( $this->buildForm() );
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
$this->showLogExtract( $wgOut );
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
function save() {
|
2006-01-10 16:19:32 +00:00
|
|
|
global $wgRequest, $wgUser, $wgOut;
|
2007-01-22 20:59:00 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
if( $this->disabled ) {
|
2007-01-22 20:59:00 +00:00
|
|
|
$this->show();
|
2005-12-22 05:41:06 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
$token = $wgRequest->getVal( 'wpEditToken' );
|
|
|
|
|
if( !$wgUser->matchEditToken( $token ) ) {
|
2007-01-22 20:59:00 +00:00
|
|
|
$this->show( wfMsg( 'sessionfailure' ) );
|
|
|
|
|
return false;
|
2005-12-22 05:41:06 +00:00
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2007-01-22 08:26:41 +00:00
|
|
|
if ( strlen( $this->mExpiry ) == 0 ) {
|
|
|
|
|
$this->mExpiry = 'infinite';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( $this->mExpiry == 'infinite' || $this->mExpiry == 'indefinite' ) {
|
|
|
|
|
$expiry = Block::infinity();
|
|
|
|
|
} else {
|
|
|
|
|
# Convert GNU-style date, on error returns -1 for PHP <5.1 and false for PHP >=5.1
|
|
|
|
|
$expiry = strtotime( $this->mExpiry );
|
|
|
|
|
|
|
|
|
|
if ( $expiry < 0 || $expiry === false ) {
|
|
|
|
|
$this->show( wfMsg( 'protect_expiry_invalid' ) );
|
2007-01-22 20:59:00 +00:00
|
|
|
return false;
|
2007-01-22 08:26:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$expiry = wfTimestamp( TS_MW, $expiry );
|
2007-02-16 07:39:33 +00:00
|
|
|
|
|
|
|
|
if ( $expiry < wfTimestampNow() ) {
|
|
|
|
|
$this->show( wfMsg( 'protect_expiry_old' ) );
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-22 08:26:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$ok = $this->mArticle->updateRestrictions( $this->mRestrictions, $this->mReason, $this->mCascade, $expiry );
|
2005-12-22 05:41:06 +00:00
|
|
|
if( !$ok ) {
|
2006-06-07 06:40:24 +00:00
|
|
|
throw new FatalError( "Unknown error at restriction save time." );
|
2005-12-22 05:41:06 +00:00
|
|
|
}
|
|
|
|
|
return $ok;
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
function buildForm() {
|
|
|
|
|
global $wgUser;
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
$out = '';
|
|
|
|
|
if( !$this->disabled ) {
|
|
|
|
|
$out .= $this->buildScript();
|
|
|
|
|
// The submission needs to reenable the move permission selector
|
|
|
|
|
// if it's in locked mode, or some browsers won't submit the data.
|
|
|
|
|
$out .= wfOpenElement( 'form', array(
|
2007-04-16 10:34:58 +00:00
|
|
|
'id' => 'mw-Protect-Form',
|
2005-12-22 05:41:06 +00:00
|
|
|
'action' => $this->mTitle->getLocalUrl( 'action=protect' ),
|
|
|
|
|
'method' => 'post',
|
|
|
|
|
'onsubmit' => 'protectEnable(true)' ) );
|
|
|
|
|
|
|
|
|
|
$out .= wfElement( 'input', array(
|
|
|
|
|
'type' => 'hidden',
|
|
|
|
|
'name' => 'wpEditToken',
|
|
|
|
|
'value' => $wgUser->editToken() ) );
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
$out .= "<table id='mwProtectSet'>";
|
|
|
|
|
$out .= "<tbody>";
|
|
|
|
|
$out .= "<tr>\n";
|
2006-11-25 17:11:58 +00:00
|
|
|
foreach( $this->mRestrictions as $action => $required ) {
|
2006-02-18 15:07:02 +00:00
|
|
|
/* Not all languages have V_x <-> N_x relation */
|
|
|
|
|
$out .= "<th>" . wfMsgHtml( 'restriction-' . $action ) . "</th>\n";
|
2005-12-22 05:41:06 +00:00
|
|
|
}
|
|
|
|
|
$out .= "</tr>\n";
|
|
|
|
|
$out .= "<tr>\n";
|
|
|
|
|
foreach( $this->mRestrictions as $action => $selected ) {
|
|
|
|
|
$out .= "<td>\n";
|
|
|
|
|
$out .= $this->buildSelector( $action, $selected );
|
|
|
|
|
$out .= "</td>\n";
|
|
|
|
|
}
|
|
|
|
|
$out .= "</tr>\n";
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
// JavaScript will add another row with a value-chaining checkbox
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
$out .= "</tbody>\n";
|
|
|
|
|
$out .= "</table>\n";
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2007-01-10 23:32:38 +00:00
|
|
|
global $wgEnableCascadingProtection;
|
|
|
|
|
|
|
|
|
|
if ($wgEnableCascadingProtection)
|
|
|
|
|
$out .= $this->buildCascadeInput();
|
|
|
|
|
|
2007-03-19 07:08:58 +00:00
|
|
|
$out .= "<table>\n";
|
|
|
|
|
$out .= "<tbody>\n";
|
|
|
|
|
|
2007-01-22 08:26:41 +00:00
|
|
|
$out .= $this->buildExpiryInput();
|
|
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
if( !$this->disabled ) {
|
|
|
|
|
$out .= "<tr><td>" . $this->buildReasonInput() . "</td></tr>\n";
|
|
|
|
|
$out .= "<tr><td></td><td>" . $this->buildSubmit() . "</td></tr>\n";
|
2007-01-22 08:26:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$out .= "</tbody>\n";
|
|
|
|
|
$out .= "</table>\n";
|
|
|
|
|
|
|
|
|
|
if ( !$this->disabled ) {
|
2005-12-22 05:41:06 +00:00
|
|
|
$out .= "</form>\n";
|
2006-07-06 16:42:48 +00:00
|
|
|
$out .= $this->buildCleanupScript();
|
2005-12-22 05:41:06 +00:00
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
return $out;
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
function buildSelector( $action, $selected ) {
|
|
|
|
|
global $wgRestrictionLevels;
|
|
|
|
|
$id = 'mwProtect-level-' . $action;
|
|
|
|
|
$attribs = array(
|
|
|
|
|
'id' => $id,
|
|
|
|
|
'name' => $id,
|
|
|
|
|
'size' => count( $wgRestrictionLevels ),
|
|
|
|
|
'onchange' => 'protectLevelsUpdate(this)',
|
|
|
|
|
) + $this->disabledAttrib;
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
$out = wfOpenElement( 'select', $attribs );
|
|
|
|
|
foreach( $wgRestrictionLevels as $key ) {
|
|
|
|
|
$out .= $this->buildOption( $key, $selected );
|
|
|
|
|
}
|
|
|
|
|
$out .= "</select>\n";
|
|
|
|
|
return $out;
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
function buildOption( $key, $selected ) {
|
|
|
|
|
$text = ( $key == '' )
|
|
|
|
|
? wfMsg( 'protect-default' )
|
|
|
|
|
: wfMsg( "protect-level-$key" );
|
|
|
|
|
$selectedAttrib = ($selected == $key)
|
|
|
|
|
? array( 'selected' => 'selected' )
|
|
|
|
|
: array();
|
|
|
|
|
return wfElement( 'option',
|
|
|
|
|
array( 'value' => $key ) + $selectedAttrib,
|
|
|
|
|
$text );
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
function buildReasonInput() {
|
|
|
|
|
$id = 'mwProtect-reason';
|
|
|
|
|
return wfElement( 'label', array(
|
|
|
|
|
'id' => "$id-label",
|
|
|
|
|
'for' => $id ),
|
|
|
|
|
wfMsg( 'protectcomment' ) ) .
|
|
|
|
|
'</td><td>' .
|
|
|
|
|
wfElement( 'input', array(
|
|
|
|
|
'size' => 60,
|
|
|
|
|
'name' => $id,
|
2007-02-16 07:21:03 +00:00
|
|
|
'id' => $id,
|
|
|
|
|
'value' => $this->mReason ) );
|
2005-12-22 05:41:06 +00:00
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2007-01-10 23:32:38 +00:00
|
|
|
function buildCascadeInput() {
|
|
|
|
|
$id = 'mwProtect-cascade';
|
2007-03-19 07:08:58 +00:00
|
|
|
$ci = wfCheckLabel( wfMsg( 'protect-cascade' ), $id, $id, $this->mCascade, $this->disabledAttrib);
|
2007-01-22 08:26:41 +00:00
|
|
|
return $ci;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function buildExpiryInput() {
|
|
|
|
|
$id = 'mwProtect-expiry';
|
|
|
|
|
|
|
|
|
|
$ci = "<tr> <td align=\"right\">";
|
|
|
|
|
$ci .= wfElement( 'label', array (
|
|
|
|
|
'id' => "$id-label",
|
|
|
|
|
'for' => $id ),
|
|
|
|
|
wfMsg( 'protectexpiry' ) );
|
2007-02-16 07:39:33 +00:00
|
|
|
$ci .= "</td> <td align=\"left\">";
|
2007-01-22 08:26:41 +00:00
|
|
|
$ci .= wfElement( 'input', array(
|
|
|
|
|
'size' => 60,
|
|
|
|
|
'name' => $id,
|
|
|
|
|
'id' => $id,
|
2007-01-23 07:57:41 +00:00
|
|
|
'value' => $this->mExpiry ) + $this->disabledAttrib );
|
2007-01-22 08:26:41 +00:00
|
|
|
$ci .= "</td></tr>";
|
2007-01-20 13:34:31 +00:00
|
|
|
|
2007-01-10 23:32:38 +00:00
|
|
|
return $ci;
|
|
|
|
|
}
|
|
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
function buildSubmit() {
|
|
|
|
|
return wfElement( 'input', array(
|
2007-04-16 10:34:58 +00:00
|
|
|
'id' => 'mw-Protect-submit',
|
2005-12-22 05:41:06 +00:00
|
|
|
'type' => 'submit',
|
|
|
|
|
'value' => wfMsg( 'confirm' ) ) );
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
function buildScript() {
|
2006-10-13 21:48:19 +00:00
|
|
|
global $wgStylePath, $wgStyleVersion;
|
2005-12-22 05:41:06 +00:00
|
|
|
return '<script type="text/javascript" src="' .
|
2006-10-13 21:48:19 +00:00
|
|
|
htmlspecialchars( $wgStylePath . "/common/protect.js?$wgStyleVersion" ) .
|
2005-12-22 05:41:06 +00:00
|
|
|
'"></script>';
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
function buildCleanupScript() {
|
2007-03-15 02:52:28 +00:00
|
|
|
global $wgRestrictionLevels, $wgGroupPermissions;
|
|
|
|
|
$script = 'var wgCascadeableLevels=';
|
|
|
|
|
$CascadeableLevels = array();
|
|
|
|
|
foreach( $wgRestrictionLevels as $key ) {
|
|
|
|
|
if ( isset($wgGroupPermissions[$key]['protect']) && $wgGroupPermissions[$key]['protect'] ) {
|
|
|
|
|
$CascadeableLevels[]="'" . wfEscapeJsString($key) . "'";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$script .= "[" . implode(',',$CascadeableLevels) . "];\n";
|
|
|
|
|
$script .= 'protectInitialize("mwProtectSet","' . wfEscapeJsString( wfMsg( 'protect-unchain' ) ) . '")';
|
|
|
|
|
return '<script type="text/javascript">' . $script . '</script>';
|
2005-12-22 05:41:06 +00:00
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-22 05:41:06 +00:00
|
|
|
/**
|
|
|
|
|
* @param OutputPage $out
|
|
|
|
|
* @access private
|
|
|
|
|
*/
|
|
|
|
|
function showLogExtract( &$out ) {
|
|
|
|
|
# Show relevant lines from the deletion log:
|
|
|
|
|
$out->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'protect' ) ) . "</h2>\n" );
|
|
|
|
|
$logViewer = new LogViewer(
|
|
|
|
|
new LogReader(
|
|
|
|
|
new FauxRequest(
|
|
|
|
|
array( 'page' => $this->mTitle->getPrefixedText(),
|
|
|
|
|
'type' => 'protect' ) ) ) );
|
|
|
|
|
$logViewer->showList( $out );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-01-10 16:19:32 +00:00
|
|
|
?>
|