diff --git a/application/helpers/google_analytics_helper.php b/application/helpers/google_analytics_helper.php index 8229c4eb..e7769343 100644 --- a/application/helpers/google_analytics_helper.php +++ b/application/helpers/google_analytics_helper.php @@ -20,41 +20,40 @@ */ function google_analytics_script() { - $CI =& get_instance(); + $google_analytics_code = setting('google_analytics_code'); - $CI->load->model('settings_model'); + if ($google_analytics_code !== '') + { - $google_analytics_code = $CI->settings_model->get_setting('google_analytics_code'); - - if ($google_analytics_code !== '') { - - // If the google analytics code starts with UA then it is a Universal Analytics Property and the script stays - // the legacy one - if (substr($google_analytics_code, 0, 2) === "UA") { + // If the Google Analytics code starts with UA then it is a Universal Analytics Property and the script stays + // the legacy one. + if (substr($google_analytics_code, 0, 2) === 'UA') + { echo ' - - '; + + '; } - // If the google analytics code starts with a G then it is a Google Analytics 4-Property and the script + // If the Google Analytics code starts with a G then it is a Google Analytics 4-Property and the script // to inject it looks different. - if (substr($google_analytics_code, 0, 2) === "G-") { + if (substr($google_analytics_code, 0, 2) === 'G-') + { echo ' - - + - '; + + '; } } } diff --git a/application/helpers/permission_helper.php b/application/helpers/permission_helper.php index 2ed025b1..e4046ba2 100644 --- a/application/helpers/permission_helper.php +++ b/application/helpers/permission_helper.php @@ -32,7 +32,7 @@ if ( ! function_exists('can')) $CI = &get_instance(); $CI->load->model('roles_model'); - $CI->load->model('user_model'); + $CI->load->model('users_model'); if (empty($user_id)) { @@ -40,8 +40,9 @@ if ( ! function_exists('can')) } else { - $user = $CI->user_model->get_user($user_id); - $role_slug = $CI->roles_model->value('slug', $user['id_roles']); + $user = $CI->users_model->find($user_id); + + $role_slug = $CI->roles_model->value($user['id_roles'], 'slug'); } if (empty($role_slug)) @@ -49,7 +50,7 @@ if ( ! function_exists('can')) return FALSE; } - $permissions = $CI->roles_model->get_privileges($role_slug); + $permissions = $CI->roles_model->get_permissions_by_slug($role_slug); return $permissions[$resource][$action]; }