Index: nopremium.module
===================================================================
--- nopremium.module	(revision 7780)
+++ nopremium.module	(working copy)
@@ -267,8 +267,43 @@
   return $node;
 }
 
+/**
+ * Implementation of hook_file_download().
+ * Stolen from /modules/upload.php - Drupal Core 6.22
+ */
+function nopremium_file_download($filepath) {
+  $filepath = file_create_path($filepath);
+  $result = db_query("SELECT f.*, u.nid FROM {files} f INNER JOIN {upload} u ON f.fid = u.fid WHERE filepath = '%s'", $filepath);
+  while ($file = db_fetch_object($result)) {
+    if ($filepath !== $file->filepath) {
+      // Since some database servers sometimes use a case-insensitive
+      // comparison by default, double check that the filename is an exact
+      // match.
+      continue;
+    }
+	
+	if(($node = node_load($file->nid)) && $node->premium) {
+		if(user_access('view uploaded files') && node_access('view', $node) && nopremium_access_full_content($node)) {
+			return array(
+				'Content-Type: ' . $file->filemime,
+				'Content-Length: ' . $file->filesize,
+			);
+		} else {
+			return -1;
+		}
+	} elseif (user_access('view uploaded files') && ($node = node_load($file->nid)) && node_access('view', $node)) {
+      return array(
+        'Content-Type: ' . $file->filemime,
+        'Content-Length: ' . $file->filesize,
+      );
+    } else {
+      return -1;
+    }
+  }
+}
 
 
+
 /**
  * Get the raw nopremium message for the given node type.
  */
