| 1 | <?php |
| 2 | /** |
| 3 | * Implements Special:AuthenticationPopupSuccess |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along |
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | * http://www.gnu.org/copyleft/gpl.html |
| 19 | * |
| 20 | * @file |
| 21 | * @ingroup SpecialPage |
| 22 | */ |
| 23 | |
| 24 | namespace MediaWiki\Specials; |
| 25 | |
| 26 | use MediaWiki\SpecialPage\UnlistedSpecialPage; |
| 27 | use SkinFactory; |
| 28 | |
| 29 | /** |
| 30 | * A page for the 'mediawiki.authenticationPopup' module. If opened in a popup window, |
| 31 | * it communicates with the module on the parent page and closes itself. |
| 32 | * |
| 33 | * @ingroup SpecialPage |
| 34 | */ |
| 35 | class SpecialAuthenticationPopupSuccess extends UnlistedSpecialPage { |
| 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 | } |