mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 11:46:19 +01:00
MDL-15919 fixed scriptname param
This commit is contained in:
parent
84dabeef01
commit
d8c1ec4312
@ -11,7 +11,7 @@
|
||||
// disable moodle specific debug messages
|
||||
disable_debugging();
|
||||
|
||||
$relativepath = get_file_argument('file.php');
|
||||
$relativepath = get_file_argument('draftfile.php');
|
||||
$forcedownload = optional_param('forcedownload', 0, PARAM_BOOL);
|
||||
|
||||
// relative path must start with '/'
|
||||
@ -29,7 +29,7 @@
|
||||
}
|
||||
|
||||
$contextid = (int)array_shift($args);
|
||||
$filearea = array_shift($args);
|
||||
$itemid = (int)array_shift($args);
|
||||
|
||||
$context = get_context_instance_by_id($contextid);
|
||||
if ($context->contextlevel != CONTEXT_USER) {
|
||||
@ -41,17 +41,11 @@
|
||||
print_error('invaliduserid');
|
||||
}
|
||||
|
||||
switch ($filearea) {
|
||||
case 'user_draft' : $itemid = (int)array_shift($args); break;
|
||||
default: send_file_not_found();
|
||||
}
|
||||
|
||||
$relativepath = '/'.implode('/', $args);
|
||||
|
||||
|
||||
$fs = get_file_storage();
|
||||
|
||||
$fullpath = $context->id.$filearea.$itemid.$relativepath;
|
||||
$fullpath = $context->id.'user_draft'.$itemid.$relativepath;
|
||||
|
||||
if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->get_filename() == '.') {
|
||||
send_file_not_found();
|
||||
|
@ -6,7 +6,7 @@
|
||||
// disable moodle specific debug messages
|
||||
disable_debugging();
|
||||
|
||||
$relativepath = get_file_argument('file.php');
|
||||
$relativepath = get_file_argument('pluginfile.php');
|
||||
$forcedownload = optional_param('forcedownload', 0, PARAM_BOOL);
|
||||
|
||||
// relative path must start with '/'
|
||||
|
@ -6,7 +6,7 @@
|
||||
// disable moodle specific debug messages
|
||||
disable_debugging();
|
||||
|
||||
$relativepath = get_file_argument('file.php');
|
||||
$relativepath = get_file_argument('userfile.php');
|
||||
$forcedownload = optional_param('forcedownload', 0, PARAM_BOOL);
|
||||
|
||||
// relative path must start with '/'
|
||||
|
Loading…
x
Reference in New Issue
Block a user