From 63601400e476c6cf43d985f3e7b9864681695ed4 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 18 Jan 2013 16:46:04 +0100 Subject: Update to MediaWiki 1.20.2 this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024 --- includes/ProtectionForm.php | 85 +++++++++++++++++++++++++++++---------------- 1 file changed, 55 insertions(+), 30 deletions(-) (limited to 'includes/ProtectionForm.php') diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index dbe06d49..ce0e36b0 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -74,17 +74,17 @@ class ProtectionForm { $this->disabledAttrib = $this->disabled ? array( 'disabled' => 'disabled' ) : array(); - + $this->loadData(); } - + /** * Loads the current state of protection into the object. */ function loadData() { global $wgRequest, $wgUser; global $wgRestrictionLevels; - + $this->mCascade = $this->mTitle->areRestrictionsCascading(); $this->mReason = $wgRequest->getText( 'mwProtect-reason' ); @@ -94,7 +94,7 @@ class ProtectionForm { foreach( $this->mApplicableTypes as $action ) { // @todo FIXME: This form currently requires individual selections, // but the db allows multiples separated by commas. - + // Pull the actual restriction from the DB $this->mRestrictions[$action] = implode( '', $this->mTitle->getRestrictions( $action ) ); @@ -151,7 +151,7 @@ class ProtectionForm { * Get the expiry time for a given action, by combining the relevant inputs. * * @param $action string - * + * * @return string 14-char timestamp or "infinity", or false if the input was invalid */ function getExpiry( $action ) { @@ -265,7 +265,7 @@ class ProtectionForm { $reasonstr = $this->mReasonSelection; if ( $reasonstr != 'other' && $this->mReason != '' ) { // Entry from drop down menu + additional comment - $reasonstr .= wfMsgForContent( 'colon-separator' ) . $this->mReason; + $reasonstr .= wfMessage( 'colon-separator' )->text() . $this->mReason; } elseif ( $reasonstr == 'other' ) { $reasonstr = $this->mReason; } @@ -318,10 +318,12 @@ class ProtectionForm { return false; } - if ( $wgRequest->getCheck( 'mwProtectWatch' ) && $wgUser->isLoggedIn() ) { - WatchAction::doWatch( $this->mTitle, $wgUser ); - } elseif ( $this->mTitle->userIsWatching() ) { - WatchAction::doUnwatch( $this->mTitle, $wgUser ); + if ( $wgUser->isLoggedIn() && $wgRequest->getCheck( 'mwProtectWatch' ) != $wgUser->isWatched( $this->mTitle ) ) { + if ( $wgRequest->getCheck( 'mwProtectWatch' ) ) { + WatchAction::doWatch( $this->mTitle, $wgUser ); + } else { + WatchAction::doUnwatch( $this->mTitle, $wgUser ); + } } return true; } @@ -334,8 +336,14 @@ class ProtectionForm { function buildForm() { global $wgUser, $wgLang, $wgOut; - $mProtectreasonother = Xml::label( wfMsg( 'protectcomment' ), 'wpProtectReasonSelection' ); - $mProtectreason = Xml::label( wfMsg( 'protect-otherreason' ), 'mwProtect-reason' ); + $mProtectreasonother = Xml::label( + wfMessage( 'protectcomment' )->text(), + 'wpProtectReasonSelection' + ); + $mProtectreason = Xml::label( + wfMessage( 'protect-otherreason' )->text(), + 'mwProtect-reason' + ); $out = ''; if( !$this->disabled ) { @@ -346,7 +354,7 @@ class ProtectionForm { } $out .= Xml::openElement( 'fieldset' ) . - Xml::element( 'legend', null, wfMsg( 'protect-legend' ) ) . + Xml::element( 'legend', null, wfMessage( 'protect-legend' )->text() ) . Xml::openElement( 'table', array( 'id' => 'mwProtectSet' ) ) . Xml::openElement( 'tbody' ); @@ -360,16 +368,22 @@ class ProtectionForm { "" . $this->buildSelector( $action, $selected ) . ""; $reasonDropDown = Xml::listDropDown( 'wpProtectReasonSelection', - wfMsgForContent( 'protect-dropdown' ), - wfMsgForContent( 'protect-otherreason-op' ), + wfMessage( 'protect-dropdown' )->inContentLanguage()->text(), + wfMessage( 'protect-otherreason-op' )->inContentLanguage()->text(), $this->mReasonSelection, 'mwProtect-reason', 4 ); - $scExpiryOptions = wfMsgForContent( 'protect-expiry-options' ); + $scExpiryOptions = wfMessage( 'protect-expiry-options' )->inContentLanguage()->text(); $showProtectOptions = ($scExpiryOptions !== '-' && !$this->disabled); - $mProtectexpiry = Xml::label( wfMsg( 'protectexpiry' ), "mwProtectExpirySelection-$action" ); - $mProtectother = Xml::label( wfMsg( 'protect-othertime' ), "mwProtect-$action-expires" ); + $mProtectexpiry = Xml::label( + wfMessage( 'protectexpiry' )->text(), + "mwProtectExpirySelection-$action" + ); + $mProtectother = Xml::label( + wfMessage( 'protect-othertime' )->text(), + "mwProtect-$action-expires" + ); $expiryFormOptions = ''; if ( $this->mExistingExpiry[$action] && $this->mExistingExpiry[$action] != 'infinity' ) { @@ -378,13 +392,16 @@ class ProtectionForm { $t = $wgLang->time( $this->mExistingExpiry[$action], true ); $expiryFormOptions .= Xml::option( - wfMsg( 'protect-existing-expiry', $timestamp, $d, $t ), + wfMessage( 'protect-existing-expiry', $timestamp, $d, $t )->text(), 'existing', $this->mExpirySelection[$action] == 'existing' ) . "\n"; } - $expiryFormOptions .= Xml::option( wfMsg( 'protect-othertime-op' ), "othertime" ) . "\n"; + $expiryFormOptions .= Xml::option( + wfMessage( 'protect-othertime-op' )->text(), + "othertime" + ) . "\n"; foreach( explode(',', $scExpiryOptions) as $option ) { if ( strpos($option, ":") === false ) { $show = $value = $option; @@ -442,8 +459,12 @@ class ProtectionForm { $out .= ' ' . - Xml::checkLabel( wfMsg( 'protect-cascade' ), 'mwProtect-cascade', 'mwProtect-cascade', - $this->mCascade, $this->disabledAttrib ) . + Xml::checkLabel( + wfMessage( 'protect-cascade' )->text(), + 'mwProtect-cascade', + 'mwProtect-cascade', + $this->mCascade, $this->disabledAttrib + ) . " \n"; $out .= Xml::closeElement( 'tbody' ) . Xml::closeElement( 'table' ); @@ -480,7 +501,7 @@ class ProtectionForm { " . - Xml::checkLabel( wfMsg( 'watchthis' ), + Xml::checkLabel( wfMessage( 'watchthis' )->text(), 'mwProtectWatch', 'mwProtectWatch', $this->mTitle->userIsWatching() || $wgUser->getOption( 'watchdefault' ) ) . " @@ -490,7 +511,10 @@ class ProtectionForm { " . - Xml::submitButton( wfMsg( 'confirm' ), array( 'id' => 'mw-Protect-submit' ) ) . + Xml::submitButton( + wfMessage( 'confirm' )->text(), + array( 'id' => 'mw-Protect-submit' ) + ) . " \n"; $out .= Xml::closeElement( 'tbody' ) . Xml::closeElement( 'table' ); @@ -501,7 +525,7 @@ class ProtectionForm { $title = Title::makeTitle( NS_MEDIAWIKI, 'Protect-dropdown' ); $link = Linker::link( $title, - wfMsgHtml( 'protect-edit-reasonlist' ), + wfMessage( 'protect-edit-reasonlist' )->escaped(), array(), array( 'action' => 'edit' ) ); @@ -565,23 +589,23 @@ class ProtectionForm { */ private function getOptionLabel( $permission ) { if( $permission == '' ) { - return wfMsg( 'protect-default' ); + return wfMessage( 'protect-default' )->text(); } else { $msg = wfMessage( "protect-level-{$permission}" ); if( $msg->exists() ) { return $msg->text(); } - return wfMsg( 'protect-fallback', $permission ); + return wfMessage( 'protect-fallback', $permission )->text(); } } - + function buildCleanupScript() { global $wgRestrictionLevels, $wgGroupPermissions, $wgOut; $cascadeableLevels = array(); foreach( $wgRestrictionLevels as $key ) { if ( ( isset( $wgGroupPermissions[$key]['protect'] ) && $wgGroupPermissions[$key]['protect'] ) - || $key == 'protect' + || $key == 'protect' ) { $cascadeableLevels[] = $key; } @@ -606,7 +630,8 @@ class ProtectionForm { */ function showLogExtract( &$out ) { # Show relevant lines from the protection log: - $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'protect' ) ) ); + $protectLogPage = new LogPage( 'protect' ); + $out->addHTML( Xml::element( 'h2', null, $protectLogPage->getName()->text() ) ); LogEventsList::showLogExtract( $out, 'protect', $this->mTitle ); # Let extensions add other relevant log extracts wfRunHooks( 'ProtectionForm::showLogExtract', array($this->mArticle,$out) ); -- cgit v1.2.3-54-g00ecf