MDL-15919 oops, reverting previous commit - not finished yet

This commit is contained in:
skodak
2008-09-06 21:16:59 +00:00
parent d8c1ec4312
commit 4149edbd64
+8 -2
View File
@@ -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();