From c5bc384962b4ef74578d54dc682276e36357f40b Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 27 Sep 2016 19:34:33 +0200 Subject: c/MY_Controller: Extract CSRF protection code into method Signed-off-by: Florian Pritz --- application/core/MY_Controller.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php index cbb95aa33..afd8b5ef2 100644 --- a/application/core/MY_Controller.php +++ b/application/core/MY_Controller.php @@ -62,11 +62,7 @@ class MY_Controller extends CI_Controller { } if ($csrf_protection && !$this->input->is_cli_request()) { - // 2 functions for accessing config options, really? - $this->config->set_item('csrf_protection', true); - config_item("csrf_protection", true); - $this->security->__construct(); - $this->security->csrf_verify(); + $this->_setup_csrf_protection(); } if ($this->config->item("environment") == "development") { @@ -108,4 +104,12 @@ class MY_Controller extends CI_Controller { } } + private function _setup_csrf_protection() + { + // 2 functions for accessing config options, really? + $this->config->set_item('csrf_protection', true); + config_item("csrf_protection", true); + $this->security->__construct(); + $this->security->csrf_verify(); + } } -- cgit v1.2.3-24-g4f1b