From d8c1ec431285fe66b98ae34feaf104e94e38fb8e Mon Sep 17 00:00:00 2001 From: skodak Date: Sat, 6 Sep 2008 21:15:52 +0000 Subject: [PATCH] MDL-15919 fixed scriptname param --- draftfile.php | 12 +++--------- pluginfile.php | 2 +- userfile.php | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/draftfile.php b/draftfile.php index bc1e7e5076..8284b44c64 100644 --- a/draftfile.php +++ b/draftfile.php @@ -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 '/' @@ -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) { @@ -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(); diff --git a/pluginfile.php b/pluginfile.php index ed3c18d2f2..06dc3cb845 100644 --- a/pluginfile.php +++ b/pluginfile.php @@ -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 '/' diff --git a/userfile.php b/userfile.php index 228ad856ca..3d7a68c1e9 100644 --- a/userfile.php +++ b/userfile.php @@ -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 '/' -- 2.39.5