? test.patch ? usage Index: release/project_release.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project/release/project_release.module,v retrieving revision 1.37 diff -u -r1.37 project_release.module --- release/project_release.module 3 Aug 2007 23:02:05 -0000 1.37 +++ release/project_release.module 5 Aug 2007 02:43:16 -0000 @@ -1807,3 +1807,26 @@ return l($link_text, $link_path); } } + +/** + * Implementation of hook_file_download(). + * + * @param $filepath + * The name of the file to download. + * @return + * An array of header fields for the download. + */ +function project_release_file_download($filepath) { + $result = db_query("SELECT f.nid FROM {project_release_nodes} f WHERE file_path = '%s'", $filepath); + if ($nid = db_result($result)) { + $node = node_load($nid); + if (node_access('view', $node)) { + return array( + 'Content-Type: application/octet-stream', + 'Content-Length: '. filesize($filepath), + 'Content-Disposition: attachment; filename='. mime_header_encode($filepath), + ); + } + return -1; + } +} \ No newline at end of file