From abcc46db94181703bb602903faca30aff43f5424 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Thu, 26 Jan 2023 09:17:45 +0100 Subject: [PATCH] Add PHP8.2 support to the application --- application/core/EA_Controller.php | 16 ++++++++++ application/core/EA_Input.php | 2 +- .../views/components/js_lang_script.php | 2 +- system/core/Controller.php | 19 +++++++++++- system/core/Loader.php | 21 ++++++++++++-- system/core/Router.php | 2 ++ system/core/URI.php | 17 +++++++++++ system/database/DB_driver.php | 17 +++++++++++ system/libraries/Cache/Cache.php | 2 ++ system/libraries/Driver.php | 29 +++++++++++++++---- 10 files changed, 117 insertions(+), 10 deletions(-) diff --git a/application/core/EA_Controller.php b/application/core/EA_Controller.php index 28d7796e..2a78e3ff 100644 --- a/application/core/EA_Controller.php +++ b/application/core/EA_Controller.php @@ -77,6 +77,8 @@ class EA_Controller extends CI_Controller { $this->configure_language(); + $this->load_common_html_vars(); + $this->load_common_script_vars(); rate_limit($this->input->ip_address()); @@ -97,6 +99,20 @@ class EA_Controller extends CI_Controller { $this->lang->load('translations'); } + /** + * Load common script vars for all requests. + */ + private function load_common_html_vars() + { + html_vars([ + 'base_url' => config('base_url'), + 'index_page' => config('index_page'), + 'available_languages' => config('available_languages'), + 'language' => $this->lang->language, + 'csrf_token' => $this->security->get_csrf_hash(), + ]); + } + /** * Load common script vars for all requests. */ diff --git a/application/core/EA_Input.php b/application/core/EA_Input.php index 00d81454..9e006d44 100644 --- a/application/core/EA_Input.php +++ b/application/core/EA_Input.php @@ -55,7 +55,7 @@ class EA_Input extends CI_Input { /** @var EA_Controller $CI */ $CI = &get_instance(); - if (strpos($CI->input->get_request_header('Content-Type'), 'application/json') === false) + if (strpos((string)$CI->input->get_request_header('Content-Type'), 'application/json') === false) { return NULL; } diff --git a/application/views/components/js_lang_script.php b/application/views/components/js_lang_script.php index 80a821f2..ef18a90a 100644 --- a/application/views/components/js_lang_script.php +++ b/application/views/components/js_lang_script.php @@ -1,6 +1,6 @@