From: jenkins-bot Date: Mon, 14 Aug 2017 16:48:17 +0000 (+0000) Subject: Merge "Perform a permission check on the title when changing the page language" X-Git-Tag: 1.31.0-rc.0~2391 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=6c9a2923fe1ee3a65cb027be5e781772f2b12fbd;p=lhc%2Fweb%2Fwiklou.git Merge "Perform a permission check on the title when changing the page language" --- 6c9a2923fe1ee3a65cb027be5e781772f2b12fbd diff --cc includes/specials/SpecialPageLanguage.php index 2943fd4e3d,ef034fb4d4..78a453e7b1 --- a/includes/specials/SpecialPageLanguage.php +++ b/includes/specials/SpecialPageLanguage.php @@@ -135,8 -135,18 +135,18 @@@ class SpecialPageLanguage extends FormS return Status::newFatal( $ex->getMessageObject() ); } + // Check permissions and make sure the user has permission to edit the page + $errors = $title->getUserPermissionsErrors( 'edit', $this->getUser() ); + + if ( $errors ) { + $out = $this->getOutput(); + $wikitext = $out->formatPermissionsErrorMessage( $errors ); + // Hack to get our wikitext parsed + return Status::newFatal( new RawMessage( '$1', [ $wikitext ] ) ); + } + // Url to redirect to after the operation - $this->goToUrl = $title->getFullURL( + $this->goToUrl = $title->getFullUrlForRedirect( $title->isRedirect() ? [ 'redirect' => 'no' ] : [] );