]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - includes/specials/SpecialUserlogout.php
MediaWiki 1.16.1
[autoinstalls/mediawiki.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         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;
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 }