Pass Context to User::resetOptions
[lhc/web/wiklou.git] / includes / specials / SpecialPreferences.php
index bb6bc95..cc7b8fa 100644 (file)
@@ -69,6 +69,10 @@ 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' );
@@ -82,8 +86,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' );