From 95d26cbcb723bdb7ae559eb1981fbb7138f33ad8 Mon Sep 17 00:00:00 2001 From: DamienMetzger Date: Thu, 22 Nov 2012 10:12:42 +0100 Subject: [PATCH] [-] FO : cookie lifetime is now set with the front end lifetime value instead of the BO value #PSCFV-5668 --- config/config.inc.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/config/config.inc.php b/config/config.inc.php index 4ecdb0184..f80438cc0 100644 --- a/config/config.inc.php +++ b/config/config.inc.php @@ -109,21 +109,24 @@ Context::getContext()->country = $defaultCountry; @date_default_timezone_set(Configuration::get('PS_TIMEZONE')); /* Instantiate cookie */ -$cookieLifetime = (time() + (((int)Configuration::get('PS_COOKIE_LIFETIME_BO') > 0 ? (int)Configuration::get('PS_COOKIE_LIFETIME_BO') : 1)* 3600)); + + +$cookie_lifetime = (int)(defined('_PS_ADMIN_DIR_') ? Configuration::get('PS_COOKIE_LIFETIME_BO') : Configuration::get('PS_COOKIE_LIFETIME_FO')); +$cookie_lifetime = time() + (max($cookie_lifetime, 1) * 3600); if (defined('_PS_ADMIN_DIR_')) - $cookie = new Cookie('psAdmin', '', $cookieLifetime); + $cookie = new Cookie('psAdmin', '', $cookie_lifetime); else { if (Context::getContext()->shop->getGroup()->share_order) - $cookie = new Cookie('ps-sg'.Context::getContext()->shop->getGroup()->id, '', $cookieLifetime, Context::getContext()->shop->getUrlsSharedCart()); + $cookie = new Cookie('ps-sg'.Context::getContext()->shop->getGroup()->id, '', $cookie_lifetime, Context::getContext()->shop->getUrlsSharedCart()); else { $domains = null; if(Context::getContext()->shop->domain != Context::getContext()->shop->domain_ssl) $domains = array(Context::getContext()->shop->domain_ssl, Context::getContext()->shop->domain); - $cookie = new Cookie('ps-s'.Context::getContext()->shop->id, '', $cookieLifetime, $domains); + $cookie = new Cookie('ps-s'.Context::getContext()->shop->id, '', $cookie_lifetime, $domains); } }