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 @@