4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 * http://www.gnu.org/copyleft/gpl.html
21 * Implements Special:Userlogout
22 * @ingroup SpecialPage
24 class SpecialUserlogout
extends UnlistedSpecialPage
{
26 function __construct() {
27 parent
::__construct( 'Userlogout' );
30 function execute( $par ) {
31 global $wgUser, $wgOut;
34 * Some satellite ISPs use broken precaching schemes that log people out straight after
35 * they're logged in (bug 17790). Luckily, there's a way to detect such requests.
37 if ( isset( $_SERVER['REQUEST_URI'] ) && strpos( $_SERVER['REQUEST_URI'], '&' ) !== false ) {
38 wfDebug( "Special:Userlogout request {$_SERVER['REQUEST_URI']} looks suspicious, denying.\n" );
39 wfHttpError( 400, wfMsg( 'loginerror' ), wfMsg( 'suspicious-userlogout' ) );
44 $this->outputHeader();
46 $oldName = $wgUser->getName();
49 $wgOut->addWikiMsg( 'logouttext' );
53 wfRunHooks( 'UserLogoutComplete', array( &$wgUser, &$injected_html, $oldName ) );
54 $wgOut->addHTML( $injected_html );
56 $wgOut->returnToMain();