Issues (2128)

main/chat/chat.php (2 issues)

Labels
Severity
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
define('CHAMILO_LOAD_WYSIWYG', false);
6
7
require_once __DIR__.'/../inc/global.inc.php';
8
9
api_protect_course_script(true);
10
11
Event::event_access_tool(TOOL_CHAT);
0 ignored issues
show
The method event_access_tool() does not exist on Event. ( Ignorable by Annotation )

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

11
Event::/** @scrutinizer ignore-call */ 
12
       event_access_tool(TOOL_CHAT);

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...
12
13
$logInfo = [
14
    'tool' => TOOL_CHAT,
15
    'action' => 'start',
16
    'action_details' => 'start-chat',
17
];
18
Event::registerLog($logInfo);
0 ignored issues
show
The method registerLog() does not exist on Event. ( Ignorable by Annotation )

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

18
Event::/** @scrutinizer ignore-call */ 
19
       registerLog($logInfo);

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...
19
20
$externalCSS = [
21
    'jquery-emojiarea/jquery.emojiarea.css',
22
    'jquery-textcomplete/jquery.textcomplete.css',
23
    'emojione/css/emojione.min.css',
24
    'emojione/css/autocomplete.css',
25
    'highlight/styles/github.css',
26
];
27
28
foreach ($externalCSS as $css) {
29
    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH).$css);
30
}
31
32
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'chat.css');
33
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'markdown.css');
34
35
$externalJS = [
36
    'highlight/highlight.pack.js',
37
    'jquery-textcomplete/jquery.textcomplete.js',
38
    'emojione/js/emojione.min.js',
39
    'jquery-emojiarea/jquery.emojiarea.js',
40
];
41
42
foreach ($externalJS as $js) {
43
    $htmlHeadXtra[] = api_get_js($js);
44
}
45
46
$iconList = [];
47
48
foreach (Emojione\Emojione::$shortcode_replace as $key => $icon) {
49
    if (!in_array($key, CourseChatUtils::getEmojisToInclude())) {
50
        continue;
51
    }
52
53
    $iconList[$key] = strtoupper($icon).'.png';
54
}
55
56
$view = new Template(get_lang('Chat'), false, false, false, true, false);
57
$view->assign('icons', $iconList);
58
$view->assign('emoji_strategy', CourseChatUtils::getEmojiStrategy());
59
$view->assign('emoji_smile', \Emojione\Emojione::toImage(':smile:'));
60
$view->assign('restrict_to_coach', api_get_configuration_value('course_chat_restrict_to_coach'));
61
$view->assign('send_message_only_on_button', api_get_configuration_value('course_chat_send_message_only_on_button') === true ? 1 : 0);
62
$view->assign('course_chat_sec_token', Security::get_token('course_chat'));
63
64
$template = $view->get_template('chat/chat.tpl');
65
$content = $view->fetch($template);
66
67
$view->assign('content', $content);
68
$view->display_no_layout_template();
69