MediaWiki  REL1_22
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, $this->msg( 'suspicious-userlogout' ), $this->msg( 'loginerror' ) );
00043         }
00044 
00045         $this->setHeaders();
00046         $this->outputHeader();
00047 
00048         $user = $this->getUser();
00049         $oldName = $user->getName();
00050         $user->logout();
00051 
00052         $loginURL = SpecialPage::getTitleFor( 'Userlogin' )->getFullURL(
00053             $this->getRequest()->getValues( 'returnto', 'returntoquery' ) );
00054 
00055         $out = $this->getOutput();
00056         $out->addWikiMsg( 'logouttext', $loginURL );
00057 
00058         // Hook.
00059         $injected_html = '';
00060         wfRunHooks( 'UserLogoutComplete', array( &$user, &$injected_html, $oldName ) );
00061         $out->addHTML( $injected_html );
00062 
00063         $out->returnToMain();
00064     }
00065 
00066     protected function getGroupName() {
00067         return 'login';
00068     }
00069 }