Tidy up the class
[mediawiki.git] / includes / specials / SpecialUserlogout.php
blobe23df612cc64d649506d50cf9d7c938de03ba6bf
1 <?php
2 /**
3 * @file
4 * @ingroup SpecialPage
5 */
7 /**
8 * constructor
9 */
10 function wfSpecialUserlogout() {
11 global $wgUser, $wgOut;
13 /**
14 * Some satellite ISPs use broken precaching schemes that log people out straight after
15 * they're logged in (bug 17790). Luckily, there's a way to detect such requests.
17 if ( isset( $_SERVER['REQUEST_URI'] ) && strpos( $_SERVER['REQUEST_URI'], '&amp;' ) !== false ) {
18 wfDebug( "Special:Userlogout request {$_SERVER['REQUEST_URI']} looks suspicious, denying.\n" );
19 wfHttpError( 400, wfMsg( 'loginerror' ), wfMsg( 'suspicious-userlogout' ) );
20 return;
23 $oldName = $wgUser->getName();
24 $wgUser->logout();
25 $wgOut->setRobotPolicy( 'noindex,nofollow' );
27 // Hook.
28 $injected_html = '';
29 wfRunHooks( 'UserLogoutComplete', array(&$wgUser, &$injected_html, $oldName) );
31 $wgOut->addHTML( wfMsgExt( 'logouttext', array( 'parse' ) ) . $injected_html );
32 $wgOut->returnToMain();