X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUserlogout.php;h=d957e875ce48ce453e86b10d3e10307acac6d837;hb=e7c0da1dc1b10cafc31f1a14cd2200f4221c8cff;hp=a7257de6d523a26513277c2cafb55b8c76246b2e;hpb=7b229a2047bb04443486f1a8864ced4ae58ff36a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUserlogout.php b/includes/specials/SpecialUserlogout.php index a7257de6d5..d957e875ce 100644 --- a/includes/specials/SpecialUserlogout.php +++ b/includes/specials/SpecialUserlogout.php @@ -1,5 +1,6 @@ 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(); - $wgOut->addHTML( wfMsgExt( 'logouttext', array( 'parse' ) ) . $injected_html ); - $wgOut->returnToMain(); + $user = $this->getUser(); + $oldName = $user->getName(); + $user->logout(); + + $loginURL = SpecialPage::getTitleFor( 'Userlogin' )->getFullURL( + $this->getRequest()->getValues( 'returnto', 'returntoquery' ) ); + + $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'; + } }