Opencart 3 (PHP version > 7.0)
Αρχείο:
1 2 3 |
system/framework.php |
Αντικατάσταση:
1 2 3 |
setcookie($config->get('session_name'), $session->getId(), ini_get('session.cookie_lifetime'), ini_get('session.cookie_path'), ini_get('session.cookie_domain')); |
Με:
1 2 3 |
setcookie($config->get('session_name'), $session->getId(), ['expires' => ini_get('session.cookie_lifetime'), 'path' => ini_get('session.cookie_path'), 'domain' => ini_get('session.cookie_domain'), 'secure' => true, 'httponly' => true, 'samesite' => 'None' ]); |
Αρχείο:
1 2 3 |
catalog/controller/startup/session.php |
Αντικατάσταση:
1 2 3 |
setcookie($this->config->get('session_name'), $this->session->getId(), ini_get('session.cookie_lifetime'), ini_get('session.cookie_path'), ini_get('session.cookie_domain')); |
Με:
1 2 3 |
setcookie( $this->config->get('session_name'), $this->session->getId(), ['expires' => ini_get('session.cookie_lifetime'), 'path' => ini_get('session.cookie_path'), 'domain' => ini_get('session.cookie_domain'), 'secure' => true, 'httponly' => true, 'samesite' => 'None'] ); |
Αρχείο:
1 2 3 |
catalog/controller/startup/startup.php |
Αντικατάσταση:
1 2 3 |
setcookie('currency', $code, time() + 60 * 60 * 24 * 30, '/', $this->request->server['HTTP_HOST']); |
Με:
1 2 3 |
setcookie('currency', $code, ['expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => $this->request->server['HTTP_HOST'], 'samesite' => 'None', 'secure' => true]); |
Αντικατάσταση:
1 2 3 |
setcookie('language', $code, time() + 60 * 60 * 24 * 30, '/', $this->request->server['HTTP_HOST']); |
Με:
1 2 3 |
setcookie('language', $code, ['expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => $this->request->server['HTTP_HOST'], 'samesite' => 'None', 'secure' => true]); |
Opencart 2.3
Αρχείο:
1 2 3 |
system/library/session.php |
Αντικατάσταση:
1 2 3 |
session_set_cookie_params(0, '/'); |
Με:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
if (PHP_VERSION_ID < 70300) { session_set_cookie_params(0, '/; samesite=None', ini_get('session.cookie_domain'), true, true); } else { ini_set('session.cookie_samesite', 'None'); session_set_cookie_params([ 'lifetime' => 0, 'path' => '/', 'domain' => ini_get('session.cookie_domain'), 'secure' => true, 'httponly' => true, 'samesite' => 'None' ]); } |
Αντικατάσταση:
1 2 3 |
setcookie($key, $this->session_id, ini_get('session.cookie_lifetime'), ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure'), ini_get('session.cookie_httponly')); |
Με:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
if (PHP_VERSION_ID < 70300) { setcookie($key, $this->session_id, ini_get('session.cookie_lifetime'), ini_get('session.cookie_path') . '; SameSite=None', ini_get('session.cookie_domain'), ini_get('session.cookie_secure'), ini_get('session.cookie_httponly')); } else { $samsite_cookie_options = array ( 'expires' => ini_get('session.cookie_lifetime'), 'path' => ini_get('session.cookie_path'), 'domain' => ini_get('session.cookie_domain'), 'secure' => true, 'httponly' => true, 'samesite' => 'None' ); setcookie($key, $this->session_id, $samsite_cookie_options); } |
Αντικατάσταση:
1 2 3 |
setcookie($key, '', time() - 42000, ini_get('session.cookie_path'), ini_get('session.cookie_domain')); |
Με:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
if (PHP_VERSION_ID < 70300) { setcookie($key, '', time() - 42000, ini_get('session.cookie_path') . '; SameSite=None', ini_get('session.cookie_domain')); } else { $samsite_cookie_options = array ( 'expires' => time() - 42000, 'path' => ini_get('session.cookie_path'), 'domain' => ini_get('session.cookie_domain'), 'secure' => true, 'httponly' => true, 'samesite' => 'None' ); setcookie($key, '', $samsite_cookie_options); } |
Αρχείο:
1 2 3 |
catalog/controller/startup/startup.php |
Αντικατάσταση:
1 2 3 |
setcookie('language', $code, time() + 60 * 60 * 24 * 30, '/', $this->request->server['HTTP_HOST']); |
Με:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
if (PHP_VERSION_ID < 70300) { setcookie('language', $code, time() + 60 * 60 * 24 * 30, '/; SameSite=None', $this->request->server['HTTP_HOST']); } else { $samsite_cookie_options = array ( 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => $this->request->server['HTTP_HOST'], 'secure' => true, 'httponly' => true, 'samesite' => 'None' ); setcookie('language', $code, $samsite_cookie_options); } |
Αντικατάσταση:
1 2 3 |
setcookie('tracking', $this->request->get['tracking'], time() + 3600 * 24 * 1000, '/'); |
Με:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
if (PHP_VERSION_ID < 70300) { setcookie('tracking', $this->request->get['tracking'], time() + 3600 * 24 * 1000, '/; SameSite=None'); } else { $samsite_cookie_options = array ( 'expires' => time() + 3600 * 24 * 1000, 'path' => '/', 'domain' => $this->request->server['HTTP_HOST'], 'secure' => true, 'httponly' => true, 'samesite' => 'None' ); setcookie('tracking', $this->request->get['tracking'], $samsite_cookie_options); } |
Αντικατάσταση:
1 2 3 |
setcookie('currency', $code, time() + 60 * 60 * 24 * 30, '/', $this->request->server['HTTP_HOST']); |
Με:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
if (PHP_VERSION_ID < 70300) { setcookie('currency', $code, time() + 60 * 60 * 24 * 30, '/; SameSite=None', $this->request->server['HTTP_HOST']); } else { $samsite_cookie_options = array ( 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => $this->request->server['HTTP_HOST'], 'secure' => true, // or false 'httponly' => true, // or false 'samesite' => 'None' // None || Lax || Strict ); setcookie('currency', $code, $samsite_cookie_options); } |