diff --git a/public/main/inc/lib/api.lib.php b/public/main/inc/lib/api.lib.php index 8f43f009df..dda9bed3fd 100644 --- a/public/main/inc/lib/api.lib.php +++ b/public/main/inc/lib/api.lib.php @@ -7433,20 +7433,6 @@ function api_get_locked_settings() ]; } -/** - * Checks if the user is corrently logged in. Returns the user ID if he is, or - * false if he isn't. If the user ID is given and is an integer, then the same - * ID is simply returned. - * - * @param int User ID - * - * @return bool Integer User ID is logged in, or false otherwise - */ -function api_user_is_login($user_id = null) -{ - return Container::getAuthorizationChecker()->isGranted('IS_AUTHENTICATED_FULLY'); -} - /** * Guess the real ip for register in the database, even in reverse proxy cases. * To be recognized, the IP has to be found in either $_SERVER['REMOTE_ADDR'] or diff --git a/public/main/inc/lib/course.lib.php b/public/main/inc/lib/course.lib.php index 6cc7e28ba4..ee2306a2ce 100644 --- a/public/main/inc/lib/course.lib.php +++ b/public/main/inc/lib/course.lib.php @@ -5216,7 +5216,7 @@ class CourseManager $my_course['register_button'] = ''; $access_link = self::get_access_link_by_user( - api_get_user_id(), + $user_id, $course_info, $codeList ); @@ -5485,10 +5485,12 @@ class CourseManager $options[] = 'register'; } + $isLogin = !api_is_anonymous(); + // Go To Course button (only if admin, if course public or if student already subscribed) if ($is_admin || COURSE_VISIBILITY_OPEN_WORLD == $course['visibility'] && empty($course['registration_code']) || - (api_user_is_login($uid) && COURSE_VISIBILITY_OPEN_PLATFORM == $course['visibility'] && empty($course['registration_code'])) || + ($isLogin && COURSE_VISIBILITY_OPEN_PLATFORM == $course['visibility'] && empty($course['registration_code'])) || (in_array($course['real_id'], $user_courses) && COURSE_VISIBILITY_CLOSED != $course['visibility']) ) { $options[] = 'enter'; @@ -5496,7 +5498,7 @@ class CourseManager if ($is_admin || COURSE_VISIBILITY_OPEN_WORLD == $course['visibility'] && empty($course['registration_code']) || - (api_user_is_login($uid) && COURSE_VISIBILITY_OPEN_PLATFORM == $course['visibility'] && empty($course['registration_code'])) || + ($isLogin && COURSE_VISIBILITY_OPEN_PLATFORM == $course['visibility'] && empty($course['registration_code'])) || (in_array($course['real_id'], $user_courses) && COURSE_VISIBILITY_CLOSED != $course['visibility']) ) { $options[] = 'enter'; @@ -5505,7 +5507,7 @@ class CourseManager if (COURSE_VISIBILITY_HIDDEN != $course['visibility'] && empty($course['registration_code']) && UNSUBSCRIBE_ALLOWED == $course['unsubscribe'] && - api_user_is_login($uid) && + $isLogin && in_array($course['real_id'], $user_courses) ) { $options[] = 'unsubscribe'; diff --git a/public/main/inc/lib/template.lib.php b/public/main/inc/lib/template.lib.php index 0d576fff1d..797a7134b1 100644 --- a/public/main/inc/lib/template.lib.php +++ b/public/main/inc/lib/template.lib.php @@ -1155,7 +1155,7 @@ class Template $user_info = []; $user_info['logged'] = 0; $this->user_is_logged_in = false; - if (api_user_is_login()) { + if (!api_is_anonymous()) { $user_info = api_get_user_info(api_get_user_id(), true); $user_info['logged'] = 1; diff --git a/public/main/index/whoisonline.php b/public/main/index/whoisonline.php index 64ab26135e..5b4e1fc2ee 100644 --- a/public/main/index/whoisonline.php +++ b/public/main/index/whoisonline.php @@ -52,7 +52,7 @@ if ($user_list) { $whoisonline_list .= SocialManager::display_user_list($user_list); if (isset($_GET['id'])) { - if ('true' == api_get_setting('allow_social_tool') && api_user_is_login()) { + if ('true' == api_get_setting('allow_social_tool') && !api_is_anonymous()) { header("Location: ".api_get_path(WEB_CODE_PATH)."social/profile.php?u=".intval($_GET['id'])); exit; } diff --git a/public/plugin/zoom/lib/ZoomPlugin.php b/public/plugin/zoom/lib/ZoomPlugin.php index 40c85fc283..594abacea2 100644 --- a/public/plugin/zoom/lib/ZoomPlugin.php +++ b/public/plugin/zoom/lib/ZoomPlugin.php @@ -104,7 +104,6 @@ class ZoomPlugin extends Plugin return false; } - //return 'true' === api_get_plugin_setting('zoom', 'enableGlobalConference') && api_user_is_login(); return 'true' === api_get_plugin_setting('zoom', 'enableGlobalConference') && in_array(