Issues (2130)

main/upload/index.php (1 issue)

Labels
Severity
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
use ChamiloSession as Session;
5
6
/**
7
 * Main script for the documents tool.
8
 *
9
 * This script allows the user to manage files and directories on a remote http server.
10
 *
11
 * The user can : - upload a file
12
 *
13
 * The script respects the strategical split between process and display, so the first
14
 * part is only processing code (init, process, display preparation) and the second
15
 * part is only display (HTML)
16
 *
17
 * @package chamilo.upload
18
 */
19
require_once __DIR__.'/../inc/global.inc.php';
20
21
$_course = api_get_course_info();
22
23
api_protect_course_script(true);
24
25
$htmlHeadXtra[] = "<script>
26
function check_unzip() {
27
	if (document.upload.unzip.checked) {
28
        document.upload.if_exists[0].disabled=true;
29
        document.upload.if_exists[1].checked=true;
30
        document.upload.if_exists[2].disabled=true;
31
	} else {
32
        document.upload.if_exists[0].checked=true;
33
        document.upload.if_exists[0].disabled=false;
34
        document.upload.if_exists[2].disabled=false;
35
	}
36
}
37
</script>";
38
39
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
40
if (!$is_allowed_to_edit) {
41
    api_not_allowed(true);
42
}
43
44
//what's the current path?
45
$path = '/';
46
if (isset($_REQUEST['curdirpath'])) {
47
    $path = $_REQUEST['curdirpath'];
48
}
49
50
$toolFromSession = Session::read('my_tool');
51
52
// set calling tool
53
if (isset($_REQUEST['tool'])) {
54
    $my_tool = $_REQUEST['tool'];
55
    Session::write('my_tool', $_REQUEST['tool']);
56
} elseif (!empty($toolFromSession)) {
57
    $my_tool = $toolFromSession;
58
} else {
59
    $my_tool = 'document';
60
    Session::write('my_tool', $my_tool);
61
}
62
63
/**
64
 * Process.
65
 */
66
Event::event_access_tool(TOOL_UPLOAD);
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

66
Event::/** @scrutinizer ignore-call */ 
67
       event_access_tool(TOOL_UPLOAD);

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...
67
68
/**
69
 * Now call the corresponding display script, the current script acting like a controller.
70
 */
71
switch ($my_tool) {
72
    case TOOL_LEARNPATH:
73
        require 'form.scorm.php';
74
        break;
75
    //the following cases need to be distinguished later on
76
    case TOOL_DROPBOX:
77
    case TOOL_STUDENTPUBLICATION:
78
    case TOOL_DOCUMENT:
79
    default:
80
        require 'form.document.php';
81
        break;
82
}
83