Index: docs/developer/hooks/core.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/docs/developer/hooks/core.php,v retrieving revision 1.171 diff -u -p -r1.171 core.php --- docs/developer/hooks/core.php 15 Apr 2008 14:58:32 -0000 1.171 +++ docs/developer/hooks/core.php 29 Apr 2008 21:23:30 -0000 @@ -464,20 +464,22 @@ function hook_exit($destination = NULL) /** * Allow file downloads. * - * @param $file + * @param $filepath * String of the file's path. * @return * If the user does not have permission to access the file, return -1. If the - * user has permission, return an array with the appropriate headers. + * user has permission, return an array with the appropriate headers. If the file + * is not controlled by the current module, the return value should be NULL. */ -function hook_file_download($file) { - if (user_access('access content')) { - if ($filemime = db_result(db_query("SELECT filemime FROM {fileupload} WHERE filepath = '%s'", file_create_path($file)))) { +function hook_file_download($filepath) { + // Check if the file is controlled by the current module. + if ($filemime = db_result(db_query("SELECT filemime FROM {fileupload} WHERE filepath = '%s'", file_create_path($filepath)))) { + if (user_access('access content')) { return array('Content-type:' . $filemime); } - } - else { - return -1; + else { + return -1; + } } }