]> git.mjollnir.org Git - moodle.git/commitdiff
NOBUG: better handling of {module}_pluginfile() return values
authormudrd8mz <mudrd8mz>
Mon, 7 Sep 2009 14:45:20 +0000 (14:45 +0000)
committermudrd8mz <mudrd8mz>
Mon, 7 Sep 2009 14:45:20 +0000 (14:45 +0000)
{module}_pluginfile() should either send the file or
send_file_not_found() or print an error and terminate or whatever, it
should never return to the caller

pluginfile.php

index 1585040e6e2a57865118e90a27e16b6a96a3fcb9..c5377b9265b137734dc4e9b70daf7a9b5da81b13 100644 (file)
@@ -281,9 +281,11 @@ if ($context->contextlevel == CONTEXT_SYSTEM) {
 
     $filefunction = $modname.'_pluginfile';
     if (function_exists($filefunction)) {
-        if ($filefunction($course, $cminfo, $context, $filearea, $args, $forcedownload) !== false) {
-            die;
+        // if the function exists, it must send the file and terminate. Whatever it returns leads to "not found"
+        $filefunction($course, $cminfo, $context, $filearea, $args, $forcedownload);
         }
+
+    send_file_not_found();
     }
 
 } else if ($context->contextlevel == CONTEXT_BLOCK) {