add methods unsetActive user try session timeout
This commit is contained in:
parent
6ea06b7620
commit
84b26d8271
1 changed files with 21 additions and 0 deletions
|
|
@ -360,6 +360,17 @@ class WPCrm
|
|||
return self::$user = new WPCrmUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove active user
|
||||
* to prevent WPCrm::check to return true
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function unsetActiveUser()
|
||||
{
|
||||
self::$user = null;
|
||||
}
|
||||
|
||||
// --- PRIVATE --- METHODS
|
||||
|
||||
/**
|
||||
|
|
@ -457,6 +468,16 @@ class WPCrm
|
|||
if (!session_id() && !self::$sessionDestroyed) {
|
||||
session_start();
|
||||
}
|
||||
if (
|
||||
isset($_SESSION[self::$sessionKey]) and
|
||||
isset($_SESSION['lastActivity']) and
|
||||
($_SESSION['lastActivity'] + 120) < time()
|
||||
) {
|
||||
self::$sessionDestroyed = true;
|
||||
unset($_SESSION[self::$sessionKey]);
|
||||
} else {
|
||||
$_SESSION['lastActivity'] = time();
|
||||
}
|
||||
if (!self::$user and array_key_exists(self::$sessionKey, $_SESSION)) {
|
||||
/**
|
||||
* The user object
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue