]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15919 oops, reverting previous commit - not finished yet
authorskodak <skodak>
Sat, 6 Sep 2008 21:16:59 +0000 (21:16 +0000)
committerskodak <skodak>
Sat, 6 Sep 2008 21:16:59 +0000 (21:16 +0000)
draftfile.php

index 8284b44c6453246f6d5fdfe74bd49a3dc0eebfd8..70df735ad664c919000d86bb4f110159ec59642a 100644 (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) {
         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();