From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- includes/specials/SpecialPreferences.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'includes/specials/SpecialPreferences.php') diff --git a/includes/specials/SpecialPreferences.php b/includes/specials/SpecialPreferences.php index a50e7c18..ecee0bb7 100644 --- a/includes/specials/SpecialPreferences.php +++ b/includes/specials/SpecialPreferences.php @@ -35,16 +35,21 @@ class SpecialPreferences extends SpecialPage { $this->setHeaders(); $this->outputHeader(); $out = $this->getOutput(); - $out->disallowUserJs(); # Prevent hijacked user scripts from sniffing passwords etc. + $out->disallowUserJs(); # Prevent hijacked user scripts from sniffing passwords etc. $user = $this->getUser(); if ( $user->isAnon() ) { - throw new ErrorPageError( 'prefsnologin', 'prefsnologintext', array( $this->getTitle()->getPrefixedDBkey() ) ); + throw new ErrorPageError( + 'prefsnologin', + 'prefsnologintext', + array( $this->getTitle()->getPrefixedDBkey() ) + ); } $this->checkReadOnly(); if ( $par == 'reset' ) { $this->showResetForm(); + return; } @@ -52,7 +57,7 @@ class SpecialPreferences extends SpecialPage { if ( $this->getRequest()->getCheck( 'success' ) ) { $out->wrapWikiMsg( - "
\n$1\n
", + "
\n$1\n
", 'savedprefs' ); } @@ -64,12 +69,17 @@ class SpecialPreferences extends SpecialPage { } private function showResetForm() { + if ( !$this->getUser()->isAllowed( 'editmyoptions' ) ) { + throw new PermissionsError( 'editmyoptions' ); + } + $this->getOutput()->addWikiMsg( 'prefs-reset-intro' ); - $htmlForm = new HTMLForm( array(), $this->getContext(), 'prefs-restore' ); + $context = new DerivativeContext( $this->getContext() ); + $context->setTitle( $this->getTitle( 'reset' ) ); // Reset subpage + $htmlForm = new HTMLForm( array(), $context, 'prefs-restore' ); $htmlForm->setSubmitTextMsg( 'restoreprefs' ); - $htmlForm->setTitle( $this->getTitle( 'reset' ) ); $htmlForm->setSubmitCallback( array( $this, 'submitReset' ) ); $htmlForm->suppressReset(); @@ -77,8 +87,12 @@ class SpecialPreferences extends SpecialPage { } public function submitReset( $formData ) { + if ( !$this->getUser()->isAllowed( 'editmyoptions' ) ) { + throw new PermissionsError( 'editmyoptions' ); + } + $user = $this->getUser(); - $user->resetOptions( 'all' ); + $user->resetOptions( 'all', $this->getContext() ); $user->saveSettings(); $url = $this->getTitle()->getFullURL( 'success' ); -- cgit v1.2.3-54-g00ecf