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