aboutsummaryrefslogtreecommitdiffstats
path: root/includes/User.php
diff options
context:
space:
mode:
authorTom Gilder <tomgilder@users.mediawiki.org>2005-01-18 03:06:20 +0000
committerTom Gilder <tomgilder@users.mediawiki.org>2005-01-18 03:06:20 +0000
commit8249f225d0e26dd1b9c4345f50f31b7f82c9b72f (patch)
tree9421759d00b5cc9b6a328699ae733617f380030a /includes/User.php
parentcc586b28c81d45db105c7e375eefa741700fcb06 (diff)
downloadmediawikicore-8249f225d0e26dd1b9c4345f50f31b7f82c9b72f.tar.gz
mediawikicore-8249f225d0e26dd1b9c4345f50f31b7f82c9b72f.zip
Much more graceful way of not showing logged-in pages to logged-out users
Notes
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/7144
Diffstat (limited to 'includes/User.php')
-rw-r--r--includes/User.php29
1 files changed, 9 insertions, 20 deletions
diff --git a/includes/User.php b/includes/User.php
index c347f3030efd..036d8837ea9a 100644
--- a/includes/User.php
+++ b/includes/User.php
@@ -153,7 +153,7 @@ class User {
$fname = 'User::loadDefaults' . $n;
wfProfileIn( $fname );
- global $wgContLang, $wgIP;
+ global $wgContLang, $wgIP, $wgDBname;
global $wgNamespacesToBeSearchedDefault;
$this->mId = 0;
@@ -175,9 +175,16 @@ class User {
unset( $this->mSkin );
$this->mDataLoaded = false;
$this->mBlockedby = -1; # Unset
- $this->mTouched = '0'; # Allow any pages to be cached
$this->setToken(); # Random
$this->mHash = false;
+
+ if ( isset( $_COOKIE[$wgDBname.'LoggedOut'] ) ) {
+ $this->mTouched = wfTimestamp( TS_MW, $_COOKIE[$wgDBname.'LoggedOut'] );
+ }
+ else {
+ $this->mTouched = '0'; # Allow any pages to be cached
+ }
+
wfProfileOut( $fname );
}
@@ -899,10 +906,6 @@ class User {
} else {
setcookie( $wgDBname.'Token', '', time() - 3600 );
}
-
- # Clear previous logged out time, set logged in time
- setcookie( $wgDBname.'LoggedOut', '', time() - 3600, $wgCookiePath, $wgCookieDomain );
- setcookie( $wgDBname.'LoggedIn', wfTimestampNow(), time() + 86400, $wgCookiePath, $wgCookieDomain );
}
/**
@@ -1184,20 +1187,6 @@ class User {
}
return false;
}
-
- /**
- * Check if the user was logged on at a certain timestamp, but no longer is.
- * @param int $timestamp Timestamp to check.
- * @return bool True if user was logged in.
- */
- function wasLoggedInAt( $timestamp ) {
- global $wgDBname;
-
- if ( !$this->getID() && isset( $_COOKIE[$wgDBname.'LoggedIn'] ) && isset( $_COOKIE[$wgDBname.'LoggedOut'] ) )
- return ( $timestamp >= $_COOKIE[$wgDBname.'LoggedIn'] && $timestamp <= $_COOKIE[$wgDBname.'LoggedOut'] );
- else
- return false;
- }
}
?>