X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUserlogout.php;h=d957e875ce48ce453e86b10d3e10307acac6d837;hb=8f806d211f218d785c728c76aa12ec22352bd520;hp=28f8a5eed0b5757723c5a52013e2654d00daefb0;hpb=e3e5cf1bb9b6ab066b31599f6261961d18741620;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUserlogout.php b/includes/specials/SpecialUserlogout.php index 28f8a5eed0..d957e875ce 100644 --- a/includes/specials/SpecialUserlogout.php +++ b/includes/specials/SpecialUserlogout.php @@ -1,33 +1,69 @@ getName(); - $wgUser->logout(); - $wgOut->setRobotPolicy( 'noindex,nofollow' ); - // Hook. - $injected_html = ''; - wfRunHooks( 'UserLogoutComplete', array(&$wgUser, &$injected_html, $oldName) ); + function execute( $par ) { + /** + * Some satellite ISPs use broken precaching schemes that log people out straight after + * they're logged in (bug 17790). Luckily, there's a way to detect such requests. + */ + if ( isset( $_SERVER['REQUEST_URI'] ) && strpos( $_SERVER['REQUEST_URI'], '&' ) !== false ) { + wfDebug( "Special:Userlogout request {$_SERVER['REQUEST_URI']} looks suspicious, denying.\n" ); + throw new HttpError( 400, $this->msg( 'suspicious-userlogout' ), $this->msg( 'loginerror' ) ); + } + + $this->setHeaders(); + $this->outputHeader(); + + $user = $this->getUser(); + $oldName = $user->getName(); + $user->logout(); + + $loginURL = SpecialPage::getTitleFor( 'Userlogin' )->getFullURL( + $this->getRequest()->getValues( 'returnto', 'returntoquery' ) ); - $wgOut->addHTML( wfMsgExt( 'logouttext', array( 'parse' ) ) . $injected_html ); - $wgOut->returnToMain(); + $out = $this->getOutput(); + $out->addWikiMsg( 'logouttext', $loginURL ); + + // Hook. + $injected_html = ''; + wfRunHooks( 'UserLogoutComplete', array( &$user, &$injected_html, $oldName ) ); + $out->addHTML( $injected_html ); + + $out->returnToMain(); + } + + protected function getGroupName() { + return 'login'; + } }