Skip to content

Commit

Permalink
MDL-15919 fixed scriptname param
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Sep 6, 2008
1 parent 84dabee commit d8c1ec4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
12 changes: 3 additions & 9 deletions draftfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '/'
Expand All @@ -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) {
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion pluginfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '/'
Expand Down
2 changes: 1 addition & 1 deletion userfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '/'
Expand Down

0 comments on commit d8c1ec4

Please sign in to comment.