MediaWiki master
SpecialAuthenticationPopupSuccess.php
Go to the documentation of this file.
1<?php
24namespace MediaWiki\Specials;
25
27use SkinFactory;
28
36 private SkinFactory $skinFactory;
37
38 public function __construct(
39 SkinFactory $skinFactory
40 ) {
41 parent::__construct( 'AuthenticationPopupSuccess' );
42 $this->skinFactory = $skinFactory;
43 }
44
45 public function execute( $par ) {
46 if ( $this->getRequest()->getRawVal( 'display' ) === 'popup' ) {
47 // Replace the default skin with a "micro-skin" that omits most of the interface. (T362706)
48 // In the future, we might allow normal skins to serve this mode too, if they advise that
49 // they support it by setting a skin option, so that colors and fonts could stay consistent.
50 $this->getContext()->setSkin( $this->skinFactory->makeSkin( 'authentication-popup' ) );
51 }
52
53 $this->setHeaders();
54
55 $out = $this->getOutput();
56 $out->addModules( 'mediawiki.authenticationPopup.success' );
57
58 if ( $this->getUser()->isNamed() ) {
59 $out->setPageTitleMsg( $this->msg( 'loginsuccesstitle' ) );
60 $out->addWikiMsg( 'loginsuccess', wfEscapeWikiText( $this->getUser()->getName() ) );
61 } else {
62 $out->setPageTitleMsg( $this->msg( 'exception-nologin' ) );
63 $out->addWikiMsg( 'exception-nologin-text' );
64 }
65 $out->addWikiMsg( 'userlogin-authpopup-closeme' );
66 }
67}
wfEscapeWikiText( $input)
Escapes the given text so that it may be output using addWikiText() without any linking,...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getUser()
Shortcut to get the User executing this instance.
getContext()
Gets the context this SpecialPage is executed in.
getRequest()
Get the WebRequest being used for this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
getName()
Get the canonical, unlocalized name of this special page without namespace.
Shortcut to construct a special page which is unlisted by default.
A page for the 'mediawiki.authenticationPopup' module.
execute( $par)
Default execute method Checks user permissions.
Factory class to create Skin objects.