Index: trunk/phase3/includes/User.php |
— | — | @@ -816,7 +816,7 @@ |
817 | 817 | function loadDefaults( $name = false ) { |
818 | 818 | wfProfileIn( __METHOD__ ); |
819 | 819 | |
820 | | - global $wgCookiePrefix; |
| 820 | + global $wgRequest; |
821 | 821 | |
822 | 822 | $this->mId = 0; |
823 | 823 | $this->mName = $name; |
— | — | @@ -827,8 +827,8 @@ |
828 | 828 | $this->mOptionOverrides = null; |
829 | 829 | $this->mOptionsLoaded = false; |
830 | 830 | |
831 | | - if ( isset( $_COOKIE[$wgCookiePrefix.'LoggedOut'] ) ) { |
832 | | - $this->mTouched = wfTimestamp( TS_MW, $_COOKIE[$wgCookiePrefix.'LoggedOut'] ); |
| 831 | + if( $wgRequest->getCookie( 'LoggedOut' ) ) { |
| 832 | + $this->mTouched = wfTimestamp( TS_MW, $wgRequest->getCookie( 'LoggedOut' ) ); |
833 | 833 | } else { |
834 | 834 | $this->mTouched = '0'; # Allow any pages to be cached |
835 | 835 | } |
— | — | @@ -859,7 +859,7 @@ |
860 | 860 | * @return \bool True if the user is logged in, false otherwise. |
861 | 861 | */ |
862 | 862 | private function loadFromSession() { |
863 | | - global $wgCookiePrefix, $wgExternalAuthType, $wgAutocreatePolicy; |
| 863 | + global $wgRequest, $wgExternalAuthType, $wgAutocreatePolicy; |
864 | 864 | |
865 | 865 | $result = null; |
866 | 866 | wfRunHooks( 'UserLoadFromSession', array( $this, &$result ) ); |
— | — | @@ -875,8 +875,8 @@ |
876 | 876 | } |
877 | 877 | } |
878 | 878 | |
879 | | - if ( isset( $_COOKIE["{$wgCookiePrefix}UserID"] ) ) { |
880 | | - $sId = intval( $_COOKIE["{$wgCookiePrefix}UserID"] ); |
| 879 | + if ( $wgRequest->getCookie( 'UserID' ) ) { |
| 880 | + $sId = intval( $wgRequest->getCookie( 'UserID' ) ); |
881 | 881 | if( isset( $_SESSION['wsUserID'] ) && $sId != $_SESSION['wsUserID'] ) { |
882 | 882 | $this->loadDefaults(); // Possible collision! |
883 | 883 | wfDebugLog( 'loginSessions', "Session user ID ({$_SESSION['wsUserID']}) and |
— | — | @@ -898,8 +898,8 @@ |
899 | 899 | |
900 | 900 | if ( isset( $_SESSION['wsUserName'] ) ) { |
901 | 901 | $sName = $_SESSION['wsUserName']; |
902 | | - } else if ( isset( $_COOKIE["{$wgCookiePrefix}UserName"] ) ) { |
903 | | - $sName = $_COOKIE["{$wgCookiePrefix}UserName"]; |
| 902 | + } else if ( $wgRequest->getCookie('UserName') ) { |
| 903 | + $sName = $wgRequest->getCookie('UserName'); |
904 | 904 | $_SESSION['wsUserName'] = $sName; |
905 | 905 | } else { |
906 | 906 | $this->loadDefaults(); |
— | — | @@ -923,8 +923,8 @@ |
924 | 924 | if ( isset( $_SESSION['wsToken'] ) ) { |
925 | 925 | $passwordCorrect = $_SESSION['wsToken'] == $this->mToken; |
926 | 926 | $from = 'session'; |
927 | | - } else if ( isset( $_COOKIE["{$wgCookiePrefix}Token"] ) ) { |
928 | | - $passwordCorrect = $this->mToken == $_COOKIE["{$wgCookiePrefix}Token"]; |
| 927 | + } else if ( $wgRequest->getCookie( 'Token' ) ) { |
| 928 | + $passwordCorrect = $this->mToken == $wgRequest->getCookie( 'Token' ); |
929 | 929 | $from = 'cookie'; |
930 | 930 | } else { |
931 | 931 | # No session or persistent login cookie |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -305,7 +305,7 @@ |
306 | 306 | session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' ); |
307 | 307 | |
308 | 308 | if( !defined( 'MW_NO_SESSION' ) ) { |
309 | | - if( !$wgCommandLineMode && ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix.'Token'] ) ) ) { |
| 309 | + if( !$wgCommandLineMode && ( $wgRequest->checkSessionCookie() || $wgRequest->getCookie( 'Token' ) ) ) { |
310 | 310 | wfIncrStats( 'request_with_session' ); |
311 | 311 | wfSetupSession(); |
312 | 312 | $wgSessionStarted = true; |
Index: trunk/phase3/includes/WebRequest.php |
— | — | @@ -427,19 +427,19 @@ |
428 | 428 | * @return Boolean |
429 | 429 | */ |
430 | 430 | public function checkSessionCookie() { |
431 | | - return isset( $_COOKIE[session_name()] ); |
| 431 | + return isset( $_COOKIE[ session_name() ] ); |
432 | 432 | } |
433 | 433 | |
434 | 434 | /** |
435 | 435 | * Get a cookie from the $_COOKIE jar |
436 | 436 | * |
437 | 437 | * @param $key String: the name of the cookie |
| 438 | + * @param $prefix String: a prefix to use for the cookie name, if not $wgCookiePrefix |
438 | 439 | * @param $default Mixed: what to return if the value isn't found |
439 | | - * @param $prefix String: a prefix to use for the cookie name, if not $wgCookiePrefix |
440 | 440 | * @return Mixed: cookie value or $default if the cookie not set |
441 | 441 | */ |
442 | | - public function getCookie( $key, $default = null, $prefix = '' ) { |
443 | | - if( !$prefix ) { |
| 442 | + public function getCookie( $key, $prefix = null, $default = null ) { |
| 443 | + if( $prefix === null ) { |
444 | 444 | global $wgCookiePrefix; |
445 | 445 | $prefix = $wgCookiePrefix; |
446 | 446 | } |
Index: trunk/phase3/includes/specials/SpecialUserlogin.php |
— | — | @@ -936,7 +936,7 @@ |
937 | 937 | */ |
938 | 938 | function mainLoginForm( $msg, $msgtype = 'error' ) { |
939 | 939 | global $wgUser, $wgOut, $wgHiddenPrefs, $wgEnableEmail; |
940 | | - global $wgCookiePrefix, $wgLoginLanguageSelector; |
| 940 | + global $wgRequest, $wgLoginLanguageSelector; |
941 | 941 | global $wgAuth, $wgEmailConfirmToEdit, $wgCookieExpiration; |
942 | 942 | |
943 | 943 | $titleObj = SpecialPage::getTitleFor( 'Userlogin' ); |
— | — | @@ -961,7 +961,7 @@ |
962 | 962 | if ( $wgUser->isLoggedIn() ) { |
963 | 963 | $this->mName = $wgUser->getName(); |
964 | 964 | } else { |
965 | | - $this->mName = isset( $_COOKIE[$wgCookiePrefix.'UserName'] ) ? $_COOKIE[$wgCookiePrefix.'UserName'] : null; |
| 965 | + $this->mName = $wgRequest->getCookie( 'UserName' ); |
966 | 966 | } |
967 | 967 | } |
968 | 968 | |
Index: trunk/phase3/includes/extauth/vB.php |
— | — | @@ -50,13 +50,13 @@ |
51 | 51 | # Try using the session table. It will only have a row if the user has |
52 | 52 | # an active session, so it might not always work, but it's a lot easier |
53 | 53 | # than trying to convince PHP to give us vB's $_SESSION. |
54 | | - global $wgExternalAuthConf; |
| 54 | + global $wgExternalAuthConf, $wgRequest; |
55 | 55 | if ( !isset( $wgExternalAuthConf['cookieprefix'] ) ) { |
56 | 56 | $prefix = 'bb'; |
57 | 57 | } else { |
58 | 58 | $prefix = $wgExternalAuthConf['cookieprefix']; |
59 | 59 | } |
60 | | - if ( !isset( $_COOKIE["{$prefix}sessionhash"] ) ) { |
| 60 | + if ( !$wgRequest->getCookie( 'sessionhash', $prefix ) ) { |
61 | 61 | return false; |
62 | 62 | } |
63 | 63 | |
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | $this->getFields(), |
69 | 69 | array( |
70 | 70 | 'session.userid = user.userid', |
71 | | - 'sessionhash' => $_COOKIE["{$prefix}sessionhash"] |
| 71 | + 'sessionhash' => $wgRequest->getCookie( 'sessionhash', $prefix ), |
72 | 72 | ), |
73 | 73 | __METHOD__ |
74 | 74 | ); |