Skip to content

Commit

Permalink
MDL-15919 oops, reverting previous commit - not finished yet
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Sep 6, 2008
1 parent d8c1ec4 commit 4149edb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions draftfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
}

$contextid = (int)array_shift($args);
$itemid = (int)array_shift($args);
$filearea = array_shift($args);

$context = get_context_instance_by_id($contextid);
if ($context->contextlevel != CONTEXT_USER) {
Expand All @@ -41,11 +41,17 @@
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.'user_draft'.$itemid.$relativepath;
$fullpath = $context->id.$filearea.$itemid.$relativepath;

if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->get_filename() == '.') {
send_file_not_found();
Expand Down

0 comments on commit 4149edb

Please sign in to comment.