From 19af0c49c8373ef9c95abd17ae4c2fc3e135ec68 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Tue, 13 Aug 2024 08:08:57 +0200 Subject: [PATCH 1/4] fix gettext cookie --- application/hooks/gettext/Gettext.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/hooks/gettext/Gettext.php b/application/hooks/gettext/Gettext.php index 84325d404..212523d03 100644 --- a/application/hooks/gettext/Gettext.php +++ b/application/hooks/gettext/Gettext.php @@ -279,7 +279,7 @@ class Gettext $folder = NULL; // Check if any cookie is set - if ($cookie = $IN->cookie(config_item('cookie_prefix').$this->config['cookie'], TRUE)) + if ($cookie = $IN->cookie($this->config['cookie'], TRUE)) { $folder = $cookie; } @@ -308,7 +308,7 @@ class Gettext // Use cookie if enabled if ( ! empty($this->config['cookie'])) { - $IN->set_cookie($this->config['cookie'], $current['folder'], 2678400); + $IN->set_cookie(str_replace(config_item('cookie_prefix'), '', $this->config['cookie']), $current['folder'], 2678400); } // In case we use session @@ -401,7 +401,7 @@ class Gettext // If the use of cookies is ON if ($this->config['cookie'] !== NULL) { - $IN->set_cookie($this->config['cookie'], $lang['folder'], 2678400); + $IN->set_cookie(str_replace(config_item('cookie_prefix'), '', $this->config['cookie']), $lang['folder'], 2678400); } // In case COOKIE are off but SESSION is on From 5e7a6b5cb195066d2b6c1a03a49e2fecee723933 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Tue, 13 Aug 2024 08:26:28 +0200 Subject: [PATCH 2/4] fix keep_login cookie --- application/controllers/User.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/application/controllers/User.php b/application/controllers/User.php index f6345645f..bf2cbd0d6 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -830,7 +830,7 @@ class User extends CI_Controller { log_message('debug', "User ID: [$uid] Login rejected because of an active maintenance mode (and he is no admin)."); // Delete keep_login cookie - setcookie('keep_login', '', time() - 3600, '/'); + $this->input->set_cookie('keep_login', '', time() - 3600, ''); redirect('user/login'); } @@ -839,7 +839,7 @@ class User extends CI_Controller { log_message('debug', "User ID: [$uid] Login rejected because of non matching hash key ('Keep Login')."); // Delete keep_login cookie - setcookie('keep_login', '', time() - 3600, '/'); + $this->input->set_cookie('keep_login', '', time() - 3600, ''); $this->session->set_flashdata('error', __("Login failed. Try again.")); redirect('user/login'); } @@ -848,7 +848,7 @@ class User extends CI_Controller { log_message('error', "User ID: [".$uid."]; 'Keep Login' failed. Cookie deleted. Message: ".$e); // Delete keep_login cookie - setcookie('keep_login', '', time() - 3600, '/'); + $this->input->set_cookie('keep_login', '', time() - 3600, ''); $this->session->set_flashdata('error', __("Login failed. Try again.")); redirect('user/login'); @@ -912,7 +912,7 @@ class User extends CI_Controller { $user_name = $this->session->userdata('user_name'); // Delete keep_login cookie - setcookie('keep_login', '', time() - 3600, '/'); + $this->input->set_cookie('keep_login', '', time() - 3600, ''); $this->user_model->clear_session(); From b281143aa81e58416762db38e08e203b39a4fa70 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Tue, 13 Aug 2024 08:30:54 +0200 Subject: [PATCH 3/4] make use of the config for cookie names --- application/controllers/User.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/controllers/User.php b/application/controllers/User.php index bf2cbd0d6..a617c6389 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -635,7 +635,7 @@ class User extends CI_Controller { if ($this->session->userdata('user_id') == $this->uri->segment(3)) { // Editing own User? Set cookie! $cookie= array( - 'name' => 'language', + 'name' => $this->config->item('gettext_cookie', 'gettext'), 'value' => $this->input->post('user_language', true), 'expire' => time()+1000, 'secure' => FALSE @@ -869,7 +869,7 @@ class User extends CI_Controller { $this->user_model->update_session($data['user']->user_id); $cookie= array( - 'name' => 'language', + 'name' => $this->config->item('gettext_cookie', 'gettext'), 'value' => $data['user']->user_language, 'expire' => time()+1000, 'secure' => FALSE From 0165508b04ac1867f6a41efa8f40dad3f51bb809 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Tue, 13 Aug 2024 11:52:41 +0200 Subject: [PATCH 4/4] small UI addition --- application/views/debug/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/views/debug/index.php b/application/views/debug/index.php index 245b15c37..65a5ee5ab 100644 --- a/application/views/debug/index.php +++ b/application/views/debug/index.php @@ -29,7 +29,7 @@ - config->item('language')) . "\n"; ?> + config->item('language'))) . "\n"; ?>