From 41c5abd4e8849e6a84ed2af405e9c25a74e018f3 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 22 Sep 2013 17:09:57 +0200 Subject: Move user_logged_in check to controller constructor TL;DR: Allows us to show a proper error page if encryption_key is missing from the config. muser->logged_in() can load the session class which will die if encryption_key is not set in the config causing an error to be displayed. Because the header is also loaded when we display an error loading the class will be tried again. CI maintains an array with information which classes have been tried to be loaded and will simply return true without loading again. muser->logged_in() will then try to access $this->session which doesn't exist. Since all of this happens when we are already in the header the error message appears in the navigation being hard to read. Signed-off-by: Florian Pritz --- application/core/MY_Controller.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'application/core') diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php index 47083035c..043b52ef7 100644 --- a/application/core/MY_Controller.php +++ b/application/core/MY_Controller.php @@ -99,5 +99,8 @@ class MY_Controller extends CI_Controller { } $this->data['title'] = "FileBin"; + + $this->load->model("muser"); + $this->data["user_logged_in"] = $this->muser->logged_in(); } } -- cgit v1.2.3-24-g4f1b