From: umherirrender Date: Mon, 30 Jul 2012 16:46:01 +0000 (+0200) Subject: Move some readonly around X-Git-Tag: 1.31.0-rc.0~22911^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=105ebc6883fb85db04647088ff7f39088e5229cc;p=lhc%2Fweb%2Fwiklou.git Move some readonly around Checking first permission and than read only is better, than user without permissions does not retry it when read only is over. Moving disallowUserJS to top so javascript is always not possible, same is already done on Special:ChangePassword Change-Id: Ia27ee177b67f1151fd1178b24744b65da8e756fd --- diff --git a/includes/specials/SpecialChangeEmail.php b/includes/specials/SpecialChangeEmail.php index a1c6fd2a57..167d4e2c80 100644 --- a/includes/specials/SpecialChangeEmail.php +++ b/includes/specials/SpecialChangeEmail.php @@ -42,11 +42,13 @@ class SpecialChangeEmail extends UnlistedSpecialPage { function execute( $par ) { global $wgAuth; - $this->checkReadOnly(); - $this->setHeaders(); $this->outputHeader(); + $out = $this->getOutput(); + $out->disallowUserJs(); + $out->addModules( 'mediawiki.special.changeemail' ); + if ( !$wgAuth->allowPropChange( 'emailaddress' ) ) { $this->error( 'cannotchangeemail' ); return; @@ -65,9 +67,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage { return; } - $out = $this->getOutput(); - $out->disallowUserJs(); - $out->addModules( 'mediawiki.special.changeemail' ); + $this->checkReadOnly(); $this->mPassword = $request->getVal( 'wpPassword' ); $this->mNewEmail = $request->getVal( 'wpNewEmail' ); diff --git a/includes/specials/SpecialChangePassword.php b/includes/specials/SpecialChangePassword.php index b30605b7e1..41b3b2558f 100644 --- a/includes/specials/SpecialChangePassword.php +++ b/includes/specials/SpecialChangePassword.php @@ -37,7 +37,9 @@ class SpecialChangePassword extends UnlistedSpecialPage { function execute( $par ) { global $wgAuth; - $this->checkReadOnly(); + $this->setHeaders(); + $this->outputHeader(); + $this->getOutput()->disallowUserJs(); $request = $this->getRequest(); $this->mUserName = trim( $request->getVal( 'wpName' ) ); @@ -46,10 +48,6 @@ class SpecialChangePassword extends UnlistedSpecialPage { $this->mRetype = $request->getVal( 'wpRetype' ); $this->mDomain = $request->getVal( 'wpDomain' ); - $this->setHeaders(); - $this->outputHeader(); - $this->getOutput()->disallowUserJs(); - $user = $this->getUser(); if( !$request->wasPosted() && !$user->isLoggedIn() ) { $this->error( $this->msg( 'resetpass-no-info' )->text() ); @@ -61,6 +59,8 @@ class SpecialChangePassword extends UnlistedSpecialPage { return; } + $this->checkReadOnly(); + if( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'token' ) ) ) { try { $this->mDomain = $wgAuth->getDomain();