MediaWiki  REL1_19
SpecialUserlogout.php
Go to the documentation of this file.
00001 <?php
00029 class SpecialUserlogout extends UnlistedSpecialPage {
00030 
00031         function __construct() {
00032                 parent::__construct( 'Userlogout' );
00033         }
00034 
00035         function execute( $par ) {
00040                 if ( isset( $_SERVER['REQUEST_URI'] ) && strpos( $_SERVER['REQUEST_URI'], '&amp;' ) !== false ) {
00041                         wfDebug( "Special:Userlogout request {$_SERVER['REQUEST_URI']} looks suspicious, denying.\n" );
00042                         throw new HttpError( 400, wfMessage( 'suspicious-userlogout' ), wfMessage( 'loginerror' ) );
00043                 }
00044 
00045                 $this->setHeaders();
00046                 $this->outputHeader();
00047 
00048                 $user = $this->getUser();
00049                 $oldName = $user->getName();
00050                 $user->logout();
00051 
00052                 $out = $this->getOutput();
00053                 $out->addWikiMsg( 'logouttext' );
00054 
00055                 // Hook.
00056                 $injected_html = '';
00057                 wfRunHooks( 'UserLogoutComplete', array( &$user, &$injected_html, $oldName ) );
00058                 $out->addHTML( $injected_html );
00059 
00060                 $out->returnToMain();
00061         }
00062 }