diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-09-27 19:34:33 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-11-05 19:44:15 +0100 |
commit | 88109ab1093711137e1341ce16f769467f2395e0 (patch) | |
tree | 7ffb7d8946e43df16c7fc61f4d18512ad10c5c2e /application/core | |
parent | 8645083c2569995b6d12dbc2b11bbfa0848c2615 (diff) |
c/MY_Controller: Extract CSRF protection code into method
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/core')
-rw-r--r-- | application/core/MY_Controller.php | 14 |
1 files 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(); + } } |