diff options
author | Florian Pritz <bluewind@xinu.at> | 2013-09-22 17:09:57 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2013-09-22 17:18:56 +0200 |
commit | 41c5abd4e8849e6a84ed2af405e9c25a74e018f3 (patch) | |
tree | 9c8a62934a5b725330d9def35653e04adca20a08 /application/views | |
parent | 9538bea0908c8a3758b41967d977455af731c344 (diff) |
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 <bluewind@xinu.at>
Diffstat (limited to 'application/views')
-rw-r--r-- | application/views/file/upload_form.php | 2 | ||||
-rw-r--r-- | application/views/header.php | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/application/views/file/upload_form.php b/application/views/file/upload_form.php index a977aaa92..b472bcc10 100644 --- a/application/views/file/upload_form.php +++ b/application/views/file/upload_form.php @@ -1,4 +1,4 @@ -<?php if (user_logged_in()) { ?> +<?php if (isset($user_logged_in) && $user_logged_in) { ?> <div class="well"> <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 text-upload-form"> diff --git a/application/views/header.php b/application/views/header.php index 396841a0e..7d4ba1f54 100644 --- a/application/views/header.php +++ b/application/views/header.php @@ -54,7 +54,7 @@ if (is_cli_client() && !isset($force_full_html)) { <div class="collapse navbar-collapse navbar-ex1-collapse"> <?php if(!isset($GLOBALS["is_error_page"])) { ?> <ul class="nav navbar-nav navbar-right"> - <?php if(user_logged_in()) { ?> + <?php if (isset($user_logged_in) && $user_logged_in) { ?> <li><a class="navbar-link" href="<?php echo site_url("/user/logout"); ?>">Logout</a></li> <?php } else { ?> <li class="dropdown"> @@ -74,7 +74,7 @@ if (is_cli_client() && !isset($force_full_html)) { </ul> <?php }; ?> <ul class="nav navbar-nav"> - <?php if(user_logged_in()) { ?> + <?php if (isset($user_logged_in) && $user_logged_in) { ?> <li><a href="<?php echo site_url("file/index") ?>"><span class="glyphicon glyphicon-pencil"></span> New</a></li> <li><a href="<?php echo site_url("file/upload_history") ?>"><span class="glyphicon glyphicon-book"></span> History</a></li> <li class="dropdown"> |