(bug 17790) Users instantly logged off on HughesNet
[lhc/web/wiklou.git] / includes / specials / SpecialUserlogout.php
1 <?php
2 /**
3 * @file
4 * @ingroup SpecialPage
5 */
6
7 /**
8 * constructor
9 */
10 function wfSpecialUserlogout() {
11 global $wgUser, $wgOut;
12
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.
16 */
17 wfDebug( $_SERVER['REQUEST_URI'] . "\n" );
18 if ( isset( $_SERVER['REQUEST_URI'] ) && strpos( $_SERVER['REQUEST_URI'], '&amp;' ) !== false ) {
19 wfHttpError( 400, wfMsg( 'loginerror' ), wfMsg( 'suspicious-userlogout' ) );
20 return;
21 }
22
23 $oldName = $wgUser->getName();
24 $wgUser->logout();
25 $wgOut->setRobotPolicy( 'noindex,nofollow' );
26
27 // Hook.
28 $injected_html = '';
29 wfRunHooks( 'UserLogoutComplete', array(&$wgUser, &$injected_html, $oldName) );
30
31 $wgOut->addHTML( wfMsgExt( 'logouttext', array( 'parse' ) ) . $injected_html );
32 $wgOut->returnToMain();
33 }