| 1: | <?php
|
| 2: | namespace Opencart\Admin\Controller\Startup;
|
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: |
|
| 8: | class Session extends \Opencart\System\Engine\Controller {
|
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: |
|
| 16: | public function index(): void {
|
| 17: | $session = new \Opencart\System\Library\Session($this->config->get('session_engine'), $this->registry);
|
| 18: | $this->registry->set('session', $session);
|
| 19: |
|
| 20: | if (isset($this->request->cookie[$this->config->get('session_name')])) {
|
| 21: | $session_id = $this->request->cookie[$this->config->get('session_name')];
|
| 22: | } else {
|
| 23: | $session_id = '';
|
| 24: | }
|
| 25: |
|
| 26: | $session->start($session_id);
|
| 27: |
|
| 28: |
|
| 29: | if ($this->config->get('config_session_expire')) {
|
| 30: | $this->config->set('session_expire', $this->config->get('config_session_expire'));
|
| 31: | }
|
| 32: |
|
| 33: |
|
| 34: | $option = [
|
| 35: | 'expires' => $this->config->get('config_session_expire') ? time() + (int)$this->config->get('config_session_expire') : 0,
|
| 36: | 'path' => $this->config->get('session_path'),
|
| 37: | 'secure' => $this->request->server['HTTPS'],
|
| 38: | 'httponly' => false,
|
| 39: | 'SameSite' => $this->config->get('config_session_samesite')
|
| 40: | ];
|
| 41: |
|
| 42: | setcookie($this->config->get('session_name'), $session->getId(), $option);
|
| 43: | }
|
| 44: | }
|
| 45: | |