X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialRedirect.php;h=82d8b73b1f51d59672179883f509c02950295347;hp=49f1b3cd6ab38f2c8c81292db5b1175715edd32c;hb=02f35caa16fa574bb36a1d22eea62c3b250de235;hpb=0bb36bf5aaa72e3af0d7e47177895184f315fbb6 diff --git a/includes/specials/SpecialRedirect.php b/includes/specials/SpecialRedirect.php index 49f1b3cd6a..82d8b73b1f 100644 --- a/includes/specials/SpecialRedirect.php +++ b/includes/specials/SpecialRedirect.php @@ -21,6 +21,8 @@ * @ingroup SpecialPage */ +use MediaWiki\MediaWikiServices; + /** * A special page that redirects to: the user for a numeric user id, * the file for a given filename, or the page for a given revision id. @@ -81,9 +83,16 @@ class SpecialRedirect extends FormSpecialPage { // Message: redirect-not-exists return Status::newFatal( $this->getMessagePrefix() . '-not-exists' ); } + if ( $user->isHidden() && !MediaWikiServices::getInstance()->getPermissionManager() + ->userHasRight( $this->getUser(), 'hideuser' ) + ) { + throw new PermissionsError( null, [ 'badaccess-group0' ] ); + } $userpage = Title::makeTitle( NS_USER, $username ); - return Status::newGood( $userpage->getFullURL( '', false, PROTO_CURRENT ) ); + return Status::newGood( [ + $userpage->getFullURL( '', false, PROTO_CURRENT ), 302 + ] ); } /** @@ -101,7 +110,7 @@ class SpecialRedirect extends FormSpecialPage { } catch ( MalformedTitleException $e ) { return Status::newFatal( $e->getMessageObject() ); } - $file = wfFindFile( $title ); + $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile( $title ); if ( !$file || !$file->exists() ) { // Message: redirect-not-exists