Skip to content

Commit

Permalink
Adding support for storing memcache configuration for sessions. photo…
Browse files Browse the repository at this point in the history
  • Loading branch information
jmathai committed Apr 1, 2012
1 parent cd56451 commit befc88c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/libraries/external/epi/EpiSession_Memcached.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ class EpiSession_Memcached implements EpiSessionInterface

public function __construct($params = array())
{
$this->host = !empty($params[0]) ? $params[0] : 'localhost';
$this->port = !empty($params[1]) ? $params[1] : 11211;;
$this->compress = !empty($params[2]) ? $params[2] : 0;;
$this->expiry = !empty($params[3]) ? $params[3] : 3600;
$this->domain = !empty($params[4]) ? $params[4] : $_SERVER['HTTP_HOST'];
if(empty($_COOKIE[EpiSession::COOKIE]))
{
$cookieVal = md5(uniqid(rand(), true));
setcookie(EpiSession::COOKIE, $cookieVal, time()+1209600, '/');
setcookie(EpiSession::COOKIE, $cookieVal, time()+$this->expiry, '/', $this->domain);
$_COOKIE[EpiSession::COOKIE] = $cookieVal;
}
$this->host = !empty($params[0]) ? $params[0] : 'localhost';
$this->port = !empty($params[1]) ? $params[1] : 11211;;
$this->compress = !empty($params[2]) ? $params[2] : 0;;
$this->expiry = !empty($params[3]) ? $params[3] : 3600;
}

public function end()
Expand Down
2 changes: 2 additions & 0 deletions src/libraries/models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ public function setEmail($email)
{
$this->session->set('email', $email);
$this->session->set('crumb', md5($this->config->secrets->secret . time()));
if($this->isOwner())
$this->session->set('site', $_SERVER['HTTP_HOST']);
}

/**
Expand Down

0 comments on commit befc88c

Please sign in to comment.