From 4149edbd645dc30dd9ea6f60d2136df5a623c295 Mon Sep 17 00:00:00 2001 From: skodak Date: Sat, 6 Sep 2008 21:16:59 +0000 Subject: [PATCH] MDL-15919 oops, reverting previous commit - not finished yet --- draftfile.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/draftfile.php b/draftfile.php index 8284b44c64..70df735ad6 100644 --- a/draftfile.php +++ b/draftfile.php @@ -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) { @@ -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(); -- 2.39.5