From cdd8c8a5f88c5bde674805093bc93a9c136120cc Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 8 Jan 2026 06:38:12 +0000 Subject: [PATCH] Add auth to stats-controller --- application/controllers/Statistics.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/application/controllers/Statistics.php b/application/controllers/Statistics.php index 7c56681dc..074f0383a 100644 --- a/application/controllers/Statistics.php +++ b/application/controllers/Statistics.php @@ -2,9 +2,14 @@ class Statistics extends CI_Controller { - function __construct() - { + function __construct() { parent::__construct(); + + $this->load->model('user_model'); + if (!$this->user_model->authorize(2)) { + $this->session->set_flashdata('error', __("You're not allowed to do that!")); + redirect('dashboard'); + } } @@ -12,14 +17,6 @@ class Statistics extends CI_Controller { $this->load->model('user_model'); $this->load->model('bands'); - if(!$this->user_model->authorize($this->config->item('auth_mode'))) { - if($this->user_model->validate_session()) { - $this->user_model->clear_session(); - show_error('Access denied

Click here to log in as another user', 403); - } else { - redirect('user/login'); - } - } // Render User Interface // Set Page Title