Passed
Push — master ( 4b7894...00fdaa )
by Julito
14:38 queued 04:03
created

whoisonline.php (1 issue)

Labels
Severity
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
/**
5
 * Who is online list.
6
 */
7
if (!isset($_GET['cidReq'])) {
8
    $cidReset = true;
9
}
10
11
require_once './main/inc/global.inc.php';
12
13
if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
14
    api_protect_course_script(true);
15
}
16
17
$this_section = SECTION_SOCIAL;
18
$social_right_content = '';
19
$whoisonline_list = '';
20
$social_search = '';
21
$userId = api_get_user_id();
22
$access = accessToWhoIsOnline();
23
24
if (!$access) {
25
    api_not_allowed(true);
26
}
27
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);
46
            }
47
        }
48
        $social_right_content .= SocialManager::display_user_list($user_list);
49
    }
50
}
51
52
$whoisonline_list .= SocialManager::display_user_list($user_list);
53
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']);
0 ignored issues
show
The method display_individual_user() does not exist on SocialManager. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

59
        $social_right_content .= SocialManager::/** @scrutinizer ignore-call */ display_individual_user($_GET['id']);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
60
    }
61
}
62
63
$tpl = new Template(get_lang('UsersOnLineList'));
64
65
if (api_get_setting('allow_social_tool') === 'true' && !api_is_anonymous()) {
66
    $tpl->assign('whoisonline', $whoisonline_list);
67
    $tpl->assign('social_search', $social_search);
68
} else {
69
    $tpl->assign('whoisonline', $social_right_content);
70
}
71
72
$social_layout = $tpl->get_template('social/whoisonline.tpl');
73
$tpl->display($social_layout);
74