Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/MobileFrontend.php |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | } |
90 | 90 | |
91 | 91 | class ExtMobileFrontend { |
92 | | - const VERSION = '0.5.90'; |
| 92 | + const VERSION = '0.5.91'; |
93 | 93 | |
94 | 94 | /** |
95 | 95 | * @var DOMDocument |
— | — | @@ -585,6 +585,7 @@ |
586 | 586 | $this->sendXDeviceVaryHeader(); |
587 | 587 | $this->sendApplicationVersionVaryHeader(); |
588 | 588 | $this->checkUserStatus(); |
| 589 | + $this->checkUserLoggedIn(); |
589 | 590 | |
590 | 591 | if ( self::$title->isSpecial( 'Userlogin' ) && self::$isBetaGroupMember ) { |
591 | 592 | self::$wsLoginToken = $wgRequest->getSessionData( 'wsLoginToken' ); |
— | — | @@ -601,6 +602,32 @@ |
602 | 603 | wfProfileOut( __METHOD__ ); |
603 | 604 | return true; |
604 | 605 | } |
| 606 | + |
| 607 | + /** |
| 608 | + * @return bool |
| 609 | + */ |
| 610 | + private function checkUserLoggedIn() { |
| 611 | + global $wgUser, $wgCookieDomain, $wgRequest, $wgCookiePrefix; |
| 612 | + wfProfileIn( __METHOD__ ); |
| 613 | + $tempWgCookieDomain = $wgCookieDomain; |
| 614 | + $wgCookieDomain = $this->getBaseDomain(); |
| 615 | + $tempWgCookiePrefix = $wgCookiePrefix; |
| 616 | + $wgCookiePrefix = ''; |
| 617 | + |
| 618 | + if ( $wgUser->isLoggedIn() ) { |
| 619 | + $wgRequest->response()->setcookie( 'mfsecure', '1', 0, '' ); |
| 620 | + } else { |
| 621 | + $mfSecure = $wgRequest->getCookie( 'mfsecure', '' ); |
| 622 | + if ( !empty( $mfSecure ) && $mfSecure == '1' ) { |
| 623 | + $wgRequest->response()->setcookie( 'mfsecure', '', 0, '' ); |
| 624 | + } |
| 625 | + } |
| 626 | + |
| 627 | + $wgCookieDomain = $tempWgCookieDomain; |
| 628 | + $wgCookiePrefix = $tempWgCookiePrefix; |
| 629 | + wfProfileOut( __METHOD__ ); |
| 630 | + return true; |
| 631 | + } |
605 | 632 | |
606 | 633 | private function checkUserStatus() { |
607 | 634 | wfProfileIn( __METHOD__ ); |