|
8 | 8 | $cidReset = true;
|
9 | 9 | }
|
10 | 10 |
|
11 |
| -// including necessary files |
12 | 11 | require_once './main/inc/global.inc.php';
|
13 | 12 |
|
14 | 13 | if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
|
|
20 | 19 | $whoisonline_list = '';
|
21 | 20 | $social_search = '';
|
22 | 21 | $userId = api_get_user_id();
|
| 22 | +$access = accessToWhoIsOnline(); |
23 | 23 |
|
24 |
| -// This if statement prevents users accessing the who's online feature when it has been disabled. |
25 |
| -if ((api_get_setting('showonline', 'world') == 'true' && !$userId) || |
26 |
| - ((api_get_setting('showonline', 'users') == 'true' || |
27 |
| - api_get_setting('showonline', 'course') == 'true') && $userId) |
28 |
| -) { |
29 |
| - if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) { |
30 |
| - $user_list = who_is_online_in_this_course( |
31 |
| - 0, |
32 |
| - MAX_ONLINE_USERS, |
33 |
| - api_get_user_id(), |
34 |
| - api_get_setting('time_limit_whosonline'), |
35 |
| - $_GET['cidReq'] |
36 |
| - ); |
37 |
| - } else { |
38 |
| - $user_list = who_is_online(0, MAX_ONLINE_USERS); |
39 |
| - } |
| 24 | +if (!$access) { |
| 25 | + api_not_allowed(true); |
| 26 | +} |
40 | 27 |
|
41 |
| - if ($user_list) { |
42 |
| - if (!isset($_GET['id'])) { |
43 |
| - if (api_get_setting('allow_social_tool') == 'true') { |
44 |
| - if (!api_is_anonymous()) { |
45 |
| - $query = isset($_GET['q']) ? $_GET['q'] : null; |
46 |
| - $social_search = UserManager::get_search_form($query); |
47 |
| - } |
| 28 | +if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) { |
| 29 | + $user_list = who_is_online_in_this_course( |
| 30 | + 0, |
| 31 | + MAX_ONLINE_USERS, |
| 32 | + api_get_user_id(), |
| 33 | + api_get_setting('time_limit_whosonline'), |
| 34 | + $_GET['cidReq'] |
| 35 | + ); |
| 36 | +} else { |
| 37 | + $user_list = who_is_online(0, MAX_ONLINE_USERS); |
| 38 | +} |
| 39 | + |
| 40 | +if ($user_list) { |
| 41 | + if (!isset($_GET['id'])) { |
| 42 | + if (api_get_setting('allow_social_tool') == 'true') { |
| 43 | + if (!api_is_anonymous()) { |
| 44 | + $query = isset($_GET['q']) ? $_GET['q'] : null; |
| 45 | + $social_search = UserManager::get_search_form($query); |
48 | 46 | }
|
49 |
| - $social_right_content .= SocialManager::display_user_list($user_list); |
50 | 47 | }
|
| 48 | + $social_right_content .= SocialManager::display_user_list($user_list); |
51 | 49 | }
|
| 50 | +} |
52 | 51 |
|
53 |
| - $whoisonline_list .= SocialManager::display_user_list($user_list); |
| 52 | +$whoisonline_list .= SocialManager::display_user_list($user_list); |
54 | 53 |
|
55 |
| - if (isset($_GET['id'])) { |
56 |
| - if (api_get_setting('allow_social_tool') == 'true' && api_user_is_login()) { |
57 |
| - header("Location: ".api_get_path(WEB_CODE_PATH)."social/profile.php?u=".intval($_GET['id'])); |
58 |
| - exit; |
59 |
| - } else { |
60 |
| - $social_right_content .= SocialManager::display_individual_user($_GET['id']); |
61 |
| - } |
| 54 | +if (isset($_GET['id'])) { |
| 55 | + if (api_get_setting('allow_social_tool') == 'true' && api_user_is_login()) { |
| 56 | + header("Location: ".api_get_path(WEB_CODE_PATH)."social/profile.php?u=".intval($_GET['id'])); |
| 57 | + exit; |
| 58 | + } else { |
| 59 | + $social_right_content .= SocialManager::display_individual_user($_GET['id']); |
62 | 60 | }
|
63 |
| -} else { |
64 |
| - api_not_allowed(true); |
65 | 61 | }
|
66 | 62 |
|
67 | 63 | $tpl = new Template(get_lang('UsersOnLineList'));
|
|
0 commit comments