[-] FO : #PSCFV-3242 - Add PS version in cookie hach name

This commit is contained in:
mDeflotte
2012-07-25 15:30:47 +00:00
parent b8de38394b
commit fed5d1c614
2 changed files with 8 additions and 8 deletions
+6 -6
View File
@@ -63,7 +63,7 @@ class CookieCore
{ {
$this->_content = array(); $this->_content = array();
$this->_expire = isset($expire) ? (int)($expire) : (time() + 1728000); $this->_expire = isset($expire) ? (int)($expire) : (time() + 1728000);
$this->_name = md5($name); $this->_name = md5(_PS_VERSION_.$name);
$this->_path = trim(Context::getContext()->shop->physical_uri.$path, '/\\').'/'; $this->_path = trim(Context::getContext()->shop->physical_uri.$path, '/\\').'/';
if ($this->_path{0} != '/') $this->_path = '/'.$this->_path; if ($this->_path{0} != '/') $this->_path = '/'.$this->_path;
$this->_path = rawurlencode($this->_path); $this->_path = rawurlencode($this->_path);
@@ -273,8 +273,8 @@ class CookieCore
{ {
$tmpTab2 = explode('|', $keyAndValue); $tmpTab2 = explode('|', $keyAndValue);
if (count($tmpTab2) == 2) if (count($tmpTab2) == 2)
$this->_content[$tmpTab2[0]] = $tmpTab2[1]; $this->_content[$tmpTab2[0]] = $tmpTab2[1];
} }
/* Blowfish fix */ /* Blowfish fix */
if (isset($this->_content['checksum'])) if (isset($this->_content['checksum']))
$this->_content['checksum'] = (int)($this->_content['checksum']); $this->_content['checksum'] = (int)($this->_content['checksum']);
@@ -309,7 +309,7 @@ class CookieCore
else else
{ {
$content = 0; $content = 0;
$time = time() - 1; $time = 1;
} }
if (PHP_VERSION_ID <= 50200) /* PHP version > 5.2.0 */ if (PHP_VERSION_ID <= 50200) /* PHP version > 5.2.0 */
return setcookie($this->_name, $content, $time, $this->_path, $this->_domain, 0); return setcookie($this->_name, $content, $time, $this->_path, $this->_domain, 0);
@@ -318,8 +318,8 @@ class CookieCore
} }
/** /**
* Save cookie with setcookie() * Save cookie with setcookie()
*/ */
public function write() public function write()
{ {
$cookie = ''; $cookie = '';
+2 -2
View File
@@ -139,7 +139,7 @@ class AdminLoginControllerCore extends AdminController
if (!count($this->errors)) if (!count($this->errors))
{ {
// Find employee // Find employee
$this->context->employee = new Employee(); $this->context->employee = new Employee();
$is_employee_loaded = $this->context->employee->getByemail($email, $passwd); $is_employee_loaded = $this->context->employee->getByemail($email, $passwd);
$employee_associated_shop = $this->context->employee->getAssociatedShops(); $employee_associated_shop = $this->context->employee->getAssociatedShops();
@@ -156,7 +156,7 @@ class AdminLoginControllerCore extends AdminController
else else
{ {
$this->context->employee->remote_addr = ip2long(Tools::getRemoteAddr()); $this->context->employee->remote_addr = ip2long(Tools::getRemoteAddr());
// Update cookie // Update cookie
$cookie = Context::getContext()->cookie; $cookie = Context::getContext()->cookie;
$cookie->id_employee = $this->context->employee->id; $cookie->id_employee = $this->context->employee->id;
$cookie->email = $this->context->employee->email; $cookie->email = $this->context->employee->email;